Metadata Title Advanced Illness and Frailty Exclusion Library Version 5.12.000 Identifier urn:oid:2.16.840.1.113883.4.642.40.61.28.2 Status Draft Jurisdiction Global (Whole world) Steward (Publisher) HL7 International / Clinical Quality Information Description Advanced Illness and Frailty Exclusion Example Library 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: Has Criteria Indicating Frailty Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: boolean Parameter Name: Outpatient Encounters with Advanced Illness Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: Inpatient Encounter with Advanced Illness Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: Dementia Medications In Year Before or During Measurement Period Use: Out Min Cardinality: 0 Max Cardinality: * Type: MedicationDispense Parameter Name: Advanced Illness and Frailty Exclusion Including Over Age 80 Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: boolean Parameter Name: Advanced Illness and Frailty Exclusion Not Including Over Age 80 Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: boolean Parameter Name: Long Term Care Periods During Measurement Period Use: Out Min Cardinality: 0 Max Cardinality: * Type: Period Parameter Name: Long Term Care Periods Longer Than 90 Consecutive Days Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: boolean Data Requirement Type: Patient Profile(s): Patient Data Requirement Type: DeviceRequest Profile(s): DeviceRequest Must Support Elements: code, authoredOn Code Filter(s): Path: code ValueSet: Frailty Device Data Requirement Type: Condition Profile(s): Condition Must Support Elements: code Code Filter(s): Path: code ValueSet: Frailty Diagnosis Data Requirement Type: Condition Profile(s): Condition Must Support Elements: code, id Code Filter(s): Path: code ValueSet: Advanced Illness Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, period, diagnosis Code Filter(s): Path: type ValueSet: Frailty Encounter Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, diagnosis, period Code Filter(s): Path: type ValueSet: Outpatient Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, diagnosis, period Code Filter(s): Path: type ValueSet: Observation Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, diagnosis, period Code Filter(s): Path: type ValueSet: ED Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, diagnosis, period Code Filter(s): Path: type ValueSet: Nonacute Inpatient Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, diagnosis, period Code Filter(s): Path: type ValueSet: Acute Inpatient Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, diagnosis, period Code Filter(s): Path: type ValueSet: Care Services in Long Term Residential Facility Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, diagnosis, period Code Filter(s): Path: type ValueSet: Nursing Facility Visit Data Requirement Type: Observation Profile(s): Observation Must Support Elements: code, effective Code Filter(s): Path: code ValueSet: Frailty Symptom Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Must Support Elements: medication, whenHandedOver Code Filter(s): Path: medication ValueSet: Dementia Medications Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Must Support Elements: medication.reference, whenHandedOver Data Requirement Type: Medication Profile(s): Medication Must Support Elements: id, code Library Content CQL Content /*#xD; This example is a work in progress and should not be considered a final specification#xD; or recommendation for guidance. This example will help guide and direct the process#xD; of finding conventions and usage patterns that meet the needs of the various stakeholders#xD; in the measure development community.#xD; */#xD; library AdvancedIllnessandFrailtyExclusion version '5.12.000'#xD; #xD; using FHIR version '4.0.1'#xD; #xD; include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' called FHIRHelpers#xD; #xD; include MATGlobalCommonFunctions version '5.0.000' called Global#xD; #xD; codesystem "LOINC": 'http://loinc.org'#xD; #xD; valueset "Acute Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1083'#xD; valueset "Advanced Illness": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1082'#xD; 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'#xD; valueset "Dementia Medications": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.196.12.1510'#xD; valueset "ED": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1085'#xD; valueset "Frailty Device": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.118.12.1300'#xD; valueset "Frailty Diagnosis": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1074'#xD; valueset "Frailty Encounter": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1088'#xD; valueset "Frailty Symptom": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1075'#xD; valueset "Nonacute Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1084'#xD; valueset "Nursing Facility Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1012'#xD; valueset "Observation": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1086'#xD; valueset "Outpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1087'#xD; #xD; code "Birth date": '21112-8' from "LOINC" display 'Birth date'#xD; #xD; parameter "Measurement Period" Interval<DateTime>#xD; default Interval[@2019-01-01T00:00:00.0, @2020-01-01T00:00:00.0)#xD; #xD; context Patient#xD; #xD; define "Advanced Illness and Frailty Exclusion Including Over Age 80":#xD; //If the measure includes populations age 80 and older, then use this logic:#xD; (#xD; Global."CalendarAgeInYearsAt"(FHIRHelpers.ToDate(Patient.birthDate), start of "Measurement Period")in Interval[66, 80]#xD; and "Has Criteria Indicating Frailty"#xD; and ( Count("Outpatient Encounters with Advanced Illness")>= 2#xD; or exists ( "Inpatient Encounter with Advanced Illness" )#xD; or exists "Dementia Medications In Year Before or During Measurement Period"#xD; )#xD; )#xD; or (#xD; Global."CalendarAgeInYearsAt"(FHIRHelpers.ToDate(Patient.birthDate), start of "Measurement Period")>= 81#xD; and "Has Criteria Indicating Frailty"#xD; )#xD; #xD; define "Advanced Illness and Frailty Exclusion Not Including Over Age 80":#xD; //If the measure does NOT include populations age 80 and older, then use this logic:#xD; Global."CalendarAgeInYearsAt"(FHIRHelpers.ToDate(Patient.birthDate), start of "Measurement Period")>= 65#xD; and "Has Criteria Indicating Frailty"#xD; and ( Count("Outpatient Encounters with Advanced Illness")>= 2#xD; or exists ( "Inpatient Encounter with Advanced Illness" )#xD; or exists "Dementia Medications In Year Before or During Measurement Period"#xD; )#xD; #xD; define "Dementia Medications In Year Before or During Measurement Period":#xD; ["MedicationDispense": "Dementia Medications"] DementiaMed#xD; where DementiaMed.whenHandedOver during Interval[#xD; ( start of "Measurement Period" - 1 year ), end of "Measurement Period"#xD; ]#xD; #xD; define "Has Criteria Indicating Frailty":#xD; //Ask Bryn about devices#xD; exists ( [DeviceRequest: "Frailty Device"] FrailtyDeviceOrder#xD; where FrailtyDeviceOrder.authoredOn during "Measurement Period"#xD; )#xD; // DeviceUseStatement has a known issue with the publication tooling#xD; // so it is removed to allow this IG to publish until that is fixed#xD; //or exists ( [DeviceUseStatement: "Frailty Device"] FrailtyDeviceUse#xD; // where Global."Normalize Interval"(FrailtyDeviceUse.timing) overlaps "Measurement Period"#xD; //)#xD; or exists ( [Condition: "Frailty Diagnosis"] FrailtyDiagnosis#xD; where Global."Prevalence Period"(FrailtyDiagnosis) overlaps "Measurement Period"#xD; )#xD; or exists ( [Encounter: "Frailty Encounter"] FrailtyEncounter#xD; where FrailtyEncounter.period overlaps "Measurement Period"#xD; )#xD; or exists ( [Observation: "Frailty Symptom"] FrailtySymptomObservation#xD; where Global."Normalize Interval"(FrailtySymptomObservation.effective) overlaps "Measurement Period"#xD; )#xD; #xD; define "Inpatient Encounter with Advanced Illness":#xD; [Encounter: "Acute Inpatient"] InpatientEncounter#xD; with [Condition: "Advanced Illness"] AdvancedIllnessDiagnosis#xD; such that exists (#xD; InpatientEncounter.diagnosis.condition EncounterDiagnosis#xD; where EndsWith(EncounterDiagnosis.reference, AdvancedIllnessDiagnosis.id)#xD; )#xD; and InpatientEncounter.period starts 2 years or less on or before#xD; end of "Measurement Period"#xD; // start here#xD; #xD; define "Long Term Care Periods During Measurement Period":#xD; ( [Encounter: "Care Services in Long-Term Residential Facility"]#xD; union [Encounter: "Nursing Facility Visit"] ) LongTermFacilityEncounter#xD; where LongTermFacilityEncounter.period overlaps "Measurement Period"#xD; return LongTermFacilityEncounter.period#xD; intersect "Measurement Period"#xD; #xD; define "Long Term Care Periods Longer Than 90 Consecutive Days":#xD; exists ( "Long Term Care Periods During Measurement Period" LongTermCareDuringMP#xD; where duration in days of LongTermCareDuringMP > 90#xD; )#xD; #xD; define "Outpatient Encounters with Advanced Illness":#xD; ( [Encounter: "Outpatient"]#xD; union [Encounter: "Observation"]#xD; union [Encounter: "ED"]#xD; union [Encounter: "Nonacute Inpatient"] ) OutpatientEncounter#xD; with [Condition: "Advanced Illness"] AdvancedIllnessDiagnosis#xD; such that exists (#xD; OutpatientEncounter.diagnosis.condition EncounterDiagnosis#xD; where EndsWith(EncounterDiagnosis.reference, AdvancedIllnessDiagnosis.id)#xD; )#xD; and OutpatientEncounter.period starts 2 years or less on or before#xD; end of "Measurement Period"#xD; #xD; define function "CumulativeDays"(Intervals List<Interval<DateTime>> ):#xD; Sum((collapse Intervals)CollapsedInterval#xD; return all duration in days of CollapsedInterval#xD; )#xD; ELM XML Content Encoded data (134924 characters) ELM JSON Content Encoded data (249964 characters) Generated using version 0.4.9 of the sample-content-ig Liquid templates
Advanced Illness and Frailty Exclusion Library
HL7 International / Clinical Quality Information
Advanced Illness and Frailty Exclusion Example Library
Value set Care Services in Long-Term Residential Facility
Outpatient Encounters with Advanced Illness
Inpatient Encounter with Advanced Illness
Dementia Medications In Year Before or During Measurement Period
Advanced Illness and Frailty Exclusion Including Over Age 80
Advanced Illness and Frailty Exclusion Not Including Over Age 80
Long Term Care Periods During Measurement Period
Long Term Care Periods Longer Than 90 Consecutive Days