HealthRecordCommunity
FHIR🌏 USAEnriched

Achieving CMS Quality Measures with SQL: From FHIR Data to CQL Engine-Free Execution

Calculating CMS Quality Measures as SQL on FHIR — No CQL Engine Required

July 22, 2026

Summary

This article introduces a new approach using "SQL on FHIR" to address the challenge of running Electronic Clinical Quality Measures (eCQMs). By flattening FHIR data and treating ValueSet membership as a JOIN, it makes complex measurement logic executable as a single SQL query.

Details

Electronic Clinical Quality Measures (eCQMs) are used to measure care quality, with many programs like CMS and HEDIS authored in CQL (Clinical Quality Language). Traditionally, executing these requires a dedicated CQL engine separate from the FHIR server. This creates issues related to additional compute infrastructure, scaling concerns for large populations, and difficulty in explaining exactly why a care gap occurred. SQL on FHIR solves this by transforming the measure logic into standard FHIR artifacts. It uses `ViewDefinition` to flatten complex FHIR resources (e.g., `encounter_flat`) into simple tables. Furthermore, it handles code-set membership—a critical part of any measure—by pre-expanding and indexing ValueSets, allowing membership checks to become efficient JOIN operations rather than runtime network calls. The entire measure then becomes a single, legible SQL query composed of CTEs (Common Table Expressions), which can be run directly where the data resides. This significantly improves portability, performance, and explainability.

📰
Read Original Article
health-samurai.io
→

Original content copyright by respective publishers