blaze icon indicating copy to clipboard operation
blaze copied to clipboard

Implement support for include statements in CQL

Open citizenrich opened this issue 4 years ago • 7 comments

Support referencing libraries, ie. include FHIRCommon version '4.0.1' called FC in CQL.

See: https://cql.hl7.org/02-authorsguide.html#libraries

citizenrich avatar Aug 23 '21 17:08 citizenrich

+1 : An FYI, see this information https://github.com/cqframework/cql-execution/pull/251 as the IG Publisher tooling using cql2elm with options that uses the namespace of the IG being developed as a convention when building the includes. This is different outcome if using the converter outside of an IG.

Incidentally, the IG tooling can create a one-to-one FHIR Library for every CQL library. The FHIR Library resource includes not only the base64 CQL, but also elm+json and elm+xml content. Does/could blaze use this if it is present in the FHIR Library resource, or will it run the translator in all cases? This could have consequences as the namespace might be lost as it would be converted outside the context of an IG (with canonical base)...

bkaney avatar Oct 10 '21 18:10 bkaney

Here is an example bundle (Measure, Libraries, and ValueSets) created using the IG Publisher tooling: https://gist.github.com/bkaney/f369ec1df7238f62ff5d2e593ed82ce3

This works with the VS Code CQL evaluator (which uses CQF Tooling) https://marketplace.visualstudio.com/items?itemName=cqframework.cql

Running the measure (GET http://localhost:8080/fhir/Measure/CMS122v9/$evaluate-measure?periodStart=2000&periodEnd=2030) gives this currently (most recent docker image): image

bkaney avatar Oct 10 '21 20:10 bkaney

+1 : An FYI, see this information cqframework/cql-execution#251 as the IG Publisher tooling using cql2elm with options that uses the namespace of the IG being developed as a convention when building the includes. This is different outcome if using the converter outside of an IG.

Incidentally, the IG tooling can create a one-to-one FHIR Library for every CQL library. The FHIR Library resource includes not only the base64 CQL, but also elm+json and elm+xml content. Does/could blaze use this if it is present in the FHIR Library resource, or will it run the translator in all cases? This could have consequences as the namespace might be lost as it would be converted outside the context of an IG (with canonical base)...

Blaze always does the CQL-to-ELM Conversion using the cqframework translator currently in version 1.5.4.

alexanderkiel avatar Oct 11 '21 10:10 alexanderkiel

I updated the CQL to try it as all-in-one (see: https://gist.github.com/bkaney/f369ec1df7238f62ff5d2e593ed82ce3#file-all-in-one-cql), and I see this error:

:cognitect.anomalies/message "Unsupported ELM expression type: OperandRef"

Is this already covered by https://github.com/samply/blaze/issues/493 or is this a new issue?

bkaney avatar Oct 11 '21 13:10 bkaney

The error with the OperandRef occurs, because Blaze currently doesn't support functions https://github.com/samply/blaze/issues/501. Also #110 and #493 has to be resolved before your query could be evaluated.

alexanderkiel avatar Oct 12 '21 09:10 alexanderkiel

Okay, and I see all of that might enable https://github.com/samply/blaze/issues/452. FWIW I can remove the functions, but support for valueset references (#110) is something that would block.

bkaney avatar Oct 12 '21 13:10 bkaney

Functions in the same CQL library are implemented in #766.

alexanderkiel avatar Jun 29 '23 15:06 alexanderkiel