FHIR Chat · CQF Ruler cql-to-elm · cql

Stream: cql

Topic: CQF Ruler cql-to-elm


view this post on Zulip Rich Boyce (Aug 20 2020 at 19:57):

I have the DSTU3 version of the CQF-Ruler running locally and have posted a plan definition and library bundle, however, whenever I attempt to post an order-select command I get an error whenever the CQL logic is trying to be converted into ELM:

Caused by: java.lang.IllegalArgumentException: [Warfarin_NSAIDs_CDS-1.0[45:5, 48:5]Could not resolve call to operator Flatten with signature (list<System.String>)., Warfarin_NSAIDs_CDS-1.0[97:7, 97:38]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[102:7, 102:45]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[107:7, 107:39]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[112:7, 112:40]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[95:3, 116:3]Could not resolve call to operator Flatten with signature (list<FHIR.Coding>)., Warfarin_NSAIDs_CDS-1.0[92:11, 92:23]Could not validate reference to expression Warfarin Rx because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[72:10, 72:34]Could not validate reference to expression Is warfarin in prefetch because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[132:20, 132:32]Could not validate reference to expression Warfarin Rx because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[45:5, 48:5]Could not resolve call to operator Flatten with signature (list<System.String>)., Warfarin_NSAIDs_CDS-1.0[45:5, 48:5]Could not resolve call to operator Flatten with signature (list<System.String>)., Warfarin_NSAIDs_CDS-1.0[148:5, 148:38]Could not resolve call to operator GetDrugNames with signature (list<FHIR.Coding>)., Warfarin_NSAIDs_CDS-1.0[45:5, 48:5]Could not resolve call to operator Flatten with signature (list<System.String>)., Warfarin_NSAIDs_CDS-1.0[155:5, 155:38]Could not resolve call to operator GetDrugNames with signature (list<FHIR.Coding>)., Warfarin_NSAIDs_CDS-1.0[190:7, 190:50]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[195:7, 195:57]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[200:7, 200:51]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[205:7, 205:52]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[188:2, 209:3]Could not resolve call to operator Flatten with signature (list<FHIR.Coding>)., Warfarin_NSAIDs_CDS-1.0[185:11, 185:36]Could not validate reference to expression PPIs and Misoprostols Rx because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[164:6, 164:32]Could not validate reference to expression Taking PPI or misoprostol because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[169:6, 169:32]Could not validate reference to expression Taking PPI or misoprostol because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[179:6, 179:32]Could not validate reference to expression Taking PPI or misoprostol because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[245:5, 245:39]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[240:3, 240:32]Could not resolve call to operator Exists with signature (FHIR.Condition)., Warfarin_NSAIDs_CDS-1.0[215:6, 215:32]Could not validate reference to expression Age > 65 years or Hx UGIB because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[220:6, 220:32]Could not validate reference to expression Age > 65 years or Hx UGIB because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[232:6, 232:32]Could not validate reference to expression Taking PPI or misoprostol because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[290:7, 290:53]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[295:7, 295:60]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[300:7, 300:54]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[305:7, 305:55]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[288:2, 309:3]Could not resolve call to operator Flatten with signature (list<FHIR.Coding>)., Warfarin_NSAIDs_CDS-1.0[285:11, 285:39]Could not validate reference to expression Systemic Corticosteroids Rx because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[280:3, 280:32]Could not validate reference to expression Has Systemic Corticosteroids because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[317:7, 317:52]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[322:7, 322:59]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[327:7, 327:53]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[332:7, 332:54]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[315:2, 336:3]Could not resolve call to operator Flatten with signature (list<FHIR.Coding>)., Warfarin_NSAIDs_CDS-1.0[312:11, 312:38]Could not validate reference to expression Aldosterone Antagonists Rx because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[344:7, 344:35]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[349:7, 349:42]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[354:7, 354:36]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[359:7, 359:37]Could not resolve membership operator for terminology target of the retrieve., Warfarin_NSAIDs_CDS-1.0[342:2, 363:3]Could not resolve call to operator Flatten with signature (list<FHIR.Coding>)., Warfarin_NSAIDs_CDS-1.0[339:11, 339:20]Could not validate reference to expression NSAID Rx because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[253:6, 253:32]Could not validate reference to expression Taking CS, MCRA, or NSAID because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[258:6, 258:32]Could not validate reference to expression Taking CS, MCRA, or NSAID because its definition contains errors., Warfarin_NSAIDs_CDS-1.0[272:6, 272:32]Could not validate reference to expression Taking PPI or misoprostol because its definition contains errors.]

I have cloned the clinical_quality_language (https://github.com/cqframework/clinical_quality_language) and was able to successfully convert the same CQL. I attempted this again with the 1.4.9 tag and encountered the same errors listed above. Finally, I updated the pom in the CQF-Ruler project to use 1.5.0-SNAPSHOT version for cql-engine.version but then encountered the following issue at the same step (it would appear that this was done at one point according to GitHub history):

java.lang.NoClassDefFoundError: org/cqframework/cql/gen/cqlParser$CodeComparatorContext

What would be recommended in order to move forward?

view this post on Zulip Bryn Rhodes (Aug 21 2020 at 01:47):

Can you open that CQL library in an Atom editor and see if you get any validation errors?

view this post on Zulip Bryn Rhodes (Aug 21 2020 at 01:49):

And which branch of the ruler are you using, master or develop?

view this post on Zulip Rich Boyce (Aug 21 2020 at 14:37):

I am working on the develop branch. I am not too familiar with atom but I did install the application as well as the "language-cql" package. I do not see any errors on the CQL file but get the following error when I try to execute it:

org.cqframework.cql.cql2elm.CqlTranslatorIncludeException: Could not load source for library warfarin, version null.
    at org.cqframework.cql.cql2elm.LibraryManager.translateLibrary(LibraryManager.java:105)
    at org.cqframework.cql.cql2elm.LibraryManager.resolveLibrary(LibraryManager.java:90)
    at org.opencds.cqf.cql.evaluator.execution.loader.TranslatingLibraryLoader.load(TranslatingLibraryLoader.java:40)
    at org.opencds.cqf.cql.evaluator.cli.Main.execute(Main.java:82)
    at org.opencds.cqf.cql.evaluator.cli.Main.parseAndExecute(Main.java:52)
    at org.opencds.cqf.cql.evaluator.cli.Main.main(Main.java:37)
Caused by: java.lang.IllegalArgumentException: Could not load source for library warfarin, version null.
    at org.cqframework.cql.cql2elm.PriorityLibrarySourceLoader.getLibrarySource(PriorityLibrarySourceLoader.java:53)
    at org.cqframework.cql.cql2elm.LibraryManager.translateLibrary(LibraryManager.java:102)
    ... 5 more
The specified path to resource files does not exist.
java.lang.IllegalArgumentException: The specified path to resource files does not exist.
    at org.opencds.cqf.cql.evaluator.execution.util.DirectoryBundler.bundle(DirectoryBundler.java:55)
    at org.opencds.cqf.cql.evaluator.cli.Main.create(Main.java:130)
    at org.opencds.cqf.cql.evaluator.cli.Main.execute(Main.java:89)
    at org.opencds.cqf.cql.evaluator.cli.Main.parseAndExecute(Main.java:52)
    at org.opencds.cqf.cql.evaluator.cli.Main.main(Main.java:37)

view this post on Zulip Bryn Rhodes (Aug 21 2020 at 19:58):

@Rich Boyce , is this somewhere I can reproduce it?

view this post on Zulip Rich Boyce (Aug 24 2020 at 14:16):

Attached is the CQL file that is being attempted to convert to ELM. Currently we are using a forked version of the develop branch warfarin-nsaids-cds-select-logic.cql

view this post on Zulip Bryn Rhodes (Aug 25 2020 at 20:33):

We just merged a fix to develop that sounds like the same issue, can you confirm you're running the latest develop fixes?

view this post on Zulip Rich Boyce (Aug 27 2020 at 15:28):

I just did a remote pull so I am up to date with the develop branch and the issue persists. I believe it is a problem specifically with the cql-to-elm mvn dependency. I tried converting the CQL using the 1.4.9 release of the clinical quality language (https://github.com/cqframework/clinical_quality_language/releases) and ran into the same issues but the conversions worked using 1.5.0

view this post on Zulip Bryn Rhodes (Sep 04 2020 at 15:32):

Hi @Rich Boyce , I was out last week, so just getting back to this. I was able to evaluate it in Atom, but I had to rename the library file name to match the library name declaration. Once I did that, the Atom plugin successfully evaluated the content. Are you still seeing this issue, and is there maybe a content IG repository you could point me to for a repro?

view this post on Zulip Rich Boyce (Nov 10 2020 at 17:40):

Hi Bryn, we came back to this after getting better acquainted with Atom and were able to move past that problem. We are now having an issue with a ValueSet that references other value sets. warfarin-nsaids-valueset-bundle.xml. If I reference the ValueSet "valueset-ketorolac" then the CQL is processed correctly, however, if I try to reference "valueset-NSAIDS" which includes ketorolac then it fails to find any codes. Currently we are still working with DSTU3

view this post on Zulip Bryn Rhodes (Nov 11 2020 at 02:55):

The evaluator that's part of the Atom plugin doesn't have any terminology service capabilities, so it relies on the valueset to have an expansion element. It can compute an extensional compose, but that's it (i.e. when the compose is literally just a list of codes). So you would need to have a ValueSet resource with the expansion element populated. Does that help?

view this post on Zulip Rich Boyce (Nov 11 2020 at 14:07):

Sorry, I am having difficulties in the CQF Ruler, specifically the DSTU3 version

view this post on Zulip Bryn Rhodes (Nov 11 2020 at 16:18):

Does the valueset-ketorolac have an expansion element?

view this post on Zulip Rich Boyce (Nov 11 2020 at 16:26):

It does not, what exactly would that entail?

view this post on Zulip Rich Boyce (Nov 11 2020 at 16:29):

Would the expansion element replace the compose element?

view this post on Zulip Bryn Rhodes (Nov 11 2020 at 16:57):

No, a ValueSet can contain both a compose and an expansion, but if it doesn't contain an expansion, then the implementation environment has to obtain the expansion somehow. If the compose is intensional, then the Ruler doesn't have the ability to expand it. Where did you define the value set?

view this post on Zulip Bryn Rhodes (Nov 11 2020 at 16:57):

And does the compose contain the codes, or is just a grouping value set?

view this post on Zulip Rich Boyce (Nov 11 2020 at 17:14):

Here is the file that contains all the value sets: warfarin-nsaids-valueset-bundle.xml The "valueset-ketorolac" has all of the codes listed under compose, the "valueset-nsaids" includes the valueset-ketorolac under compose

view this post on Zulip Bryn Rhodes (Nov 13 2020 at 17:23):

So you manually authored these value set resources?

view this post on Zulip Rich Boyce (Nov 13 2020 at 17:26):

Some time ago yes

view this post on Zulip Bryn Rhodes (Nov 13 2020 at 17:31):

So, there is code in CQF-Tooling to "expand" an extensional value set: https://github.com/cqframework/cqf-tooling/blob/develop/src/main/java/org/opencds/cqf/tooling/terminology/EnsureExecutableValueSetOperation.java

view this post on Zulip Bryn Rhodes (Nov 13 2020 at 17:32):

In theory, given that the source value sets are all "extensional", it would be straightforward to extend that code to support expanding a "grouper of extensional value sets".

view this post on Zulip Bryn Rhodes (Nov 13 2020 at 17:32):

You could also try loading all those value sets into the Ruler and asking for an $expand, to see if the HAPI machinery can already do that.


Last updated: Apr 12 2022 at 19:14 UTC