Quality Measure Implementation Guide (STU5)
5.0.0-ballot - ballot United States of America flag

This page is part of the Quality Measure STU2 for FHIR R4 Implementation Guide (v5.0.0-ballot: STU5 (v5.0.0) Ballot 1) based on FHIR (HL7® FHIR® Standard) R4. The current version which supersedes this version is 4.0.0. For a full list of available versions, see the Directory of published versions

Example Measure: EXM108 - Venous Thromboembolism Prophylaxis

Active as of 2022-02-22
Id: EXM108-FHIR
Download cql: EXM108-FHIR.cql
Url: EXM108 - Venous Thromboembolism Prophylaxis
Version: 5.0.0-ballot
Identifier:

value: 108

Name: EXM108
Title: EXM108 - Venous Thromboembolism Prophylaxis
Status: active
Experimental: true
Scoring:

Proportion

Improvement Notation:

Increased score indicates improvement

Type:

process

Date: 2022-02-22
Publisher: HL7 International / Clinical Quality Information
Description:

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

Use Context:
codevalue
program
Jurisdiction: US
Topic: 57024-2
Copyright:

Measure specifications are in the Public Domain.

LOINC(R) is a registered trademark of the Regenstrief Institute.

This material contains SNOMED Clinical Terms(R) (SNOMED CT(C)) copyright 2004-2017 International Health Terminology Standards Development 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

Approval Date: 2019-03-08
Last Review Date: 2019-03-08
Effective Period: 2018-01-01..2018-12-31
Population Criteria:
Initial Population: Patients age 18 and older discharged from hospital inpatient acute care without a diagnosis of venous thromboembolism (VTE) or obstetrics with a length of stay less than or equal to 120 days that ends during the measurement period
Numerator: Patients who received VTE prophylaxis: - the day of or 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 Patients who have documentation of a reason why no VTE prophylaxis was given: - between arrival and hospital admission - the day of or 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)
Denominator: All patients in the initial population
Denominator Exclusion: * Patients who have a length of stay less than 2 days * Patients with comfort measures documented anytime between arrival and the day after hospital admission * Patients with comfort measures documented by the day after surgery end date for surgeries that start the day of or the day after hospital admission * 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 * Patients with a principal diagnosis of mental disorders or stroke * Patients with a principal procedure of Surgical Care Improvement Project (SCIP) VTE selected surgeries
Supplemental Data Elements: SDE Ethnicity SDE Payer SDE Race SDE Sex
Libraries:
EXM108 - Venous Thromboembolism Prophylaxis Library
Related Artifact Dependencies:
  • http://hl7.org/fhir/us/cqfmeasures/Library/SupplementalDataElements|2.0.000
  • http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
  • MAT Global Common Functions FHIR Library
  • http://hl7.org/fhir/us/cqfmeasures/Library/TJCOverall|4.0.000
  • VTE ICU Library
  • Condition Clinical Status Codes
  • Logical Observation Identifiers, Names and Codes (LOINC)
  • 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
  • Device Application
  • Intermittent pneumatic compression devices (IPC)
  • Venous foot pumps (VFP)
  • Graduated compression stockings (GCS)
  • 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
  • Observation Services
  • Emergency Department Visit
  • Medical Reason
  • 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:
    nameuseminmaxtype
    Measurement Period in 0 1 Period
    SDE Sex out 0 1 Coding
    Numerator out 0 * Encounter
    Denominator out 0 * Encounter
    SDE Payer out 0 * Resource
    Initial Population out 0 * Encounter
    SDE Ethnicity out 0 * Coding
    Denominator Exclusion out 0 * Resource
    SDE Race out 0 * Coding
    DataRequirements:
    TypeMust SupportValueset NameValueset
    Patient extension value birthDate url
    Encounter period type Emergency Department Visit Emergency Department Visit
    Encounter period type Observation Services Observation Services
    Encounter period type status Encounter Inpatient Encounter Inpatient
    MedicationAdministration dosage.route dosage medication Unfractionated Heparin Unfractionated Heparin
    MedicationAdministration medication Direct Thrombin Inhibitor Direct Thrombin Inhibitor
    MedicationAdministration medication Glycoprotein IIb/IIIa Inhibitors Glycoprotein IIb/IIIa Inhibitors
    MedicationAdministration dosage.route dosage medication status Low Dose Unfractionated Heparin for VTE Prophylaxis Low Dose Unfractionated Heparin for VTE Prophylaxis
    MedicationAdministration medication status Low Molecular Weight Heparin for VTE Prophylaxis Low Molecular Weight Heparin for VTE Prophylaxis
    MedicationAdministration medication status Injectable Factor Xa Inhibitor for VTE Prophylaxis Injectable Factor Xa Inhibitor for VTE Prophylaxis
    MedicationAdministration medication status Warfarin Warfarin
    MedicationAdministration effective medication status Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment
    MedicationRequest medication Low Dose Unfractionated Heparin for VTE Prophylaxis Low Dose Unfractionated Heparin for VTE Prophylaxis
    MedicationRequest medication Low Molecular Weight Heparin for VTE Prophylaxis Low Molecular Weight Heparin for VTE Prophylaxis
    MedicationRequest medication Injectable Factor Xa Inhibitor for VTE Prophylaxis Injectable Factor Xa Inhibitor for VTE Prophylaxis
    MedicationRequest medication Warfarin Warfarin
    ServiceRequest code Venous foot pumps (VFP) Venous foot pumps (VFP)
    ServiceRequest code Intermittent pneumatic compression devices (IPC) Intermittent pneumatic compression devices (IPC)
    ServiceRequest code Graduated compression stockings (GCS) Graduated compression stockings (GCS)
    ServiceRequest code intent Comfort Measures Comfort Measures
    Procedure code General Surgery General Surgery
    Procedure code Gynecological Surgery Gynecological Surgery
    Procedure code Hip Fracture Surgery Hip Fracture Surgery
    Procedure code Intracranial Neurosurgery Intracranial Neurosurgery
    Procedure code Urological Surgery Urological Surgery
    Procedure code status Comfort Measures Comfort Measures
    Procedure code Hip Replacement Surgery Hip Replacement Surgery
    Procedure code Knee Replacement Surgery Knee Replacement Surgery
    Procedure code statusReason usedCode id status Device Application Device Application
    Procedure code performed status General or Neuraxial Anesthesia General or Neuraxial Anesthesia
    Condition id
    Condition code clinicalStatus onset Atrial Fibrillation/Flutter Atrial Fibrillation/Flutter
    Condition code clinicalStatus onset Venous Thromboembolism Venous Thromboembolism
    Observation code value status
    Observation code id issued value status INR INR
    Coverage period type Payer Payer
    Location id
    Direct Reference Codes:
    displaycodesystem
    active Condition Clinical Status Codes
    recurrence Condition Clinical Status Codes
    relapse Condition Clinical Status Codes
    inactive Condition Clinical Status Codes
    remission Condition Clinical Status Codes
    resolved Condition Clinical Status Codes
    Risk for venous thromboembolism 72136-5 Logical Observation Identifiers, Names and Codes (LOINC)
    Logic Definitions:
    GroupScoringPopulation CriteriaExpression
    Measure scoring:

    Proportion

    Initial Population
    define "Initial Population":
      "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions"
    Numerator
    define "Numerator":
        "Encounter With VTE Prophylaxis Received on Day of or 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 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"
    Denominator
    define "Denominator":
          "Initial Population"
    Denominator Exclusion
    define "Denominator Exclusion":
        "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 NameName
    SupplementalDataElements SDE Sex
    define "SDE Sex":
      case
          when Patient.gender = 'male' then Code { code: 'M', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Male' }
          when Patient.gender = 'female' then Code { code: 'F', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Female' }
          else null
        end
    Library NameName
    EXM108-FHIR SDE Sex
    define "SDE Sex":
    	SDE."SDE Sex"
    Library NameName
    MATGlobalCommonFunctions Inpatient Encounter
    define "Inpatient Encounter":
    	[Encounter: "Encounter Inpatient"] EncounterInpatient
    		where EncounterInpatient.status = 'finished'
    		    and "LengthInDays"(EncounterInpatient.period) <= 120
    			and EncounterInpatient.period ends during "Measurement Period"
    Library NameName
    EXM108-FHIR Admission Without VTE or Obstetrical Conditions
    define "Admission Without VTE or Obstetrical Conditions":
    	  	Global."Inpatient Encounter" InpatientEncounter
    		    where not (exists (Global.EncounterDiagnosis(InpatientEncounter)) EncounterDiagnosis
                  where (EncounterDiagnosis.code in "Obstetrics"
    								or EncounterDiagnosis.code in "Venous Thromboembolism"
    								or EncounterDiagnosis.code in "Obstetrics VTE"
    			         )
            )
    Library NameName
    EXM108-FHIR Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions
    // Note: added FHIRHelpers.ToDate() in R4
    define "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions":
        ( Global."Inpatient Encounter" InpatientEncounter
        		with ["Patient"] BirthDate
        			such that Global."CalendarAgeInYearsAt"(FHIRHelpers.ToDate(BirthDate.birthDate), start of InpatientEncounter.period) >= 18
        )
        intersect "Admission Without VTE or Obstetrical Conditions"
    Library NameName
    EXM108 VTE Prophylaxis by Medication Administered or Device Applied
    // 10/29: Replaced DeviceUseStatement with Procedure with a new value set and procedure.usdCode for specifying devices
    define "VTE Prophylaxis by Medication Administered or Device Applied":
      ( ["MedicationAdministration": medication in "Low Dose Unfractionated Heparin for VTE Prophylaxis"] VTEMedication
          where VTEMedication.status ='completed'
    			     and VTEMedication.dosage.route in "Subcutaneous route"
      )
       union (["MedicationAdministration": medication in "Low Molecular Weight Heparin for VTE Prophylaxis"] LMWH where LMWH.status = 'completed')
        union (["MedicationAdministration": medication in "Injectable Factor Xa Inhibitor for VTE Prophylaxis"] FactorXa where FactorXa.status = 'completed')
         union (["MedicationAdministration": medication in "Warfarin"] Warfarin where Warfarin.status = 'completed')
          union (
              ["Procedure": "Device Application"] DeviceApplied
              where DeviceApplied.status = 'complete'
                    and (DeviceApplied.usedCode in "Intermittent pneumatic compression devices (IPC)"
                        or DeviceApplied.usedCode in"Venous foot pumps (VFP)"
                        or DeviceApplied.usedCode in "Graduated compression stockings (GCS)"
                        )
              )
    Library NameName
    EXM108-FHIR Encounter With VTE Prophylaxis Received on Day of or Day After Admission or Procedure
    define "Encounter With VTE Prophylaxis Received on Day of or Day After Admission or Procedure":
     	( from
       			"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
       			"VTE Prophylaxis by Medication Administered or Device Applied" VTEProphylaxis
      		where Coalesce(Global."Normalize Interval"(VTEProphylaxis.effective), Global."Normalize Interval"(VTEProphylaxis.performed)) starts during TJC."CalendarDayOfOrDayAfter"(start of QualifyingEncounter.period)
      		return QualifyingEncounter
     	)
     	union (
        from
      			"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
      			["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
      			"VTE Prophylaxis by Medication Administered or Device Applied" VTEProphylaxis
    			where Global."Normalize Interval"(AnesthesiaProcedure.performed) ends 1 day after day of start of QualifyingEncounter.period
    				and Coalesce(Global."Normalize Interval"(VTEProphylaxis.effective), Global."Normalize Interval"(VTEProphylaxis.performed)) starts during TJC."CalendarDayOfOrDayAfter"(end of Global."Normalize Interval"(AnesthesiaProcedure.performed))
    			return QualifyingEncounter
    	)
    Library NameName
    EXM108-FHIR 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
        		"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
      			["MedicationAdministration": medication in "Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment"] FactorXaMedication
        where FactorXaMedication.status = 'completed'
          and Global."Normalize Interval"(FactorXaMedication.effective) starts during TJC."CalendarDayOfOrDayAfter"(start of QualifyingEncounter.period)
        return QualifyingEncounter
        )
        union ( from
        				  "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
          				["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
          				["MedicationAdministration": medication in "Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment"] FactorXaMedication
          			where FactorXaMedication.status = 'completed'
                    and AnesthesiaProcedure.status = 'completed'
          			    and Global."Normalize Interval"(AnesthesiaProcedure.performed) ends 1 day after day of start of QualifyingEncounter.period
          					and Global."Normalize Interval"(FactorXaMedication.effective) starts during TJC."CalendarDayOfOrDayAfter"(end of Global."Normalize Interval"(AnesthesiaProcedure.performed))
          			return QualifyingEncounter
          		)
    Library NameName
    EXM108-FHIR Encounter With Prior or Present Diagnosis of Atrial Fibrillation or VTE
    /*NOTE: Feedback at Digitial Quality Summit 2019 indicates verificationStatus may be difficult for implementers to retrieve
            both condition.clinicalStatus and condition.verificationStatus = 'confirmed'
    */
    define "Encounter With Prior or Present Diagnosis of Atrial Fibrillation or VTE":
    	( "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
    		with ["Condition": code in "Atrial Fibrillation/Flutter"] AtrialFibrillation
    		such that FHIRHelpers.ToConcept(AtrialFibrillation.clinicalStatus) in { Global."active", Global."recurrence", Global."relapse" }
    			and Global."Normalize Interval"(AtrialFibrillation.onset) starts on or before end of QualifyingEncounter.period
        )
        union ( "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        				where Global.EncounterDiagnosis(QualifyingEncounter).code in "Atrial Fibrillation/Flutter"
        			)
        union ( "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        				with ["Condition": code in "Venous Thromboembolism"] VTEDiagnosis
        				such that  FHIRHelpers.ToConcept(VTEDiagnosis.clinicalStatus) in { Global."inactive", Global."remission", Global."resolved" }
          					//and VTEDiagnosis.verificationStatus = 'confirmed'
        				and Global."Normalize Interval"(VTEDiagnosis.onset) before start of QualifyingEncounter.period
          		)
    Library NameName
    EXM108-FHIR 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":
    	"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 Global."Normalize Interval"(HipKneeProcedure.performed) starts on or before end of QualifyingEncounter.period
    Library NameName
    EXM108-FHIR Is In Low Risk for VTE or On Anticoagulant
    define "Is In Low Risk for VTE or On Anticoagulant":
    	  ( ["Observation": "Risk for venous thromboembolism"] VTERiskAssessment
    			  where VTERiskAssessment.value in "Low Risk"
            and VTERiskAssessment.status in {'final','amended', 'corrected'}
    	  )
      union ( ["Observation": "INR"] INRLabTest
            where INRLabTest.value as Quantity > 3.0
                and INRLabTest.status in {'final','amended', 'corrected'}
            return "Observation" { id: INRLabTest.id, effective: 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 = 'complete'
             return "Observation" { id: AnticoagulantMedication.id, effective: AnticoagulantMedication.effective }
          )
    Library NameName
    EXM108-FHIR 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":
     	"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        with "Is In Low Risk for VTE or On Anticoagulant" VTERiskAssessment
        such that Global."Normalize Interval"(VTERiskAssessment.effective) starts during VTEICU."FromDayOfStartOfHospitalizationToDayAfterAdmission"(QualifyingEncounter)
    Library NameName
    EXM108-FHIR 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
       		"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
       		["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
       		"Is In Low Risk for VTE or On Anticoagulant" VTERiskAssessment
    	where Global."Normalize Interval"(AnesthesiaProcedure.performed) ends 1 day after day of start of QualifyingEncounter.period
     			and Global."Normalize Interval"(VTERiskAssessment.effective) starts during TJC."CalendarDayOfOrDayAfter"(end of Global."Normalize Interval"(AnesthesiaProcedure.performed))
    	return QualifyingEncounter
    Library NameName
    EXM108-FHIR 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 NameName
    EXM108-FHIR No VTE Prophylaxis Medication Administered or Ordered
    define "No VTE Prophylaxis Medication Administered or Ordered":
       ((	["MedicationAdministration": medication in "Low Dose Unfractionated Heparin for VTE Prophylaxis"]
         union
    	    ["MedicationAdministration": medication in "Low Molecular Weight Heparin for VTE Prophylaxis"]
         union
    	    ["MedicationAdministration": medication in "Injectable Factor Xa Inhibitor for VTE Prophylaxis"]
         union
    	    ["MedicationAdministration": medication in "Warfarin"]
           ) MedicationAdm
           where MedicationAdm.status = 'not-done'
            )
      union
    	   ((	["MedicationRequest": medication in "Low Dose Unfractionated Heparin for VTE Prophylaxis"]
      	union
      	 ["MedicationRequest": medication in "Low Molecular Weight Heparin for VTE Prophylaxis"]
        union
        	["MedicationRequest": medication in "Injectable Factor Xa Inhibitor for VTE Prophylaxis"]
        union
        	["MedicationRequest": medication in "Warfarin"]
        ) MedicationOrder
        	where	MedicationOrder.doNotPerform is true
            and MedicationOrder.status in {'completed', 'cancelled'}
            //11/5 discussion: all expressions for QI-Core must include a status.
            //Therefore, we need ServiceRequest.status = completed; and MedicationRequest.status = cancelled (or completed, since cancelled indicates it was once ordered but intentionally never filled).
            //So the not done issue is handled by ServiceRequest.doNotPerform = True  Or MedicationRequest.doNotPerform = True
        )
    Library NameName
    EXM108-FHIR 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":
       	"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
           with	"No VTE Prophylaxis Medication Administered or Ordered" NoVTEMedication
         	such that Coalesce(NoVTEMedication.statusReason,NoVTEMedication.reasonCode) in "Medical Reason"
          			and Coalesce(NoVTEMedication.authoredOn, start of Global."Normalize Interval"(NoVTEMedication.effective)) during VTEICU."FromDayOfStartOfHospitalizationToDayAfterAdmission"(QualifyingEncounter)
    Library NameName
    EXM108-FHIR No VTE Prophylaxis Device Applied or Ordered
    define "No VTE Prophylaxis Device Applied or Ordered":
      ((
        ["ServiceRequest": "Venous foot pumps (VFP)"]
        union ["ServiceRequest": "Intermittent pneumatic compression devices (IPC)"]
        union ["ServiceRequest": "Graduated compression stockings (GCS)"]
        ) DeviceOrder
        where DeviceOrder.status = 'completed'
        //11/5 discussion: all expressions for QI-Core must include a status
        //ServiceRequest.status -  draft | active | suspended | completed | entered-in-error | cancelled
            and DeviceOrder.doNotPerform is true
        return {id: DeviceOrder.id, requestStatusReason: GetStatusReason(DeviceOrder), authoredOn: DeviceOrder.authoredOn}
        )
      union
        (
          ["Procedure": "Device Application"] DeviceApplied
          let DeviceNotDoneTiming: Global.GetExtension(DeviceApplied, 'qicore-recorded').value
          where (DeviceApplied.usedCode in "Intermittent pneumatic compression devices (IPC)"
                or DeviceApplied.usedCode in "Venous foot pumps (VFP)"
                or DeviceApplied.usedCode in "Graduated compression stockings (GCS)"
                )
             and  DeviceApplied.status = 'not-done'
             return {id: DeviceApplied.id, requestStatusReason: DeviceApplied.statusReason, authoredOn: DeviceNotDoneTiming}
    
        )
    Library NameName
    EXM108-FHIR No VTE Prophylaxis Device Due to Medical Reason From Day of Start of Hospitalization To Day After Admission
    define "No VTE Prophylaxis Device Due to Medical Reason From Day of Start of Hospitalization To Day After Admission":
      "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
      	with "No VTE Prophylaxis Device Applied or Ordered" NoVTEDevice
          such that NoVTEDevice.requestStatusReason in "Medical Reason"
            and  NoVTEDevice.authoredOn during VTEICU."FromDayOfStartOfHospitalizationToDayAfterAdmission"(QualifyingEncounter)
    Library NameName
    EXM108-FHIR 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
      		"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 Coalesce(NoVTEMedication.statusReason,NoVTEMedication.reasonCode) in "Medical Reason"
    			and AnesthesiaProcedure.status = 'completed'
    			and Global."Normalize Interval"(AnesthesiaProcedure.performed) ends 1 day after day of start of QualifyingEncounter.period
    			and Coalesce(NoVTEMedication.authoredOn, start of Global."Normalize Interval"(NoVTEMedication.effective)) during TJC."CalendarDayOfOrDayAfter"(end of Global."Normalize Interval"(AnesthesiaProcedure.performed))
      return QualifyingEncounter
    Library NameName
    EXM108-FHIR No VTE Prophylaxis Device Due to Medical Reason on Day of or Day After Procedure
    define "No VTE Prophylaxis Device Due to Medical Reason on Day of or Day After Procedure":
      from
      		"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
      		["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
      		"No VTE Prophylaxis Device Applied or Ordered" NoVTEDevice
      where  NoVTEDevice.requestStatusReason in "Medical Reason"
          and AnesthesiaProcedure.status = 'completed'
      		and Global."Normalize Interval"(AnesthesiaProcedure.performed) ends 1 day after day of start of QualifyingEncounter.period
          and NoVTEDevice.authoredOn during TJC."CalendarDayOfOrDayAfter"(end of Global."Normalize Interval"(AnesthesiaProcedure.performed))
      return QualifyingEncounter
    Library NameName
    EXM108-FHIR 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 VTE Prophylaxis Device 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 VTE Prophylaxis Device Due to Medical Reason on Day of or Day After Procedure"
           )
    Library NameName
    EXM108-FHIR No VTE Prophylaxis Medication or Device Due to Patient Refusal
    define "No VTE Prophylaxis Medication or Device Due to Patient Refusal":
        ( "No VTE Prophylaxis Medication Administered or Ordered" NoVTEMedication
            where Coalesce(NoVTEMedication.statusReason,NoVTEMedication.reasonCode) in "Patient Refusal"
        )
      union ("No VTE Prophylaxis Device Applied or Ordered" NoVTEDevice
               where NoVTEDevice.requestStatusReason in "Patient Refusal"
            )
    Library NameName
    EXM108-FHIR 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":
     	"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
    	 with "No VTE Prophylaxis Medication or Device Due to Patient Refusal" PatientRefusal
       such that Coalesce(start of Global."Normalize Interval"(PatientRefusal.effective), PatientRefusal.authoredOn)
             during VTEICU."FromDayOfStartOfHospitalizationToDayAfterAdmission"(QualifyingEncounter)
    Library NameName
    EXM108-FHIR 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
       		"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
       		["Procedure": "General or Neuraxial Anesthesia"] AnesthesiaProcedure,
       		"No VTE Prophylaxis Medication or Device Due to Patient Refusal" PatientRefusal
    	where Global."Normalize Interval"(AnesthesiaProcedure.performed) ends 1 day after day of start of QualifyingEncounter.period
     			and Coalesce(start of Global."Normalize Interval"(PatientRefusal.effective), PatientRefusal.authoredOn)
                 during TJC."CalendarDayOfOrDayAfter"(end of Global."Normalize Interval"(AnesthesiaProcedure.performed))
    	return QualifyingEncounter
    Library NameName
    EXM108-FHIR 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 NameName
    EXM108-FHIR Numerator
    define "Numerator":
        "Encounter With VTE Prophylaxis Received on Day of or 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 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 NameName
    EXM108-FHIR Initial Population
    define "Initial Population":
      "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions"
    Library NameName
    EXM108-FHIR Denominator
    define "Denominator":
          "Initial Population"
    Library NameName
    SupplementalDataElements SDE Payer
    define "SDE Payer":
      [Coverage: type in "Payer"] Payer
            return {
              code: Payer.type,
              period: Payer.period
            }
    Library NameName
    EXM108-FHIR SDE Payer
    define "SDE Payer":
    	SDE."SDE Payer"
    Library NameName
    SupplementalDataElements SDE Ethnicity
    define "SDE Ethnicity":
      (flatten (
          Patient.extension Extension
            where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'
              return Extension.extension
        )) E
          where E.url = 'ombCategory'
            or E.url = 'detailed'
          return E.value as Coding
    Library NameName
    EXM108-FHIR SDE Ethnicity
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
    Library NameName
    EXM108-FHIR Encounter Less Than 2 Days
    define "Encounter Less Than 2 Days":
      "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
      	where Global."LengthInDays"(QualifyingEncounter.period)< 2
    Library NameName
    EXM108-FHIR Encounter With ICU Location Stay 1 Day or More
    define "Encounter With ICU Location Stay 1 Day or More":
      "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        where exists ( QualifyingEncounter.location Location
        		where Global.GetLocation(Location.location).type in "Intensive Care Unit"
        			and Global."LengthInDays"(Location.period)>= 1
        			and Location.period starts during TJC."CalendarDayOfOrDayAfter"(start of QualifyingEncounter.period)
    	    )
    Library NameName
    EXM108-FHIR Encounter With Principal Diagnosis of Mental Disorder or Stroke
    define "Encounter With Principal Diagnosis of Mental Disorder or Stroke":
      "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
        where Global."PrincipalDiagnosis"(QualifyingEncounter).code in "Mental Health Diagnoses"
            or Global."PrincipalDiagnosis"(QualifyingEncounter).code in "Hemorrhagic Stroke"
            or Global."PrincipalDiagnosis"(QualifyingEncounter).code in "Ischemic Stroke"
    Library NameName
    EXM108-FHIR 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 NameName
    EXM108-FHIR Encounter With Principal Procedure of SCIP VTE Selected Surgery
    /* NOTE: 2 options to express Principal Procedure to retrive "encounter Procedure as an url" and proedure "rank as extension" in R4
              VTE-1 uses Option 1 - generic extension funtion
              VTE-2 uses Option 2 - Specific extension functions
      TODO:  Mapping Table needs revision on using "Encounter.procedure.code", "Encounter.procedure.sequence"
    */
    define "Encounter With Principal Procedure of SCIP VTE Selected Surgery":
      from
          "Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
          "SCIP VTE Selected Surgery" SelectedProcedure
          let EncounterProcedure: Global.GetExtension(QualifyingEncounter, 'qicore-encounter-procedure')
      where FHIRHelpers.ToInteger(Global.GetExtension(EncounterProcedure, 'rank').value as FHIR.positiveInt) = 1
          and Global.GetId(FHIRHelpers.ToString((Global.GetExtension(EncounterProcedure, 'procedure').value as FHIR.Reference).reference)) = SelectedProcedure.id
          and Global."Normalize Interval"(SelectedProcedure.performed) during QualifyingEncounter.period
    Library NameName
    EXM108-FHIR Intervention Comfort Measures
    define "Intervention Comfort Measures":
    	(["ServiceRequest": "Comfort Measures"] P
        		where P.intent = 'order'
      )
      	union
        	(["Procedure": "Comfort Measures"] InterventionPerformed
          	where InterventionPerformed.status in {'completed', 'in-progress'})
    Library NameName
    EXM108-FHIR 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":
    	"Encounter With Age Range and Without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
    		with "Intervention Comfort Measures" ComfortMeasure
    		such that Coalesce(start of Global."Normalize Interval"(ComfortMeasure.performed), ComfortMeasure.authoredOn) during VTEICU."FromDayOfStartOfHospitalizationToDayAfterAdmission"(QualifyingEncounter)
    Library NameName
    EXM108-FHIR 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
      		"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 Global."Normalize Interval"(AnesthesiaProcedure.performed) ends 1 day after day of start of QualifyingEncounter.period
            and Coalesce(start of Global."Normalize Interval"(ComfortMeasure.performed), ComfortMeasure.authoredOn) during TJC."CalendarDayOfOrDayAfter"(end of Global."Normalize Interval"(AnesthesiaProcedure.performed))
        return QualifyingEncounter
    Library NameName
    EXM108-FHIR Denominator Exclusion
    define "Denominator Exclusion":
        "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 NameName
    SupplementalDataElements SDE Race
    define "SDE Race":
      (flatten (
          Patient.extension Extension
            where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'
              return Extension.extension
        )) E
          where E.url = 'ombCategory'
            or E.url = 'detailed'
          return E.value as Coding
    Library NameName
    EXM108-FHIR SDE Race
    define "SDE Race":
      SDE."SDE Race"

    Contained resources