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-hospice-fhir

Formats: XML, JSON, Turtle

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

type: depends-on

Resource:
Library/matglobalcommonfunctions-fhir

type: depends-on

Resource:
Library/fhirhelpers

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:

type: Encounter

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

type: ServiceRequest

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

type: Procedure

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

Content: type: text/cql
library Hospice_FHIR version '1.0.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 MATGlobalCommonFunctions_FHIR version '2.0.000' called Global
include FHIRHelpers version '4.0.0' called FHIRHelpers

codesystem "SNOMED CT:2017-09": 'http://snomed.info/sct' version 'http://snomed.info/sct/731000124108/version/201709'

valueset "Encounter Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'
valueset "Hospice care ambulatory": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.15'

code "Discharge to healthcare facility for hospice care (procedure)": '428371000124100' from "SNOMED CT:2017-09" display 'Discharge to healthcare facility for hospice care (procedure)'
code "Discharge to home for hospice care (procedure)": '428361000124107' from "SNOMED CT:2017-09" display 'Discharge to home for hospice care (procedure)'

context Patient

define function "Has Hospice"(MeasurementPeriod Interval<DateTime>):
	exists (
	    [Encounter: "Encounter Inpatient"] DischargeHospice
			where DischargeHospice.status = 'final'
			    and (
			        FHIRHelpers.ToConcept(DischargeHospice.hospitalization.dischargeDisposition).codes[0] ~ "Discharge to home for hospice care (procedure)"
					    or FHIRHelpers.ToConcept(DischargeHospice.hospitalization.dischargeDisposition).codes[0] ~ "Discharge to healthcare facility for hospice care (procedure)"
			    )
				and DischargeHospice.period ends during day of MeasurementPeriod
	)
    or exists (
        [ServiceRequest: "Hospice care ambulatory"] HospiceOrder
            where HospiceOrder.intent = 'order'
                and HospiceOrder.authoredOn in day of MeasurementPeriod
    )
    or exists (
        [Procedure: "Hospice care ambulatory"] HospicePerformed
            where HospicePerformed.status = 'completed'
                and Global."Get Choice Interval - dateTime or Period"(HospicePerformed.performed) overlaps MeasurementPeriod
    )