What is HL7 CQL?

Clinical Quality Language (CQL) is a SQL-style query language used by health plans for calculating HEDIS measure performance metrics for a given set of HL7 FHIR patient data.

Understanding HEDIS/Quality is a prerequisite for understanding CQL, we recommending reading our HEDIS introduction first if you are new to it.

Here are some additional quick questions answered:

  • CQL is an HL7-created language with defined syntax. Just like the medical record formats, it was created by the HL7 committee. CQL query files have a *.CQL file extension.

  • CQL is compiled to create EML (Expression Logical Model): While CQL is highly human readable, it needs to be converted to EML (json/xml format), which is machine readable before it can be executed.

  • NCQA is the most common implementer of CQL, as they release CQL statements for all measures each year which may be used by health plans to expedite HEDIS measurement.

  • CQL is meant for HL7v4 FHIR data, with the R4 implementation standard. CQL cannot be used with any other data format (databases, CDA, ADT, or unstructured data). It can only be used with FHIR.

CQL Process Overview

Step 1: Conversion to EML

CQL to EML

Step 2: Performance Evaluation

EML to HEDIS measure performance

Review of a CQL Example

This will make more sense with some visuals. Referencing this example CQL file for chlamydia screening, lets look closer in detail:

library ChlamydiaScreening_CQM version '2'

using QUICK

This specifies that the name, version of the library and that it is using the QUICK (Quality Information and Clinical Knowledge) data model that allows simple syntax referencing of FHIR resources.

valueset "Female Administrative Sex": '2.16.840.1.113883.3.560.100.2'
valueset "Other Female Reproductive Conditions": '2.16.840.1.113883.3.464.1003.111.12.1006'
valueset "Genital Herpes": '2.16.840.1.113883.3.464.1003.110.12.1049'

These value sets describe the names and OID identifiers of them. These value sets are groups of codes (LOINC, CPT, ICD-10-CM, etc) that represent a concept in HEDIS/Quality evaluation. Here Female administrative sex is one of them, as the measure is quantifying the percentage of women who got checkups.

parameter MeasurementPeriod default Interval[DateTime(2013, 1, 1, 0, 0, 0, 0), DateTime(2014, 1, 1, 0, 0, 0, 0))

this specifies that the measurement period is 2013 to 2014.

Patient CQL Section

context Patient
define "InDemographic":
	AgeInYearsAt(start of MeasurementPeriod) >= 16 and AgeInYearsAt(start of MeasurementPeriod) < 24
		and "Patient"."gender" in "Female Administrative Sex"
...

This is just a snippet of the patient section that describes the definition of a patient falling within the relevant demographic of 16-24 year-old women. Note that the language uses syntax that references the gender field of the Patient HL7 FHIR resource. In the full hyperlinked patient section there are more definitions that specify that:

  • Patients are in the denominator if they are woman between ages 16 and 24 that are sexually active

  • Patients are in the numerator if they have received a chlamydia screening during the measurement period.

Population CQL Section

context Population
define "MeasureScore": (Count(Patient P where "InInitialPopulation" and "InDenominator" and "InNumerator") / Count("Patient" P where "InInitialPopulation" and "InDenominator")) * 100

This final statement is the performance calculations. It specifies that both numerator and denominator patients must be in the age/gender demographic, and that the output number 0 and 100.

Conclusion

HL7 Clinical Quality Language (CQL) is a query language designed to calculate healthcare quality measures, such as HEDIS metrics, using HL7 FHIR R4 data. With SQL-like syntax, CQL offers a standardized, human-readable approach to define cohorts, perform calculations, and assess quality measures. It works exclusively with FHIR resources and requires conversion to a machine-readable Expression Logical Model (EML) format for execution.

CQL leverages value sets (e.g., ICD-10, LOINC) and parameters like measurement periods to define precise criteria for evaluating patient populations. It integrates logic for defining denominators (eligible patients), numerators (patients meeting the measure), and overall performance scores, enabling consistent and automated reporting. Widely adopted by organizations like NCQA, CQL supports efficient quality evaluation and reporting.

As CQL continues to align with healthcare data standards, it serves as a cornerstone for improving care quality, streamlining compliance, and driving data-driven decision-making in healthcare organizations.

If you are interested in utilizing CQL for larger processes, reach out to our team!

Previous
Previous

HEDIS NLP Evidence Detection with Tenasol

Next
Next

How to Convert a Medical Record