Quality Measure Implementation Guide
1.0.0 - STU 1 International flag

Quality Measure Implementation Guide, published by HL7 International / Clinical Quality Information. This guide is not an authorized publication; it is the continuous build for version 1.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-cqm/ and changes regularly. 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 Version: 5.0.0
Standards status: Informative Computable Name: EXM55
Other Identifiers: http://example.org/fhir/cqi/ecqm/Library/Identifier#EXM55 (use: official, ), OID:2.16.840.1.113883.4.642.40.61.28.13

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

Metadata
Title EXM55 - Median Emergency Department Visit Duration Library (Example Continuous Variable Measure Library)
Version 5.0.0
Identifier EXM55
Identifier urn:oid:2.16.840.1.113883.4.642.40.61.28.13
Approval Date 2019-08-03
Last Review Date 2019-08-03
Experimental true
Jurisdiction Global (Whole world)
Steward (Publisher) HL7 International / Clinical Quality Information
Description

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

Type Logic Library
Parameter Name: Measurement Period
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: Period
Parameter Name: Patient
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Patient
Parameter Name: Inpatient Encounter
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Initial Population
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Measure Population
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Measure Population Exclusion
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Stratification 1
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Stratification 2
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Stratification 3
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Data Requirement Type: Patient
Profile(s): Patient
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: period, use, rank, rank.value, condition, condition.reference
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, status, period, use, rank, rank.value, condition, condition.reference, hospitalization, hospitalization.admitSource
Code Filter(s):
Path: type
ValueSet: Emergency Department Visit
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: id
Code Filter(s):
Path: id
Library Content
CQL Content
/*
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 hl7.fhir.uv.cql.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
ELM XML Content
Encoded data (91764 characters)
ELM JSON Content
Encoded data (168872 characters)
Generated using version 0.4.9 of the sample-content-ig Liquid templates