Metadata Title EXM Ratio Measure Version 2.0.0 Identifier EXMRatio-FHIR Identifier urn:oid:2.16.840.1.113883.4.642.40.61.29.10 Approval Date 2019-02-17 Last Review Date 2019-02-17 Experimental true Use Context Clinical Venue = EC Jurisdiction 001 from http://unstats.un.org/unsd/methods/m49/m49.htm Topic Health Quality Measure Document Steward (Publisher) HL7 International / Clinical Quality Information Developer Example Measure Content Developer Description An example FHIR-based publishable measure Purpose This measure has been developed to support improvement in clinical care. Copyright Example Copyright Statement Disclaimer Example disclaimer Measure Basis Encounter Measure Scoring Ratio Measure Scoring Unit /1000.d from http://unitsofmeasure.org Improvement Notation Decreased score indicates improvement Measure Type process from http://terminology.hl7.org/CodeSystem/measure-type Rationale The rationale of this measure is... Guidance (Usage) Users of this measure should be aware of... Measure Group (Rate) (ID: primary) Measure Logic Primary Library EXMRatio - Example Ratio Measure Library Contents Population Criteria Logic Definitions Terminology Dependencies Data Requirements Parameters Population Criteria Measure Group (Rate) (ID: primary) Logic Definitions Logic Definition Library Name: EXMRatio define "Qualifying Encounters": ["Encounter": "Inpatient"] Logic Definition Library Name: EXMRatio define "Initial Population": "Qualifying Encounters" Logic Definition Library Name: EXMRatio define "Numerator": "Initial Population" Logic Definition Library Name: EXMRatio define "Denominator": "Initial Population" Logic Definition Library Name: EXMRatio define "Falls with Major Injury": ["Observation": "Fall"] Logic Definition Library Name: EXMRatio define function "Denominator Observation"(Encounter "Encounter"): duration in hours of Global.Hospitalization(Encounter) / 24 Logic Definition Library Name: EXMRatio define function "Numerator Observation"(Encounter "Encounter"): Count( "Falls with Major Injury" Falls where Global."Normalize Interval"(Falls.effective) during Encounter.period ) Logic Definition Library Name: MATGlobalCommonFunctions define function "Hospitalization"(TheEncounter FHIR.Encounter): ( "ED Visit"(TheEncounter) ) X return if X is null then TheEncounter.period else Interval[start of FHIRHelpers.ToInterval(X.period), end of FHIRHelpers.ToInterval(TheEncounter.period)] Logic Definition Library Name: MATGlobalCommonFunctions define function "ED Visit"(TheEncounter FHIR.Encounter): singleton from ( [Encounter: "Emergency Department Visit"] EDVisit where EDVisit.status = 'finished' and EDVisit.period ends 1 hour or less on or before start of FHIRHelpers.ToInterval(TheEncounter.period) ) Logic Definition Library Name: MATGlobalCommonFunctions /* * * CQFMeasures Common Logic * */ define function "Normalize Interval"(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>): case when choice is FHIR.dateTime then Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)] when choice is FHIR.Period then FHIRHelpers.ToInterval(choice as FHIR.Period) when choice is FHIR.instant then Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)] when choice is FHIR.Age then Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age), FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year) when choice is FHIR.Range then Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low), FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year) when choice is FHIR.Timing then Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute a single interval from a Timing type') when choice is FHIR.string then Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute an interval from a String value') else null as Interval<DateTime> end Logic Definition Library Name: FHIRHelpers define function ToString(value EncounterStatus): value.value Logic Definition Library Name: FHIRHelpers /* @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period) value to a CQL DateTime Interval @comment: If the start value of the given period is unspecified, the starting boundary of the resulting interval will be open (meaning the start of the interval is unknown, as opposed to interpreted as the beginning of time). */ define function ToInterval(period FHIR.Period): if period is null then null else if period."start" is null then Interval(period."start".value, period."end".value] else Interval[period."start".value, period."end".value] Logic Definition Library Name: FHIRHelpers define function ToDateTime(value dateTime): value.value Logic Definition Library Name: FHIRHelpers define function ToDateTime(value instant): value.value Logic Definition Library Name: FHIRHelpers define function ToDate(value date): value.value Logic Definition Library Name: FHIRHelpers /* @description: Converts the given FHIR [Quantity](https://hl7.org/fhir/datatypes.html#Quantity) value to a CQL Quantity @comment: If the given quantity has a comparator specified, a runtime error is raised. If the given quantity has a system other than UCUM (i.e. `http://unitsofmeasure.org`) or CQL calendar units (i.e. `http://hl7.org/fhirpath/CodeSystem/calendar-units`) an error is raised. For UCUM to calendar units, the `ToCalendarUnit` function is used. @seealso: ToCalendarUnit */ define function ToQuantity(quantity FHIR.Quantity): case when quantity is null then null when quantity.value is null then null when quantity.comparator is not null then Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.') when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org' or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) } else Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')') end Logic Definition Library Name: FHIRHelpers /* @description: Converts a UCUM definite duration unit to a CQL calendar duration unit using conversions specified in the [quantities](https://cql.hl7.org/02-authorsguide.html#quantities) topic of the CQL specification. @comment: Note that for durations above days (or weeks), the conversion is understood to be approximate */ define function ToCalendarUnit(unit System.String): case unit when 'ms' then 'millisecond' when 's' then 'second' when 'min' then 'minute' when 'h' then 'hour' when 'd' then 'day' when 'wk' then 'week' when 'mo' then 'month' when 'a' then 'year' else unit end Terminology Value Set Description: Value set Inpatient Resource: http://example.org/fhir/ValueSet/inpatient Canonical URL: http://example.org/fhir/ValueSet/inpatient Value Set Description: Value set Emergency Department Visit Resource: Emergency Department Visit Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292 Value Set Description: Value set Fall Resource: http://example.org/fhir/ValueSet/fall Canonical URL: http://example.org/fhir/ValueSet/fall Dependencies Dependency Description: FHIR model information Resource: http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1 Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1 Dependency Description: Library Global Resource: MAT Global Common Functions FHIR Library version: 5.0.000 Canonical URL: http://hl7.org/fhir/uv/cqm/Library/MATGlobalCommonFunctions|5.0.000 Dependency Description: Library FHIRHelpers Resource: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1 Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1 Data Requirements Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, status, period Code Filter(s): Path: type ValueSet: Emergency Department Visit Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, period Code Filter(s): Path: type ValueSet: http://example.org/fhir/ValueSet/inpatient Data Requirement Type: Observation Profile(s): Observation Must Support Elements: code, effective Code Filter(s): Path: code ValueSet: http://example.org/fhir/ValueSet/fall Data Requirement Type: Patient Profile(s): Patient Parameters Name Use Card. Type Documentation Numerator Out 0..* Encounter Denominator Out 0..* Encounter Initial Population Out 0..* Encounter Generated using version 0.5.4 of the sample-content-ig Liquid templates
define "Qualifying Encounters": ["Encounter": "Inpatient"]
define "Initial Population": "Qualifying Encounters"
define "Numerator": "Initial Population"
define "Denominator": "Initial Population"
define "Falls with Major Injury": ["Observation": "Fall"]
define function "Denominator Observation"(Encounter "Encounter"): duration in hours of Global.Hospitalization(Encounter) / 24
define function "Hospitalization"(TheEncounter FHIR.Encounter): ( "ED Visit"(TheEncounter) ) X return if X is null then TheEncounter.period else Interval[start of FHIRHelpers.ToInterval(X.period), end of FHIRHelpers.ToInterval(TheEncounter.period)]
define function "ED Visit"(TheEncounter FHIR.Encounter): singleton from ( [Encounter: "Emergency Department Visit"] EDVisit where EDVisit.status = 'finished' and EDVisit.period ends 1 hour or less on or before start of FHIRHelpers.ToInterval(TheEncounter.period) )
define function ToString(value EncounterStatus): value.value
/* @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period) value to a CQL DateTime Interval @comment: If the start value of the given period is unspecified, the starting boundary of the resulting interval will be open (meaning the start of the interval is unknown, as opposed to interpreted as the beginning of time). */ define function ToInterval(period FHIR.Period): if period is null then null else if period."start" is null then Interval(period."start".value, period."end".value] else Interval[period."start".value, period."end".value]
define function "Numerator Observation"(Encounter "Encounter"): Count( "Falls with Major Injury" Falls where Global."Normalize Interval"(Falls.effective) during Encounter.period )
/* * * CQFMeasures Common Logic * */ define function "Normalize Interval"(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>): case when choice is FHIR.dateTime then Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)] when choice is FHIR.Period then FHIRHelpers.ToInterval(choice as FHIR.Period) when choice is FHIR.instant then Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)] when choice is FHIR.Age then Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age), FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year) when choice is FHIR.Range then Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low), FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year) when choice is FHIR.Timing then Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute a single interval from a Timing type') when choice is FHIR.string then Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute an interval from a String value') else null as Interval<DateTime> end
define function ToDateTime(value dateTime): value.value
define function ToDateTime(value instant): value.value
define function ToDate(value date): value.value
/* @description: Converts the given FHIR [Quantity](https://hl7.org/fhir/datatypes.html#Quantity) value to a CQL Quantity @comment: If the given quantity has a comparator specified, a runtime error is raised. If the given quantity has a system other than UCUM (i.e. `http://unitsofmeasure.org`) or CQL calendar units (i.e. `http://hl7.org/fhirpath/CodeSystem/calendar-units`) an error is raised. For UCUM to calendar units, the `ToCalendarUnit` function is used. @seealso: ToCalendarUnit */ define function ToQuantity(quantity FHIR.Quantity): case when quantity is null then null when quantity.value is null then null when quantity.comparator is not null then Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.') when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org' or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) } else Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')') end
/* @description: Converts a UCUM definite duration unit to a CQL calendar duration unit using conversions specified in the [quantities](https://cql.hl7.org/02-authorsguide.html#quantities) topic of the CQL specification. @comment: Note that for durations above days (or weeks), the conversion is understood to be approximate */ define function ToCalendarUnit(unit System.String): case unit when 'ms' then 'millisecond' when 's' then 'second' when 'min' then 'minute' when 'h' then 'hour' when 'd' then 'day' when 'wk' then 'week' when 'mo' then 'month' when 'a' then 'year' else unit end
HL7 International / Clinical Quality Information
An example FHIR-based publishable measure
This measure has been developed to support improvement in clinical care.
Users of this measure should be aware of...