Your User Friendly Name for MyContentIG Here
0.5.3 - CI Build

Your User Friendly Name for MyContentIG Here, published by HL7 International - [Some] Work Group. This guide is not an authorized publication; it is the continuous build for version 0.5.3 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/sample-content-ig/ and changes regularly. See the Directory of published versions

## Library: HybridHospitalWideMortalityFHIRExample

Official URL: http://somewhere.org/fhir/uv/mycontentig/Library/HybridHospitalWideMortalityFHIRExample | Version: 0.5.3
Draft as of 2025-12-10 | Computable Name: HybridHospitalWideMortalityFHIRExample

Metadata
Version | 0.5.3
Status | Draft
Jurisdiction | 001 from http://unstats.un.org/unsd/methods/m49/m49.htm
Steward (Publisher) | HL7 International - [Some] Work Group
Type | logic-library from http://terminology.hl7.org/CodeSystem/library-type
Dependency | Description: Library FHIRHelpers Resource: `http://somewhere.org/fhir/uv/mycontentig/Library/FHIRHelpers|4.0.1` Canonical URL: `http://somewhere.org/fhir/uv/mycontentig/Library/FHIRHelpers|4.0.1`
Dependency | Description: Library SDE Resource: SupplementalDataElementsExample Canonical URL: `http://somewhere.org/fhir/uv/mycontentig/Library/SupplementalDataElementsExample`
Dependency | Description: Library CQMCommon Resource: CQMCommonExample Canonical URL: `http://somewhere.org/fhir/uv/mycontentig/Library/CQMCommonExample`
Dependency | Description: Library QICoreCommon Resource: QICoreCommonExample Canonical URL: `http://somewhere.org/fhir/uv/mycontentig/Library/QICoreCommonExample`
Dependency | Description: Code system LOINC Resource: Logical Observation Identifiers, Names and Codes (LOINC) Canonical URL: `http://loinc.org`
Dependency | Description: Code system ActCode Resource: ActCode Canonical URL: `http://terminology.hl7.org/CodeSystem/v3-ActCode`
Dependency | Description: Code system Source of Payment Typology Resource: Source of Payment Typology Canonical URL: `https://nahdo.org/sopt`
Dependency | Description: Value set Bicarbonate lab test Resource: Bicarbonate lab test Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139`
Dependency | Description: Value set birth date Resource: birth date Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.560.100.4`
Dependency | Description: Value set Body temperature Resource: Body temperature Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.152`
Dependency | Description: Value set Creatinine lab test Resource: Creatinine lab test Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.2363`
Dependency | Description: Value set Emergency Department Visit Resource: Emergency Department Visit Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292`
Dependency | Description: Value set Encounter Inpatient Resource: Encounter Inpatient Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307`
Dependency | Description: Value set Ethnicity Resource: Ethnicity Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837`
Dependency | Description: Value set Heart Rate Resource: Heart Rate Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.149`
Dependency | Description: Value set Hematocrit lab test Resource: Hematocrit lab test Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.114`
Dependency | Description: Value set Medicare payer Resource: Medicare payer Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1104.10`
Dependency | Description: Value set Observation Services Resource: Observation Services Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143`
Dependency | Description: Value set ONC Administrative Sex Resource: ONC Administrative Sex Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1`
Dependency | Description: Value set Oxygen Saturation by Pulse Oximetry Resource: Oxygen Saturation by Pulse Oximetry Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.151`
Dependency | Description: Value set Payer Resource: Payer Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591`
Dependency | Description: Value set Platelet count lab test Resource: Platelet count lab test Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.127`
Dependency | Description: Value set Race Resource: Race Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836`
Dependency | Description: Value set Sodium lab test Resource: Sodium lab test Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.119`
Dependency | Description: Value set Systolic Blood Pressure Resource: Systolic Blood Pressure Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.163`
Dependency | Description: Value set White blood cells count lab test Resource: White blood cells count lab test Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.129`
Data Requirement | Type: Patient Profile(s): QICore Patient
Data Requirement | Type: Encounter Profile(s): QICore Encounter Must Support Elements: type, status, status.value, class, period, id, id.value Code Filter(s): Path: type ValueSet: Encounter Inpatient
Data Requirement | Type: Coverage Profile(s): QICore Coverage Must Support Elements: type Code Filter(s): Path: type ValueSet: Medicare payer
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Heart Rate
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Systolic Blood Pressure
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Body temperature
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Oxygen Saturation by Pulse Oximetry
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Hematocrit lab test
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Platelet count lab test
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: White blood cells count lab test
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Sodium lab test
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Bicarbonate lab test
Data Requirement | Type: Observation Profile(s): QICore Observation Must Support Elements: code, effective, status, status.value, value, issued, issued.value Code Filter(s): Path: code ValueSet: Creatinine lab test
Parameters
Name | Use | Card. | Type | Documentation
Measurement Period | In | 0..1 | Period |
Patient | Out | 0..1 | Resource |
SDE Ethnicity | Out | 0..1 | Resource |
SDE Payer | Out | 0..* | Resource |
SDE Race | Out | 0..1 | Resource |
SDE Sex | Out | 0..1 | Coding |
Inpatient Encounters | Out | 0..* | Resource |
Initial Population | Out | 0..* | Resource |
Results | Out | 0..* | string |
Library Content
CQL Content |
    library HybridHospitalWideMortalityFHIRExample version '0.5.3-cibuild'

    /*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.0.1' called FHIRHelpers
    include SupplementalDataElementsExample called SDE
    include CQMCommonExample called CQMCommon
    include QICoreCommonExample 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>
      default Interval[@2024-01-01T00:00:00.0, @2025-01-01T00:00:00.0)

    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))
ELM XML Content |
    Encoded data
ELM JSON Content |
    Encoded data
Generated using version 0.5.3 of the sample-content-ig Liquid templates