Clinical Query Language (CQL) is a high-level domain-independent query language designed to support the creation of quality measures and clinical decision rules. It enables clinicians to write intuitive and unambiguous queries without needing to understand the complexities of database structures or programming logic. CQL is particularly useful in clinical decision support systems, where rules can generate alerts based on patient data. These alerts operate at both individual and population levels, ensuring that healthcare providers can make data-driven decisions. One of the key benefits of CQL is its flexibility—it can work with any data model and integrates with various programming languages through ANTLR-generated lexers and parsers, making it adaptable across different health information systems.

CQL to ELM translator API with SpringBoot
Image credit: Kelti, CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0, via Wikimedia Commons

CQL does not impose a specific data model, instead relying on an intermediary format called the Expression Logical Model (ELM). ELM serves as the bridge between CQL queries and the lower-level database logic required for execution. The grammar is derived from FHIRPath, ensuring consistency with widely used clinical data standards. With its structured semantics, CQL can be leveraged to automate processes, reducing manual workload for clinicians while ensuring standardized, reliable data interpretation. Ongoing developments, such as integrating CQL with private terminology servers beyond the National Library of Medicine’s Value Set Authority Center (VSAC), further enhance its versatility. As healthcare systems increasingly rely on interoperable data exchanges, CQL continues to play a crucial role in improving clinical decision-making and quality measurement.

The CQL-to-ELM Translator Reference Implementation is an open-source tool designed to convert CQL syntax into the Expression Logical Model (ELM) representation. This translation process ensures that clinical decision support and quality measurement artifacts can be uniformly shared and executed across different systems. Built in Java, the translator leverages ANTLR4, a powerful parser generator, to process syntax and generate ELM output. It supports integration within Integrated Development Environments (IDEs) and provides various options for customization, including XML and JSON output formats. The translator is licensed under the Apache Version 2.0 license and is available via the Sonatype Maven repository, making it accessible for developers working on FHIR, QDM, and QUICK models. With ongoing enhancements, such as improved error handling and data requirements analysis, the translator continues to evolve as a critical component in clinical quality frameworks.

Here is a simple SpringBoot wrapper for the CQL-to-ELM Translator for exposing the service as an API.

In Part 2, I will discuss how to add support for FHIR terminology server in cql-exec-vsac.

Bell Eapen
Follow Me
Latest posts by Bell Eapen (see all)