eCQM QICore Content Implementation Guide
2024.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 2024.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-2024/ and changes regularly. See the Directory of published versions

Measure: Appropriate Treatment for ST-Segment Elevation Myocardial Infarction (STEMI) Patients in the Emergency Department (ED)FHIR

Official URL: https://madie.cms.gov/Measure/AppropriateTreatmentforSTEMIFHIR Version: 1.2.000
Draft as of 2024-07-09 Responsible: Centers for Medicare & Medicaid Services (CMS) Computable Name: AppropriateTreatmentforSTEMIFHIR
Other Identifiers: Short Name (use: usual, ), UUID:a48685e0-4926-4ae8-9eb3-d8e8839b1704 (use: official, ), UUID:feb911dd-6b34-4b3f-866f-3059dd4d19d0 (use: official, ), Publisher (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-2023 International Health Terminology Standards Development Organisation. All rights reserved. LOINC(R) copyright 2004-2023 Regenstrief Institute, Inc. CPT(R) contained in the Measure specifications is copyright 2004-2023 American Medical Association. ICD-10 is copyright 2023 World Health Organization. All Rights Reserved.

Percentage of emergency department (ED) encounters for patients 18 years and older with a diagnosis of ST-segment elevation myocardial infarction (STEMI) that received appropriate treatment, defined as fibrinolytic therapy within 30 minutes of ED arrival, percutaneous coronary intervention (PCI) within 90 minutes of ED arrival, or transfer within 45 minutes of ED arrival

UNKNOWN

Title: Appropriate Treatment for ST-Segment Elevation Myocardial Infarction (STEMI) Patients in the Emergency Department (ED)FHIR
Id: AppropriateTreatmentforSTEMIFHIR
Version: 1.2.000
Url: Appropriate Treatment for ST-Segment Elevation Myocardial Infarction (STEMI) Patients in the Emergency Department (ED)FHIR
short-name identifier:

CMS996FHIR

version-independent identifier:

urn:uuid:a48685e0-4926-4ae8-9eb3-d8e8839b1704

version-specific identifier:

urn:uuid:feb911dd-6b34-4b3f-866f-3059dd4d19d0

publisher (CMS) identifier:

996FHIR

Effective Period: 2025-01-01..2025-12-31
Status: draft
Publisher: Centers for Medicare & Medicaid Services (CMS)
Author: Yale New Haven Health Service Corporation/ Center for Outcomes Research and Evaluation, The Lewin Group
Description:

Percentage of emergency department (ED) encounters for patients 18 years and older with a diagnosis of ST-segment elevation myocardial infarction (STEMI) that received appropriate treatment, defined as fibrinolytic therapy within 30 minutes of ED arrival, percutaneous coronary intervention (PCI) within 90 minutes of ED arrival, or transfer within 45 minutes of ED arrival

Purpose:

UNKNOWN

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-2023 International Health Terminology Standards Development Organisation. All rights reserved. LOINC(R) copyright 2004-2023 Regenstrief Institute, Inc. CPT(R) contained in the Measure specifications is copyright 2004-2023 American Medical Association. ICD-10 is copyright 2023 World Health Organization. All Rights Reserved.

Disclaimer:

These performance specifications are not clinical guidelines and 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:

Studies have shown that delays in the treatment of acute myocardial infarction (AMI) leads to increased risk of in-hospital mortality and morbidity, with nearly two lives per 1,000 patients lost per hour of delay in treatment (Sohlpour & Yusuf, 2014; Fibrinolytic Therapy Trialists' Collaborative Group, 1994). For patients receiving fibrinolytic therapy, the American Heart Association (AHA) estimates that 65 lives will be saved per 1,000 patients if treatment is administered within the first hour of symptom onset, and 131 lives will be saved per 1,000 patients treated if fibrinolytic therapy is delivered within the first three hours (O'Connor et al., 2010). The total ischemic time-that is, the time from onset of STEMI symptoms to the initiation of some form of reperfusion therapy-is the principal determinant of health outcomes for patients with an AMI, so timely care is essential to minimize disease morbidity and mortality. Primary PCI is the preferred treatment approach, with guidelines recommending initiation of PCI within 120 minutes from first medical contact (O'Gara et al., 2013). In situations where it is unlikely or impossible for a patient to receive primary PCI within the 120-minute timeframe, fibrinolytic therapy may be used for reperfusion and should be rapidly administered to reduce mortality and minimize morbidity; guidelines recommend that fibrinolytic therapy administration occur within 30 minutes of hospital arrival; this may also require rapid transfer for PCI (O'Gara et al., 2013). Implementation of an eCQM addressing appropriateness and effectiveness of care for STEMI patients in the ED has the potential to improve the delivery of care furthering alignment with current clinical practice guidelines, while reducing adverse health outcomes such as mortality, bleeding events, and reinfarction. Use of the proposed eCQM could also reduce burden on facilities currently measured using the chart-abstracted Fibrinolytic Therapy Received within 30 Minutes of ED Arrival (OP-2) measure and broaden the population for which performance scores could be publicly reported.

Clinical recommendation statement:

Primary PCI in STEMI: The 2013 ACCF/AHA clinical practice guideline for the management of STEMI recommends that: - "Primary PCI should be performed in patients with STEMI and ischemic symptoms of less than 12 hours' duration." - "Primary PCI should be performed in patients with STEMI and ischemic symptoms of less than 12 hours' duration who have contraindications to fibrinolytic therapy, irrespective of the time delay from first medical contact." Fibrinolytic Therapy when there is an Anticipated Delay to Performing Primary PCI within 120 Minutes of First Medical Contact: The 2013 American College of Cardiology Foundation (ACCF)/American Heart Association (AHA) clinical practice guideline for the management of STEMI recommends that: - "In the absence of contraindications, fibrinolytic therapy should be given to patients with STEMI and onset of ischemic symptoms within the previous 12 hours when it is anticipated that primary PCI cannot be performed within 120 minutes of first medical contact." Transfer to a PCI-Capable Hospital after Fibrinolytic Therapy: The 2013 ACCF/AHA clinical practice guideline for the management of STEMI recommends that: - Immediate transfer to a PCI-capable hospital for coronary angiography is recommended for suitable patients with STEMI who develop cardiogenic shock or acute severe heart failure (HF), irrespective of the time delay from MI onset. - Urgent transfer to a PCI-capable hospital for coronary angiography is reasonable for patients with STEMI who demonstrate evidence of failed reperfusion or reocclusion after fibrinolytic therapy. - Transfer to a PCI-capable hospital for coronary angiography is reasonable for patients with STEMI who have received fibrinolytic therapy even when hemodynamically stable and with clinical evidence of successful reperfusion. Angiography can be performed as soon as logistically feasible at the receiving hospital, and ideally within 24 hours, but should not be performed within the first 2 to 3 hours after administration of fibrinolytic therapy.

Guidance (Usage): This eCQM is an episode-based measure and should be reported for each instance of an ED encounter during the measurement period for patients with a STEMI. This FHIR-based measure has been derived from the QDM-based measure: CMS996v5. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU4.1.1/) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (https://hl7.org/fhir/us/qicore/STU4.1.1/qdm-to-qicore.html).
Population Criteria:
6633d92a6c1d307ea36e74c0
Initial Population: All emergency department encounters for patients 18 years and older at the start of the encounter with a diagnosis of ST-segment elevation myocardial infarction (STEMI) during an Emergency Department encounter that ends during the measurement period
Denominator: Equals Initial Population
Denominator Exclusion: Patients with the following conditions are excluded from measure denominator: At some point during ED encounter: - Allergic reaction to alteplase, streptokinase, anistreplase, tenecteplase, or reteplase Starts before the start of ED encounter and does not end before ED encounter: - Bleeding or bleeding diathesis (excluding menses) - Known malignant intracranial neoplasm (primary or metastatic) - Known structural cerebral vascular lesion (e.g., arteriovenous malformation) - Advanced dementia - Pregnancy - Diagnosis of allergy to thrombolytics At the start of ED encounter, or most recent dose within 90 days or less of ED encounter: -Active oral anticoagulant therapy Occurs 24 hours or less before start of ED encounter or during ED encounter: - Aortic dissection or ruptured aortic aneurysm - Severe neurologic impairment - Mechanical circulatory assist device placement, including: aortic balloon pump, biventricular assist device, intra-aortic balloon, intra-aortic balloon counterpulsation, intra-aortic counterpulsation balloon pump, left ventricular device, percutaneous ventricular assist device, or ventricular assist device - Intubation, including endotracheal intubation, mechanical ventilation, nasotracheal intubation, or orotracheal intubation - Cardiopulmonary arrest, including: cardiac arrest, cardiopulmonary resuscitation (CPR), defibrillation, respiratory arrest, or ventricular fibrillation (V-fib), ventricular tachycardia (VT), or pulseless electrical activity (PEA); or, traumatic or prolonged (>10 minutes) CPR Occurs 21 days or less before start of or starts during ED encounter: - Major surgery Occurs 90 days before start of or at start of ED encounter: - Ischemic stroke - Significant facial and/or closed head trauma - Peptic ulcer Occurs 90 days or less before start of ED encounter: - Intracranial or intraspinal surgery With a discharge disposition of patient expired in the ED
Numerator: Emergency department encounters with a diagnosis of STEMI: - where time from ED arrival to fibrinolysis is 30 minutes or fewer; OR - where PCI is performed within 90 minutes of arrival; OR - where the patient is transferred within 45 minutes of ED arrival
Denominator Exception: Emergency department encounters where the patient received fibrinolytic therapy at another facility within 24 hours.
Supplemental Data Elements:

SDE Ethnicity

SDE Payer

SDE Race

SDE Sex

Supplemental Data Guidance : For every patient evaluated by this measure also identify payer, race, ethnicity and sex
Libraries:
AppropriateTreatmentforSTEMIFHIR
Terminology and Other Dependencies:
  • Library/SupplementalDataElements|3.5.000
  • Library/FHIRHelpers|4.4.000
  • Library/CQMCommon|2.2.000
  • Library/QICoreCommon|2.1.000
  • AdministrativeGender
  • ActCode
  • Condition Clinical Status Codes
  • AllergyIntolerance Clinical Status Codes
  • International Classification of Diseases, 10th Revision, Clinical Modification (ICD-10-CM)
  • Emergency Department Visit
  • STEMI
  • Fibrinolytic Therapy
  • Emergency Department Visit
  • Percutaneous Coronary Intervention
  • Discharge To Acute Care Facility
  • Payer
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.4
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.6
  • Active Bleeding or Bleeding Diathesis (Excluding Menses)
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.3
  • Cerebral Vascular Lesion
  • Dementia
  • Pregnancy
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.5
  • Anticoagulant Medications, Oral
  • Aortic Dissection
  • Neurologic impairment
  • Cardiopulmonary Arrest
  • Major Surgical Procedure
  • Endotracheal Intubation
  • Mechanical Circulatory Assist Device
  • Ischemic Stroke
  • Closed Head Trauma
  • Active Peptic Ulcer
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.2
  • Patient Expired
  • Parameters:
    name use min max type
    Measurement Period In 0 1 Period
    SDE Sex Out 0 1 Coding
    Numerator Out 0 * Resource
    Denominator Out 0 * Resource
    SDE Payer Out 0 * Resource
    Initial Population Out 0 * Resource
    SDE Ethnicity Out 0 1 Resource
    Denominator Exclusions Out 0 * Resource
    SDE Race Out 0 1 Resource
    Denominator Exceptions Out 0 * Resource
    DataRequirements:
    Resource Type Resource Elements Valueset Name Valueset
    Patient(QICorePatient) ethnicity race
    Encounter(QICoreEncounter) type period status status.value class condition condition.reference condition.reference.value location location.type hospitalization hospitalization.dischargeDisposition reasonCode Emergency Department Evaluation and Management Visit Emergency Department Visit
    Condition(QICoreCondition) id id.value code
    Condition(QICoreCondition) code clinicalStatus STEMI STEMI
    Condition(QICoreCondition) code Active Bleeding Excluding Menses or Bleeding Diathesis Active Bleeding or Bleeding Diathesis (Excluding Menses)
    Condition(QICoreCondition) code Malignant Intracranial Neoplasm Group http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.3
    Condition(QICoreCondition) code Cerebral Vascular Lesion Cerebral Vascular Lesion
    Condition(QICoreCondition) code Dementia and Related Intracranial Pathologies Dementia
    Condition(QICoreCondition) code Pregnant State Pregnancy
    Condition(QICoreCondition) code Allergy to thrombolytics http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.5
    Condition(QICoreCondition) code Aortic Dissection or Ruptured Aortic Aneurysm Aortic Dissection
    Condition(QICoreCondition) code Neurologic impairment Neurologic impairment
    Condition(QICoreCondition) code Ischemic Stroke Ischemic Stroke
    Condition(QICoreCondition) code Closed Head and Facial Trauma Closed Head Trauma
    Condition(QICoreCondition) code Active Peptic Ulcer Active Peptic Ulcer
    Condition(QICoreCondition) code Cardiopulmonary Arrest Cardiopulmonary Arrest
    Condition(QICoreCondition) code
    Location(QICoreLocation) id id.value
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value effective Fibrinolytic Therapy Fibrinolytic Therapy
    Procedure(QICoreProcedure) code performed status status.value Percutaneous Coronary Intervention Percutaneous Coronary Intervention
    Procedure(QICoreProcedure) code performed status status.value Major Surgical Procedure Major Surgical Procedure
    Procedure(QICoreProcedure) code performed status status.value Endotracheal Intubation Endotracheal Intubation
    Procedure(QICoreProcedure) code performed status status.value Insertion or Replacement of Mechanical Circulatory Assist Device Mechanical Circulatory Assist Device
    Procedure(QICoreProcedure) code performed status status.value Intracranial or Intraspinal surgery http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.2
    Coverage(QICoreCoverage) type period Payer Type Payer
    AllergyIntolerance(QICoreAllergyIntolerance) code clinicalStatus onset Thrombolytic medications http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.4
    AdverseEvent(QICoreAdverseEvent) event recordedDate recordedDate.value actuality actuality.value Thrombolytics Adverse Event http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1170.6
    Medication(QICoreMedication) id
    MedicationRequest(QICoreMedicationRequest) medication.reference status status.value intent intent.value authoredOn authoredOn.value
    MedicationRequest(QICoreMedicationRequest) medication status status.value intent intent.value authoredOn authoredOn.value Oral Anticoagulant Medications Anticoagulant Medications, Oral
    Direct Reference Codes:
    display code system
    Male M http://hl7.org/fhir/administrative-gender
    Female F http://hl7.org/fhir/administrative-gender
    emergency EMER http://terminology.hl7.org/CodeSystem/v3-ActCode
    Active active http://terminology.hl7.org/CodeSystem/condition-clinical
    Active active http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical
    Status post administration of tPA (rtPA) in a different facility within the last 24 hours prior to admission to current facility Z92.82 http://hl7.org/fhir/sid/icd-10-cm
    Logic Definitions:
    Group Scoring Population Criteria Expression
    6633d92a6c1d307ea36e74c0 Group scoring: proportion
    Type:

    Process

    Rate Aggregation: None
    Improvement Notation:

    increase

    Initial Population
    define "Initial Population":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        where AgeInYearsAt(date from start of(EDwithSTEMI.period)) >= 18
    Denominator
    define "Denominator":
      "Initial Population"
    Denominator Exclusion
    define "Denominator Exclusions":
      "Allergy or Intolerance to Thrombolytic Medications Overlaps ED Encounter"
        union "Adverse Effect to Thrombolytic Medications Before End of ED Encounter"
        union "Active Exclusion Diagnosis at Start of ED Encounter"
        union "Active Oral Anticoagulant Medication at the Start of ED Encounter"
        union "Exclusion Diagnosis During ED Encounter or Within 24 Hours of ED Encounter Start"
        union "Major Surgical Procedure 21 Days or Less Before Start of or Starts During ED Encounter"
        union "Intubation or Mechanical Circulatory Assist Procedure During ED Encounter or Within 24 Hours of ED Encounter Start"
        union "Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter"
        union "Intracranial or Intraspinal Procedure 90 Days or Less Before Start of ED Encounter"
        union "ED Encounter with Discharge Disposition as Patient Expired"
    Numerator
    define "Numerator":
      "Fibrinolytic Therapy within 30 Minutes of Arrival"
        union "PCI within 90 Minutes of Arrival"
        union "ED Departure with Transfer to Acute Care Facility Within 45 Minutes of Arrival"
    Denominator Exception
    define "Denominator Exceptions":
      "Received tPA in Another Facility within 24 hours Prior to Admission"
    Library Name Name
    SupplementalDataElements SDE Sex
    define "SDE Sex":
      case
        when Patient.gender = 'male' then "M"
        when Patient.gender = 'female' then "F"
        else null
      end
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR SDE Sex
    define "SDE Sex":
      SDE."SDE Sex"
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR ED Encounter During MP
    define "ED Encounter During MP":
      ["Encounter": "Emergency Department Evaluation and Management Visit"] EDEncounter
        where EDEncounter.period ends during day of "Measurement Period"
          and EDEncounter.status = 'finished'
          and EDEncounter.class ~ "EMER"
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR ED Encounter with Encounter Diagnosis of STEMI
    define "ED Encounter with Encounter Diagnosis of STEMI":
      "ED Encounter During MP" EDEncounter
        where ( EDEncounter.reasonCode in "STEMI"
            or exists ( ( EDEncounter.encounterDiagnosis ( ) ) EncDiagnosis
                where EncDiagnosis.code in "STEMI"
            )
        )
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR ED Encounter with Diagnosis of STEMI
    define "ED Encounter with Diagnosis of STEMI":
      "ED Encounter During MP" EDEncounter
        with ["Condition": "STEMI"] DxSTEMI
          such that DxSTEMI.clinicalStatus ~ QICoreCommon."active"
            and DxSTEMI.prevalenceInterval ( ) starts during EDEncounter.period
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR ED Encounter with STEMI Diagnosis
    define "ED Encounter with STEMI Diagnosis":
      "ED Encounter with Encounter Diagnosis of STEMI"
        union "ED Encounter with Diagnosis of STEMI"
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Fibrinolytic Therapy within 30 Minutes of Arrival
    define "Fibrinolytic Therapy within 30 Minutes of Arrival":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ["MedicationAdministration": "Fibrinolytic Therapy"] Fibrinolytic
          such that Fibrinolytic.status = 'completed'
            and start of ( Fibrinolytic.effective.toInterval ( ) ) 30 minutes or less after EDwithSTEMI.currentemergencyDepartmentArrivalTime ( )
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR PCI within 90 Minutes of Arrival
    define "PCI within 90 Minutes of Arrival":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ["Procedure": "Percutaneous Coronary Intervention"] PCI
          such that PCI.performed.toInterval ( ) starts 90 minutes or less after EDwithSTEMI.currentemergencyDepartmentArrivalTime ( )
            and PCI.status = 'completed'
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR ED Departure with Transfer to Acute Care Facility Within 45 Minutes of Arrival
    define "ED Departure with Transfer to Acute Care Facility Within 45 Minutes of Arrival":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        where ( EDwithSTEMI.period ) ends 45 minutes or less after start of ( EDwithSTEMI.period )
          and EDwithSTEMI.hospitalization.dischargeDisposition in "Discharge To Acute Care Facility"
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Numerator
    define "Numerator":
      "Fibrinolytic Therapy within 30 Minutes of Arrival"
        union "PCI within 90 Minutes of Arrival"
        union "ED Departure with Transfer to Acute Care Facility Within 45 Minutes of Arrival"
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Initial Population
    define "Initial Population":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        where AgeInYearsAt(date from start of(EDwithSTEMI.period)) >= 18
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Denominator
    define "Denominator":
      "Initial Population"
    Library Name Name
    SupplementalDataElements SDE Payer
    define "SDE Payer":
      [Coverage: type in "Payer Type"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR SDE Payer
    define "SDE Payer":
      SDE."SDE Payer"
    Library Name Name
    SupplementalDataElements SDE Ethnicity
    define "SDE Ethnicity":
      Patient.ethnicity E
        return Tuple {
          codes: { E.ombCategory } union E.detailed,
          display: E.text
        }
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR SDE Ethnicity
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Allergy or Intolerance to Thrombolytic Medications Overlaps ED Encounter
    define "Allergy or Intolerance to Thrombolytic Medications Overlaps ED Encounter":
      "ED Encounter with STEMI Diagnosis" EDwSTEMI
        with ["AllergyIntolerance": "Thrombolytic medications"] ThrombolyticAllergy
          such that ThrombolyticAllergy.clinicalStatus ~ QICoreCommon."allergy-active"
            and ThrombolyticAllergy.onset.toInterval ( ) overlaps ( EDwSTEMI.period )
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Adverse Effect to Thrombolytic Medications Before End of ED Encounter
    /*define "Adverse Effect to Thrombolytic Medications Before End of ED Encounter":
    "ED Encounter with STEMI Diagnosis" EDwSTEMI
        with [AdverseEvent: event in "Thrombolytic medications"] ThrombolyticAdverseEvent
        such that ThrombolyticAdverseEvent.category in "Adverse reaction to thrombolytics"
        and ThrombolyticAdverseEvent.recordedDate before end of ( EDwSTEMI.period )
            and ThrombolyticAdverseEvent.actuality = 'actual'*/
    /*KS Note - not sure we need category in the logic - it is must support, but not sure this brings value to the measure logic*/
    
    
    
    define "Adverse Effect to Thrombolytic Medications Before End of ED Encounter":
      "ED Encounter with STEMI Diagnosis" EDwSTEMI
        with [AdverseEvent: event in "Thrombolytics Adverse Event"] ThrombolyticAdverseEvent
          such that ThrombolyticAdverseEvent.recordedDate before end of ( EDwSTEMI.period )
            and ThrombolyticAdverseEvent.actuality = 'actual'
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Active Exclusion Diagnosis at Start of ED Encounter
    define "Active Exclusion Diagnosis at Start of ED Encounter":
    /*KS 8-10-23: in CQLIT-389, discussed the impacts of requiring a clinical status of active but the condition could end before the end (during) the ED Visit, which would trigger an inactive status. Decided to not follow the Authoring Patterns and remove the requirement for a clinicalstatus of 'active'  */
      
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ( ["Condition": "Active Bleeding Excluding Menses or Bleeding Diathesis"]
          union ["Condition": "Malignant Intracranial Neoplasm Group"]
          union ["Condition": "Cerebral Vascular Lesion"]
          union ["Condition": "Dementia and Related Intracranial Pathologies"]
          union ["Condition": "Pregnant State"]
          union ["Condition": "Allergy to thrombolytics"] ) ActiveExclusionDx
          such that /*ActiveExclusionDx.isActive ()
            and */
          ActiveExclusionDx.prevalenceInterval ( ) overlaps before ( EDwithSTEMI.period )
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Active Oral Anticoagulant Medication at the Start of ED Encounter
    define "Active Oral Anticoagulant Medication at the Start of ED Encounter":
        /*this definition differs from QDM re: timing - cannot use overlaps for a single point in time*/
      
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ["MedicationRequest": "Oral Anticoagulant Medications"] OralAnticoagulant
          such that OralAnticoagulant.status = 'active'
            and OralAnticoagulant.intent = 'order'
            and OralAnticoagulant.authoredOn 90 days or less before or on start of EDwithSTEMI.period
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Exclusion Diagnosis During ED Encounter or Within 24 Hours of ED Encounter Start
    define "Exclusion Diagnosis During ED Encounter or Within 24 Hours of ED Encounter Start":
    /*Did not include a status of active as any diagnosis that resolves during the ED visit would not be counted*/
      
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ( ["Condition": "Aortic Dissection or Ruptured Aortic Aneurysm"]
          union ["Condition": "Neurologic impairment"]
          union ["Condition": "Cardiopulmonary Arrest"] ) ExclusionDiagnosis
          such that ( ExclusionDiagnosis.prevalenceInterval ( ) starts during EDwithSTEMI.period )
            or ( ExclusionDiagnosis.prevalenceInterval ( ) starts 24 hours or less before start of EDwithSTEMI.period )
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Major Surgical Procedure 21 Days or Less Before Start of or Starts During ED Encounter
    define "Major Surgical Procedure 21 Days or Less Before Start of or Starts During ED Encounter":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ["Procedure": "Major Surgical Procedure"] MajorSurgery
          such that MajorSurgery.performed.toInterval ( ) starts 21 days or less before start of ( EDwithSTEMI.period )
            and MajorSurgery.status = 'completed'
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Intubation or Mechanical Circulatory Assist Procedure During ED Encounter or Within 24 Hours of ED Encounter Start
    define "Intubation or Mechanical Circulatory Assist Procedure During ED Encounter or Within 24 Hours of ED Encounter Start":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ( ["Procedure": "Endotracheal Intubation"]
          union ["Procedure": "Insertion or Replacement of Mechanical Circulatory Assist Device"] ) AirwayProcedure
          such that ( ( AirwayProcedure.performed.toInterval ( ) starts during ( EDwithSTEMI.period ) )
              or ( AirwayProcedure.performed.toInterval ( ) starts 24 hours or less before start of ( EDwithSTEMI.period ) )
          )
            and AirwayProcedure.status = 'completed'
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter
    define "Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter":
      "ED Encounter with STEMI Diagnosis" EDwSTEMI
        with ( ["Condition": "Ischemic Stroke"]
          union ["Condition": "Closed Head and Facial Trauma"]
          union ["Condition": "Active Peptic Ulcer"]
          union ["Condition": "Cardiopulmonary Arrest"] ) ExclusionCondition
          such that /* ExclusionCondition.isActive ()
       and */
          ExclusionCondition.prevalenceInterval ( ) starts during Interval[start of ( EDwSTEMI.period ) - 90 days, start of ( EDwSTEMI.period )]
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Intracranial or Intraspinal Procedure 90 Days or Less Before Start of ED Encounter
    define "Intracranial or Intraspinal Procedure 90 Days or Less Before Start of ED Encounter":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ["Procedure": "Intracranial or Intraspinal surgery"] CranialorSpinalSurgery
          such that CranialorSpinalSurgery.performed.toInterval ( ) starts 90 days or less before start of ( EDwithSTEMI.period )
            and CranialorSpinalSurgery.status = 'completed'
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR ED Encounter with Discharge Disposition as Patient Expired
    define "ED Encounter with Discharge Disposition as Patient Expired":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        where EDwithSTEMI.hospitalization.dischargeDisposition in "Patient Expired"
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Denominator Exclusions
    define "Denominator Exclusions":
      "Allergy or Intolerance to Thrombolytic Medications Overlaps ED Encounter"
        union "Adverse Effect to Thrombolytic Medications Before End of ED Encounter"
        union "Active Exclusion Diagnosis at Start of ED Encounter"
        union "Active Oral Anticoagulant Medication at the Start of ED Encounter"
        union "Exclusion Diagnosis During ED Encounter or Within 24 Hours of ED Encounter Start"
        union "Major Surgical Procedure 21 Days or Less Before Start of or Starts During ED Encounter"
        union "Intubation or Mechanical Circulatory Assist Procedure During ED Encounter or Within 24 Hours of ED Encounter Start"
        union "Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter"
        union "Intracranial or Intraspinal Procedure 90 Days or Less Before Start of ED Encounter"
        union "ED Encounter with Discharge Disposition as Patient Expired"
    Library Name Name
    SupplementalDataElements SDE Race
    define "SDE Race":
      Patient.race R
        return Tuple {
          codes: R.ombCategory union R.detailed,
          display: R.text
        }
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR SDE Race
    define "SDE Race":
      SDE."SDE Race"
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Received tPA in Another Facility within 24 hours Prior to Admission
    define "Received tPA in Another Facility within 24 hours Prior to Admission":
      "ED Encounter with STEMI Diagnosis" EDwithSTEMI
        with ( ["Condition": "Status post administration of tPA (rtPA) in a different facility within the last 24 hours prior to admission to current facility"] ) TPA
          such that TPA.prevalenceInterval ( ) starts during EDwithSTEMI.period
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR Denominator Exceptions
    define "Denominator Exceptions":
      "Received tPA in Another Facility within 24 hours Prior to Admission"
    Library Name Name
    FHIRHelpers ToConcept
    /*
    @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
            }
    Library Name Name
    CQMCommon encounterDiagnosis
    /*
    @description: Returns the Condition resources referenced by the diagnosis element of the Encounter
    */
    define fluent function encounterDiagnosis(Encounter Encounter ):
      Encounter.diagnosis D
        return singleton from ([Condition] C where C.id = D.condition.reference.getId())
    Library Name Name
    QICoreCommon getId
    /*
    @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).
    @comment: This function can be used to determine the logical id of a given resource. It can be used in
    a single-server environment to trace references. However, this function does not attempt to resolve
    or distinguish the base of the given url, and so cannot be used safely in multi-server environments.
    */
    define fluent function getId(uri String):
      Last(Split(uri, '/'))
    Library Name Name
    QICoreCommon prevalenceInterval
    /*
    @description: Returns an interval representing the normalized prevalence period of a given Condition.
    @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
    onset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting 
    interval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary.
    */
    define fluent function prevalenceInterval(condition Condition):
    if condition.clinicalStatus ~ "active"
      or condition.clinicalStatus ~ "recurrence"
      or condition.clinicalStatus ~ "relapse" then
      Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
    else
        (end of condition.abatementInterval()) abatementDate
        return if abatementDate is null then
          Interval[start of condition.onset.toInterval(), abatementDate)
        else
          Interval[start of condition.onset.toInterval(), abatementDate]
    Library Name Name
    AppropriateTreatmentforSTEMIFHIR currentemergencyDepartmentArrivalTime
    define fluent function currentemergencyDepartmentArrivalTime(EDEncounter Encounter):
    /*
    @description: Returns the emergency department arrival time for the encounter.
    */
      
      start of ( singleton from ( ( ( EDEncounter.location ) ) EDLocation
            where CQMCommon.GetLocation ( EDLocation.location ).type in "Emergency Department Visit"
        )
      ).period
    Library Name Name
    CQMCommon GetLocation
    /*
    @description: Returns the Location resource specified by the given reference
    @deprecated: This function is deprecated. Use the fluent function `getLocation()` instead.
    */
    define function "GetLocation"(reference Reference ):
      singleton from (
        [Location] L where L.id = reference.reference.getId()
      )
    Library Name Name
    FHIRHelpers ToString
    define function ToString(value uri): value.value
    Library Name Name
    FHIRHelpers ToCode
    /*
    @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
            }