CMS FHIR Quality Measure Development IG
1.0.0-cibuild - CI Build
CMS FHIR Quality Measure Development IG, published by Centers for Medicare & Medicaid Services (CMS). This guide is not an authorized publication; it is the continuous build for version 1.0.0-cibuild built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/cms-qmd/ and changes regularly. See the Directory of published versions
QI-Core defines an Encounter profile to model any encounter between a patient and any number of providers in any setting, including virtual.
NOTE: For background information on accessing clinical information with CQL, see the Retrieve topic in the CQL specification.
By default, encounters in QI-Core are characterized using the type element, which is typically bound to a value set. This value set limits the encounters returned to those whose type includes a code from the specified value set. For example:
CQL:
define "Office Visit Encounters":
[Encounter: "Office Visit"]
The type element of Encounters is plural meaning that a given Encounter may have multiple types associated with it. When using value sets such as the “Office Visit” example above, the retrieve resolves using the List
This issue is being reviewed and may result in a specification or tooling change to support this use case (see Translator Issue 1181). However, at this time there are two possible workarounds:
CQL:
define "Office Visit Encounters By Code":
[Encounter] Visit
where exists ((Visit.type) VisitType where VisitType ~ "Office Visit Code")
Note that this latter workaround will typically result in an unrestricted data requirement for Encounters. For this reason, best-practice is to use the first workaround.
The QI-Core profile also supports characterizing encounters using the class element. This element categorizes encounters more broadly than the type element, using the ActEncounterCode value set. For example:
CQL:
define "Virtual Encounters":
[Encounter: class ~ QICoreCommon."virtual"]
Although QDM-based eCQMs have historically used a type-based approach to filtering encounters,
classis a required element in USCore. Therefore, the recommendation is to filter by class first, unless the measure intent requires identifying encounters by type across classes. In many cases, additional filtering may be necessary. For example to limit encounters based on specialty:
CQL:
define "Ophthalmology Encounter Codes":
[Encounter: class in "Inpatient Encounter Class Code"] InpatientEncounter
where InpatientEncounter.type in "Ophthalmology Services"
Encounters often need to be filtered based on status and period, for example:
CQL:
define "Completed Encounters During The Measurement Period":
[Encounter: "Office Visit"] OfficeVisit
where OfficeVisit.status = 'finished'
and OfficeVisit.period starts during "Measurement Period"
The CQMCommon library defines a lengthInDays() fluent function that calculates the difference in days between the start and end of a period. For example, to filter encounters by the duration of stay:
CQL:
define "Non-Elective Inpatient Encounter Less Than 120 Days":
[Encounter: "Non-Elective Inpatient Encounter"] NonElectiveEncounter
where NonElectiveEncounter.period.lengthInDays() <= 120
Other durations can also be calculated, for example:
CQL:
define "Non-Elective Inpatient Encounter Over 24 Hours":
[Encounter: "Non-Elective Inpatient Encounter"] NonElectiveEncounter
where duration in hours of NonElectiveEncounter.period >= 24
NOTE: For ongoing encounters, the end of the period is often not specified, which will typically be interpreted in CQL as an ongoing period, resulting in large duration values.
For inpatient encounters, measures and rules often need to consider the entire hospitalization period, including any immediately preceding emergency department and/or observation status encounters. To support this, the CQMCommon library provides a hospitalizationWithObservation() fluent function that returns the total duration beginning with the earliest associated emergency department or observation encounter to the conclusion of the inpatient encounter. For example:
CQL:
define "Comfort Measures Performed":
[Procedure: "Comfort Measures"] InterventionPerformed
where InterventionPerformed.status in { 'completed', 'in-progress' }
define "Encounter With Comfort Measures Performed During Hospitalization":
"Non-Elective Inpatient Encounter Less Than 120 Days" NonElectiveEncounter
with "Comfort Measures Performed" ComfortMeasure
such that start of ComfortMeasure.performed.toInterval() during NonElectiveEncounter.hospitalizationWithObservation()