Skip to content

Latest commit

 

History

History
74 lines (50 loc) · 3.65 KB

README.md

File metadata and controls

74 lines (50 loc) · 3.65 KB

Overview

This is a multi-module project for CQL java libraries and tooling applications. It contains the following sub-projects:

  • cql: generates and builds Java lexers, parsers, listeners, and visitors using the CQL ANTLR4 grammar
  • model: generates and builds Java classes based on the ELM Model Info schema and CQL base type system
  • elm: generates and builds Java classes based on the ELM XML schema
  • elm-fhir: contains data requirements processor and fhir-related utilities
  • engine: contains the ELM runtime (aka "CQL engine")
  • engine-fhir: contains fhir-related components for the ELM runtime
  • qdm: contains schema and model info resources for QDM (4.2, 5.0, 5.0.1, 5.0.2, 5.3)
  • quick: contains schema and model info resources for QUICK and FHIR, DSTU2 (1.0.2), and STU3 (1.4, 1.6, 1.8, and 3.0.1)
  • cql-to-elm: generates Expression Logical Model (ELM) XML and JSON from CQL source
  • tools:cql-formatter: formats input CQL based on standard formatting conventions as suggested by the CQL specification
  • tools:cql-parsetree: provides simple command-line access to the debug information for a CQL parse tree
  • tools:xsd-to-modelinfo: generates model info given an XML Schema (XSD) as input

Building the Project

This project uses the Gradle build system. A gradle wrapper, which automatically downloads and uses an instance of gradle, is provided for convenience. To build the project, install the JDK 17, clone this repository, then execute this command from within this directory:

./gradlew build

This will generate and build the ANTLR4 CQL artifacts, the JAXB QUICK artifacts, and the JAXB ELM artifacts. It will also build and test the corresponding code libraries and applications.

To clean up the build artifacts:

./gradlew clean

Executing the Sample Code

You can execute the sample code using the gradlew command or a script generated by gradle.

To execute the sample code using gradlew, you must execute the run command, using the project-specific path. The following are current possibilities:

./gradlew :cql:run
./gradlew :cql-to-elm-cli:run
./gradlew :tools:cql-parsetree:run

To execute the sample code using a script generated by gradle, first generate the scripts:

./gradlew installDist

Then execute the generated script (optionally passing in an argument). The following example executes the sample cql code with the path to a CQL file as an argument:

./cql/build/install/cql/bin/cql ../../Examples/CMS135_QDM.cql

You can also execute the cql-parsetree tool in a similar way:

./tools/cql-parsetree/build/install/cql-parsetree/bin/cql-parsetree ../../Examples/CMS135_QDM.cql

Generate an ELM Representation of CQL Logic

To generate an ELM representation of CQL logic, build and execute the cql-to-elm app:

./gradlew :cql-to-elm-cli:installDist
./cql-to-elm-cli/build/install/cql-to-elm-cli/bin/cql-to-elm-cli --input ../../Examples/CMS135_QDM.cql

The following options are supported:

  • --input or -i: Specify the input CQL file (REQUIRED).
  • --output or -o: Specify the output file. If not specified, the output file will have the same base name and location as the input file. If only a directory is specified, the output file will have the same base name as the input file and be written to the requested directory.
  • --format or -f: Output as XML (default), JSON, or COFFEE.
  • more...

For a complete list of supported options as well as more information on the CQL-to-ELM translator, refer to the Overview for that project.