Quality Measure Implementation Guide (STU3)
3.0.0 - STU 3 US

This page is part of the Quality Measure STU2 for FHIR R4 Implementation Guide (v3.0.0: STU3) based on FHIR R4. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

Example Library: EXMRatio - Example Ratio Measure Library

Active as of 2019-09-03
Id: EXMRatio
Url: http://hl7.org/fhir/us/cqfmeasures/Library/EXMRatio
Version: 4.0.0
Identifier:

value: EXMRatio

Name: EXMRatio
Title: EXMRatio - Example Ratio Measure Library
Status: active
Experimental: true
Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2019-09-03
Publisher: Clinical Quality Information WG
Description: This library is used as an example in the FHIR Quality Measure Implementation Guide
Use Context:
codevaluedisplay
program ep-ec EP/EC
Jurisdiction: US
Approval Date: 2019-08-03
Last Review Date: 2019-08-03
Related Artifacts:

Dependencies

  • http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
  • http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
  • http://hl7.org/fhir/us/cqfmeasures/Library/MATGlobalCommonFunctions|5.0.000
  • http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Parameters:
NameTypeMinMaxIn/Out
PatientPatient01out
Qualifying EncountersEncounter0*out
Initial PopulationEncounter0*out
DenominatorEncounter0*out
NumeratorEncounter0*out
Falls with Major InjuryObservation0*out
Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/StructureDefinition/Patient
Encounter http://hl7.org/fhir/StructureDefinition/Encounter code filter:
path: type
Observation http://hl7.org/fhir/StructureDefinition/Observation code filter:
path: code
Encounter http://hl7.org/fhir/StructureDefinition/Encounter code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Content: text/cql
/*
Measures the number of inpatient falls with major injury per 1000 patient days.

“Patient days� are to be calculated such that:
  Sum actual hours for all patients, whether in-patient, ED or observation, and divide by 24.

The approach we envision is starting from an encounter-based eCQM with numerator
and denominator observations to arrive at the following:

Patient A has a 10 day inpatient encounter. On day 1 she fell 9 times. No more falls in that stay.

Patient B has a 2 day inpatient encounter. On day 2 he fell 1 time. No other falls in that stay

Result: 10 falls/12 days = 833/1000 patient days

Answer: There are multiple considerations involved in the representation of falls with major injury,
this example does not address those considerations, focusing only on the overall structure
of the measure and the final calculation.

This measure can be represented as an encounter-based ratio measure, with:

Numerator Observation: Count(Falls with Major Injury)
Denominator Observation: Sum(Encounter Days)

This does result in a ratio, but there isn't mechanism in the current FHIR measure
to specify that the ratio should be converted to "per 1000 days".

To support that aspect, we are proposing a scoringUnit extension of the Quality Measure IG
to state the expected units of a ratio measure.

This is submitted as a tracker to the quality measure IG here:
https://jira.hl7.org/browse/FHIR-30506

The included EXMRatioFHIRv603-Artifacts.zip is an export of this measure expressed
in the MAT which includes everything but the proprosed scoringUnit extension. That
extension is proposed for inclusion in the May 2021 ballot of the quality measure ig
and is not supported by the MAT at this time.
*/
library EXMRatio

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'

include MATGlobalCommonFunctions version '5.0.000' called Global

valueset "Inpatient": 'TBD'
valueset "Fall": 'TBD'

context Patient

define "Initial Population":
  "Qualifying Encounters"

define "Denominator":
  "Initial Population"

define "Numerator":
  "Initial Population"

define "Qualifying Encounters":
  ["Encounter": "Inpatient"]

define "Falls with Major Injury":
  ["Observation": "Fall"]

define function "Denominator Observation"(Encounter "Encounter"):
  duration in hours of Global.Hospitalization(Encounter) / 24

define function "Numerator Observation"(Encounter "Encounter"):
  Count(
    "Falls with Major Injury" Falls
      where Global."Normalize Interval"(Falls.effective) during Encounter.period
  )
Content: application/elm+xml
Encoded data (20292 characters)
Content: application/elm+json
Encoded data (32772 characters)