| Library Name |
Name |
| SupplementalDataElements |
SDE Sex |
|
define "SDE Sex":
case
when Patient.gender = 'male' then "M"
when Patient.gender = 'female' then "F"
else null
end
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
SDE Sex |
|
define "SDE Sex":
SDE."SDE Sex"
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
ED Encounter with Encounter Diagnosis of STEMI |
|
define "ED Encounter with Encounter Diagnosis of STEMI":
["Encounter": "ED"] EDEncounter
where EDEncounter.status = 'finished'
and EDEncounter.class ~ "EMER"
and ( EDEncounter.reasonCode in "STEMI"
or exists ( ( EDEncounter.encounterDiagnosis ( ) ) EncDiagnosis
where EncDiagnosis.code in "STEMI"
)
)
and EDEncounter.period during "Measurement Period"
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
ED Encounter with Diagnosis of STEMI |
|
define "ED Encounter with Diagnosis of STEMI":
["Encounter": "ED"] EDEncounter
with ["Condition": "STEMI"] DxSTEMI
such that DxSTEMI.clinicalStatus ~ QICoreCommon."active"
and EDEncounter.status = 'finished'
and EDEncounter.class ~ "EMER"
and DxSTEMI.prevalenceInterval ( ) starts during EDEncounter.period
and EDEncounter.period during day of "Measurement Period"
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
ED Encounter with STEMI Diagnosis |
|
define "ED Encounter with STEMI Diagnosis":
"ED Encounter with Encounter Diagnosis of STEMI"
union "ED Encounter with Diagnosis of STEMI"
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Fibrinolytic Therapy within 30 Minutes of Arrival |
|
/*Did not include a status of active as any diagnosis that resolves during the ED visit would not be counted*/
define "Fibrinolytic Therapy within 30 Minutes of Arrival":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ["MedicationAdministration": "Fibrinolytic Therapy"] Fibrinolytic
such that Fibrinolytic.status = 'completed'
and start of ( Fibrinolytic.effective.toInterval ( ) ) 30 minutes or less after EDwithSTEMI.currentemergencyDepartmentArrivalTime ( )
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
PCI within 90 Minutes of Arrival |
|
define "PCI within 90 Minutes of Arrival":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ["Procedure": "Percutaneous Coronary Intervention"] PCI
such that PCI.performed.toInterval ( ) starts 90 minutes or less after EDwithSTEMI.currentemergencyDepartmentArrivalTime ( )
and PCI.status = 'completed'
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
ED Departure with Transfer to Acute Care Facility Within 45 Minutes of Arrival |
|
define "ED Departure with Transfer to Acute Care Facility Within 45 Minutes of Arrival":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
where ( EDwithSTEMI.period ) ends 45 minutes or less after start of ( EDwithSTEMI.period )
and EDwithSTEMI.hospitalization.dischargeDisposition in "Discharge To Acute Care Facility"
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Numerator |
|
define "Numerator":
"Fibrinolytic Therapy within 30 Minutes of Arrival"
union "PCI within 90 Minutes of Arrival"
union "ED Departure with Transfer to Acute Care Facility Within 45 Minutes of Arrival"
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Initial Population |
|
/***Population Criteria***/
define "Initial Population":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
where AgeInYearsAt(date from start of(EDwithSTEMI.period)) >= 18
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Denominator |
|
define "Denominator":
"Initial Population"
|
| Library Name |
Name |
| SupplementalDataElements |
SDE Payer |
|
define "SDE Payer":
[Coverage: type in "Payer Type"] Payer
return {
code: Payer.type,
period: Payer.period
}
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
SDE Payer |
|
define "SDE Payer":
SDE."SDE Payer"
|
| Library Name |
Name |
| SupplementalDataElements |
SDE Ethnicity |
|
define "SDE Ethnicity":
Patient.ethnicity E
return Tuple {
codes: { E.ombCategory } union E.detailed,
display: E.text
}
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
SDE Ethnicity |
|
define "SDE Ethnicity":
SDE."SDE Ethnicity"
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Allergy or Intolerance to Thrombolytic Medications Overlaps ED Encounter |
|
define "Allergy or Intolerance to Thrombolytic Medications Overlaps ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
with ["AllergyIntolerance": "Thrombolytic medications"] ThrombolyticAllergy
such that ThrombolyticAllergy.clinicalStatus ~ QICoreCommon."allergy-active"
and ThrombolyticAllergy.onset.toInterval ( ) overlaps ( EDwSTEMI.period )
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Adverse Effect to Thrombolytic Medications Before End of ED Encounter |
|
/*this definition differs from QDM re: timing - cannot use overlaps for a single point in time*/
/*define "Adverse Effect to Thrombolytic Medications Before End of ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
with [AdverseEvent: event in "Thrombolytic medications"] ThrombolyticAdverseEvent
such that ThrombolyticAdverseEvent.category in "Adverse reaction to thrombolytics"
and ThrombolyticAdverseEvent.recordedDate before end of ( EDwSTEMI.period )
and ThrombolyticAdverseEvent.actuality = 'actual'*/
/*KS Note - not sure we need category in the logic - it is must support, but not sure this brings value to the measure logic*/
define "Adverse Effect to Thrombolytic Medications Before End of ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
with [AdverseEvent: event in "Adverse reaction to thrombolytics"] ThrombolyticAdverseEvent
such that ThrombolyticAdverseEvent.recordedDate before end of ( EDwSTEMI.period )
and ThrombolyticAdverseEvent.actuality = 'actual'
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Active Exclusion Diagnosis at Start of ED Encounter |
|
/***Definitions***/
define "Active Exclusion Diagnosis at Start of ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ( ["Condition": "Active Bleeding Excluding Menses or Bleeding Diathesis"]
union ["Condition": "Malignant Intracranial Neoplasm Group"]
union ["Condition": "Cerebral Vascular Lesion"]
union ["Condition": "Dementia"]
union ["Condition": "Pregnancy"]
union ["Condition": "Allergy to thrombolytics"] ) ActiveExclusionDx
such that /*ActiveExclusionDx.isActive ()
and */
ActiveExclusionDx.prevalenceInterval ( ) overlaps before ( EDwithSTEMI.period )
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Active Oral Anticoagulant Medication at the Start of ED Encounter |
|
define "Active Oral Anticoagulant Medication at the Start of ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ["MedicationRequest": "Oral Anticoagulant Medications"] OralAnticoagulant
such that OralAnticoagulant.status = 'active'
and OralAnticoagulant.intent = 'order'
and OralAnticoagulant.authoredOn before or on start of EDwithSTEMI.period
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Exclusion Diagnosis During ED Encounter or Within 24 Hours of ED Encounter Start |
|
define "Exclusion Diagnosis During ED Encounter or Within 24 Hours of ED Encounter Start":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ( ["Condition": "Aortic Dissection and Rupture"]
union ["Condition": "Neurologic impairment"]
union ["Condition": "Cardiopulmonary Arrest"] ) ExclusionDiagnosis
such that ( ExclusionDiagnosis.prevalenceInterval ( ) starts during EDwithSTEMI.period )
or ( ExclusionDiagnosis.prevalenceInterval ( ) starts 24 hours or less before start of EDwithSTEMI.period )
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Major Surgical Procedure 21 Days or Less Before Start of or Starts During ED Encounter |
|
define "Major Surgical Procedure 21 Days or Less Before Start of or Starts During ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ["Procedure": "Major Surgical Procedure"] MajorSurgery
such that MajorSurgery.performed.toInterval ( ) starts 21 days or less before start of ( EDwithSTEMI.period )
and MajorSurgery.status = 'completed'
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Intubation or Mechanical Circulatory Assist Procedure During ED Encounter or Within 24 Hours of ED Encounter Start |
|
define "Intubation or Mechanical Circulatory Assist Procedure During ED Encounter or Within 24 Hours of ED Encounter Start":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ( ["Procedure": "Endotracheal Intubation"]
union ["Procedure": "Insertion or Replacement of Mechanical Circulatory Assist Device"] ) AirwayProcedure
such that ( ( AirwayProcedure.performed.toInterval ( ) starts during ( EDwithSTEMI.period ) )
or ( AirwayProcedure.performed.toInterval ( ) starts 24 hours or less before start of ( EDwithSTEMI.period ) )
)
and AirwayProcedure.status = 'completed'
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter |
|
/*KS 8-10-23: in CQLIT-389, discussed the impacts of requiring a clinical status of active but the condition could end before the end (during) the ED Visit, which would trigger an inactive status. Decided to not follow the Authoring Patterns and remove the requirement for a clinicalstatus of 'active' */
define "Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
with ( ["Condition": "Ischemic Stroke"]
union ["Condition": "Closed Head and Facial Trauma"]
union ["Condition": "Active Peptic Ulcer"]
union ["Condition": "Cardiopulmonary Arrest"] ) ExclusionCondition
such that /* ExclusionCondition.isActive ()
and */
ExclusionCondition.prevalenceInterval ( ) starts during Interval[start of ( EDwSTEMI.period ) - 90 days, start of ( EDwSTEMI.period )]
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Intracranial or Intraspinal Procedure 90 Days or Less Before Start of ED Encounter |
|
define "Intracranial or Intraspinal Procedure 90 Days or Less Before Start of ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ["Procedure": "Intracranial or Intraspinal surgery"] CranialorSpinalSurgery
such that CranialorSpinalSurgery.performed.toInterval ( ) starts 90 days or less before start of ( EDwithSTEMI.period )
and CranialorSpinalSurgery.status = 'completed'
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
ED Encounter with Discharge Disposition as Patient Expired |
|
define "ED Encounter with Discharge Disposition as Patient Expired":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
where EDwithSTEMI.hospitalization.dischargeDisposition in "Patient Expired"
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
Denominator Exclusions |
|
define "Denominator Exclusions":
"Allergy or Intolerance to Thrombolytic Medications Overlaps ED Encounter"
union "Adverse Effect to Thrombolytic Medications Before End of ED Encounter"
union "Active Exclusion Diagnosis at Start of ED Encounter"
union "Active Oral Anticoagulant Medication at the Start of ED Encounter"
union "Exclusion Diagnosis During ED Encounter or Within 24 Hours of ED Encounter Start"
union "Major Surgical Procedure 21 Days or Less Before Start of or Starts During ED Encounter"
union "Intubation or Mechanical Circulatory Assist Procedure During ED Encounter or Within 24 Hours of ED Encounter Start"
union "Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter"
union "Intracranial or Intraspinal Procedure 90 Days or Less Before Start of ED Encounter"
union "ED Encounter with Discharge Disposition as Patient Expired"
|
| Library Name |
Name |
| SupplementalDataElements |
SDE Race |
|
define "SDE Race":
Patient.race R
return Tuple {
codes: R.ombCategory union R.detailed,
display: R.text
}
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
SDE Race |
|
define "SDE Race":
SDE."SDE Race"
|
| Library Name |
Name |
| FHIRHelpers |
ToConcept |
|
/*
@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
*/
define function ToConcept(concept FHIR.CodeableConcept):
if concept is null then
null
else
System.Concept {
codes: concept.coding C return ToCode(C),
display: concept.text.value
}
|
| Library Name |
Name |
| CQMCommon |
encounterDiagnosis |
|
/*
@description: Returns the Condition resources referenced by the diagnosis element of the Encounter
*/
define fluent function encounterDiagnosis(Encounter Encounter ):
Encounter.diagnosis D
return singleton from ([Condition] C where C.id = D.condition.reference.getId())
|
| Library Name |
Name |
| QICoreCommon |
getId |
|
/*
@description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).
@comment: This function can be used to determine the logical id of a given resource. It can be used in
a single-server environment to trace references. However, this function does not attempt to resolve
or distinguish the base of the given url, and so cannot be used safely in multi-server environments.
*/
define fluent function getId(uri String):
Last(Split(uri, '/'))
|
| Library Name |
Name |
| QICoreCommon |
prevalenceInterval |
|
/*
@description: Returns an interval representing the normalized prevalence period of a given Condition.
@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have
a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary.
*/
define fluent function prevalenceInterval(condition Condition):
if condition.clinicalStatus ~ "active"
or condition.clinicalStatus ~ "recurrence"
or condition.clinicalStatus ~ "relapse" then
Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
else
Interval[start of condition.onset.toInterval(), end of condition.abatementInterval())
|
| Library Name |
Name |
| AppropriateTreatmentforSTEMIFHIR |
currentemergencyDepartmentArrivalTime |
|
/*
@description: Returns the emergency department arrival time for the encounter.
*/
define fluent function currentemergencyDepartmentArrivalTime(EDEncounter Encounter):
start of ( singleton from ( ( ( EDEncounter.location ) ) EDLocation
where CQMCommon.GetLocation ( EDLocation.location ).type in "Emergency Department Visit"
)
).period
|
| Library Name |
Name |
| CQMCommon |
GetLocation |
|
/*
@description: Returns the Location resource specified by the given reference
@deprecated: This function is deprecated. Use the fluent function `getLocation()` instead.
*/
define function "GetLocation"(reference Reference ):
singleton from (
[Location] L where L.id = reference.reference.getId()
)
|
| Library Name |
Name |
| FHIRHelpers |
ToString |
|
define function ToString(value uri): value.value
|
| Library Name |
Name |
| FHIRHelpers |
ToCode |
|
/*
@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
*/
define function ToCode(coding FHIR.Coding):
if coding is null then
null
else
System.Code {
code: coding.code.value,
system: coding.system.value,
version: coding.version.value,
display: coding.display.value
}
|
| Library Name |
Name |
| QICoreCommon |
toInterval |
|
/*
@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
@comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types
to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
representations for timing-valued elements in QICore, allowing this function to be used across any resource.
The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>.
The intent of this function is to provide a clear and concise mechanism to treat single
elements that have multiple possible representations as intervals so that logic doesn't have to account
for the variability. More complex calculations (such as medication request period or dispense period
calculation) need specific guidance and consideration. That guidance may make use of this function, but
the focus of this function is on single element calculations where the semantics are unambiguous.
If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.
If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,
and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.
If the input is a DateTime Interval, the result is the input.
If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result
is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending
immediately before one year later than the date the patient turned the age given as the end of the quantity interval.
Any other input will reslt in a null DateTime Interval
*/
define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>):
case
when choice is DateTime then
Interval[choice as DateTime, choice as DateTime]
when choice is Interval<DateTime> then
choice as Interval<DateTime>
when choice is Quantity then
Interval[Patient.birthDate + (choice as Quantity),
Patient.birthDate + (choice as Quantity) + 1 year)
when choice is Interval<Quantity> then
Interval[Patient.birthDate + (choice.low as Quantity),
Patient.birthDate + (choice.high as Quantity) + 1 year)
else
null as Interval<DateTime>
end
|