Quality Measure Implementation Guide
1.0.0-ballot - ballot International flag

This page is part of the Quality Measure Implementation Guide (v1.0.0-ballot: STU1 (v1.0.0) Ballot 1) based on FHIR (HL7® FHIR® Standard) R4. . For a full list of available versions, see the Directory of published versions

Library: EXM55 - Median Emergency Department Visit Duration Library (Example Continuous Variable Measure Library) (Experimental)

Official URL: http://hl7.org/fhir/uv/cqm/Library/EXM55-FHIR Version: 5.0.0
Active as of 2019-09-03 Computable Name: EXM55
Other Identifiers: http://example.org/fhir/cqi/ecqm/Library/Identifier#EXM55 (use: official, )

This library is used as an example in the FHIR Quality Measure Implementation Guide

Title: EXM55 - Median Emergency Department Visit Duration Library (Example Continuous Variable Measure Library)
Id: EXM55-FHIR
Version: 5.0.0
Url: http://hl7.org/fhir/uv/cqm/Library/EXM55-FHIR
Official

EXM55

Experimental: true
Type:

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

code: logic-library

Date: 2019-09-03
Publisher: HL7 International / Clinical Quality Information
Description:

This library is used as an example in the FHIR Quality Measure Implementation Guide

Jurisdiction: 001
Approval 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
  • Diagnosis Role
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.126
Parameters:
NameTypeMinMaxIn/Out
Measurement PeriodPeriod01In
PatientPatient01Out
Inpatient EncounterEncounter0*Out
Initial PopulationEncounter0*Out
Measure PopulationEncounter0*Out
Measure Population ExclusionEncounter0*Out
Stratification 1Encounter0*Out
Stratification 2Encounter0*Out
Stratification 3Encounter0*Out
Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/StructureDefinition/Patient
Encounter http://hl7.org/fhir/StructureDefinition/Encounter
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
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
Condition http://hl7.org/fhir/StructureDefinition/Condition code filter:
path: id
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
/*
This example is a work in progress and should not be considered a final specification
or recommendation for guidance. This example will help guide and direct the process
of finding conventions and usage patterns that meet the needs of the various stakeholders
in the measure development community.
*/

library EXM55 version '5.0.0'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1' called FHIRHelpers

codesystem "Diagnosis Role": 'http://terminology.hl7.org/CodeSystem/diagnosis-role'

valueset "Emergency Department Visit" : 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'
valueset "Psychiatric/Mental Health Patient" : 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299'
valueset "Hospital Settings" : 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.126'

code "Billing": 'billing' from "Diagnosis Role" display 'Billing'

parameter "Measurement Period" Interval<DateTime>

context Patient

define "Initial Population" :
  "Inpatient Encounter" Encounter
    with ["Encounter" : "Emergency Department Visit"] ED
     such that ED.status = 'finished'
       and ED.period ends 1 hour or less before start of Encounter.period

define "Measure Population" :
  "Initial Population"

define "Inpatient Encounter" :
  ["Encounter"] Encounter
    where LengthInDays(Encounter.period) <= 120
      and Encounter.period ends during "Measurement Period"

define "Measure Population Exclusion" :
  "Inpatient Encounter" Encounter
    with ["Encounter" : "Emergency Department Visit"] ED
      such that ED.period ends 1 hour or less before start of Encounter.period
        and ED.status = 'finished'
        and ED.hospitalization.admitSource in "Hospital Settings"

define function "PrincipalDiagnosis"(Encounter Encounter):
	(singleton from (Encounter.diagnosis D where D.use ~ ToConcept("Billing") and D.rank.value = 1)) PD
		return singleton from ([Condition: id in "GetId"(PD.condition.reference)])

define function "LengthInDays"(Value Interval<DateTime>):
	difference in days between start of Value and end of Value

define function "GetId"(uri String):
	Last(Split(uri, '/'))

define "Stratification 1" :
  "Inpatient Encounter" Encounter
    where not (PrincipalDiagnosis(Encounter).code in "Psychiatric/Mental Health Patient")

define "Stratification 2" :
  "Inpatient Encounter" Encounter
    where PrincipalDiagnosis(Encounter).code in "Psychiatric/Mental Health Patient"

define "Stratification 3" :
  "Inpatient Encounter" Encounter
    where PrincipalDiagnosis(Encounter) is null

//Measure Observation
define function "Related ED Visit" (Encounter "Encounter" ) :
  Last(["Encounter" : "Emergency Department Visit"] ED
    where ED.status = 'finished'
      and ED.period ends 1 hour or less before start of Encounter.period
    sort by start of period )

define function "Measure Observation" (Encounter "Encounter" ) :
  duration in minutes of "Related ED Visit"(Encounter).period
Content: application/elm+xml
Encoded data (81168 characters)
Content: application/elm+json
Encoded data (147776 characters)