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

Library: CMS108VTEProphylaxisFHIR

Official URL: https://madie.cms.gov/Library/CMS108VTEProphylaxisFHIR Version: 0.2.003
Active as of 2024-12-05 Responsible: The Joint Commission Computable Name: CMS108VTEProphylaxisFHIR
Other Identifiers: https://madie.cms.gov/login#CMS108VTEProphylaxisFHIR (use: official, )

CMS108VTEProphylaxisFHIR

Title: CMS108VTEProphylaxisFHIR
Id: CMS108VTEProphylaxisFHIR
Version: 0.2.003
Url: https://madie.cms.gov/Library/CMS108VTEProphylaxisFHIR
official

CMS108VTEProphylaxisFHIR

Type:

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

code: logic-library

Date: 2024-12-05T19:08:40+00:00
Publisher: The Joint Commission
Description: CMS108VTEProphylaxisFHIR
Related Artifacts:

Dependencies

  • http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.206
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.39
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.41
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.50
  • 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.65
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.134
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.202
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.205
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.211
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.212
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.213
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.214
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.218
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.219
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.222
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.223
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.230
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.232
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.247
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.255
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.256
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.257
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.258
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.259
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.260
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.261
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.263
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.264
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.272
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.279
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.400
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.473
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.93
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.105.12.1004
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.1743
  • http://loinc.org
  • https://madie.cms.gov/Library/CQMCommon|2.2.000
  • https://madie.cms.gov/Library/FHIRHelpers|4.4.000
  • https://madie.cms.gov/Library/QICoreCommon|2.1.000
  • https://madie.cms.gov/Library/SupplementalDataElements|3.5.000
  • https://madie.cms.gov/Library/TJCOverall|8.15.000
  • https://madie.cms.gov/Library/VTE|8.9.000
Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient ;;;;
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;;;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.39
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.219
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.211
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.232
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.50
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.134
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.218
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.205
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration ;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.41
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.65
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.64
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.1743
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.255
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.257
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.258
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.259
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.260
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.261
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.272
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
Condition http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.202
Condition http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition ;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.279
Condition http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition ;
Observation http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation ;;;;;;; code filter:
path: code

system: http://loinc.org

code: 72136-5

display: Risk for venous thromboembolism

Observation http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab ;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.213
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.39
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.39
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.219
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.219
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.211
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.211
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.232
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.232
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.50
MedicationAdministration http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered ;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.50
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.39
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.39
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.219
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.219
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.211
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.211
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.232
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.232
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.50
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested ;;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.50
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicenotrequested ;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.230
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicenotrequested ;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.230
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicenotrequested ;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.214
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicenotrequested ;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.214
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicenotrequested ;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.256
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicenotrequested ;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.256
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone ;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.65
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone ;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.65
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone ;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.64
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone ;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.64
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone ;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone ;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66
Coverage http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage ;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest ;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
Content: text/cql
library CMS108VTEProphylaxisFHIR version '0.2.003'

using QICore version '4.1.1'

include CQMCommon version '2.2.000' called CQMCommon
include QICoreCommon version '2.1.000' called QICoreCommon
include FHIRHelpers version '4.4.000' called FHIRHelpers
include SupplementalDataElements version '3.5.000' called SDE
include TJCOverall version '8.15.000' called TJC
include VTE version '8.9.000' called VTE

codesystem "LOINC": 'http://loinc.org'

valueset "Application of Graduated Compression Stockings": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.66'
valueset "Application of Intermittent Pneumatic Compression Devices": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.65'
valueset "Application of Venous Foot Pumps": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.64'
valueset "Atrial Fibrillation or Flutter": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.202'
valueset "Comfort Measures": 'http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45'
valueset "Direct Thrombin Inhibitor": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.205'
valueset "Emergency Department Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'
valueset "General or Neuraxial Anesthesia": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.1743'
valueset "General Surgery": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.255'
valueset "Glycoprotein IIb/IIIa Inhibitors": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.41'
valueset "Graduated compression stockings": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.256'
valueset "Gynecological Surgery": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.257'
valueset "Hemorrhagic Stroke": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.212'
valueset "Ischemic Stroke": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.247'
valueset "Hip Fracture Surgery": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.258'
valueset "Hip Replacement Surgery": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.259'
valueset "Injectable Factor Xa Inhibitor for VTE Prophylaxis": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.211'
valueset "INR": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.213'
valueset "Intensive Care Unit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.206'
valueset "Intermittent pneumatic compression devices": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.214'
valueset "Intracranial Neurosurgery": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.260'
valueset "Intravenous route": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.222'
valueset "Knee Replacement Surgery": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.261'
valueset "Low Dose Unfractionated Heparin for VTE Prophylaxis": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.39'
valueset "Low Molecular Weight Heparin for VTE Prophylaxis": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.219'
valueset "Low Risk": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.400'
valueset "Medical Reason For Not Providing Treatment": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.473'
valueset "Mental Health Diagnoses": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.105.12.1004'
valueset "Obstetrical or Pregnancy Related Conditions": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.263'
valueset "Obstetrics VTE": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.264'
valueset "Oral Factor Xa Inhibitor for VTE Prophylaxis or VTE Treatment": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.134'
valueset "Patient Refusal": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.93'
valueset "Rivaroxaban for VTE Prophylaxis": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.50'
valueset "Subcutaneous route": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.223'
valueset "Unfractionated Heparin": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.218'
valueset "Urological Surgery": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.272'
valueset "Venous foot pumps": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.230'
valueset "Venous Thromboembolism": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.279'
valueset "Warfarin": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.232'

code "Risk for venous thromboembolism": '72136-5' from "LOINC" display 'Risk for venous thromboembolism'

parameter "Measurement Period" Interval<DateTime>

context Patient

define "SDE Ethnicity":
  SDE."SDE Ethnicity"

define "SDE Payer":
  SDE."SDE Payer"

define "SDE Race":
  SDE."SDE Race"

define "SDE Sex":
  SDE."SDE Sex"

define "Initial Population":
  VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions"

define "Denominator":
  "Initial Population"

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 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"

define "Encounter Less Than 2 Days":
  VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter
    where QualifyingEncounter.period.lengthInDays ( ) < 2

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 ( )
    )

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"

define "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'

define "Encounter with Principal Procedure of Selected Surgery":
  from
    VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter,
    "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

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' }
    )

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

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 ( )

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"

define "Pharmacological or Mechanical VTE Prophylaxis Received":
  ( ["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"] WarfarinAdm
        where WarfarinAdm.status = 'completed'
    )
    union ( ["MedicationAdministration": medication in "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'
    )

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
    )

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": medication in "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": medication in "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
    )

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
    )

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

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"

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": medication in "Unfractionated Heparin"] UnfractionatedHeparin
          where UnfractionatedHeparin.dosage.route in "Intravenous route"
      )
        union ["MedicationAdministration": medication in "Direct Thrombin Inhibitor"]
        union ["MedicationAdministration": medication in "Glycoprotein IIb/IIIa Inhibitors"] ) AnticoagulantMedication
        where AnticoagulantMedication.status = 'completed'
        return {
          id: AnticoagulantMedication.id,
          LowRiskDatetime: start of AnticoagulantMedication.effective.toInterval ( )
        }
    )

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 ( )

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

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"
    )

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 ( )

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
        }
    )

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 ( )

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
        }
    )

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

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

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"

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 ( )

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"
    )

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

define fluent function "FromDayOfStartOfHospitalizationToDayAfterAdmission"(Encounter Encounter):
  Interval[date from ( start of Encounter.hospitalizationWithObservation ( ) ), date from ( start of Encounter.period ) + 1 days]