eCQM QICore Content Implementation Guide
2023.0.0 - CI Build

eCQM QICore Content Implementation Guide, published by cqframework. This guide is not an authorized publication; it is the continuous build for version 2023.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/ecqm-content-qicore-2023/ and changes regularly. See the Directory of published versions

## Library: HybridHospitalWideMortalityFHIR

Official URL: http://ecqi.healthit.gov/ecqms/Library/HybridHospitalWideMortalityFHIR | Version: 0.0.001
Active as of 2023-08-14 | Computable Name: HybridHospitalWideMortalityFHIR
Other Identifiers: https://madie.cms.gov/login#HybridHospitalWideMortalityFHIR (use: official, )

HybridHospitalWideMortalityFHIR

Id: | HybridHospitalWideMortalityFHIR
Url: | http://ecqi.healthit.gov/ecqms/Library/HybridHospitalWideMortalityFHIR
Version: | 0.0.001
Identifier: | value: HybridHospitalWideMortalityFHIR
Name: | HybridHospitalWideMortalityFHIR
Title: | HybridHospitalWideMortalityFHIR
Status: | active
Experimental: | false
Type: | system: http://terminology.hl7.org/CodeSystem/library-type code: logic-library
Date: | 2023-08-14T15:24:17+00:00
Description: | HybridHospitalWideMortalityFHIR
Related Artifacts: | Dependencies
Data Requirements: |
Type | Profile | MS | Code Filter
--- | --- | --- | ---
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient |  |
Patient | http://hl7.org/fhir/Patient | ;;;; |
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient |  |
Encounter | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter | ;;;; | code filter: path: type value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Encounter | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter | ;;;; | code filter: path: type value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Encounter | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter | ;;;; | code filter: path: type value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Encounter | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter | ;;;; | code filter: path: type value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Encounter | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter | ;;;;; | code filter: path: type value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Coverage | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage | ; | code filter: path: type value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1104.10
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient |  |
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.149
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.163
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.152
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.151
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.114
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.127
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.129
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.119
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139
Observation | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation | ; | code filter: path: code value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.2363
Coverage | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage | ;; | code filter: path: type value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
uri | http://hl7.org/fhir/uri | ; |
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient | ;; |
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient | ;; |
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient | ;; |
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient | ;; |
Coverage | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage | ;; | code filter: path: type value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient | ;; |
Patient | http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient | ;; |
Content: text/cql
    library HybridHospitalWideMortalityFHIR version '0.0.001'

    /*This FHIR-based measure has been derived from CMS844v4.0.0 - QDM 5.6 Specifications*/

    using QICore version '4.1.1'

    include FHIRHelpers version '4.3.000' called FHIRHelpers
    include SupplementalDataElements version '3.4.000' called SDE
    include CQMCommon version '1.4.000' called CQMCommon
    include QICoreCommon version '1.5.000' called QICoreCommon

    codesystem "LOINC": 'http://loinc.org'
    codesystem "ActCode": 'http://terminology.hl7.org/CodeSystem/v3-ActCode'
    codesystem "Source of Payment Typology": 'https://nahdo.org/sopt'

    valueset "Bicarbonate lab test": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139'
    valueset "birth date": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.560.100.4'
    valueset "Body temperature": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.152'
    valueset "Creatinine lab test": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.2363'
    valueset "Emergency Department Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'
    valueset "Encounter Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'
    valueset "Ethnicity": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837'
    valueset "Heart Rate": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.149'
    valueset "Hematocrit lab test": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.114'
    valueset "Medicare payer": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1104.10'
    valueset "Observation Services": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'
    valueset "ONC Administrative Sex": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1'
    valueset "Oxygen Saturation by Pulse Oximetry": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.151'
    valueset "Payer": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591'
    valueset "Platelet count lab test": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.127'
    valueset "Race": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836'
    valueset "Sodium lab test": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.119'
    valueset "Systolic Blood Pressure": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.163'
    valueset "White blood cells count lab test": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.129'

    code "Birthdate": '21112-8' from "LOINC" display 'Birthdate'
    code "IMP": 'IMP' from "ActCode" display 'Inpatient'
    code "ACUTE": 'ACUTE' from "ActCode" display 'Acute'
    code "NONAC": 'NONAC' from "ActCode" display 'Nonacute'
    code "OBSENC": 'OBSENC' from "ActCode" display 'Observation Encounter'

    parameter "Measurement Period" Interval<DateTime>

    context Patient

    define "SDE Ethnicity":
      SDE."SDE Ethnicity"

    define "SDE Payer":
      SDE."SDE Payer"

    define "SDE Race":
      SDE."SDE Race"

    define "SDE Sex":
      SDE."SDE Sex"

    define "Initial Population":
      "Inpatient Encounters"

    define "Inpatient Encounters":
      from
        ["Encounter": "Encounter Inpatient"] InpatientEncounter,
        ["Coverage": "Medicare payer"] Payer
        where InpatientEncounter.status = 'finished'
          and ( InpatientEncounter.class ~ "IMP"
              or InpatientEncounter.class ~ "ACUTE"
              or InpatientEncounter.class ~ "NONAC"
              or InpatientEncounter.class ~ "OBSENC"
          )
          and AgeInYearsAt(date from start of InpatientEncounter.period) in Interval[65, 94]
          and InpatientEncounter.hospitalizationWithObservationLengthofStay ( ) < 365
          and InpatientEncounter.period ends during day of "Measurement Period"
        return InpatientEncounter
    /*Inpatient encounter initially listed as AMB class; changed this to inpatient classes as discussed with CORE team- AM*/

    define "Results":
      flatten {
        //First physical exams (vital signs)
      "FirstPhysicalExamWithEncounterId"([Observation: "Heart Rate"], 'FirstHeartRate'), "FirstPhysicalExamWithEncounterId"([Observation: "Systolic Blood Pressure"], 'FirstSystolicBP'), "FirstPhysicalExamWithEncounterId"([Observation: "Body temperature"], 'FirstTemperature'), "FirstPhysicalExamWithEncounterId"([Observation: "Oxygen Saturation by Pulse Oximetry"], 'FirstO2Saturation'),
        //First lab tests
      "FirstLabTestWithEncounterId"([Observation: "Hematocrit lab test"], 'FirstHematocrit'), "FirstLabTestWithEncounterId"([Observation: "Platelet count lab test"], 'FirstPlateletCount'), "FirstLabTestWithEncounterId"([Observation: "White blood cells count lab test"], 'FirstWhiteBloodCell'), "FirstLabTestWithEncounterId"([Observation: "Sodium lab test"], 'FirstSodium'), "FirstLabTestWithEncounterId"([Observation: "Bicarbonate lab test"], 'FirstBicarbonate'), "FirstLabTestWithEncounterId"([Observation: "Creatinine lab test"], 'FirstCreatinine') }

    define function "FirstLabTestWithEncounterId"(LabList List<Observation>, CCDE String):
      "Inpatient Encounters" Encounter
        let firstlab: First(LabList Lab
            where Lab.issued is not null
              and Lab.issued during Interval[start of Encounter.period - 1440 minutes, start of Encounter.period + 1440 minutes]
              and Lab.status in { 'final', 'amended', 'preliminary' }
              and Lab.value is not null
            sort by issued
        )
        return '\r\n' & CCDE & ',' & Encounter.id & ',' & ( ToString(firstlab.value as Quantity) ) & ',' & ToString(firstlab.issued)

    define function "FirstPhysicalExamWithEncounterId"(ExamList List<Observation>, CCDE String):
      "Inpatient Encounters" Encounter
        let firstexam: First(ExamList Exam
            where start of QICoreCommon."ToInterval"(Exam.effective) is not null
              and start of QICoreCommon."ToInterval"(Exam.effective) during Interval[start of Encounter.period - 1440 minutes, start of Encounter.period + 120 minutes]
              and Exam.status in { 'final', 'amended', 'preliminary' }
              and Exam.value is not null
            sort by start of QICoreCommon."ToInterval"(effective)
        )
        return '\r\n' & CCDE & ',' & Encounter.id & ' , ' & ( ToString(firstexam.value as Quantity) ) & ',' & ToString(start of QICoreCommon."ToInterval"(firstexam.effective))
Content: application/elm+xml
    Encoded data (250680 characters)
Content: application/elm+json
    Encoded data (370548 characters)