This section describes how to evaluate a CQL query using the command line only.
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
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
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
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
./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.
./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.