Skip to content

Latest commit

 

History

History
76 lines (51 loc) · 2.19 KB

command-line.md

File metadata and controls

76 lines (51 loc) · 2.19 KB

Evaluate a CQL Query using the Command Line

This section describes how to evaluate a CQL query using the command line only.

Checkout the Project

This section assumes, that you have checked out the project and open a command line inside it.

git clone https://github.com/samply/blaze.git

Run Blaze

If you don't already have Blaze running, you can read about how to do it in Deployment. If you have Docker available just run:

docker run -p 8080:8080 -v blaze-data:/app/data samply/blaze:0.17

Import some data

If you just started Blaze without any data, you can import some using the blazectl command:

blazectl upload --server http://localhost:8080/fhir .github/test-data/synthea

Use the evaluate-measure.sh Script

An easy way to evaluate queries is to use the script evaluate-measure.sh, which is available at the root of the repository.

./evaluate-measure.sh
Usage: ./evaluate-measure.sh -f QUERY_FILE [ -t subject-type ] [ -r report-type ] BASE

Example subject-types: Patient, Specimen; default is Patient
Possible report-types: subject-list, population; default is population 

Examples

Counting the Number of Male Patients

./evaluate-measure.sh -f docs/cql-queries/gender-male.cql http://localhost:8080/fhir

the result should be something like this:

Generating a population count report...
Found 57 patients.

Listing all Male Patients

./evaluate-measure.sh -f docs/cql-queries/gender-male.cql -r subject-list http://localhost:8080/fhir

the result should be something like this:

Generating a report including the list of matching patients...
Found 57 patients that can be found on List http://localhost:8080/fhir/List/C745YHPCXXA6W7YK.

Please use the following blazectl command to download the patients:
  blazectl download --server http://localhost:8080/fhir Patient -q '_list=C745YHPCXXA6W7YK' -o patients.ndjson

If you can execute:

blazectl download --server http://localhost:8080/fhir Patient -q '_list=C745YHPCXXA6W7YK' -o patients.ndjson

You will find all Patient resources in the file patients.ndjson one resource per line.