dQM QICore Content Implementation Guide
2025.0.0 - CI Build

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

Measure: Emergency Care Access \& Timeliness (HOQR)FHIR

Official URL: https://madie.cms.gov/Measure/CMS1244FHIRECATHOQR Version: 1.0.000
Active as of 2025-08-25 Responsible: Centers for Medicare & Medicaid Services (CMS) Computable Name: CMS1244FHIRECATHOQR
Other Identifiers: Short Name: CMS1244FHIR (use: usual, ), UUID:1d711504-ebec-41de-81b0-d1993115eac2 (use: official, ), UUID:43ee6832-7bc9-4247-a51c-6d8052f1a222 (use: official, ), Endorser: 4625e (use: official, ), Publisher: 1244FHIR (use: official, )

Copyright/Legal: Limited proprietary coding is contained in these specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. All rights reserved. ICD-10 copyright 2024 World Health Organization. All Rights Reserved. CPT(R) contained in the Measure specifications is copyright 2004-2024 American Medical Association.

This measure assesses the variation in access and timeliness of emergency care to support hospital quality improvement for patients requiring emergency care in an emergency department (ED). This measure is designed to align with incentives to promote improved care both in EDs and the broader health system to help identify where patients do not receive timely access to emergency care. Emergency care access and timeliness gaps are inclusive of several concepts pertaining to boarding and crowding in an ED, including significantly longer ED wait times, higher left without being seen rates, longer boarding times, and longer total length of stay in the ED.

Metadata
Title Emergency Care Access & Timeliness (HOQR)FHIR
Version 1.0.000
Short Name CMS1244FHIR
GUID (Version Independent) urn:uuid:1d711504-ebec-41de-81b0-d1993115eac2
GUID (Version Specific) urn:uuid:43ee6832-7bc9-4247-a51c-6d8052f1a222
CMS Identifier 1244FHIR
CMS Consensus Based Entity Identifier 4625e
Effective Period 2027-01-01 through 2027-12-31
Steward (Publisher) Centers for Medicare & Medicaid Services (CMS)
Developer Acumen, LLC
Description This measure assesses the variation in access and timeliness of emergency care to support hospital quality improvement for patients requiring emergency care in an emergency department (ED). This measure is designed to align with incentives to promote improved care both in EDs and the broader health system to help identify where patients do not receive timely access to emergency care. Emergency care access and timeliness gaps are inclusive of several concepts pertaining to boarding and crowding in an ED, including significantly longer ED wait times, higher left without being seen rates, longer boarding times, and longer total length of stay in the ED.
Copyright Limited proprietary coding is contained in these specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. All rights reserved. ICD-10 copyright 2024 World Health Organization. All Rights Reserved. CPT(R) contained in the Measure specifications is copyright 2004-2024 American Medical Association.
Disclaimer These performance specifications are not clinical guidelines, do not establish a standard of medical care, and have not been tested for all potential applications. THE MEASURES AND SPECIFICATIONS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].
Rationale This measure aims to reduce patient harm and improve outcomes for patients requiring emergency care in an ED by addressing the variation in emergency care and measuring access and timeliness of emergency care. There are long-standing concerns about parameters that impact access and timeliness of care in the ED. Currently, there are no national metrics to assess the proportion of patients impacted by access and timeliness of ED care.
Clinical Recommendation Statement The goal of the Emergency Care Access & Timeliness (ECAT) measure is to assess and improve the safety of the 140 million ED visits that patients experience each year (Centers for Disease Control and Prevention [CDC], 2021). Limitations in access and timeliness of emergency care have been shown to be associated with harm, such as increases in mortality, delays in care, preventable errors, poor patient experience, and staff burnout. These quality limitations are also associated with increased costs of care. The ECAT measure under consideration is intended for use in CMS’s Hospital Outpatient Quality Reporting (HOQR) program. The numerator is comprised of all ED visits with a quality gap in access as defined in the numerator criteria. Challenges related to emergency care access and timeliness have been increasing and have prompted public calls for action. This measure improves upon previous efforts as it measures the mean instead of the median to highlight the presence of extreme quality gaps, and captures several indicators of quality gaps by using multiple numerator criteria. Implementation of this measure, which captures multiple components of access and timeliness, can help identify facilities where patients do not receive timely access to emergency care as defined in the numerator criteria. This measure, therefore, could positively impact millions of patients who seek treatment in the ED and help address long-standing disparities in emergency care, including for patients with mental health diagnoses.
Citation American College of Emergency Physicians. (2018). Definition of Boarded Patient. Policy Statements. https://www.acep.org/patient-care/policy-statements/definition-of-boarded-patient
Citation American Medical Association. (2022). What is Behavioral Health. https://www.ama-assn.org/delivering-care/public-health/what-behavioral-health
Citation Centers for Disease Control and Prevention. (2021). Emergency Department Visits. https://www.cdc.gov/nchs/fastats/emergency-department.htm
Citation eCQI Resource Center. (n.d). Median Admit Decision Time to ED Departure Time for Admitted Patients.
Definition Boarding: The practice of holding inpatients in the emergency department after admission to the hospital because no hospital inpatient bed is available. (American College of Emergency Physicians [ACEP], 2018).
Definition ED Observation: Observation stays are inclusive of both ED observation care in which a patient initially evaluated in the ED is cared for under observation status for an extended period of time in the ED or in a care area dedicated to observation care, as well as hospital observation stays in which a patient initially evaluated in the ED is cared for in observation status often in a hospital bed used for both inpatient or observation status admissions. Because these two forms of observation stays cannot be easily distinguished in a standardized fashion in existing electronic health record data ontologies, for the purposes of this quality measure all observation stays have been considered an exclusion from both numerator criteria 3 and 4.
Definition Left Without Being Seen (LWBS): Patients arrive to the ED for evaluation and leave before seeing a physician, advanced practice nurse, or physician’s assistant.
Definition Mental Health: Mental health generally refers to mental health diagnoses, life stressors and crises, and stress-related physical symptoms (American Medical Association [AMA], 2022). For this measure, mental health conditions will be defined separately from substance use disorders.
Guidance (Usage)

Measure Score Calculation The measure score is first calculated at the individual ED level as the proportion of ED visits where any one of the four outcomes occurred, as defined by the numerator. Scores will be standardized z-scores by ED case volume strata (defined in ED visit volume bands of 20,000 visits). For CMS Certification Numbers (CCNs) with more than one ED, volume-adjusted z-scores are then combined as a weighted average for that CCN. A z-score of greater than zero means worse performance and less than zero means better performance, compared to like EDs. For the purposes of this measure, a decision to admit can be captured using any of the following: - an evaluation that results in a decision to admit - an order to admit to inpatient - an order for a bed assignment - start of inpatient admission This dQM is an episode-based measure. An episode is defined as an ED visit that ends during the measurement period. This FHIR-based measure has been derived from the QDM-based measure: CMS1244v1. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU6/) for more information on QI-Core and mapping recommendations from QDM to QI-Core STU 6 (https://hl7.org/fhir/us/qicore/STU6/qdm-to-qicore.html).

Measure Group (Rate) (ID: Group_1)
Basis Encounter
Scoring [http://terminology.hl7.org/CodeSystem/measure-scoring#proportion: 'Proportion']
Type [http://terminology.hl7.org/CodeSystem/measure-type#outcome: 'Outcome']
Rate Aggregation None
Improvement Notation [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#decrease: 'Decreased score indicates improvement']
Initial Population ID: InitialPopulation_1
Description:

All ED visits that end during the measurement period for all patients

Logic Definition: Initial Population
Denominator ID: Denominator_1
Description:

Equals Initial Population

Logic Definition: Denominator
Numerator ID: Numerator_1
Description:

The numerator is comprised of ED visits meeting the denominator criteria and where the patient experiences any of the following quality gaps in access: 1. The patient waited longer than 60 minutes (1 hour) after arrival to the ED to be placed in a treatment room or dedicated treatment area that allows for audiovisual privacy during history-taking and physical examination, or 2. The patient left the ED without being evaluated, or 3. The patient boarded (time from Decision to Admit order to ED departure for admitted patients) in the ED for longer than 240 minutes (4 hours), or 4. The patient had an ED length of stay (LOS) (time from ED arrival to ED departure as defined by the ED departure timestamp indicating when the patient physically left the ED) of longer than 480 minutes (8 hours). ED encounters with ED observation stays are excluded from criteria #3 (boarding) and #4 (ED LOS). To clarify, patients who have a ‘decision to admit’ after an ED observation stay remain excluded from criteria #3 (boarded) calculations.

Logic Definition: Numerator
Stratifier ID: Stratification_1_1
Description: All patients aged less than 18 years seen in the ED who do not have an ED encounter principal diagnosis consistent with mental health diagnosis. Patients who have an ED encounter principal diagnosis consistent with substance use disorders will be included in this stratification.
Stratifier ID: Stratification_1_2
Description: All patients aged 18 years and older seen in the ED who do not have an ED encounter principal diagnosis consistent with mental health diagnosis. Patients who have an ED encounter principal diagnosis consistent with substance use disorders will be included in this stratification.
Stratifier ID: Stratification_1_3
Description: All patients aged less than 18 years seen in the ED who have an ED encounter principal diagnosis consistent with mental health diagnosis.
Stratifier ID: Stratification_1_4
Description: All patients aged 18 years and older seen in the ED who have an ED encounter principal diagnosis consistent with mental health diagnosis.
Supplemental Data Guidance For every patient evaluated by this measure also identify payer, race, ethnicity and sex
Supplemental Data Elements
Supplemental Data Element ID: sde-ethnicity
Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data]
Description: SDE Ethnicity
Logic Definition: SDE Ethnicity
Supplemental Data Element ID: sde-payer
Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data]
Description: SDE Payer
Logic Definition: SDE Payer
Supplemental Data Element ID: sde-race
Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data]
Description: SDE Race
Logic Definition: SDE Race
Supplemental Data Element ID: sde-sex
Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data]
Description: SDE Sex
Logic Definition: SDE Sex
Measure Logic
Primary Library https://madie.cms.gov/Library/CMS1244FHIRECATHOQR
Contents Population Criteria
Logic Definitions
Terminology
Dependencies
Data Requirements
Population Criteria
Measure Group (Rate) (ID: Group_1)
Initial Population
define "Initial Population":
  "ED Evaluation and Management"
    union "ED Triage Excluding Those Prior To ED Encounters"
Denominator
define "Denominator":
  "Initial Population"
Numerator
define "Numerator":
  "Time to Treatment Room Greater Than 60 Minutes"
    union "ED Arrival Left Without Being Seen"
    union "Boarded Time Greater Than 240 Minutes and No Observation Stay"
    union "ED Length of Stay Greater Than 480 Minutes and No Observation Stay"
Stratifier
define "Stratification 1":
  "Pediatric With No Mental Health Diagnosis"
Stratifier
define "Stratification 2":
  "Adult With No Mental Health Diagnosis"
Stratifier
define "Stratification 3":
  "Pediatric With Mental Health Diagnosis"
Stratifier
define "Stratification 4":
  "Adult With Mental Health Diagnosis"
Logic Definitions
Logic Definition Library Name: SupplementalDataElements
define "SDE Sex":
  case
    when Patient.sex = '248153007' then "Male (finding)"
    when Patient.sex = '248152002' then "Female (finding)"
    else null
  end
Logic Definition Library Name: SupplementalDataElements
define "SDE Payer":
  [Coverage: type in "Payer Type"] Payer
    return {
      code: Payer.type,
      period: Payer.period
    }
Logic Definition Library Name: SupplementalDataElements
define "SDE Ethnicity":
  Patient.ethnicity E
    return Tuple {
      codes: { E.ombCategory } union E.detailed,
      display: E.text
    }
Logic Definition Library Name: SupplementalDataElements
define "SDE Race":
  Patient.race R
    return Tuple {
      codes: R.ombCategory union R.detailed,
      display: R.text
    }
Logic Definition Library Name: FHIRHelpers
define function ToString(value uri): value.value
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
value to a CQL DateTime Interval
@comment: If the start value of the given period is unspecified, the starting
boundary of the resulting interval will be open (meaning the start of the interval
is unknown, as opposed to interpreted as the beginning of time).
*/
define function ToInterval(period FHIR.Period):
    if period is null then
        null
    else
        if period."start" is null then
            Interval(period."start".value, period."end".value]
        else
            Interval[period."start".value, period."end".value]
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
*/
define function ToConcept(concept FHIR.CodeableConcept):
    if concept is null then
        null
    else
        System.Concept {
            codes: concept.coding C return ToCode(C),
            display: concept.text.value
        }
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
*/
define function ToCode(coding FHIR.Coding):
    if coding is null then
        null
    else
        System.Code {
          code: coding.code.value,
          system: coding.system.value,
          version: coding.version.value,
          display: coding.display.value
        }
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "SDE Sex":
  SDE."SDE Sex"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Evaluation and Management":
  [Encounter: "Emergency Department Evaluation and Management Visit"] EDEvalManagementVisit
    where EDEvalManagementVisit.period ends during day of "Measurement Period"
      and EDEvalManagementVisit.status = 'finished'
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Triage":
  ( [Encounter: "Triage"] EDTriage
      where EDTriage.period ends during day of "Measurement Period"
        and EDTriage.status in { 'finished', 'triaged' }
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Triage Excluding Those Prior To ED Encounters":
  "ED Triage" EDTriageinMP
    where not exists ( "ED Evaluation and Management" EDEvalManagementInMP
        where ( ( EDTriageinMP.period overlaps before EDEvalManagementInMP.period )
            or ( EDTriageinMP.period during EDEvalManagementInMP.period )
            or ( EDEvalManagementInMP.period during EDTriageinMP.period )
            or ( EDTriageinMP.period ends 120 minutes or less before start of EDEvalManagementInMP.period )
        )
    )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Initial Population":
  "ED Evaluation and Management"
    union "ED Triage Excluding Those Prior To ED Encounters"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Denominator":
  "Initial Population"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Triage Before Evaluation Management":
  "ED Triage" EDTriageinMP
    with "Denominator" EDEncounter
      such that ( ( EDTriageinMP.period overlaps before EDEncounter.period )
          or ( EDTriageinMP.period during EDEncounter.period )
          or ( EDEncounter.period during EDTriageinMP.period )
          or ( EDTriageinMP.period ends 120 minutes or less before start of EDEncounter.period )
      )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Triage and Evaluation Management":
  "Denominator"
    union "ED Triage Before Evaluation Management"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Time to Treatment Room Greater Than 60 Minutes":
  "ED Evaluation and Management" EDEvalManagementInMP
    where EDEvalManagementInMP.edArrivalTime ( ) 61 minutes or more before EDEvalManagementInMP.edTreatmentRoomTimeArrivalTime ( )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Arrival Left Without Being Seen":
  "Denominator" EDEncounter
    where EDEncounter.hospitalization.dischargeDisposition ~ "Patient left without being seen (finding)"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED To Inpatient Order":
  [ServiceRequest: "Decision to Admit to Hospital Inpatient"] AdmitIPOrder
    where AdmitIPOrder.status in { 'active', 'completed' }
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Decision to Admit Encounter Order":
  "Denominator" EDEncounter
    with CQMCommon."Inpatient Encounter" EncounterInpatient
      such that EncounterInpatient.admitDecisionUsingEncounterOrder ( ) 241 minutes or more before EDEncounter.edDepartureTime ( )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Assessment In ED":
  ["ObservationClinicalResult": "Emergency Department Evaluation"]
    union ["SimpleObservation": "Emergency Department Evaluation"] ObsInED
      where ObsInED.value as Concept in "Admit Inpatient"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Decision to Admit Using Assessment":
  "Denominator" EDEncounter
    with CQMCommon."Inpatient Encounter" EncounterInpatient
      such that EncounterInpatient.admitDecisionUsingAssessment ( ) 241 minutes or more before EDEncounter.edDepartureTime ( )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Inpatient Or Bed Assignment Encounter Order":
  ( [ServiceRequest: "Encounter Inpatient"]
    union [ServiceRequest: "Patient bed assigned (finding)"] ) IPRequest
    where IPRequest.status in { 'active', 'completed' }
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Time of Admit Order Or Bed Assignment to Departure Greater Than 241 Minutes":
  "Denominator" EDEncounter
    with CQMCommon."Inpatient Encounter" InpatientEncounter
      such that InpatientEncounter.admitInpatientOrBedAssignmentEncounterOrder ( ) 241 minutes or more before EDEncounter.edDepartureTime ( )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Admitted to Inpatient 241 Minutes or More Before Departure":
  "Denominator" EDEncounter
    with CQMCommon."Inpatient Encounter" Inpatient
      such that Inpatient.holdingInEDAfterAdmission ( ) 241 minutes or more before EDEncounter.edDepartureTime ( )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Boarded Time Greater Than 240 Minutes":
  "Decision to Admit Encounter Order"
    union "Decision to Admit Using Assessment"
    union "Time of Admit Order Or Bed Assignment to Departure Greater Than 241 Minutes"
    union "Admitted to Inpatient 241 Minutes or More Before Departure"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Observation Status":
  [Encounter: "Observation Services"] EDObsEncounter
    with "Denominator" EDEncounter
      such that EDObsEncounter.period during EDEncounter.period
        and EDObsEncounter.status = 'finished'
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Boarded Time Greater Than 240 Minutes and No Observation Stay":
  ( "Boarded Time Greater Than 240 Minutes" Boarding
      where not exists ( "ED Observation Status" EDObs
          where ( EDObs.period during Boarding.period )
      )
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Length of Stay Greater Than 480 Minutes":
  "Denominator" EDEncounter
    where EDEncounter.edArrivalTime ( ) 481 minutes or more before EDEncounter.edDepartureTime ( )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Length of Stay Greater Than 480 Minutes and No Observation Stay":
  ( "ED Length of Stay Greater Than 480 Minutes" EDStay
      where not exists ( "ED Observation Status" EDObs
          where ( EDObs.period during EDStay.period )
      )
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Numerator":
  "Time to Treatment Room Greater Than 60 Minutes"
    union "ED Arrival Left Without Being Seen"
    union "Boarded Time Greater Than 240 Minutes and No Observation Stay"
    union "ED Length of Stay Greater Than 480 Minutes and No Observation Stay"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Encounter or Triage of Patients 18 Years and Older":
  "Denominator" EDEncounter
    where AgeInYearsAt(date from start of "Measurement Period") >= 18
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Adult With Mental Health Diagnosis":
  ( "ED Encounter or Triage of Patients 18 Years and Older" AdultEDEncounters
      where ( AdultEDEncounters.hasPrincipalDiagnosisOf ( "Mental Health Diagnosis without Substance Use Disorders" ) )
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Stratification 4":
  "Adult With Mental Health Diagnosis"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "ED Encounter or Triage of Patients Less Than 18 Years":
  "Denominator" EDEncounter
    where AgeInYearsAt(date from start of "Measurement Period") < 18
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Pediatric With Mental Health Diagnosis":
  ( "ED Encounter or Triage of Patients Less Than 18 Years" PediatricEDEncounters
      where ( PediatricEDEncounters.hasPrincipalDiagnosisOf ( "Mental Health Diagnosis without Substance Use Disorders" ) )
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Stratification 3":
  "Pediatric With Mental Health Diagnosis"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Adult With No Mental Health Diagnosis":
  ( "ED Encounter or Triage of Patients 18 Years and Older" AdultEDEncounters
      where not ( AdultEDEncounters.hasPrincipalDiagnosisOf ( "Mental Health Diagnosis without Substance Use Disorders" ) )
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Stratification 2":
  "Adult With No Mental Health Diagnosis"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Pediatric With No Mental Health Diagnosis":
  ( "ED Encounter or Triage of Patients Less Than 18 Years" PediatricEDEncounters
      where not ( PediatricEDEncounters.hasPrincipalDiagnosisOf ( "Mental Health Diagnosis without Substance Use Disorders" ) )
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "Stratification 1":
  "Pediatric With No Mental Health Diagnosis"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "SDE Payer":
  SDE."SDE Payer"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "SDE Ethnicity":
  SDE."SDE Ethnicity"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define "SDE Race":
  SDE."SDE Race"
Logic Definition Library Name: CMS1244FHIRECATHOQR
define fluent function "edArrivalTime"(EDEncounter Encounter):
  Last("ED Triage and Evaluation Management".location Location
      where exists((Location.location.getLocation().type) LocationType
          where(LocationType in "Emergency Department Location"
              or LocationType ~ "Emergency room"
              or LocationType ~ "Emergency trauma unit"
          )
      )
        and start of Location.period is not null
        and(Location.period ends 120 minutes or less before start of EDEncounter.period
            or Location.period overlaps before EDEncounter.period
            or EDEncounter.period overlaps before Location.period
            or Location.period starts same as start of EDEncounter.period
        )
      return start of Location.period
      sort ascending
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define fluent function "edTreatmentRoomTimeArrivalTime"(EDEncounter Encounter):
  First(EDEncounter.location Location
      where Location.location.getLocation().type in "Emergency Department Treatment Location"
        and start of Location.period is not null
      return start of Location.period
      sort ascending
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define fluent function "admitDecisionUsingEncounterOrder"(EncounterInpatient Encounter):
  Last("ED To Inpatient Order" AdmitOrder
      let LastEDVisit: EncounterInpatient.lastEDEncounter()
      where AdmitOrder.authoredOn during LastEDVisit.period
        and AdmitOrder.intent ~ 'order'
      return AdmitOrder.authoredOn
      sort ascending
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define fluent function "lastEDEncounter"(EncounterInpatient Encounter):
  Last("ED Evaluation and Management" EDEvalManagementInMP
      where EDEvalManagementInMP.period starts 1 day or less before or on start of EncounterInpatient.period
        and EDEvalManagementInMP.period starts before start of EncounterInpatient.period
        and EDEvalManagementInMP.period during day of "Measurement Period"
        and EDEvalManagementInMP.status = 'finished'
      sort by 
      end of period ascending
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define fluent function "edDepartureTime"(EDEncounter Encounter):
  Last("ED Triage and Evaluation Management".location Location
      where exists((Location.location.getLocation().type) LocationType
          where(LocationType in "Emergency Department Location"
              or LocationType ~ "Emergency room"
              or LocationType ~ "Emergency trauma unit"
          )
      )
        and 
        end of Location.period is not null
        and(Location.period ends 120 minutes or less before start of EDEncounter.period
            or Location.period overlaps before EDEncounter.period
            or EDEncounter.period overlaps before Location.period
            or Location.period starts same as start of EDEncounter.period
        )
      return 
      end of Location.period
      sort ascending
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define fluent function "admitDecisionUsingAssessment"(EncounterInpatient Encounter):
  Last("Assessment In ED" EDEvaluation
      let LastEDVisit: EncounterInpatient.lastEDEncounter()
      where EDEvaluation.effective.toInterval() starts during LastEDVisit.period
        and EDEvaluation.status in { 'final', 'amended', 'corrected' }
      return start of EDEvaluation.effective.toInterval()
      sort ascending
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define fluent function "admitInpatientOrBedAssignmentEncounterOrder"(Encounter Encounter):
  Last(("Inpatient Or Bed Assignment Encounter Order") AdmitInpatientOrder
      let LastEDVisit: Encounter.lastEDEncounter()
      where AdmitInpatientOrder.authoredOn during LastEDVisit.period
      return AdmitInpatientOrder.authoredOn
      sort ascending
  )
Logic Definition Library Name: CMS1244FHIRECATHOQR
define fluent function holdingInEDAfterAdmission(InpatientEncounter Encounter):
  Last(CQMCommon."Inpatient Encounter" AdmittedInpatient
      let LastEDVisit: InpatientEncounter.lastEDEncounter()
      where start of AdmittedInpatient.period during LastEDVisit.period
      return start of AdmittedInpatient.period
      sort ascending
  )
Logic Definition Library Name: CQMCommon
define "Inpatient Encounter":
  [Encounter: "Encounter Inpatient"] EncounterInpatient
    where EncounterInpatient.status = 'finished'
      and EncounterInpatient.period ends during day of "Measurement Period"
Logic Definition Library Name: CQMCommon
/*
@description: Returns the Location resource specified by the given reference.
*/
define fluent function getLocation(reference Reference):
  singleton from (
    [Location] L where reference.references(L)
  )
Logic Definition Library Name: CQMCommon
/*
 @description: Returns the condition that is specified as the principal diagnosis for the encounter and has a code in the given valueSet.
 @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
 */
 define fluent function hasPrincipalDiagnosisOf(encounter Encounter, valueSet ValueSet):
   (encounter.principalDiagnosis()) PD
     return PD.diagnosis in valueSet
       or PD.diagnosis.getCondition().code in valueSet
Logic Definition Library Name: CQMCommon
/*
@description: Returns the claim diagnosis element that is specified as the principal diagnosis for the encounter
 @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
*/
define fluent function principalDiagnosis(encounter Encounter):
singleton from (
     (encounter.claimDiagnosis()) CD
       where CD.type.includesCode("Principal Diagnosis")
   )
Logic Definition Library Name: CQMCommon
/*
@description: Returns the claim diagnosis elements for the given encounter
@comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
*/
define fluent function claimDiagnosis(encounter Encounter):
  encounter E
    let 
      claim: ([Claim] C where C.status = 'active' and C.use = 'claim' and exists (C.item I where I.encounter.references(E))),
      claimItem: (claim.item I where I.encounter.references(E))
    return claim.diagnosis D where D.sequence in claimItem.diagnosisSequence
Logic Definition Library Name: CQMCommon
/*
@description: Returns the Condition resource for the given reference
*/
define fluent function getCondition(reference Reference):
  singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where reference.references(C.id))
Logic Definition Library Name: QICoreCommon
/*
@description: Returns true if the given reference is to the given resource
@comment: Returns true if the `id` element of the given resource exactly equals the tail of the given reference.
NOTE: This function assumes resources from the same source server.
*/
define fluent function references(reference Reference, resource Resource):
  resource.id = Last(Split(reference.reference, '/'))
Logic Definition Library Name: QICoreCommon
/*
@description: Returns true if any of the given references are to the given resource
@comment: Returns true if the `id` element of the given resource exactly equals the tail of any of the given references.
NOTE: This function assumes resources from the same source server.
*/
define fluent function references(references List<Reference>, resource Resource):
  exists (references R where R.references(resource))
Logic Definition Library Name: QICoreCommon
/*
@description: Returns true if the given code is in the given codeList
@comment: Returns true if the `code` is equivalent to any of the codes in the given `codeList`, false otherwise.
*/
define fluent function includesCode(codeList List<Concept>, code Code):
  exists (codeList C where C ~ code)
Logic Definition Library Name: QICoreCommon
/*
@description: Returns true if the given reference is to the given resourceId
@comment: Returns true if the `resourceId` parameter exactly equals the tail of the given reference.
NOTE: This function assumes resources from the same source server.
*/
define fluent function references(reference Reference, resourceId String):
  resourceId = Last(Split(reference.reference, '/'))
Terminology
Code System Description: Code system SNOMEDCT
Resource: http://snomed.info/sct
Canonical URL: http://snomed.info/sct
Code System Description: Code system RoleCode
Resource: http://terminology.hl7.org/CodeSystem/v3-RoleCode
Canonical URL: http://terminology.hl7.org/CodeSystem/v3-RoleCode
Code System Description: Code system Diagnosis Type
Resource: http://terminology.hl7.org/CodeSystem/ex-diagnosistype
Canonical URL: http://terminology.hl7.org/CodeSystem/ex-diagnosistype
Value Set Description: Value set Emergency Department Evaluation and Management Visit
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Value Set Description: Value set Triage
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.279
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.279
Value Set Description: Value set Emergency Department Location
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.284
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.284
Value Set Description: Value set Emergency Department Treatment Location
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.278
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.278
Value Set Description: Value set Encounter Inpatient
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Value Set Description: Value set Decision to Admit to Hospital Inpatient
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.294
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.294
Value Set Description: Value set Emergency Department Evaluation
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.163
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.163
Value Set Description: Value set Admit Inpatient
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.164
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.164
Value Set Description: Value set Observation Services
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Value Set Description: Value set Mental Health Diagnosis without Substance Use Disorders
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.285
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.285
Value Set Description: Value set Payer Type
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Direct Reference Code Display: Male (finding)
Code: 248153007
System: http://snomed.info/sct
Direct Reference Code Display: Female (finding)
Code: 248152002
System: http://snomed.info/sct
Direct Reference Code Display: Emergency room
Code: ER
System: http://terminology.hl7.org/CodeSystem/v3-RoleCode
Direct Reference Code Display: Emergency trauma unit
Code: ETU
System: http://terminology.hl7.org/CodeSystem/v3-RoleCode
Direct Reference Code Display: Patient left without being seen (finding)
Code: 21541000119102
System: http://snomed.info/sct
Direct Reference Code Display: Patient bed assigned (finding)
Code: 5751000175101
System: http://snomed.info/sct
Direct Reference Code Display: Principal Diagnosis
Code: principal
System: http://terminology.hl7.org/CodeSystem/ex-diagnosistype
Dependencies
Dependency Description: QICore model information
Resource: http://hl7.org/fhir/Library/QICore-ModelInfo
Canonical URL: http://hl7.org/fhir/Library/QICore-ModelInfo
Dependency Description: Library SDE
Resource: https://madie.cms.gov/Library/SupplementalDataElements|5.1.000
Canonical URL: https://madie.cms.gov/Library/SupplementalDataElements|5.1.000
Dependency Description: Library FHIRHelpers
Resource: https://madie.cms.gov/Library/FHIRHelpers|4.4.000
Canonical URL: https://madie.cms.gov/Library/FHIRHelpers|4.4.000
Dependency Description: Library CQMCommon
Resource: https://madie.cms.gov/Library/CQMCommon|4.1.000
Canonical URL: https://madie.cms.gov/Library/CQMCommon|4.1.000
Dependency Description: Library QICoreCommon
Resource: https://madie.cms.gov/Library/QICoreCommon|4.0.000
Canonical URL: https://madie.cms.gov/Library/QICoreCommon|4.0.000
Data Requirements
Data Requirement Type: Patient
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
Must Support Elements: extension, url
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, period, status, status.value, location, location.type, hospitalization, hospitalization.dischargeDisposition, diagnosis, diagnosis.code
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.279
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, period, status, status.value, location, location.type, hospitalization, hospitalization.dischargeDisposition, diagnosis, diagnosis.code
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: period, location, location.type, hospitalization, hospitalization.dischargeDisposition, type, diagnosis, diagnosis.code
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period, location, location.type, hospitalization, hospitalization.dischargeDisposition, diagnosis, diagnosis.code
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, period, status, status.value, location, location.type, hospitalization, hospitalization.dischargeDisposition, diagnosis, diagnosis.code
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Data Requirement Type: Resource
Profile(s): http://hl7.org/fhir/StructureDefinition/Resource
Must Support Elements: id, id.value
Data Requirement Type: Location
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-location
Data Requirement Type: ServiceRequest
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
Must Support Elements: code, status, status.value, authoredOn, authoredOn.value, intent, intent.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.294
Data Requirement Type: ServiceRequest
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
Must Support Elements: code, status, status.value, authoredOn, authoredOn.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Data Requirement Type: ServiceRequest
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
Must Support Elements: code, status, status.value, authoredOn, authoredOn.value
Code Filter(s):
Path: code
Code(s): http://snomed.info/sct#5751000175101: 'Patient bed assigned (finding)'
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-clinical-result
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.163
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation
Must Support Elements: code, value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.163
Data Requirement Type: Claim
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-claim
Must Support Elements: status, status.value, use, use.value, item
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns
Data Requirement Type: Coverage
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Generated using version 0.4.8 of the sample-content-ig Liquid templates