Quality Measure Implementation Guide
2.0.0 - STU 2 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 2.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: Example Logic Library (Experimental)

Official URL: http://hl7.org/fhir/uv/cqm/Library/EXMLogic Version: 2.0.0
Standards status: Informative Computable Name: EXMLogic
Other Identifiers: http://example.org/fhir/cqi/ecqm/Library/Identifier#EXMLogic (use: official, ), OID:2.16.840.1.113883.4.642.40.61.28.20

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

Metadata
Title Example Logic Library
Version 2.0.0
Identifier EXMLogic
Identifier urn:oid:2.16.840.1.113883.4.642.40.61.28.20
Approval Date 2019-08-03
Last Review Date 2019-08-03
Experimental true
Jurisdiction http://unstats.un.org/unsd/methods/m49/m49.htm#001
Topic FHIR
Topic CQL
Steward (Publisher) HL7 International / Clinical Quality Information
Description

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

Type http://terminology.hl7.org/CodeSystem/library-type#logic-library
Data Requirement Type: Encounter
Profile(s): Encounter
Data Requirement Type: Encounter
Profile(s): Encounter
Code Filter(s):
Path: type
ValueSet: Emergency Department Visit
Parameters
Name Use Card. Type Documentation
Measurement Period In 0..1 Period
Patient Out 0..1 Patient
Inpatient Encounter Out 0..* Encounter
Initial Population Out 0..* Encounter
Measure Population Out 0..* Encounter
Measure Population Exclusion Out 0..* Encounter
Stratification 1 Out 0..* Encounter
Stratification 2 Out 0..* Encounter
Stratification 3 Out 0..* Encounter
Library Content
CQL Content
/*
This example is purely for illustration purposes to show how all the elements of a
FHIR-based quality measure are represented. It is intentionally simplified to show
specific aspects of a measure, and is not intended as an example of a clinically
meaningful measure.
*/
library EXMLogic

using FHIR version '4.0.1'

include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' called FHIRHelpers
include hl7.fhir.uv.cql.FHIRCommon version '2.0.0' called FHIRCommon

include EXMCommon

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'

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 Encounter.period.lengthInDays() <= 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 "Stratification 1" :
  "Inpatient Encounter" Encounter
    where not (Encounter.principalDiagnosis().diagnosis in "Psychiatric/Mental Health Patient")

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

define "Stratification 3" :
  "Inpatient Encounter" Encounter
    where Encounter.principalDiagnosis().diagnosis 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 
ELM JSON Content
Encoded data 
Citations and References
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
Dependency Description: Library FHIRCommon
Resource: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0
Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0
Dependency Description: Library EXMCommon
Resource: EXMCommon
Canonical URL: http://hl7.org/fhir/uv/cqm/Library/EXMCommon
Dependency 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
Dependency Description: Value Set Psychiatric/Mental Health Patient
Resource: Psychiatric/Mental Health Diagnosis
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299
Dependency Description: Value Set Hospital Settings
Resource: Hospital Settings
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.126
Generated using version 0.5.6 of the sample-content-ig Liquid templates