Converting CQL to a library
This document discusses how to convert a CQL script to a FHIR library.
Android FHIR SDK CQL Builder
SDK workflow testing module has com.google.android.fhir.workflow.testing.CqlBuilder
which can do translation from a CQL
to Library
resource. This automatically does the elm
conversion for you internally.
An example usage can be seen in tests found here
val library = CqlBuilder.compileAndBuild(cqlScriptInputStream)
FHIR Core CQL Testing Module
The fhir-resources repository has a testing module which allows to not only get the complete Library resource to directly save to the server but also allows to test the output and make changes on the fly. Check the cucumber tests Feature File, the Test Code File and the Convertor Util Method
FHIR Core Tooling Library
FHIR Core tooling library can also be used to get a Library by running the command below. Details on the tool can be found here.
fct convert -t cql -i /some/path/Patient-1.0.0.cql
Unrecommended conversion methods
These are other methods to convert a CQL script to elm+json.
The below approaches output a json-elm
which then needs to be Base64 decoded and copied to the Library content as Attachment.
CQL to ELM REST Translator
A elm REST app that can be used to run elm microservice and convert CQL via a REST API.
CQL to ELM JAVA Translator
Her is an elm java app that can be used as an elm translator on related files and get an output. Instructions can be found here