Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

age.cql Example #229

Closed
joelmontavon opened this issue Mar 3, 2021 · 9 comments
Closed

age.cql Example #229

joelmontavon opened this issue Mar 3, 2021 · 9 comments
Assignees

Comments

@joelmontavon
Copy link

joelmontavon commented Mar 3, 2021

When I try to create the JSON file for the age.sql example, I get the error:

joel@ubuntu:~/Documents/clinical_quality_language/Src/java$ ./cql-to-elm/build/install/cql-to-elm/bin/cql-to-elm --format=JSON --input /home/joel/Documents/cql-execution/examples/node/age.cql --output /home/joel/Documents/cql-execution/examples/node

TRANSLATE /home/joel/Documents/cql-execution/examples/node/age.cql
Translation failed due to errors:
Error:[5:1, 5:28] Could not resolve model info provider for model Simple, version 1.0.0.
Error:[9:1, 9:15] Could not resolve context name Patient in model System.
Error:[12:5, 12:44] Could not resolve identifier Patient in the current library.

Is this user error or a bug?

@cmoesel
Copy link
Member

cmoesel commented Mar 3, 2021

Thanks for reporting this, @joelmontavon. This is neither user error nor a bug. It's actually just an important piece of information we forgot to document! Thank you for pointing it out!

That example uses an example data model called the Simple data model. Since that data model is not intended for real use, it is not built into the CQL-to-ELM translator. Instead, you need to tell the translator where the model-info definition is so it can use it. We do this using the --model flag and pointing to the simple-modelinfo.xml file found in this project's src folder.

If you adjust your command to be this instead, it should work:

./cql-to-elm/build/install/cql-to-elm/bin/cql-to-elm --format=JSON --input /home/joel/Documents/cql-execution/examples/node/age.cql --model /home/joel/Documents/cql-execution/src/simple-modelinfo.xml

(Note that I also left removed the --output argument since the default behavior is to generate output to the same folder as the input CQL resides).

@cmoesel cmoesel self-assigned this Mar 3, 2021
@joelmontavon
Copy link
Author

Thanks for clarifying! I am now able to create the JSON file for the example.

@cmoesel
Copy link
Member

cmoesel commented Mar 3, 2021

Thanks for confirming. I am going to close this issue but create a new one to update the documentation to reflect the need to pass in the --model parameter for the example.

@csenn
Copy link

csenn commented Oct 3, 2021

Hey @cmoesel
The following is not working for me:

./cql-to-elm/build/install/cql-to-elm/bin/cql-to-elm --format=JSON  --input ~/dev/cql-execution/examples/node/age.cql --model ~/dev/cql-execution/src/simple-modelinfo.xml

The error is:

TRANSLATE /home/craig/dev/cql-execution/examples/node/age.cql
Translation failed due to errors:
Error:[5:1, 5:28] Could not resolve model info provider for model Simple, version 1.0.0.
Error:[9:1, 9:15] Could not resolve context name Patient in model System.
Error:[12:5, 12:44] Could not resolve identifier Patient in the current library.

The same command does seem to be working for using QUICK instead of using Simple version '1.0.0' in age.cql. However, then the patient data does not resolve correctly because it's expecting a FHIR structure.

@cmoesel
Copy link
Member

cmoesel commented Oct 20, 2021

Hi @csenn. Sorry for the delay. It looks like something changed in the CQL-to-ELM translator so that it no longer properly supports the --model option. I did a little debugging and found that CQL-to-ELM version 1.5.1 works, but CQL-to-ELM version 1.5.2 (and after) is broken. I'll file an issue against the CQL-to-ELM translator to see if we can get it fixed.

@cmoesel
Copy link
Member

cmoesel commented Oct 20, 2021

It turns out there is already a bug filed for that (and I contributed to the conversation). It's referenced above. I added a comment to bump it.

@rohituks
Copy link

@cmoesel - I can still see that bug is still in Open state and not resolved. So, whats the workaround for this problem?

@cmoesel
Copy link
Member

cmoesel commented Apr 29, 2022

Hi @rohituks -- I just tried this again and can confirm it is still broken. Since the bug is in the CQL-to-ELM translator, I'd recommend commenting on the issue there (cqframework/clinical_quality_language#619) to see if there are plans to fix it soon.

The only workaround I'm aware of would be to create a Java script that can use the cql-to-elm translator library and invoke it via its API to load the custom model. Perhaps someone who works on the Translator might have a better idea though.

All that said, to be clear -- this is only needed if you're using a custom model (like the Simple model we created just for testing). If you're using a supported model (like fhir), then you don't need to pass in a --model command at all. It should just work.

@csenn
Copy link

csenn commented Apr 30, 2022

@rohituks just to confirm what @cmoesel said, I ended up using the FHIR v4 model (which was essentially what I was trying to do get working in the first place). For instance something like:

library MyLibrary version '1.0.0'

using FHIR version '4.0.1'

context Patient

define "My Statement": Sum({1,2,3,4,5})

define "Is Female": Patient.gender = 'female'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants