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: Venous Thromboembolism ProphylaxisFHIR

Official URL: https://madie.cms.gov/Measure/VenousThromboembolismProphylaxisFHIR Version: 0.2.000
Draft as of 2024-07-09 Responsible: The Joint Commission Computable Name: VenousThromboembolismProphylaxisFHIR
Other Identifiers: Short Name (use: usual, ), UUID:fa570e9c-c75f-4972-a77e-9488816d14af (use: official, ), UUID:1b60bbd2-6837-4b68-921c-ffeead0bc2ca (use: official, ), Publisher (use: official, )

Copyright/Legal: Measure specifications are in the Public Domain.

LOINC(R) copyright 2004-2023 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2023 International Health Terminology Standards Development Organisation. ICD-10 copyright 2023 World Health Organization. All Rights Reserved.

This measure assesses the number of patients who received Venous Thromboembolism (VTE) prophylaxis or have documentation why no VTE prophylaxis was given between the day of arrival to the day after hospital admission or surgery end date for surgeries that start the day of or the day after hospital admission

UNKNOWN

Title: Venous Thromboembolism ProphylaxisFHIR
Id: VenousThromboembolismProphylaxisFHIR
Version: 0.2.000
Url: Venous Thromboembolism ProphylaxisFHIR
short-name identifier:

CMS108FHIR

version-independent identifier:

urn:uuid:fa570e9c-c75f-4972-a77e-9488816d14af

version-specific identifier:

urn:uuid:1b60bbd2-6837-4b68-921c-ffeead0bc2ca

publisher (CMS) identifier:

108FHIR

Effective Period: 2025-01-01..2025-12-31
Status: draft
Publisher: The Joint Commission
Author: The Joint Commission
Description:

This measure assesses the number of patients who received Venous Thromboembolism (VTE) prophylaxis or have documentation why no VTE prophylaxis was given between the day of arrival to the day after hospital admission or surgery end date for surgeries that start the day of or the day after hospital admission

Purpose:

UNKNOWN

Copyright:

Measure specifications are in the Public Domain.

LOINC(R) copyright 2004-2023 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2023 International Health Terminology Standards Development Organisation. ICD-10 copyright 2023 World Health Organization. All Rights Reserved.

Disclaimer:

These performance measures 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 without warranty.

Scoring:

Proportion

Rationale:

The estimated annual incidence of deep-vein thrombosis (DVT) and pulmonary embolism (PE), known collectively as venous thromboembolism (VTE), ranges from 350,000 to 600,000 (Maynard, 2016). According to the Centers for Disease Control and Prevention (CDC) 2020 statistics, 1-2 per 1,000 adults in the United States are clinically diagnosed with VTE each year (CDC, 2020). Increased incidence is reported in the elderly (1 per 100) compared to young adults (1 per 10,000) (Henke et al., 2020).

VTE is a known complication of hospitalization, frequently extending the length of stay and increasing hospital mortality (Maynard, 2016). Approximately 20% of VTE are associated with a surgical procedure (Henke et al., 2020). Hospitalized patients at high-risk for VTE may develop an asymptomatic DVT, and die from PE even before the diagnosis is suspected. The majority of fatal events occur as sudden or abrupt death, underscoring the importance of prevention as the most critical action step for reducing death from PE (Geerts et al., 2008).

American Society of Hematology (ASH) 2018 VTE prophylaxis guidelines strongly recommend pharmacological prophylaxis using unfractionated heparin (UFH), low molecular weight heparin (LMWH) or fondaparinux for acutely and critically ill hospitalized medical patients, unless contraindicated. The use of mechanical prophylaxis is an acceptable alternative for patients with increased risk of bleeding and preferred over no prophylaxis. ASH 2019 guidelines for surgical patients similarly recommend pharmacological or mechanical prophylaxis over no VTE prophylaxis. (NOTE: Some select surgeries have previously been monitored in the Surgical Care Improvement Project; since performance on these surgeries has achieved very high levels, they are not included in this measure.)

Despite its proven effectiveness, VTE prophylaxis remains underused or inappropriately used in both medical and surgical patients (Kahn et al., 2018). The ENDORSE study evaluated prophylaxis rates in 17,084 major surgery patients and found that more than one third of patients at risk for VTE (38%) did not receive prophylaxis with various rates reported for different types of surgery (Cohen et al., 2008). More recently, a systemic review of multiple randomized controlled trials found that system-wide interventions, such as computer alerts to physicians and other healthcare professionals, increased the use of appropriate VTE prophylaxis while reducing the number of symptomatic VTE at three months (Kahn et al., 2018).

Clinical recommendation statement:

Failure to recognize and protect patients at risk for venous thromboembolism (VTE) increases the chances for acutely ill hospitalized patients at high risk for developing a deep vein thrombosis or dying from a pulmonary embolism. Screening all patients is the only evidence based practice in reducing incidence of disease. All hospitalized patients should be evaluated for primary VTE prophylaxis, and given appropriate prophylaxis when indicated.

Guidance (Usage): When low dose unfractionated heparin is administered for VTE prophylaxis, the intended administration route for low dose unfractionated heparin is subcutaneous. Reasons for no pharmacological and no mechanical VTE prophylaxis must be explicitly documented by the MD/APN/PA or pharmacist and linked with VTE prophylaxis. Ambulation alone is not a sufficient reason for not administering VTE prophylaxis. In order for ambulation/patient ambulating to be considered as an acceptable reason, there needs to be explicit documentation, e.g., "patient out of bed and ambulating in halls - no VTE prophylaxis needed." The denominator population includes patients with inpatient hospitalizations and patients from Acute Hospital Care at Home programs, who are treated and billed as inpatients but receive care in their home. This eCQM is an episode-based measure. An episode is defined as each inpatient hospitalization or encounter that ends during the measurement period. This FHIR-based measure has been derived from the QDM-based measure: CMS108v13. 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:
64f8bc45da013638e7b3d874
Initial Population: Inpatient hospitalizations for patients age 18 and older, discharged from hospital inpatient acute care without a diagnosis of venous thromboembolism (VTE) or obstetrics that ends during the measurement period
Denominator: Initial population
Denominator Exclusion: - Inpatient hospitalizations for patients who have a length of stay less than 2 days - Inpatient hospitalizations for patients who are direct admits to intensive care unit (ICU), or transferred to ICU the day of or the day after hospital admission with ICU length of stay greater than or equal to one day - Inpatient hospitalizations for patients with a principal diagnosis of mental disorders or stroke - Inpatient hospitalizations for patients with a principal procedure of Surgical Care Improvement Project (SCIP) VTE selected surgeries - Inpatient hospitalizations for patients with comfort measures documented anytime between the day of arrival and the day after hospital admission - Inpatient hospitalizations for patients with comfort measures documented by the day after surgery end date for surgeries that end the day of or the day after hospital admission
Numerator: Inpatient hospitalizations for patients who received VTE prophylaxis: - between the day of arrival and the day after hospital admission - the day of or the day after surgery end date (for surgeries that end the day of or the day after hospital admission) Inpatient hospitalizations for patients who have documentation of a reason why no VTE prophylaxis was given: - between the day of arrival and the day after hospital admission - the day of or the day after surgery end date (for surgeries that end the day of or the day after hospital admission)
Supplemental Data Elements:

SDE Ethnicity

SDE Race

SDE Sex

SDE Payer

Supplemental Data Guidance : For every patient evaluated by this measure also identify payer, race, ethnicity and sex; SDE Ethnicity-Patient's Ethnicity: Hispanic or Latino Not Hispanic or Latino SDE Race-Patient's Race: Native Hawaiian or Other Pacific Islander Asian American Indian or Alaska Native Other Race White Black or African American SDE Sex-Patient's Sex: Gender identity restricted to only Male and Female used in administrative situations requiring a restriction to these two categories. SDE Payer
Libraries:
VenousThromboembolismProphylaxisFHIR
Terminology and Other Dependencies:
  • Library/SupplementalDataElements|3.5.000
  • Library/VTE|8.8.000
  • Library/CQMCommon|2.2.000
  • Library/FHIRHelpers|4.4.000
  • Library/QICoreCommon|2.1.000
  • Library/TJCOverall|8.14.000
  • AdministrativeGender
  • Condition Clinical Status Codes
  • ConditionVerificationStatus
  • Logical Observation Identifiers, Names and Codes (LOINC)
  • Diagnosis Role
  • Encounter Inpatient
  • Obstetrics
  • Venous Thromboembolism
  • Obstetrics VTE
  • Low Dose Unfractionated Heparin for VTE Prophylaxis
  • Subcutaneous route
  • Low Molecular Weight Heparin for VTE Prophylaxis
  • Injectable Factor Xa Inhibitor for VTE Prophylaxis
  • Warfarin
  • Rivaroxaban and Betrixaban for VTE Prophylaxis
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.65
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.64
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66
  • Observation Services
  • Emergency Department Visit
  • General or Neuraxial Anesthesia
  • Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment
  • Atrial Fibrillation/Flutter
  • Hip Replacement Surgery
  • Knee Replacement Surgery
  • Low Risk
  • INR
  • Unfractionated Heparin
  • Intravenous route
  • Direct Thrombin Inhibitor
  • Glycoprotein IIb/IIIa Inhibitors
  • Medical Reason
  • Venous foot pumps (VFP)
  • Intermittent pneumatic compression devices (IPC)
  • Graduated compression stockings (GCS)
  • Patient Refusal
  • Payer
  • Intensive Care Unit
  • Mental Health Diagnoses
  • Hemorrhagic Stroke
  • Ischemic Stroke
  • General Surgery
  • Gynecological Surgery
  • Hip Fracture Surgery
  • Intracranial Neurosurgery
  • Urological Surgery
  • Comfort Measures
  • 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
    DataRequirements:
    Resource Type Resource Elements Valueset Name Valueset
    Patient(QICorePatient) ethnicity race
    Encounter(QICoreEncounter) type status status.value period condition condition.reference condition.reference.value period.low period.lowClosed period.high period.highClosed location rank rank.value use extension Observation Services Observation Services
    Encounter(QICoreEncounter) type status status.value period condition condition.reference condition.reference.value period.low period.lowClosed period.high period.highClosed location rank rank.value use extension Emergency Department Visit Emergency Department Visit
    Encounter(QICoreEncounter) type status status.value period condition condition.reference condition.reference.value period.low period.lowClosed period.high period.highClosed location rank rank.value use extension Encounter Inpatient Encounter Inpatient
    Condition(QICoreCondition) code verificationStatus onset Atrial Fibrillation or Flutter Atrial Fibrillation/Flutter
    Condition(QICoreCondition) code clinicalStatus verificationStatus onset Venous Thromboembolism Venous Thromboembolism
    Condition(QICoreCondition) id id.value code
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Low Dose Unfractionated Heparin for VTE Prophylaxis Low Dose Unfractionated Heparin for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Low Molecular Weight Heparin for VTE Prophylaxis Low Molecular Weight Heparin for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Injectable Factor Xa Inhibitor for VTE Prophylaxis Injectable Factor Xa Inhibitor for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Warfarin Warfarin
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Rivaroxaban for VTE Prophylaxis Rivaroxaban and Betrixaban for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Unfractionated Heparin Unfractionated Heparin
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Direct Thrombin Inhibitor Direct Thrombin Inhibitor
    MedicationAdministration(QICoreMedicationAdministration) medication status status.value dosage dosage.route effective id id.value Glycoprotein IIb/IIIa Inhibitors Glycoprotein IIb/IIIa Inhibitors
    Procedure(QICoreProcedure) code status status.value performed id id.value Application of Intermittent Pneumatic Compression Devices http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.65
    Procedure(QICoreProcedure) code status status.value performed id id.value Application of Venous Foot Pumps http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.64
    Procedure(QICoreProcedure) code status status.value performed id id.value Application of Graduated Compression Stockings http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66
    Procedure(QICoreProcedure) code status status.value performed id id.value General Surgery General Surgery
    Procedure(QICoreProcedure) code status status.value performed id id.value Gynecological Surgery Gynecological Surgery
    Procedure(QICoreProcedure) code status status.value performed id id.value Hip Fracture Surgery Hip Fracture Surgery
    Procedure(QICoreProcedure) code status status.value performed id id.value Hip Replacement Surgery Hip Replacement Surgery
    Procedure(QICoreProcedure) code status status.value performed id id.value Intracranial Neurosurgery Intracranial Neurosurgery
    Procedure(QICoreProcedure) code status status.value performed id id.value Knee Replacement Surgery Knee Replacement Surgery
    Procedure(QICoreProcedure) code status status.value performed id id.value Urological Surgery Urological Surgery
    Procedure(QICoreProcedure) code status status.value performed id id.value Comfort Measures Comfort Measures
    Procedure(QICoreProcedure) code status status.value performed performed.low performed.lowClosed performed.high performed.highClosed id id.value General or Neuraxial Anesthesia General or Neuraxial Anesthesia
    Observation(QICoreObservation) code value status status.value id id.value effective
    Observation(US Core Laboratory Result Observation Profile) code value status status.value id id.value issued issued.value INR INR
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Low Dose Unfractionated Heparin for VTE Prophylaxis Low Dose Unfractionated Heparin for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Low Dose Unfractionated Heparin for VTE Prophylaxis Low Dose Unfractionated Heparin for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Low Molecular Weight Heparin for VTE Prophylaxis Low Molecular Weight Heparin for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Low Molecular Weight Heparin for VTE Prophylaxis Low Molecular Weight Heparin for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Injectable Factor Xa Inhibitor for VTE Prophylaxis Injectable Factor Xa Inhibitor for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Injectable Factor Xa Inhibitor for VTE Prophylaxis Injectable Factor Xa Inhibitor for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Warfarin Warfarin
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Warfarin Warfarin
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Rivaroxaban for VTE Prophylaxis Rivaroxaban and Betrixaban for VTE Prophylaxis
    MedicationAdministration(QICoreMedicationAdministrationNotDone) medication id id.value statusReason extension Rivaroxaban for VTE Prophylaxis Rivaroxaban and Betrixaban for VTE Prophylaxis
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Low Dose Unfractionated Heparin for VTE Prophylaxis Low Dose Unfractionated Heparin for VTE Prophylaxis
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Low Dose Unfractionated Heparin for VTE Prophylaxis Low Dose Unfractionated Heparin for VTE Prophylaxis
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Low Molecular Weight Heparin for VTE Prophylaxis Low Molecular Weight Heparin for VTE Prophylaxis
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Low Molecular Weight Heparin for VTE Prophylaxis Low Molecular Weight Heparin for VTE Prophylaxis
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Injectable Factor Xa Inhibitor for VTE Prophylaxis Injectable Factor Xa Inhibitor for VTE Prophylaxis
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Injectable Factor Xa Inhibitor for VTE Prophylaxis Injectable Factor Xa Inhibitor for VTE Prophylaxis
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Warfarin Warfarin
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Warfarin Warfarin
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Rivaroxaban for VTE Prophylaxis Rivaroxaban and Betrixaban for VTE Prophylaxis
    MedicationRequest(QICoreMedicationNotRequested) medication intent intent.value id id.value reasonCode authoredOn authoredOn.value Rivaroxaban for VTE Prophylaxis Rivaroxaban and Betrixaban for VTE Prophylaxis
    ServiceRequest(QICoreServiceNotRequested) code intent intent.value id id.value extension authoredOn authoredOn.value Venous foot pumps Venous foot pumps (VFP)
    ServiceRequest(QICoreServiceNotRequested) code intent intent.value id id.value extension authoredOn authoredOn.value Venous foot pumps Venous foot pumps (VFP)
    ServiceRequest(QICoreServiceNotRequested) code intent intent.value id id.value extension authoredOn authoredOn.value Intermittent pneumatic compression devices Intermittent pneumatic compression devices (IPC)
    ServiceRequest(QICoreServiceNotRequested) code intent intent.value id id.value extension authoredOn authoredOn.value Intermittent pneumatic compression devices Intermittent pneumatic compression devices (IPC)
    ServiceRequest(QICoreServiceNotRequested) code intent intent.value id id.value extension authoredOn authoredOn.value Graduated compression stockings Graduated compression stockings (GCS)
    ServiceRequest(QICoreServiceNotRequested) code intent intent.value id id.value extension authoredOn authoredOn.value Graduated compression stockings Graduated compression stockings (GCS)
    Procedure(QICoreProcedureNotDone) code extension id id.value statusReason Application of Intermittent Pneumatic Compression Devices http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.65
    Procedure(QICoreProcedureNotDone) code extension id id.value statusReason Application of Intermittent Pneumatic Compression Devices http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.65
    Procedure(QICoreProcedureNotDone) code extension id id.value statusReason Application of Venous Foot Pumps http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.64
    Procedure(QICoreProcedureNotDone) code extension id id.value statusReason Application of Venous Foot Pumps http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.64
    Procedure(QICoreProcedureNotDone) code extension id id.value statusReason Application of Graduated Compression Stockings http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66
    Procedure(QICoreProcedureNotDone) code extension id id.value statusReason Application of Graduated Compression Stockings http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66
    Coverage(QICoreCoverage) type period Payer Type Payer
    Location(QICoreLocation) id id.value
    ServiceRequest(QICoreServiceRequest) code intent intent.value status status.value doNotPerform doNotPerform.value Comfort Measures Comfort Measures
    Direct Reference Codes:
    display code system
    Male M http://hl7.org/fhir/administrative-gender
    Female F http://hl7.org/fhir/administrative-gender
    Active active http://terminology.hl7.org/CodeSystem/condition-clinical
    Recurrence recurrence http://terminology.hl7.org/CodeSystem/condition-clinical
    Relapse relapse http://terminology.hl7.org/CodeSystem/condition-clinical
    Confirmed confirmed http://terminology.hl7.org/CodeSystem/condition-ver-status
    Inactive inactive http://terminology.hl7.org/CodeSystem/condition-clinical
    Remission remission http://terminology.hl7.org/CodeSystem/condition-clinical
    Resolved resolved http://terminology.hl7.org/CodeSystem/condition-clinical
    Risk for venous thromboembolism 72136-5 http://loinc.org
    Billing billing http://terminology.hl7.org/CodeSystem/diagnosis-role
    Logic Definitions:
    Group Scoring Population Criteria Expression
    64f8bc45da013638e7b3d874 Group scoring: proportion Measure scoring:

    Proportion

    Type:

    Process

    Rate Aggregation: None
    Improvement Notation:

    increase

    Initial Population
    define "Initial Population":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions"
    Denominator
    define "Denominator":
      "Initial Population"
    Denominator Exclusion
    define "Denominator Exclusions":
      "Encounter Less Than 2 Days"
        union "Encounter with ICU Location Stay 1 Day or More"
        union "Encounter with Principal Diagnosis of Mental Disorder or Stroke"
        union "Encounter with Principal Procedure of SCIP VTE Selected Surgery"
        union "Encounter with Intervention Comfort Measures From Day of Start of Hospitalization To Day After Admission"
        union "Encounter with Intervention Comfort Measures on Day of or Day After Procedure"
    Numerator
    define "Numerator":
      "Encounter with VTE Prophylaxis Received From Day of Start of Hospitalization To Day After Admission or Procedure"
        union ( "Encounter with Medication Oral Factor Xa Inhibitor Administered on Day of or Day After Admission or Procedure"
            intersect ( "Encounter with Prior or Present Diagnosis of Atrial Fibrillation or Prior Diagnosis of VTE"
                union "Encounter with Prior or Present Procedure of Hip or Knee Replacement Surgery"
            )
        )
        union "Encounter with Low Risk for VTE or Anticoagulant Administered"
        union "Encounter with No VTE Prophylaxis Due to Medical Reason"
        union "Encounter with No VTE Prophylaxis Due to Patient Refusal"
    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
    VenousThromboembolismProphylaxisFHIR SDE Sex
    define "SDE Sex":
      SDE."SDE Sex"
    Library Name Name
    CQMCommon Inpatient Encounter
    define "Inpatient Encounter":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
    		where EncounterInpatient.status = 'finished'
    		and EncounterInpatient.period ends during day of "Measurement Period"
    Library Name Name
    VTE Admission without VTE or Obstetrical Conditions
    define "Admission without VTE or Obstetrical Conditions":
      CQMCommon."Inpatient Encounter" InpatientEncounter
       where not (exists (InpatientEncounter.encounterDiagnosis()) EncDx
                     where (EncDx.code in "Obstetrical or Pregnancy Related Conditions" 
                          or EncDx.code in "Venous Thromboembolism"
              				or EncDx.code in "Obstetrics VTE"
              			         )
                         )
    Library Name Name
    VTE Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions
    define "Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions":
     ( CQMCommon."Inpatient Encounter" InpatientEncounter
         where AgeInYearsAt(date from start of InpatientEncounter.period) >= 18 )
        intersect "Admission without VTE or Obstetrical Conditions"
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Pharmacological or Mechanical VTE Prophylaxis Received
    define "Pharmacological or Mechanical VTE Prophylaxis Received":
      ( ["MedicationAdministration": "Low Dose Unfractionated Heparin for VTE Prophylaxis"] VTEMedication
          where VTEMedication.status = 'completed'
            and VTEMedication.dosage.route in "Subcutaneous route"
      )
        union ( ["MedicationAdministration": "Low Molecular Weight Heparin for VTE Prophylaxis"] LMWH
            where LMWH.status = 'completed'
        )
        union ( ["MedicationAdministration": "Injectable Factor Xa Inhibitor for VTE Prophylaxis"] FactorXa
            where FactorXa.status = 'completed'
        )
        union ( ["MedicationAdministration": "Warfarin"] Warfarin
            where Warfarin.status = 'completed'
        )
        union ( ["MedicationAdministration": "Rivaroxaban for VTE Prophylaxis"] Rivaroxaban
            where Rivaroxaban.status = 'completed'
        )
        union ( ( ["Procedure": "Application of Intermittent Pneumatic Compression Devices"]
            union ["Procedure": "Application of Venous Foot Pumps"]
            union ["Procedure": "Application of Graduated Compression Stockings"] ) DeviceApplied
            where DeviceApplied.status = 'completed'
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with VTE Prophylaxis Received From Day of Start of Hospitalization To Day After Admission or Procedure
    define "Encounter with VTE Prophylaxis Received From Day of Start of Hospitalization To Day After Admission or Procedure":
      ( from
          VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
          "Pharmacological or Mechanical VTE Prophylaxis Received" VTEProphylaxis
          where Coalesce(VTEProphylaxis.effective.toInterval(), VTEProphylaxis.performed.toInterval()) starts during day of QualifyingEncounter.FromDayOfStartOfHospitalizationToDayAfterAdmission ( )
          return QualifyingEncounter
      )
        union ( from
            VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
            ["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
            "Pharmacological or Mechanical VTE Prophylaxis Received" VTEProphylaxis
            where AnesthesiaProcedure.status = 'completed'
              and AnesthesiaProcedure.performed.toInterval ( ) ends 1 day after day of start of QualifyingEncounter.period
              and Coalesce(VTEProphylaxis.effective.toInterval(), VTEProphylaxis.performed.toInterval()) starts during day of ( end of AnesthesiaProcedure.performed.toInterval ( ) ).CalendarDayOfOrDayAfter ( )
            return QualifyingEncounter
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with Medication Oral Factor Xa Inhibitor Administered on Day of or Day After Admission or Procedure
    define "Encounter with Medication Oral Factor Xa Inhibitor Administered on Day of or Day After Admission or Procedure":
      ( from
          VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
          ["MedicationAdministration": "Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment"] FactorXaMedication
          where FactorXaMedication.status = 'completed'
            and FactorXaMedication.effective.toInterval ( ) starts during day of ( start of QualifyingEncounter.period ).CalendarDayOfOrDayAfter ( )
          return QualifyingEncounter
      )
        union ( from
            VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
            ["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
            ["MedicationAdministration": "Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment"] FactorXaMedication
            where FactorXaMedication.status = 'completed'
              and AnesthesiaProcedure.status = 'completed'
              and AnesthesiaProcedure.performed.toInterval ( ) ends 1 day after day of start of QualifyingEncounter.period
              and FactorXaMedication.effective.toInterval ( ) starts during day of ( end of AnesthesiaProcedure.performed.toInterval ( ) ).CalendarDayOfOrDayAfter ( )
            return QualifyingEncounter
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with Prior or Present Diagnosis of Atrial Fibrillation or Prior Diagnosis of VTE
    define "Encounter with Prior or Present Diagnosis of Atrial Fibrillation or Prior Diagnosis of VTE":
      ( VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
          with ["Condition": "Atrial Fibrillation or Flutter"] AtrialFibrillation
            such that AtrialFibrillation.isActive ( )
              and AtrialFibrillation.verificationStatus is not null
              and AtrialFibrillation.verificationStatus ~ QICoreCommon."confirmed"
              and AtrialFibrillation.onset.toInterval ( ) starts on or before end of QualifyingEncounter.period
      )
        union ( VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
            where QualifyingEncounter.encounterDiagnosis ( ).code in "Atrial Fibrillation or Flutter"
        )
        union ( VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
            with ["Condition": "Venous Thromboembolism"] VTEDiagnosis
              such that ( VTEDiagnosis.clinicalStatus ~ QICoreCommon."inactive"
                  or VTEDiagnosis.clinicalStatus ~ QICoreCommon."remission"
                  or VTEDiagnosis.clinicalStatus ~ QICoreCommon."resolved"
              )
                and VTEDiagnosis.verificationStatus is not null
                and VTEDiagnosis.verificationStatus ~ QICoreCommon."confirmed"
                and VTEDiagnosis.onset.toInterval ( ) before start of QualifyingEncounter.period
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with Prior or Present Procedure of Hip or Knee Replacement Surgery
    define "Encounter with Prior or Present Procedure of Hip or Knee Replacement Surgery":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        with ( ["Procedure": "Hip Replacement Surgery"]
          union ["Procedure": "Knee Replacement Surgery"] ) HipKneeProcedure
          such that HipKneeProcedure.status = 'completed'
            and HipKneeProcedure.performed.toInterval ( ) starts on or before end of QualifyingEncounter.period
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Low Risk Indicator For VTE
    define "Low Risk Indicator For VTE":
      ( ["Observation": "Risk for venous thromboembolism"] VTERiskAssessment
          where VTERiskAssessment.value as Concept in "Low Risk"
            and VTERiskAssessment.status in { 'final', 'amended', 'corrected' }
          return {
            id: VTERiskAssessment.id,
            LowRiskDatetime: VTERiskAssessment.effective.earliest ( )
          }
      )
        union ( ["US Core Laboratory Result Observation Profile": "INR"] INRLabTest
            where INRLabTest.value as Quantity > 3.0
              and INRLabTest.status in { 'final', 'amended', 'corrected' }
            return {
              id: INRLabTest.id,
              LowRiskDatetime: INRLabTest.issued
            }
        )
        union ( ( ( ["MedicationAdministration": "Unfractionated Heparin"] UnfractionatedHeparin
              where UnfractionatedHeparin.dosage.route in "Intravenous route"
          )
            union ["MedicationAdministration": "Direct Thrombin Inhibitor"]
            union ["MedicationAdministration": "Glycoprotein IIb/IIIa Inhibitors"] ) AnticoagulantMedication
            where AnticoagulantMedication.status = 'completed'
            return {
              id: AnticoagulantMedication.id,
              LowRiskDatetime: start of AnticoagulantMedication.effective.toInterval ( )
            }
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Low Risk for VTE or Anticoagulant Administered From Day of Start of Hospitalization To Day After Admission
    define "Low Risk for VTE or Anticoagulant Administered From Day of Start of Hospitalization To Day After Admission":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        with "Low Risk Indicator For VTE" LowRiskForVTE
          such that LowRiskForVTE.LowRiskDatetime during day of QualifyingEncounter.FromDayOfStartOfHospitalizationToDayAfterAdmission ( )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Low Risk for VTE or Anticoagulant Administered on Day of or Day After Procedure
    define "Low Risk for VTE or Anticoagulant Administered on Day of or Day After Procedure":
      from
        VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
        ["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
        "Low Risk Indicator For VTE" LowRiskForVTE
        where AnesthesiaProcedure.status = 'completed'
          and AnesthesiaProcedure.performed.toInterval ( ) ends 1 day after day of start of QualifyingEncounter.period
          and LowRiskForVTE.LowRiskDatetime during day of ( end of AnesthesiaProcedure.performed.toInterval ( ) ).CalendarDayOfOrDayAfter ( )
        return QualifyingEncounter
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with Low Risk for VTE or Anticoagulant Administered
    define "Encounter with Low Risk for VTE or Anticoagulant Administered":
      "Low Risk for VTE or Anticoagulant Administered From Day of Start of Hospitalization To Day After Admission"
        union "Low Risk for VTE or Anticoagulant Administered on Day of or Day After Procedure"
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No VTE Prophylaxis Medication Administered or Ordered
    define "No VTE Prophylaxis Medication Administered or Ordered":
      ( ( [MedicationAdministrationNotDone: "Low Dose Unfractionated Heparin for VTE Prophylaxis"]
          union [MedicationAdministrationNotDone: "Low Molecular Weight Heparin for VTE Prophylaxis"]
          union [MedicationAdministrationNotDone: "Injectable Factor Xa Inhibitor for VTE Prophylaxis"]
          union [MedicationAdministrationNotDone: "Warfarin"]
          union [MedicationAdministrationNotDone: "Rivaroxaban for VTE Prophylaxis"] ) NoMedicationAdm
          return {
            id: NoMedicationAdm.id,
            MedicationStatusReason: NoMedicationAdm.statusReason,
            authoredOn: NoMedicationAdm.recorded
          }
      )
        union ( ( ["MedicationNotRequested": "Low Dose Unfractionated Heparin for VTE Prophylaxis"]
            union ["MedicationNotRequested": "Low Molecular Weight Heparin for VTE Prophylaxis"]
            union ["MedicationNotRequested": "Injectable Factor Xa Inhibitor for VTE Prophylaxis"]
            union ["MedicationNotRequested": "Warfarin"]
            union ["MedicationNotRequested": "Rivaroxaban for VTE Prophylaxis"] ) NoMedicationOrder
            where NoMedicationOrder.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
            return {
              id: NoMedicationOrder.id,
              MedicationStatusReason: NoMedicationOrder.reasonCode,
              authoredOn: NoMedicationOrder.authoredOn
            }
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No VTE Prophylaxis Medication Due to Medical Reason From Day of Start of Hospitalization To Day After Admission
    define "No VTE Prophylaxis Medication Due to Medical Reason From Day of Start of Hospitalization To Day After Admission":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        with "No VTE Prophylaxis Medication Administered or Ordered" NoVTEMedication
          such that NoVTEMedication.MedicationStatusReason in "Medical Reason For Not Providing Treatment"
            and NoVTEMedication.authoredOn during day of QualifyingEncounter.FromDayOfStartOfHospitalizationToDayAfterAdmission ( )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No Mechanical VTE Prophylaxis Performed or Ordered
    define "No Mechanical VTE Prophylaxis Performed or Ordered":
      ( ( [ServiceNotRequested: "Venous foot pumps"]
          union [ServiceNotRequested: "Intermittent pneumatic compression devices"]
          union [ServiceNotRequested: "Graduated compression stockings"] ) DeviceNotOrder
          where DeviceNotOrder.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
          return {
            id: DeviceNotOrder.id,
            requestStatusReason: DeviceNotOrder.reasonRefused,
            authoredOn: DeviceNotOrder.authoredOn
          }
      )
        union ( ( [ProcedureNotDone: "Application of Intermittent Pneumatic Compression Devices"]
            union [ProcedureNotDone: "Application of Venous Foot Pumps"]
            union [ProcedureNotDone: "Application of Graduated Compression Stockings"] ) DeviceNotApplied
            let DeviceNotDoneTiming: DeviceNotApplied.recorded
            return {
              id: DeviceNotApplied.id,
              requestStatusReason: DeviceNotApplied.statusReason,
              authoredOn: DeviceNotDoneTiming
            }
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No Mechanical VTE Prophylaxis Due to Medical Reason From Day of Start of Hospitalization To Day After Admission
    define "No Mechanical VTE Prophylaxis Due to Medical Reason From Day of Start of Hospitalization To Day After Admission":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        with "No Mechanical VTE Prophylaxis Performed or Ordered" NoVTEDevice
          such that NoVTEDevice.requestStatusReason in "Medical Reason For Not Providing Treatment"
            and NoVTEDevice.authoredOn during day of QualifyingEncounter.FromDayOfStartOfHospitalizationToDayAfterAdmission ( )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No VTE Prophylaxis Medication Due to Medical Reason on Day of or Day After Procedure
    define "No VTE Prophylaxis Medication Due to Medical Reason on Day of or Day After Procedure":
      from
        VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
        ["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
        "No VTE Prophylaxis Medication Administered or Ordered" NoVTEMedication
        where NoVTEMedication.MedicationStatusReason in "Medical Reason For Not Providing Treatment"
          and AnesthesiaProcedure.status = 'completed'
          and AnesthesiaProcedure.performed.toInterval ( ) ends 1 day after day of start of QualifyingEncounter.period
          and NoVTEMedication.authoredOn during day of ( end of AnesthesiaProcedure.performed.toInterval ( ) ).CalendarDayOfOrDayAfter ( )
        return QualifyingEncounter
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No Mechanical VTE Prophylaxis Due to Medical Reason on Day of or Day After Procedure
    define "No Mechanical VTE Prophylaxis Due to Medical Reason on Day of or Day After Procedure":
      from
        VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
        ["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
        "No Mechanical VTE Prophylaxis Performed or Ordered" NoVTEDevice
        where NoVTEDevice.requestStatusReason in "Medical Reason For Not Providing Treatment"
          and AnesthesiaProcedure.status = 'completed'
          and AnesthesiaProcedure.performed.toInterval ( ) ends 1 day after day of start of QualifyingEncounter.period
          and NoVTEDevice.authoredOn during day of ( end of AnesthesiaProcedure.performed.toInterval ( ) ).CalendarDayOfOrDayAfter ( )
        return QualifyingEncounter
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with No VTE Prophylaxis Due to Medical Reason
    define "Encounter with No VTE Prophylaxis Due to Medical Reason":
      ( "No VTE Prophylaxis Medication Due to Medical Reason From Day of Start of Hospitalization To Day After Admission"
          intersect "No Mechanical VTE Prophylaxis Due to Medical Reason From Day of Start of Hospitalization To Day After Admission"
      )
        union ( "No VTE Prophylaxis Medication Due to Medical Reason on Day of or Day After Procedure"
            intersect "No Mechanical VTE Prophylaxis Due to Medical Reason on Day of or Day After Procedure"
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No Mechanical or Pharmacological VTE Prophylaxis Due to Patient Refusal
    define "No Mechanical or Pharmacological VTE Prophylaxis Due to Patient Refusal":
      ( "No VTE Prophylaxis Medication Administered or Ordered" NoVTEMedication
          where NoVTEMedication.MedicationStatusReason in "Patient Refusal"
      )
        union ( "No Mechanical VTE Prophylaxis Performed or Ordered" NoVTEDevice
            where NoVTEDevice.requestStatusReason in "Patient Refusal"
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No VTE Prophylaxis Due to Patient Refusal From Day of Start of Hospitalization To Day After Admission
    define "No VTE Prophylaxis Due to Patient Refusal From Day of Start of Hospitalization To Day After Admission":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        with "No Mechanical or Pharmacological VTE Prophylaxis Due to Patient Refusal" PatientRefusal
          such that PatientRefusal.authoredOn during day of QualifyingEncounter.FromDayOfStartOfHospitalizationToDayAfterAdmission ( )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR No VTE Prophylaxis Due to Patient Refusal on Day of or Day After Procedure
    define "No VTE Prophylaxis Due to Patient Refusal on Day of or Day After Procedure":
      from
        VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
        ["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
        "No Mechanical or Pharmacological VTE Prophylaxis Due to Patient Refusal" PatientRefusal
        where AnesthesiaProcedure.status = 'completed'
          and QICoreCommon."ToInterval" ( AnesthesiaProcedure.performed ) ends 1 day after day of start of QualifyingEncounter.period
          and PatientRefusal.authoredOn during day of ( end of AnesthesiaProcedure.performed.toInterval ( ) ).CalendarDayOfOrDayAfter ( )
        return QualifyingEncounter
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with No VTE Prophylaxis Due to Patient Refusal
    define "Encounter with No VTE Prophylaxis Due to Patient Refusal":
      "No VTE Prophylaxis Due to Patient Refusal From Day of Start of Hospitalization To Day After Admission"
        union "No VTE Prophylaxis Due to Patient Refusal on Day of or Day After Procedure"
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Numerator
    define "Numerator":
      "Encounter with VTE Prophylaxis Received From Day of Start of Hospitalization To Day After Admission or Procedure"
        union ( "Encounter with Medication Oral Factor Xa Inhibitor Administered on Day of or Day After Admission or Procedure"
            intersect ( "Encounter with Prior or Present Diagnosis of Atrial Fibrillation or Prior Diagnosis of VTE"
                union "Encounter with Prior or Present Procedure of Hip or Knee Replacement Surgery"
            )
        )
        union "Encounter with Low Risk for VTE or Anticoagulant Administered"
        union "Encounter with No VTE Prophylaxis Due to Medical Reason"
        union "Encounter with No VTE Prophylaxis Due to Patient Refusal"
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Initial Population
    define "Initial Population":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions"
    Library Name Name
    VenousThromboembolismProphylaxisFHIR 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
    VenousThromboembolismProphylaxisFHIR 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
    VenousThromboembolismProphylaxisFHIR SDE Ethnicity
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter Less Than 2 Days
    define "Encounter Less Than 2 Days":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        where QualifyingEncounter.period.lengthInDays ( ) < 2
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with ICU Location Stay 1 Day or More
    define "Encounter with ICU Location Stay 1 Day or More":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        where exists ( QualifyingEncounter.location Location
            where Location.location.getLocation ( ).type in "Intensive Care Unit"
              and Location.period.lengthInDays ( ) >= 1
              and Location.period starts on or after start of QualifyingEncounter.period
              and date from ( start of Location.period ) during ( start of QualifyingEncounter.period ).CalendarDayOfOrDayAfter ( )
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with Principal Diagnosis of Mental Disorder or Stroke
    define "Encounter with Principal Diagnosis of Mental Disorder or Stroke":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        where QualifyingEncounter.principalDiagnosis ( ).code in "Mental Health Diagnoses"
          or QualifyingEncounter.principalDiagnosis ( ).code in "Hemorrhagic Stroke"
          or QualifyingEncounter.principalDiagnosis ( ).code in "Ischemic Stroke"
    Library Name Name
    VenousThromboembolismProphylaxisFHIR SCIP VTE Selected Surgery
    define "SCIP VTE Selected Surgery":
      ( ["Procedure": "General Surgery"]
        union ["Procedure": "Gynecological Surgery"]
        union ["Procedure": "Hip Fracture Surgery"]
        union ["Procedure": "Hip Replacement Surgery"]
        union ["Procedure": "Intracranial Neurosurgery"]
        union ["Procedure": "Knee Replacement Surgery"]
        union ["Procedure": "Urological Surgery"] ) Procedure
        where Procedure.status = 'completed'
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with Principal Procedure of SCIP VTE Selected Surgery
    define "Encounter with Principal Procedure of SCIP VTE Selected Surgery":
      from
        VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
        "SCIP VTE Selected Surgery" SelectedProcedure
        let EncounterProcedure: singleton from ( QualifyingEncounter.procedure P
            where P.rank = 1
        )
        where EncounterProcedure.procedure.reference.getId ( ) = SelectedProcedure.id
          and end of SelectedProcedure.performed.toInterval ( ) during QualifyingEncounter.period
        return QualifyingEncounter
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Intervention Comfort Measures
    define "Intervention Comfort Measures":
      ( ["ServiceRequest": "Comfort Measures"] InterventionRequest
          where InterventionRequest.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
            and InterventionRequest.status in { 'active', 'on-hold', 'completed' }
            and InterventionRequest.doNotPerform is not true
      )
        union ( ["Procedure": "Comfort Measures"] InterventionPerformed
            where InterventionPerformed.status in { 'completed', 'in-progress' }
        )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with Intervention Comfort Measures From Day of Start of Hospitalization To Day After Admission
    define "Encounter with Intervention Comfort Measures From Day of Start of Hospitalization To Day After Admission":
      VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        with "Intervention Comfort Measures" ComfortMeasure
          such that Coalesce(start of ComfortMeasure.performed.toInterval(), ComfortMeasure.authoredOn) during day of QualifyingEncounter.FromDayOfStartOfHospitalizationToDayAfterAdmission ( )
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Encounter with Intervention Comfort Measures on Day of or Day After Procedure
    define "Encounter with Intervention Comfort Measures on Day of or Day After Procedure":
      from
        VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
        ["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
        "Intervention Comfort Measures" ComfortMeasure
        where AnesthesiaProcedure.status = 'completed'
          and AnesthesiaProcedure.performed.toInterval ( ) ends 1 day after day of start of QualifyingEncounter.period
          and Coalesce(start of ComfortMeasure.performed.toInterval(), ComfortMeasure.authoredOn) during day of ( end of AnesthesiaProcedure.performed.toInterval ( ) ).CalendarDayOfOrDayAfter ( )
        return QualifyingEncounter
    Library Name Name
    VenousThromboembolismProphylaxisFHIR Denominator Exclusions
    define "Denominator Exclusions":
      "Encounter Less Than 2 Days"
        union "Encounter with ICU Location Stay 1 Day or More"
        union "Encounter with Principal Diagnosis of Mental Disorder or Stroke"
        union "Encounter with Principal Procedure of SCIP VTE Selected Surgery"
        union "Encounter with Intervention Comfort Measures From Day of Start of Hospitalization To Day After Admission"
        union "Encounter with Intervention Comfort Measures on Day of or Day After Procedure"
    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
    VenousThromboembolismProphylaxisFHIR SDE Race
    define "SDE Race":
      SDE."SDE Race"
    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
    VTE FromDayOfStartOfHospitalizationToDayAfterAdmission
    define fluent function "FromDayOfStartOfHospitalizationToDayAfterAdmission"(Encounter Encounter ):
    	Interval[ date from (start of Encounter.hospitalizationWithObservation()), date from (start of Encounter.period) + 1 days]
    Library Name Name
    CQMCommon hospitalizationWithObservation
    /*
    @description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter
    */
    define fluent function hospitalizationWithObservation(TheEncounter Encounter ):
      TheEncounter Visit
      		let ObsVisit: Last([Encounter: "Observation Services"] LastObs
      				where LastObs.status = 'finished'
                and LastObs.period ends 1 hour or less on or before start of Visit.period
      				sort by end of period
      			),
      			VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
      			EDVisit: Last([Encounter: "Emergency Department Visit"] LastED
      				where LastED.status = 'finished'
                and LastED.period ends 1 hour or less on or before VisitStart
      				sort by end of period
      			)
      		return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]
    Library Name Name
    TJCOverall CalendarDayOfOrDayAfter
    define fluent function CalendarDayOfOrDayAfter(StartValue DateTime):
      Interval [date from (StartValue), date from (StartValue) + 1 day]
    Library Name Name
    QICoreCommon isActive
    /* Candidates for FHIRCommon */
    
    /*
    @description: Returns true if the given condition has a clinical status of active, recurrence, or relapse
    */
    define fluent function isActive(condition Condition):
      condition.clinicalStatus ~ "active"
        or condition.clinicalStatus ~ "recurrence"
        or condition.clinicalStatus ~ "relapse"
    Library Name Name
    QICoreCommon earliest
    /*
    @description: Given an interval, return the starting point if the interval has a starting boundary specified,
    otherwise, return the ending point
    */
    define fluent function earliest(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):
      (choice.toInterval()) period
        return
          if (period."hasStart"()) then start of period
          else end of period
    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
    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
            }
    Library Name Name
    CQMCommon lengthInDays
    /*
    @description: Calculates the difference in calendar days between the start and end of the given interval.
    */
    define fluent function lengthInDays(Value Interval<DateTime> ):
      difference in days between start of Value and end of Value
    Library Name Name
    CQMCommon getLocation
    /*
    @description: Returns the Location resource specified by the given reference.
    */
    define fluent function getLocation(reference Reference ):
      singleton from (
        [Location] L where L.id = reference.reference.getId()
      )
    Library Name Name
    CQMCommon principalDiagnosis
    /*
    @description: Returns the condition that is specified as the principal diagnosis for the encounter
    */
    define fluent function principalDiagnosis(Encounter Encounter ):
    	singleton from ((Encounter.diagnosis D where D.rank = 1 and D.use ~ "Billing") PD
          return singleton from ([Condition] C where C.id = PD.condition.reference.getId())
    	)