Skip to content

CQF API (/cqf)

Mercury implements the FHIR CQF operation surface under the /cqf base path, so it slots into a measure-calculation pipeline in place of the reference evaluator. This page covers the endpoints you’ll use most.

Terminal window
curl http://127.0.0.1:8080/cqf/metadata

Returns the FHIR CapabilityStatement describing the supported resources and operations.

Load a FHIR bundle into the server’s patient corpus, so evaluations can reference subjects by id.

Terminal window
POST /cqf/data/bundle
Content-Type: application/fhir+json
Terminal window
curl -X POST http://127.0.0.1:8080/cqf/data/bundle \
-H "Content-Type: application/fhir+json" \
--data @patients.bundle.json

See Loading data: preload vs inline for when to preload vs. supply data inline.

Create, read, update, and delete FHIR Library resources. Mercury accepts CQL directly and also ELM XML as an alternative input.

Terminal window
# Create (returns 201)
curl -X POST http://127.0.0.1:8080/cqf/Library \
-H "Content-Type: application/fhir+json" \
--data @Test.Library.json
# Read
curl http://127.0.0.1:8080/cqf/Library/Test

Measure resources support the same CRUD operations as Library.

Terminal window
curl -X POST http://127.0.0.1:8080/cqf/Measure \
-H "Content-Type: application/fhir+json" \
--data @Test.Measure.json

Evaluate a library expression (or a whole measure) for a subject. Returns 200 with a FHIR Parameters resource.

Terminal window
GET /cqf/Library/{id}/$evaluate?subject=Patient/{id}&expression={name}
Terminal window
curl "http://127.0.0.1:8080/cqf/Library/Test/\$evaluate?subject=Patient/123&expression=InDenominator"

Result — a Parameters resource whose evaluate part lists each expression and its value, e.g. InDenominator → "true".

For compatibility with existing tooling, Mercury exposes $data-requirements and $package as stubs. They respond so harnesses that call them don’t break; they aren’t full implementations.

Terminal window
GET /cqf/Library/{id}/$data-requirements
POST /cqf/Library/{id}/$package