Written and maintained by CASRAI Editorial Board
Last updated
Clinical Quality Language (CQL) is an HL7 cross-paradigm, domain-specific authoring language standard (HL7 CQL Release 1, STU 1.5) designed to express clinical logic in a human-readable yet machine-computable format for both electronic clinical quality measures (eCQMs) and clinical decision support (CDS) artifacts. Developed through a joint harmonization initiative led by the Centers for Medicare & Medicaid Services (CMS), the Office of the National Coordinator for Health Information Technology (ONC), and Health Level Seven International (HL7), CQL separates clinical expression logic from the underlying clinical data model so the same logic library can operate over the CMS Quality Data Model (QDM) or HL7 FHIR resources.
Why HL7 Clinical Quality Language (CQL) Was Created
Prior to CQL, quality measurement and real-time clinical decision support used incompatible expression standards. CMS eCQMs combined the Quality Data Model (QDM) for both data representation and boolean temporal logic inside Health Quality Measure Format (HQMF) XML files, whereas point-of-care EHR alerts relied on event-driven rules written in HL7 Arden Syntax or vendor-specific rule engines. Because HQMF could not express complex mathematical intervals, clinical timing relationships, or reusable function libraries cleanly—and Arden Syntax could not easily compute population-level measure denominators and numerators—healthcare organizations had to maintain duplicate translations of the same clinical guidelines.
HL7 CQL resolves this split by decoupling the expression logic layer from the data model layer:
- Expression Logic Layer (HL7 CQL / ELM): Defines set operations, temporal interval operators (such as
starts before start of,overlaps, orwithin 30 days of), mathematical functions, terminology value set comparisons, and population criteria. - Data Model Layer (QDM or HL7 FHIR): Defines the structure of clinical entities such as encounters, conditions, medication requests, and laboratory observations. A CQL library declares its data model at the top of the file (for example,
using QDM version '5.6'orusing FHIR version '4.0.1').
CQL Architecture and the Expression Logical Model (ELM)
Every HL7 CQL artifact operates across two complementary representations defined in the HL7 specification:
- High-Level Authoring Syntax (
.cql): A human-readable text syntax designed for clinical informaticists, measure developers, and epidemiologists. A CQL library declares a library identifier, data model version, external terminology systems (such as SNOMED CT, LOINC, ICD-10-CM, and RxNorm via the NLM Value Set Authority Center [VSAC]), context (context Patientorcontext Unfiltered), named expressions (define "In Initial Population": ...), and reusable functions. - Expression Logical Model (ELM,
.xmlor.json): A canonical abstract syntax tree (AST) representation generated by the CQL-to-ELM translator. ELM strips syntactic sugar, resolves operator overloading and type inference, and outputs a strict machine-readable XML or JSON graph. EHR rule engines, clinical data warehouses, and FHIR servers (such as HAPI FHIR or CQFramework’scql-engine) execute the compiled ELM payload directly without needing to parse raw CQL grammar at runtime.
Example HL7 CQL Snippet Using FHIR R4
library ColorectalCancerScreening version '1.0.0'
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1' called FHIRHelpers
valueset "Colonoscopy": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1020'
parameter "Measurement Period" Interval<DateTime>
context Patient
define "Colonoscopy Performed":
[Procedure: "Colonoscopy"] Colonoscopy
where Colonoscopy.status = 'completed'
and Colonoscopy.performed ends 10 years or less on or before end of "Measurement Period"
In CMS eCQM development, measure authors write and package CQL libraries using the CMS Measure Authoring Development Integrated Environment (MADiE) (which succeeded the legacy Measure Authoring Tool [MAT]) and validate logic execution against synthetic patient test cases in Bonnie / MADiE test suites before annual publication on the CMS eCQI Resource Center.
What Is Arden Syntax?
Arden Syntax (formally the HL7 Arden Syntax for Medical Logic Systems, named after the 1989 Arden Homestead conference in Harriman, New York, and initially standardized as ASTM E1460 before transitioning to HL7) is an event-driven procedural rule language created to share point-of-care clinical decision support rules across hospitals. In Arden Syntax, each clinical rule is encapsulated in a self-contained file called a Medical Logic Module (MLM).
An Arden Syntax MLM is organized into three main categories of structured slots:
- Maintenance Category: Tracks administrative metadata including
title,mlmname,ardenversion (such as v2.10 or v3.0),version,institution,author,specialist,date, andvalidationstatus (production,research,testing, orexpired). - Library Category: Documents clinical provenance, including
purpose,explanation,keywords,citations, andlinksto peer-reviewed literature. - Knowledge Category: Contains the executable logic across seven standardized slots, most notably the four core execution slots:
data:Maps local EHR database queries into MLM variables.evoke:Defines the clinical trigger event (for example, storage of a new serum potassium result or a new medication order) that wakes the MLM.logic:Evaluates procedural conditional statements (if ... then ... conclude true;).action:Specifies the output message, alert, or order recommendation sent to the clinician if the logic concludestrue.
The Arden Syntax “Curly Braces Problem”
Because Arden Syntax was designed in 1989 before standardized clinical data models existed, queries inside the data: slot that reference a hospital’s proprietary EHR database schema are wrapped in curly braces—for example, potassium := read last {select result_val from lab_results where test_id = 'K'};. When an MLM is shared with another health system, informaticists must manually rewrite every expression inside {...} to match their local database tables and local lab codes. This interoperability barrier is known in biomedical informatics as the “curly braces problem”. While Arden Syntax v3.0 introduced optional HL7 FHIR data model bindings to mitigate this issue, HL7 CQL avoids the curly braces problem entirely by binding expressions directly to standardized HL7 FHIR profiles (such as US Core and QI-Core) and standardized VSAC terminology value sets.
HL7 CQL vs. Arden Syntax vs. FHIRPath
Clinical informaticists frequently encounter CQL, Arden Syntax, and FHIRPath within the HL7 standards ecosystem. Although CQL is a superset of FHIRPath v2.0, the three languages serve distinct architectural roles:
| Dimension | HL7 Clinical Quality Language (CQL) | HL7 Arden Syntax | HL7 FHIRPath |
|---|---|---|---|
| Primary Purpose | Population-level eCQMs and sharable, data-model-independent CDS logic libraries | Event-driven, single-patient point-of-care alerts encapsulated in Medical Logic Modules (MLMs) | Graph navigation, extraction, and invariant validation within a single FHIR resource |
| Programming Paradigm | Functional, declarative set and temporal interval query language | Procedural, imperative event-condition-action (ECA) rule language | Path-based, side-effect-free expression language |
| Data Model Binding | Pluggable model info (CMS QDM 5.6, HL7 FHIR R4, QI-Core, US Core) | Institution-specific queries in curly braces {...} (FHIR bindings added in v3.0) |
Native to HL7 FHIR resource trees and data types |
| Compiled / Exchange Format | Expression Logical Model (ELM) in XML or JSON | Plain-text MLM file (.mlm) or ArdenML XML |
Inline string expression inside FHIR StructureDefinition or SearchParameter |
| CDS Integration | Embedded in FHIR Library resources invoked by FHIR PlanDefinition, Measure, and CDS Hooks services |
Executed by an Arden Syntax rule engine listening to HL7 v2 / EHR database triggers | Used inside FHIR questionnaires (SDC), invariants, and simple CDS Hooks precondition filters |
Note that HL7 Clinical Quality Language (CQL) is also entirely distinct from the proprietary “Clinical Query Language” used inside Veeva Vault CDMS for authoring electronic data capture (EDC) edit checks in clinical trials.
Frequently Asked Questions
What is Arden Syntax?
Arden Syntax is an HL7 standard rule language used to represent and share event-driven clinical decision support knowledge as independent units called Medical Logic Modules (MLMs). Each MLM contains maintenance metadata, library citations, and executable knowledge slots (data, evoke, logic, and action) that trigger real-time clinical alerts when specific EHR events occur.
How does CQL work with HL7 FHIR and CDS Hooks?
In FHIR-based quality measurement and decision support, a CQL script and its compiled ELM JSON/XML payload are base64-encoded inside a FHIR Library resource. A FHIR Measure resource (for eCQMs) or a FHIR PlanDefinition resource (for clinical guidelines and CDS Hooks services) references that Library to evaluate patient data retrieved from a FHIR server and return population counts or patient-specific clinical recommendations.







