Inferensys

Glossary

Clinical Quality Language (CQL)

An HL7 authoring standard for expressing clinical quality measures and decision support rules in a human-readable, computable format that leverages a FHIR-based data model.
Cinematic overhead of a WeWork creative suite room with multiple curved monitors showing AI decision dashboards, executives in casual attire reviewing data, dramatic pendant lighting.
HL7 EXPRESSION STANDARD

What is Clinical Quality Language (CQL)?

Clinical Quality Language (CQL) is an HL7 authoring standard for expressing clinical quality measures and decision support rules in a human-readable, computable format that leverages a FHIR-based data model.

Clinical Quality Language (CQL) is a high-level, domain-specific language designed to express clinical quality measures (eCQMs) and clinical decision support (CDS) rules. It enables the authoring of logic that queries and manipulates clinical data retrieved via a FHIR-based data model, known as the Quality Data Model (QDM) or FHIR directly. CQL is designed to be both human-readable, allowing clinicians to validate the intent of a measure, and computable, enabling direct execution by a CQL engine against a FHIR server or clinical data repository.

CQL separates the expression of clinical logic from the implementation details of data retrieval, using a declarative syntax inspired by languages like SQL and XQuery. It defines libraries of reusable logic, value sets for terminology binding, and expressions that compute scores, stratifications, and patient cohorts. The standard is integral to the FHIR Clinical Reasoning module, where CQL libraries are packaged as Library resources and evaluated by a $evaluate operation, enabling interoperable, shareable clinical knowledge artifacts across healthcare systems.

CLINICAL QUALITY LANGUAGE

Key Features of CQL

CQL is an HL7 standard for expressing clinical quality measures and decision support rules in a human-readable, computable format that leverages a FHIR-based data model.

01

Human-Readable Authoring

CQL is designed to be both human-readable and computable, bridging the gap between clinical domain experts and software engineers. Its syntax is inspired by common programming languages but uses clinical terminology, allowing non-programmers to review and validate the logic. This dual nature ensures that a quality measure's intent is transparent and auditable, reducing the risk of misinterpretation during implementation.

02

FHIR Data Model Alignment

CQL is fundamentally designed to operate on the FHIR (Fast Healthcare Interoperability Resources) data model. It uses a domain-specific data model called QUICK (Quality Improvement Core) as a logical view, which maps directly to FHIR resources. This tight coupling allows CQL expressions to natively traverse FHIR profiles, retrieve specific resources like Patient, Observation, or MedicationRequest, and access their elements using a path-based syntax, ensuring seamless integration with modern healthcare APIs.

03

Expression Logic and Timing

CQL provides a rich set of operators for defining complex clinical logic:

  • Comparison and Logical Operators: =, >, and, or, not for building conditional rules.
  • Timing and Interval Operators: Operators like before, after, during, and within allow precise temporal reasoning, such as checking if a lab test occurred within 30 days of a diagnosis.
  • List and Aggregate Functions: exists, forall, count, sum, and avg enable population-level analysis and cohort identification.
04

Terminology Service Integration

CQL has first-class support for value set membership testing. Authors can define expressions that check if a clinical concept belongs to a specific value set (e.g., 'Diabetes' value set) without hardcoding individual codes. The language includes a valueset keyword and an in operator, allowing the expression "Diabetes" in "Diabetes Value Set". This decouples the clinical logic from the specific code systems like SNOMED CT, LOINC, or ICD-10, making measures resilient to terminology updates.

05

Library and Component Model

CQL promotes modularity and reuse through a library model. Logic can be packaged into named libraries, versioned, and shared across multiple measures or decision support artifacts. A library can declare:

  • Parameters: Input values provided at runtime.
  • Expressions: Named reusable logic fragments.
  • Functions: Parameterized, callable blocks of logic. This component-based architecture prevents duplication and ensures consistent implementation of common clinical definitions across an organization.
06

Translation to ELM

For machine execution, CQL is translated into a canonical, XML-based representation called Expression Logical Model (ELM). The CQL-to-ELM translator produces a deterministic, unambiguous abstract syntax tree that calculation engines consume directly. This two-layer approach—human-readable CQL for authoring and machine-optimized ELM for execution—ensures that the original clinical intent is preserved while enabling high-performance, deterministic computation in clinical decision support and quality reporting systems.

CLINICAL QUALITY LANGUAGE

Frequently Asked Questions

Clear, authoritative answers to the most common questions about the HL7 Clinical Quality Language (CQL) standard for expressing computable clinical logic.

Clinical Quality Language (CQL) is an HL7 authoring standard designed to express clinical quality measures (CQMs) and decision support rules in a human-readable, computable format. It works by defining a formal logic language that operates over a FHIR-based clinical data model, allowing authors to write expressions that query, filter, and aggregate patient data. CQL separates the clinical logic from the implementation layer, meaning the same CQL logic can be executed against any compliant data source. The language uses a syntax familiar to clinical informaticists, with constructs like define, where, and return, while compiling down to Expression Logical Model (ELM) for machine execution. This dual-representation ensures that clinicians can review the logic for accuracy while engines can execute it deterministically against standardized data.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.