Quality Measure STU2 for FHIR R4 Implementation Guide

This page is part of the Quality Measure STU2 for FHIR R4 Implementation Guide (v1.1.0: STU 2 Ballot 1) based on FHIR R4. The current version which supercedes this version is 3.0.0. For a full list of available versions, see the Directory of published versions

Library-vteicu-fhir

Formats: XML, JSON, Turtle

Id: vteicu-fhir
Type:
system: http://terminology.hl7.org/CodeSystem/library-type
code: logic-library
Version: 2.4.000
Status: active
Related:

type: depends-on

Resource:
Library/fhirhelpers

type: depends-on

Resource:
Library/matglobalcommonfunctions-fhir

Data Requirements:

type: Encounter

code filter:
path: type
valueset: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307

type: Encounter

code filter:
path: type
valueset: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292

type: Condition

code filter:
path: idvalueset:

type: Condition

code filter:
path: idvalueset:

type: Location

code filter:
path: idvalueset:

Content: type: text/cql
library VTEICU_FHIR version '2.4.000'

/*
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.
*/

using FHIR version '4.0.0'

include FHIRHelpers version '4.0.0' called FHIRHelpers
include MATGlobalCommonFunctions_FHIR version '2.0.000' called Common

// TODO: Determine how to reference a particular version of LOINC
codesystem "LOINC:2.46": 'http://loinc.org' version 'urn:hl7:version:2.46'
codesystem "SNOMED CT:2016-03": 'http://snomed.info/sct' version 'http://snomed.info/sct/731000124108/version/201603'

valueset "Intensive Care Unit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.23'

code "Birthdate": '21112-8' from "LOINC:2.46" display 'Birth date'
code "Dead": '419099009' from "SNOMED CT:2016-03" display 'Dead'

parameter "Measurement Period" Interval<DateTime>

context Patient

define function "ToDate"(Value DateTime):
	DateTime(year from Value, month from Value, day from Value, 0, 0, 0, 0, timezone from Value)

define function "CalendarDayOfOrDayAfter"(StartValue DateTime):
	Interval[StartValue, ToDate(StartValue + 2 days))

define function "Start of First ICU"(Encounter "Encounter"):
	start of "First Intensive Care Unit"(Encounter).period

define function "First Intensive Care Unit"(Encounter "Encounter"):
	First(Encounter.location L
			where Common.GetLocation(L.location).type in "Intensive Care Unit"
				and L.period during Encounter.period
			sort by start of period
	)