From 6497cccfe187e17030bd27c58fd4df4d363c4382 Mon Sep 17 00:00:00 2001 From: dand9959 Date: Mon, 5 Oct 2020 11:25:36 -0600 Subject: [PATCH] Line 70, 100 "Left Mastectomy" renamed to "Left Mastectomy Diagnosis" for consistency Removed _FHIR4 from file names EXM125-9.1.000.cql and AdvancedIllnessFrailtyExclusion-5.0.000.cql Removed _FHIR4 from file name references in EXM125-9.1.000.cql and AdvancedIllnessFrailtyExclusion-5.0.000.cql Changed "Numerator" definition to use Observation resource instead of DiagnosticReport, per guidance in QI Core - QDM Mapping: (http://hl7.org/fhir/us/qicore/qdm-to-qicore.html Diagnostic Study, Performed) --- ...ncedIllnessandFrailtyExclusion-5.0.000.cql | 127 ++++++++++++++++++ .../fhir401/EXM125-9.1.000.cql} | 20 +-- 2 files changed, 137 insertions(+), 10 deletions(-) create mode 100644 pages/cql/complete/fhir401/AdvancedIllnessandFrailtyExclusion-5.0.000.cql rename pages/cql/{in-progress/fhir401/EXM125_FHIR4-9.1.000.cql => complete/fhir401/EXM125-9.1.000.cql} (90%) diff --git a/pages/cql/complete/fhir401/AdvancedIllnessandFrailtyExclusion-5.0.000.cql b/pages/cql/complete/fhir401/AdvancedIllnessandFrailtyExclusion-5.0.000.cql new file mode 100644 index 0000000..887e91c --- /dev/null +++ b/pages/cql/complete/fhir401/AdvancedIllnessandFrailtyExclusion-5.0.000.cql @@ -0,0 +1,127 @@ +library AdvancedIllnessandFrailtyExclusion_FHIR4 version '5.0.000' + +/* +@update: @@BTR 2020-03-31 -> +Incremented version to 5.0.000 +Updated FHIR version to 4.0.1 +@@@ +*/ + +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 + 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 Including Under 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 "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 "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 "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" + ) + 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 "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 "Has Spent More Than 90 Days in Long Term Care": + "Days Spent in Long Term Care During Measurement Period" > 90 + +define "Days Spent in Long Term Care During Measurement Period": + "CumulativeDays"("Long Term Care Periods During Measurement Period") + +define function "CumulativeDays"(Intervals List> ): + Sum((collapse Intervals)CollapsedInterval + return all duration in days of CollapsedInterval + ) diff --git a/pages/cql/in-progress/fhir401/EXM125_FHIR4-9.1.000.cql b/pages/cql/complete/fhir401/EXM125-9.1.000.cql similarity index 90% rename from pages/cql/in-progress/fhir401/EXM125_FHIR4-9.1.000.cql rename to pages/cql/complete/fhir401/EXM125-9.1.000.cql index 764750f..79af115 100644 --- a/pages/cql/in-progress/fhir401/EXM125_FHIR4-9.1.000.cql +++ b/pages/cql/complete/fhir401/EXM125-9.1.000.cql @@ -1,4 +1,4 @@ -library EXM125_FHIR401 version '9.1.000' +library EXM125 version '9.1.000' /* Based on CMS125v7 - Breast Cancer Screening @@ -14,11 +14,11 @@ in the measure development community. using FHIR version '4.0.1' include FHIRHelpers version '4.0.1' called FHIRHelpers -include Hospice_FHIR4 version '2.0.000' called Hospice -include AdultOutpatientEncounters_FHIR4 version '2.0.000' called AdultOutpatientEncounters -include MATGlobalCommonFunctions_FHIR4 version '5.0.000' called Global -include SupplementalDataElements_FHIR4 version '2.0.0' called SDE -include AdvancedIllnessandFrailtyExclusion_FHIR4 version '5.0.000' called AdvancedIllness +include Hospice version '2.0.000' called Hospice +include AdultOutpatientEncounters version '2.0.000' called AdultOutpatientEncounters +include MATGlobalCommonFunctions version '5.0.000' called Global +include SupplementalDataElements version '2.0.0' called SDE +include AdvancedIllnessandFrailtyExclusion version '5.0.000' called AdvancedIllness valueset "ONC Administrative Sex": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1' valueset "Race": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836' @@ -67,7 +67,7 @@ define "Denominator": define "Denominator Exclusion": Hospice."Has Hospice" or (( exists "Right Mastectomy Diagnosis" or exists "Right Mastectomy Procedure") - and (exists "Left Mastectomy" or exists "Left Mastectomy Procedure")) + and (exists "Left Mastectomy Diagnosis" or exists "Left Mastectomy Procedure")) or exists "Bilateral Mastectomy Diagnosis" or exists "Bilateral Mastectomy Procedure" or AdvancedIllness."Advanced Illness and Frailty Exclusion Including Under Age 80" @@ -77,7 +77,7 @@ define "Denominator Exclusion": define "Right Mastectomy Diagnosis": ( ( [Condition: "Status Post Right Mastectomy"] - //where C.clinicalStatus ~ ToConcept(Global."active") not nneeded for exclusion + //where C.clinicalStatus ~ ToConcept(Global."active") not needed for exclusion ) union ( [Condition: "Unilateral Mastectomy, Unspecified Laterality"] UnilateralMastectomyDiagnosis @@ -97,7 +97,7 @@ define "Left Mastectomy Procedure": where Global."Normalize Interval"(UnilateralMastectomyLeftPerformed.performed) ends on or before end of "Measurement Period" and UnilateralMastectomyLeftPerformed.status = 'completed' -define "Left Mastectomy": +define "Left Mastectomy Diagnosis": ( ( [Condition: "Status Post Left Mastectomy"] // where C.clinicalStatus ~ ToConcept(Global."active") not needed for exclusion @@ -122,7 +122,7 @@ define "Bilateral Mastectomy Procedure": define "Numerator": exists ( - [DiagnosticReport: "Mammography"] Mammogram + [Observation: "Mammography"] Mammogram // QDM - QI Core mapping guidance advises using Observation for Diagnostic Study, Performed. where ( Global."Normalize Interval"(Mammogram.effective) ends 27 months or less on or before end of "Measurement Period" ) and Mammogram.status in { 'final', 'amended', 'corrected', 'appended' } )