FHIR Chat · CQL test environment · cql

Stream: cql

Topic: CQL test environment


view this post on Zulip Georg Fette (Nov 22 2019 at 23:08):

Is there somewhere an openly available CQL execution engine with a web user interface and an attached FHIR repository with a bit of play examples as content. This would make experimenting with CQL easier as one could just see to what self created queries evaluate to.

view this post on Zulip Bryn Rhodes (Nov 22 2019 at 23:15):

Yes, we host a CQL Runner here: http://cql-runner.dataphoria.org

view this post on Zulip Bryn Rhodes (Nov 22 2019 at 23:16):

You can configure the test server you want to run it against, but by default we have a simple sandbox up that it uses.

view this post on Zulip Bryn Rhodes (Nov 22 2019 at 23:16):

No guarantees on availability there, but we try to keep it up and running and functional.

view this post on Zulip Georg Fette (Nov 23 2019 at 07:08):

ah, cool, thanks

view this post on Zulip Alexander Kiel (Nov 28 2019 at 11:27):

Hi @Georg Fette. In the meantime, I have written a FHIR Server with integrated CQL engine which is called Blaze. Since this week, I have also a web UI called Blaze Quality Reporting with a Public Demo at https://blaze.life.uni-leipzig.de/quality-reporting.

view this post on Zulip Georg Fette (Nov 28 2019 at 11:34):

ah, nice

view this post on Zulip Georg Fette (Nov 28 2019 at 11:36):

what interface does a working CQL engine have to expose, so that in one of those test environments the engine could be replaced by another engine, to compare their results and performances ?

view this post on Zulip Alexander Kiel (Nov 28 2019 at 11:40):

I implement https://www.hl7.org/fhir/clinicalreasoning-quality-reporting.html and especially https://www.hl7.org/fhir/operation-measure-evaluate-measure.html. There might be other ways to execute CQL over FHIR, but that's what I found.

view this post on Zulip Georg Fette (Nov 28 2019 at 11:47):

is the Blaze CQL engine hardwired with its FHIR server or can its FHIR server be exchanged ?

view this post on Zulip Alexander Kiel (Nov 28 2019 at 11:54):

It's not totally hardwired. I have different modules in the develop Branch. It's written in Clojure, so it is possible to use it from Java. One had to provide clear interfaces for retrieve and provide an object graph which can be navigated like I do it currently.

view this post on Zulip Bryn Rhodes (Dec 03 2019 at 20:26):

The Java-based CQL engine defines interfaces for an engine DataProvider, though that's more about how the engine gets to the data, rather than how the environment would call CQL.

view this post on Zulip Bryn Rhodes (Dec 03 2019 at 20:27):

The CQF Ruler defines a proposed $cql operation, but we don't have enough implementation experience with that yet to put it in a balloted spec. If there's interest in seeing that, we could add it to something like CPG-on-FHIR.

view this post on Zulip Alexander Kiel (Dec 03 2019 at 21:00):

@Bryn Rhodes Can you please point to the $cql operation?

view this post on Zulip Christopher Schuler (Dec 04 2019 at 00:07):

@Alexander Kiel You can find the operation here: https://github.com/DBCG/cqf-ruler/blob/master/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/CqlExecutionProvider.java#L216

I don't believe that we any docs around the operation... You can call it using a POST request:
POST {baseUrl}/$cql (e.g. http://localhost:8080/cqf-ruler-dstu3/fhir/$cql)
Body:
{
"resourceType": "Parameters",
"parameter": [
{
"name": "code",
"valueString": "your cql code"
},
{
"name": "patientId",
"valueString": "the patient your evaluating the cql against"
},
{
"name": "periodStart",
"valueString": "if evaluating measure logic, this is the start of the measurement period"
},
{
"name": "periodEnd",
"valueString": "if evaluating measure logic, this is the end of the measurement period"
},
{
"name": "context",
"valueString": "the context of the library (i.e. Patient, Population, etc..."
}
]
}

That should get you going. We also enable more advanced settings like defining parameters and pointing to a specific terminology endpoint. I can expand on those if you're interested.

view this post on Zulip Alexander Kiel (Dec 04 2019 at 08:29):

@Christopher Schuler I see. That is similar of what http://cql-runner.dataphoria.org expected of an API. It returns a Bundle with an entry for each expression definition as a Parameter s resource with name, location and result. With that you can basically execute what you want and get the results. I went away from http://cql-runner.dataphoria.org because the API it uses was not defined. Now if $cql is planned, I would be happy to discuss use cases.

In the meantime, we use $evaluate-measure. It fits you main use case, counting populations, well. But it has quite an overhead for our ad hoc queries, because we create a Library and Measure resource for each query.

On the other hand, we have use cases were $evaluate-measure is a better fit, because we have stable measures, which are called regularly. On top of that we need stratifiers which to my knowledge aren't possible to calculate with CQL only because it has no group by.

view this post on Zulip Bryn Rhodes (Dec 05 2019 at 23:14):

It's true that CQL has no group by, but it does have aggregate functions, and with those, group by is just a shorthand. For example:

define GroupBy:
  ([Medication] M return M.code) MCode
    return { MCode, Count([Medication] M where M.code = MCode) }

view this post on Zulip Georg Fette (Dec 06 2019 at 08:47):

This is an interesting way of expressing a group by. Although it seems a bit hard to read when a construct like this is integrated in a larger statement. Can defines be called with parameters ? Then such definitions could be extracted from complicated statements where group bys are needed to make the code more readable.

view this post on Zulip Alexander Kiel (Dec 06 2019 at 09:16):

Can defines be called with parameters ?

@Georg Fette You can define functions.

view this post on Zulip Georg Fette (Dec 06 2019 at 09:21):

ah, nice, didn't know that yet


Last updated: Apr 12 2022 at 19:14 UTC