Your User Friendly Name for MyContentIG Here
0.4.6 - CI Build International flag

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.4.6 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: Hybrid Hospital-Wide Mortality FHIR Example (Experimental)

Official URL: http://somewhere.org/fhir/uv/mycontentig/Library/HybridHospitalWideMortalityFHIRExample Version: 0.4.6
Active as of 2024-09-19 Computable Name: HybridHospitalWideMortalityFHIRExample

Hybrid Hospital-Wide Mortality FHIR Example

Title: Hybrid Hospital-Wide Mortality FHIR Example
Id: HybridHospitalWideMortalityFHIRExample
Version: 0.4.6
Url: Hybrid Hospital-Wide Mortality FHIR Example
Experimental: true
Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2024-09-19 19:22:59+0000
Publisher: HL7 International - [Some] Work Group
Description:

Hybrid Hospital-Wide Mortality FHIR Example

Jurisdiction: 001
Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
Measurement PeriodPeriod01In
PatientResource01Out
SDE EthnicityResource01Out
SDE PayerResource0*Out
SDE RaceResource01Out
SDE SexCoding01Out
Inpatient EncountersResource0*Out
Initial PopulationResource0*Out
Resultsstring0*Out
Data Requirements:
TypeProfileMSCode Filter
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.113762.1.4.1104.10
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
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
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
Content: text/cql
library HybridHospitalWideMortalityFHIRExample version '0.4.1'

/*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))
Content: application/elm+xml
Encoded data (200680 characters)
Content: application/elm+json
Encoded data (413056 characters)