Understanding Clinical Quality Language (CQL)

Ryan Lindbeck
3 min readMay 24, 2024

--

In the ever-evolving landscape of healthcare, interoperability and data standardization are critical for enhancing patient care, improving outcomes, and optimizing healthcare operations. Clinical Quality Language (CQL) is a domain-specific language designed to express clinical logic in a human-readable yet computationally executable format. It bridges the gap between clinical guidelines and electronic health records (EHRs), ensuring that healthcare providers can implement evidence-based care seamlessly. In this blog post, we’ll explore what CQL is, its importance, and provide examples of how it works against Fast Healthcare Interoperability Resources (FHIR) data.

What is Clinical Quality Language (CQL)?

CQL is a Health Level Seven International (HL7) standard designed to facilitate the sharing and implementation of clinical knowledge. It allows healthcare providers to express the logic needed to compute quality measures, clinical decision support rules, and other clinical criteria in a standardized way. The primary objectives of CQL are:

  1. Interoperability: Ensuring that clinical logic can be shared across different healthcare systems.
  2. Human Readability: Allowing clinicians and informaticians to read and understand the clinical logic.
  3. Executability: Enabling systems to execute the logic against health data to generate results.

Importance of CQL

  • Standardizing Clinical Quality Measures: It helps in defining and implementing quality measures that are consistent and comparable across different healthcare settings.
  • Supporting Clinical Decision Support (CDS): CQL can express complex clinical rules that aid in decision-making processes.
  • Enhancing Interoperability: By using a standardized language, different healthcare systems can share and implement clinical guidelines and rules more effectively.

How CQL works with FHIR Data

FHIR (Fast Healthcare Interoperability Resources) is another HL7 standard that describes data formats and elements (known as “resources”) for exchanging electronic health records. CQL can be used to define queries and logic that operate on FHIR data, enabling the extraction and manipulation of healthcare information in a standardized way.

Example 1: Defining a Simple Quality Measure

Let’s say we want to define a quality measure for identifying patients with diabetes who have had an HbA1c test in the past year. The CQL might look like this:

library DiabetesHbA1c version '1.0.0'

using FHIR version '4.0.1'

context Patient

define InInitialPopulation:
exists (
[Condition: "diabetes mellitus"] D
where D.clinicalStatus.coding.code = 'active'
)

define InDenominator:
InInitialPopulation

define InNumerator:
exists (
[Observation: "HbA1c"] H
where H.effectiveDateTime during Interval[start of "Measurement Period" - 1 year, end of "Measurement Period"]
)
  • InInitialPopulation: This definition identifies patients with an active diagnosis of diabetes mellitus.
  • InDenominator: The denominator includes all patients in the initial population.
  • InNumerator: The numerator includes patients who have had an HbA1c test during the measurement period.

Example 2: Clinical Decision Support Rule

Suppose we want to create a clinical decision support rule to alert clinicians if a diabetic patient has not had an HbA1c test in the past year. The CQL might be:

library DiabetesHbA1cAlert version '1.0.0'

using FHIR version '4.0.1'

context Patient

define HasDiabetes:
exists (
[Condition: "diabetes mellitus"] D
where D.clinicalStatus.coding.code = 'active'
)

define LastHbA1cTest:
[Observation: "HbA1c"] H
where H.effectiveDateTime during Interval[start of "Measurement Period" - 1 year, end of "Measurement Period"]
sort by effectiveDateTime desc

define NoRecentHbA1cTest:
HasDiabetes and not exists (LastHbA1cTest)

define Alert:
if NoRecentHbA1cTest then
'Patient has not had an HbA1c test in the past year. Consider ordering one.'
  • HasDiabetes: Identifies patients with an active diagnosis of diabetes.
  • LastHbA1cTest: Retrieves the most recent HbA1c test within the past year.
  • NoRecentHbA1cTest: Checks if there is no recent HbA1c test for diabetic patients.
  • Alert: Generates an alert if the patient hasn’t had an HbA1c test in the past year.

Conclusion

CQL, in conjunction with FHIR, provides a powerful framework for standardizing and implementing clinical quality measures and decision support rules. By making clinical logic both human-readable and executable, CQL enhances the interoperability and effectiveness of healthcare systems, ultimately contributing to better patient outcomes. Understanding and utilizing CQL can significantly improve the quality of care delivered by ensuring that clinical guidelines and quality measures are consistently applied across different healthcare settings.

--

--

Ryan Lindbeck

Strategic Visionary Leader in Healthcare Analytics | Software & Data Engineer