Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 3.26 KB

README.md

File metadata and controls

76 lines (49 loc) · 3.26 KB

Overview

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

  • cql: generates and builds Java lexers, parsers, listeners, and visitors using the CQL ANTLR4 grammar
  • quick: generates and builds Java classes based on the QUICK XML schema
  • elm: generates and builds Java classes based on the ELM XML schema
  • cql-to-elm: generates Expression Logical Model (ELM) XML from CQL source

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 Java SE Development Kit 8 (a.k.a. JDK 1.8), 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

Generating IDE Projects

You can generate an IDE project for IntelliJ IDEa:

./gradlew idea

In addition to creating project modules for cql, quick, elm, and cql-to-elm, this will also import project modules for the CQL grammar and examples.

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:run
./gradlew :tools:cql-parsetree:run

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

./gradlew installApp

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/ChlamydiaScreening_CQM.cql

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

./tools/cql-parsetree/build/install/cql-parsetree/bin/cql-parsetree ../../Examples/ChlamydiaScreening_CQM.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:installApp
./cql-to-elm/build/install/cql-to-elm/bin/cql-to-elm --input ../../Examples/ChlamydiaScreening_CQM.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.
  • --date-range-optimization or -d: Refactor simple during clauses into the ClinicalRequest.
  • --annotations or -a: Include annotations in the output (work in progress).
  • --stdout or -s: Write output to the console instead of a file.