Chronic Disease Surveillance
0.1.0 - CI Build International flag

Chronic Disease Surveillance, published by Clinical Quality Framework. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/aphl-chronic-ig/ and changes regularly. See the Directory of published versions

Library: AdvancedIllnessandFrailtyExclusionECQMFHIR4

Official URL: http://fhir.org/guides/cqf/aphl/chronic-ds/Library/AdvancedIllnessandFrailtyExclusionECQMFHIR4 Version: 0.1.0
Active as of 2021-01-08 Computable Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4

Frailty Exclusion

Metadata
Version 0.1.0
Jurisdiction 001 from http://unstats.un.org/unsd/methods/m49/m49.htm
Steward (Publisher) Clinical Quality Framework
Description

Frailty Exclusion

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
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: Up To One Year Prior Including Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Period
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: Has Two Outpatient Encounters With Advanced Illness on Different Dates of Service
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Has Inpatient Encounter With Advanced Illness
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Has Dementia Medications In Year Before or During Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: MedicationRequest
Parameter Name: Is Age 66 or Older with Advanced Illness and Frailty
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Is Age 66 to 80 with Advanced Illness and Frailty or Is Age 81 or Older with Frailty
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Lives In A Nursing Home
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Is Age 66 or Older Living Long Term in a Nursing Home
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: Observation
Profile(s): Observation
Must Support Elements: code, value, effective
Code Filter(s):
Path: code
Code(s): LOINC 98181-1: Medical equipment used
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, effective
Code Filter(s):
Path: code
ValueSet: Frailty Symptom
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, effective, value
Code Filter(s):
Path: code
Code(s): LOINC 71802-3: Housing status
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
Code Filter(s):
Path: code
ValueSet: Advanced Illness
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Frailty Encounter
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Outpatient
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Observation
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Emergency Department Visit
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Nonacute Inpatient
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Acute Inpatient
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication, dosageInstruction
Code Filter(s):
Path: medication
ValueSet: Dementia Medications
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication.reference, dosageInstruction
Data Requirement Type: Medication
Profile(s): Medication
Must Support Elements: id, code
Library Content
CQL Content
library AdvancedIllnessandFrailtyExclusionECQMFHIR4 version '5.12.000'

using FHIR version '4.0.1'

include FHIRHelpers version '4.1.000' called FHIRHelpers
include MATGlobalCommonFunctionsFHIR4 version '6.0.000' called Global
include FHIRCommon version '1.1.000' called FC 
include AlphoraCommon called AC

codesystem "LOINC": 'http://loinc.org'
codesystem "SNOMEDCT": 'http://snomed.info/sct' 

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 "Emergency Department Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010' 
valueset "Emergency Department Evaluation and Management Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010'
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 "Housing Status": '71802-3' from "LOINC" display 'Housing status'
code "Lives In A Nursing Home (finding)": '160734000' from "SNOMEDCT" display 'Lives in a nursing home (finding)'
code "Medical Equipment Used": '98181-1' from "LOINC" display 'Medical equipment used'

parameter "Measurement Period" default Interval[@2025-01-01T00:00:00.0, @2026-01-01T00:00:00.0)

context Patient

define "Up To One Year Prior Including Measurement Period":
  Interval[start of "Measurement Period" - 1 year, end of "Measurement Period"]

define "Is Age 66 or Older with Advanced Illness and Frailty":
  AgeInYearsAt(date from end of "Measurement Period") >= 66
    and "Has Criteria Indicating Frailty"
    and (
      exists("Has Two Outpatient Encounters With Advanced Illness on Different Dates of Service")
      or exists("Has Inpatient Encounter With Advanced Illness")
        or exists("Has Dementia Medications In Year Before or During Measurement Period")
    )

define "Is Age 66 to 80 with Advanced Illness and Frailty or Is Age 81 or Older with Frailty":
  (
    AgeInYearsAt(date from end of "Measurement Period") in Interval[66, 80]
      and "Has Criteria Indicating Frailty"
      and (
        exists("Has Two Outpatient Encounters With Advanced Illness on Different Dates of Service")
        or exists("Has Inpatient Encounter With Advanced Illness")
        or exists("Has Dementia Medications In Year Before or During Measurement Period")
      )
  ) 
  or (
    AgeInYearsAt(date from end of "Measurement Period") >= 81
      and "Has Criteria Indicating Frailty"
  )

define "Is Age 66 or Older Living Long Term in a Nursing Home":
  AgeInYearsAt(date from end of "Measurement Period") >= 66
    and "Lives In A Nursing Home"

define "Has Criteria Indicating Frailty":
  exists(
    (AC.QualifiedDeviceRequests([DeviceRequest: "Frailty Device"])) FrailtyDeviceOrder
      where FrailtyDeviceOrder.authoredOn during day of "Measurement Period"
    ) 
    or exists(
        (AC.QualifiedObservations([Observation: "Medical Equipment Used"])) EquipmentUsed
          where EquipmentUsed.value in "Frailty Device"
            and FC.ToInterval(EquipmentUsed.effective) ends during day of "Measurement Period"
    )
    or exists(
      (AC.QualifiedConditions([Condition: "Frailty Diagnosis"])) FrailtyDiagnosis
        where FC.ToPrevalenceInterval(FrailtyDiagnosis) overlaps "Measurement Period"
    )
    or exists(
      (AC.QualifiedEncounters([Encounter: "Frailty Encounter"])) FrailtyEnc
        where FC.ToInterval(FrailtyEnc.period) overlaps "Measurement Period"
    )
    or exists(
      (AC.QualifiedObservations([Observation: "Frailty Symptom"])) FrailtySymptom
        where FC.ToInterval(FrailtySymptom.effective) overlaps "Measurement Period"
    )

define "Has Inpatient Encounter With Advanced Illness":  
  (AC.QualifiedEncounters([Encounter: "Acute Inpatient"])) InpatientEnc
    with (AC.QualifiedConditions([Condition: "Advanced Illness"])) AdvanIll
      such that FC.ToPrevalenceInterval(AdvanIll) overlaps InpatientEnc.period
        and FC.ToInterval(InpatientEnc.period) overlaps "Up To One Year Prior Including Measurement Period"

define "Outpatient Encounters With Advanced Illness":
  ((AC.QualifiedEncounters([Encounter: "Outpatient"]))
    union (AC.QualifiedEncounters([Encounter: "Observation"]))
    union (AC.QualifiedEncounters([Encounter: "Emergency Department Visit"]))
    union (AC.QualifiedEncounters([Encounter: "Nonacute Inpatient"]))) OutpatientEnc
      with (AC.QualifiedConditions([Condition: "Advanced Illness"])) AdvanIll
        such that FC.ToPrevalenceInterval(AdvanIll) overlaps "Measurement Period"
      and FC.ToInterval(OutpatientEnc.period) overlaps "Up To One Year Prior Including Measurement Period" 

define "Has Two Outpatient Encounters With Advanced Illness on Different Dates of Service":
  from
    "Outpatient Encounters With Advanced Illness" OutpatientEncounter1,
    "Outpatient Encounters With Advanced Illness" OutpatientEncounter2
  where OutpatientEncounter2.period ends 1 day or more after day of end of OutpatientEncounter1.period
  return OutpatientEncounter1    

define "Has Dementia Medications In Year Before or During Measurement Period":
  (AC.QualifiedMedicationRequests([MedicationRequest: "Dementia Medications"])) DementiaMed
    where exists(
      DementiaMed.dosageInstruction dosage
      where exists(
        FC.ToTimingInterval(dosage.timing)) timing
        where timing overlaps "Up To One Year Prior Including Measurement Period")

define "Lives In A Nursing Home":
  Last(
    (AC.QualifiedObservations([Observation: "Housing Status"])) HousingStatus
      where FC.ToInterval(HousingStatus.effective) ends on or before end of "Measurement Period"
        and HousingStatus.value ~ ToConcept("Lives In A Nursing Home (finding)")
    sort by issued ascending
  ) is not null


ELM XML Content
Encoded data (154028 characters)
ELM JSON Content
Encoded data (291220 characters)
Generated using version 0.5.1-cibuild of the sample-content-ig Liquid templates