Quality Measure Implementation Guide
6.0.0-ballot - ballot United States of America 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 6.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/cqf-measures/ and changes regularly. See the Directory of published versions

Library: Advanced Illness and Frailty Exclusion Library

Official URL: http://hl7.org/fhir/uv/cqm/Library/AdvancedIllnessandFrailtyExclusion Version: 5.12.000
Draft as of 2024-11-19 Computable Name: AdvancedIllnessandFrailtyExclusion

Advanced Illness and Frailty Exclusion Example Library

Title: Advanced Illness and Frailty Exclusion Library
Id: AdvancedIllnessandFrailtyExclusion
Version: 5.12.000
Url: http://hl7.org/fhir/uv/cqm/Library/AdvancedIllnessandFrailtyExclusion
Status: draft
Type:

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

code: logic-library

Date: 2024-11-19 16:49:15+0000
Publisher: HL7 International / Clinical Quality Information
Description:

Advanced Illness and Frailty Exclusion Example Library

Jurisdiction: US
Related Artifacts:

Dependencies

  • http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
  • http://fhir.org/guides/common/Library/FHIRHelpers|4.0.1
  • http://ecqi.healthit.gov/ecqms/Library/MATGlobalCommonFunctions|5.0.000
  • http://fhir.org/guides/common/Library/FHIRHelpers|4.0.1
  • Logical Observation Identifiers, Names and Codes (LOINC)
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1083
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1082
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1014
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.196.12.1510
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1085
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.118.12.1300
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1074
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1088
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1075
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1084
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1012
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1086
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1087
Parameters:
NameTypeMinMaxIn/Out
Measurement PeriodPeriod01In
PatientPatient01Out
Has Criteria Indicating Frailtyboolean01Out
Outpatient Encounters with Advanced IllnessEncounter0*Out
Inpatient Encounter with Advanced IllnessEncounter0*Out
Dementia Medications In Year Before or During Measurement PeriodMedicationDispense0*Out
Advanced Illness and Frailty Exclusion Including Over Age 80boolean01Out
Advanced Illness and Frailty Exclusion Not Including Over Age 80boolean01Out
Long Term Care Periods During Measurement PeriodPeriod0*Out
Long Term Care Periods Longer Than 90 Consecutive Daysboolean01Out
Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/StructureDefinition/Patient
DeviceRequest http://hl7.org/fhir/StructureDefinition/DeviceRequest code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.118.12.1300
Condition http://hl7.org/fhir/StructureDefinition/Condition code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1074
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.464.1003.101.12.1088
Observation http://hl7.org/fhir/StructureDefinition/Observation code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1075
Condition http://hl7.org/fhir/StructureDefinition/Condition code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1082
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.464.1003.101.12.1083
Condition http://hl7.org/fhir/StructureDefinition/Condition code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1082
MedicationDispense http://hl7.org/fhir/StructureDefinition/MedicationDispense code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.196.12.1510
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 AdvancedIllnessandFrailtyExclusion version '5.12.000'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1' called FHIRHelpers
include MATGlobalCommonFunctions version '5.0.000' called Global

codesystem "LOINC": 'http://loinc.org'

valueset "Acute Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1083'
valueset "Advanced Illness": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1082'
valueset "Care Services in Long-Term Residential Facility": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1014'
valueset "Dementia Medications": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.196.12.1510'
valueset "ED": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1085'
valueset "Frailty Device": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.118.12.1300'
valueset "Frailty Diagnosis": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1074'
valueset "Frailty Encounter": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1088'
valueset "Frailty Symptom": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1075'
valueset "Nonacute Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1084'
valueset "Nursing Facility Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1012'
valueset "Observation": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1086'
valueset "Outpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1087'

code "Birth date": '21112-8' from "LOINC" display 'Birth date'

parameter "Measurement Period" Interval<DateTime>
  default Interval[@2019-01-01T00:00:00.0, @2020-01-01T00:00:00.0)

context Patient

define "Advanced Illness and Frailty Exclusion Including Over Age 80":
  //If the measure includes populations age 80 and older, then use this logic:
      	(
              Global."CalendarAgeInYearsAt"(FHIRHelpers.ToDate(Patient.birthDate), start of "Measurement Period")in Interval[66, 80]
                  and "Has Criteria Indicating Frailty"
                  and ( Count("Outpatient Encounters with Advanced Illness")>= 2
                      or exists ( "Inpatient Encounter with Advanced Illness" )
                      or exists "Dementia Medications In Year Before or During Measurement Period"
                  )
      	)
      		or (
                  Global."CalendarAgeInYearsAt"(FHIRHelpers.ToDate(Patient.birthDate), start of "Measurement Period")>= 81
      			    and "Has Criteria Indicating Frailty"
      		)

define "Advanced Illness and Frailty Exclusion Not Including Over Age 80":
  //If the measure does NOT include populations age 80 and older, then use this logic:
      	Global."CalendarAgeInYearsAt"(FHIRHelpers.ToDate(Patient.birthDate), start of "Measurement Period")>= 65
              and "Has Criteria Indicating Frailty"
              and ( Count("Outpatient Encounters with Advanced Illness")>= 2
                  or exists ( "Inpatient Encounter with Advanced Illness" )
                  or exists "Dementia Medications In Year Before or During Measurement Period"
              )

define "Dementia Medications In Year Before or During Measurement Period":
  ["MedicationDispense": "Dementia Medications"] DementiaMed
      		where DementiaMed.whenHandedOver during Interval[
                  ( start of "Measurement Period" - 1 year ), end of "Measurement Period"
              ]

define "Has Criteria Indicating Frailty":
  //Ask Bryn about devices
      	exists ( [DeviceRequest: "Frailty Device"] FrailtyDeviceOrder
      			where FrailtyDeviceOrder.authoredOn during "Measurement Period"
      	)
          // DeviceUseStatement has a known issue with the publication tooling
          // so it is removed to allow this IG to publish until that is fixed
      		//or exists ( [DeviceUseStatement: "Frailty Device"] FrailtyDeviceUse
      		//		where Global."Normalize Interval"(FrailtyDeviceUse.timing) overlaps "Measurement Period"
      		//)
      		or exists ( [Condition: "Frailty Diagnosis"] FrailtyDiagnosis
      				where Global."Prevalence Period"(FrailtyDiagnosis) overlaps "Measurement Period"
      		)
      		or exists ( [Encounter: "Frailty Encounter"] FrailtyEncounter
      				where FrailtyEncounter.period overlaps "Measurement Period"
      		)
      		or exists ( [Observation: "Frailty Symptom"] FrailtySymptomObservation
      				where Global."Normalize Interval"(FrailtySymptomObservation.effective) overlaps "Measurement Period"
      		)

define "Inpatient Encounter with Advanced Illness":
  [Encounter: "Acute Inpatient"] InpatientEncounter
      		with [Condition: "Advanced Illness"] AdvancedIllnessDiagnosis
                  such that exists (
                      InpatientEncounter.diagnosis.condition EncounterDiagnosis
                          where EndsWith(EncounterDiagnosis.reference, AdvancedIllnessDiagnosis.id)
                  )
      			and InpatientEncounter.period starts 2 years or less on or before
      			end of "Measurement Period"
      // start here

define "Long Term Care Periods During Measurement Period":
  ( [Encounter: "Care Services in Long-Term Residential Facility"]
              		union [Encounter: "Nursing Facility Visit"] ) LongTermFacilityEncounter
              		where LongTermFacilityEncounter.period overlaps "Measurement Period"
              		return LongTermFacilityEncounter.period
              			intersect "Measurement Period"

define "Long Term Care Periods Longer Than 90 Consecutive Days":
  exists ( "Long Term Care Periods During Measurement Period" LongTermCareDuringMP
        where duration in days of LongTermCareDuringMP > 90
    )

define "Outpatient Encounters with Advanced Illness":
  ( [Encounter: "Outpatient"]
      		union [Encounter: "Observation"]
      		union [Encounter: "ED"]
      		union [Encounter: "Nonacute Inpatient"] ) OutpatientEncounter
      		 with [Condition: "Advanced Illness"] AdvancedIllnessDiagnosis
                  such that exists (
                      OutpatientEncounter.diagnosis.condition EncounterDiagnosis
                          where EndsWith(EncounterDiagnosis.reference, AdvancedIllnessDiagnosis.id)
                  )
                  and OutpatientEncounter.period starts 2 years or less on or before
      			end of "Measurement Period"

define function "CumulativeDays"(Intervals List<Interval<DateTime>> ):
  Sum((collapse Intervals)CollapsedInterval
  			return all duration in days of CollapsedInterval
  	)
Content: application/elm+xml
Encoded data (116176 characters)