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 |
CMS996FHIRAptTxforSTEMI |
SDE Sex |
|
define "SDE Sex":
SDE."SDE Sex"
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
ED Encounter During MP |
|
define "ED Encounter During MP":
["Encounter": "Emergency Department Evaluation and Management Visit"] EDEncounter
where EDEncounter.period ends during day of "Measurement Period"
and EDEncounter.status = 'finished'
and EDEncounter.class ~ "EMER"
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
ED Encounter with STEMI Diagnosis |
|
define "ED Encounter with STEMI Diagnosis":
"ED Encounter During MP" EDEncounter
where ( EDEncounter.reasonCode in "STEMI"
or exists ( ( EDEncounter.encounterDiagnosis ( ) ) EncDiagnosis
where EncDiagnosis.code in "STEMI"
)
or exists ( ["Condition": "STEMI"] DxSTEMI
where DxSTEMI.clinicalStatus ~ QICoreCommon."active"
and DxSTEMI.prevalenceInterval ( ) starts during EDEncounter.period
)
)
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
Fibrinolytic Therapy within 30 Minutes of Arrival |
|
define "Fibrinolytic Therapy within 30 Minutes of Arrival":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ["MedicationAdministration": "Fibrinolytic Therapy"] Fibrinolytic
such that Fibrinolytic.status = 'completed'
and start of ( Fibrinolytic.effective.toInterval ( ) ) 30 minutes or less after EDwithSTEMI.currentemergencyDepartmentArrivalTime ( )
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
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 |
CMS996FHIRAptTxforSTEMI |
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.currentemergencyDepartmentDepartTime ( ) 45 minutes or less after EDwithSTEMI.currentemergencyDepartmentArrivalTime ( )
and EDwithSTEMI.hospitalization.dischargeDisposition in "Discharge To Acute Care Facility"
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
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 |
CMS996FHIRAptTxforSTEMI |
Initial Population |
|
define "Initial Population":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
where AgeInYearsAt(date from start of(EDwithSTEMI.period)) >= 18
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
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 |
CMS996FHIRAptTxforSTEMI |
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 |
CMS996FHIRAptTxforSTEMI |
SDE Ethnicity |
|
define "SDE Ethnicity":
SDE."SDE Ethnicity"
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
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 |
CMS996FHIRAptTxforSTEMI |
Adverse Effect to Thrombolytic Medications Before End of ED Encounter |
|
define "Adverse Effect to Thrombolytic Medications Before End of ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
with [AdverseEvent: event in "Thrombolytics Adverse Event"] ThrombolyticAdverseEvent
such that ThrombolyticAdverseEvent.recordedDate before end of ( EDwSTEMI.period )
and ThrombolyticAdverseEvent.actuality = 'actual'
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
Active Exclusion Diagnosis at Start of ED Encounter |
|
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 and Related Intracranial Pathologies"]
union ["Condition": "Pregnant State"]
union ["Condition": "Allergy to thrombolytics"] ) ActiveExclusionDx
such that ActiveExclusionDx.prevalenceInterval ( ) overlaps before ( EDwithSTEMI.period )
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
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 90 days or less before or on start of EDwithSTEMI.period
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
Active Long Term use of Anticoagulants |
|
define "Active Long Term use of Anticoagulants":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ["Condition": "Long term (current) use of anticoagulants"] LongTermAnticoagulant
such that ( LongTermAnticoagulant.prevalenceInterval ( ) starts before or on start of EDwithSTEMI.period
and LongTermAnticoagulant.prevalenceInterval ( ) ends on or after start of EDwithSTEMI.period
)
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
Active use of Anticoagulants |
|
define "Active use of Anticoagulants":
"Active Oral Anticoagulant Medication at the Start of ED Encounter"
union "Active Long Term use of Anticoagulants"
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
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 or Ruptured Aortic Aneurysm"]
union ["Condition": "Neurologic impairment"]
union ["Condition": "Angina pectoris with documented spasm"]
union ["Condition": "Ventricular aneurysm due to and following acute myocardial infarction (disorder)"]
union ["Condition": "Aneurysm of heart"]
union ["Condition": "Takotsubo cardiomyopathy (disorder)"]
union ["Condition": "Takotsubo syndrome"]
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 |
CMS996FHIRAptTxforSTEMI |
Major Surgical Procedure 21 Days or Less Before Start of ED Encounter |
|
define "Major Surgical Procedure 21 Days or Less Before Start of 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 |
CMS996FHIRAptTxforSTEMI |
Intubation or Mechanical Circulatory Assist Device Placement or Removal Procedure During ED Encounter or Within 24 Hours of ED Encounter Start |
|
define "Intubation or Mechanical Circulatory Assist Device Placement or Removal 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, Replacement, or Removal 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 |
CMS996FHIRAptTxforSTEMI |
Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter |
|
define "Active Exclusion Diagnosis Within 90 Days Before or At the Start of ED Encounter":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
with ( ["Condition": "Ischemic Stroke"]
union ["Condition": "Closed Head and Facial Trauma"]
union ["Condition": "Active Peptic Ulcer"] ) ExclusionCondition
such that ExclusionCondition.prevalenceInterval ( ) starts during Interval[start of ( EDwSTEMI.period ) - 90 days, start of ( EDwSTEMI.period )]
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
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 |
CMS996FHIRAptTxforSTEMI |
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 |
CMS996FHIRAptTxforSTEMI |
ED Encounter with Discharge Disposition as Left Against Medical Advice |
|
define "ED Encounter with Discharge Disposition as Left Against Medical Advice":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
where EDwSTEMI.hospitalization.dischargeDisposition in "Left Against Medical Advice"
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
ED Encounter with Hospice Services |
|
define "ED Encounter with Hospice Services":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
where ( exists ( ( ( [Encounter: "Encounter Inpatient"] ).isEncounterPerformed ( ) ) InpatientEncounter
where ( InpatientEncounter.hospitalization.dischargeDisposition ~ "Discharge to home for hospice care (procedure)"
or InpatientEncounter.hospitalization.dischargeDisposition ~ "Discharge to healthcare facility for hospice care (procedure)"
)
and InpatientEncounter.period.toInterval ( ) starts before or on start of ( EDwSTEMI.period )
and ( InpatientEncounter.period.toInterval ( ) ends 6 months or less before day of start of ( EDwSTEMI.period )
or InpatientEncounter.period.toInterval ( ) ends on or after start of ( EDwSTEMI.period )
)
)
or exists ( ( ( [Encounter: "Hospice Encounter"] ).isEncounterPerformed ( ) ) HospiceEncounter
where HospiceEncounter.period.toInterval ( ) starts before or on start of ( EDwSTEMI.period )
and ( HospiceEncounter.period.toInterval ( ) ends 6 months or less before day of start of ( EDwSTEMI.period )
or HospiceEncounter.period.toInterval ( ) ends on or after start of ( EDwSTEMI.period )
)
)
or exists ( ( ( [Observation: "Hospice care [Minimum Data Set]"] ).isAssessmentPerformed ( ) ) HospiceAssessment
where HospiceAssessment.value ~ "Yes (qualifier value)"
and HospiceAssessment.effective.toInterval ( ) starts before or on start of ( EDwSTEMI.period )
and ( HospiceAssessment.effective.toInterval ( ) ends 6 months or less before day of start of ( EDwSTEMI.period )
or HospiceAssessment.effective.toInterval ( ) ends on or after start of ( EDwSTEMI.period )
)
)
or exists ( ( ( [ServiceRequest: "Hospice Care Ambulatory"] ).isInterventionOrder ( ) ) HospiceOrder
where HospiceOrder.authoredOn.toInterval ( ) 6 months or less before start of ( EDwSTEMI.period )
)
or exists ( ( ( [Procedure: "Hospice Care Ambulatory"] ).isInterventionPerformed ( ) ) HospicePerformed
where HospicePerformed.performed.toInterval ( ) starts before or on start of ( EDwSTEMI.period )
and ( HospicePerformed.performed.toInterval ( ) ends 6 months or less before day of start of ( EDwSTEMI.period )
or HospicePerformed.performed.toInterval ( ) ends on or after start of ( EDwSTEMI.period )
)
)
or exists ( ( [Condition: "Hospice Diagnosis"] ) HospiceCareDiagnosis
where HospiceCareDiagnosis.prevalenceInterval ( ) ends on or after start of ( EDwSTEMI.period )
)
)
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
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 use of Anticoagulants"
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 ED Encounter"
union "Intubation or Mechanical Circulatory Assist Device Placement or Removal 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"
union "ED Encounter with Discharge Disposition as Left Against Medical Advice"
union "ED Encounter with Hospice Services"
|
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 |
CMS996FHIRAptTxforSTEMI |
SDE Race |
|
define "SDE Race":
SDE."SDE Race"
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
Received tPA in Another Facility within 24 hours Prior to Admission |
|
define "Received tPA in Another Facility within 24 hours Prior to Admission":
"ED Encounter with STEMI Diagnosis" EDwithSTEMI
with ( ["Condition": "Status post administration of tPA (rtPA) in a different facility within the last 24 hours prior to admission to current facility"] ) TPA
such that TPA.prevalenceInterval ( ) starts during EDwithSTEMI.period
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
Documented Reason for No PCI Performed Within 90 Minutes of ED Arrival |
|
define "Documented Reason for No PCI Performed Within 90 Minutes of ED Arrival":
["ProcedureNotDone": "Percutaneous Coronary Intervention"] PCINotDone
where ( PCINotDone.statusReason in "Patient Refusal"
or PCINotDone.statusReason in "Procedure Not Indicated/Contraindicated"
)
return {
id: PCINotDone.id,
authoredOn: PCINotDone.recorded
}
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
ED Encounter with a Documented Reason for No PCI Performed Within 90 Minutes of ED Arrival |
|
define "ED Encounter with a Documented Reason for No PCI Performed Within 90 Minutes of ED Arrival":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
with "Documented Reason for No PCI Performed Within 90 Minutes of ED Arrival" NoPCI
such that NoPCI.authoredOn during EDwSTEMI.period
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
Documented Reason for Not Administering Fibrinolytic Therapy Within 30 Minutes of ED Arrival |
|
define "Documented Reason for Not Administering Fibrinolytic Therapy Within 30 Minutes of ED Arrival":
["MedicationAdministrationNotDone": "Fibrinolytic Therapy"] FibrinolyticNoMed
where ( FibrinolyticNoMed.statusReason in "Patient Refusal"
or FibrinolyticNoMed.statusReason in "Drug Intervention Not Indicated/Contraindicated"
)
return {
id: FibrinolyticNoMed.id,
authoredOn: FibrinolyticNoMed.recorded
}
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
ED Encounter with a Documented Reason for Not Administering Fibrinolytic Therapy Within 30 Minutes of ED Arrival |
|
define "ED Encounter with a Documented Reason for Not Administering Fibrinolytic Therapy Within 30 Minutes of ED Arrival":
"ED Encounter with STEMI Diagnosis" EDwSTEMI
with "Documented Reason for Not Administering Fibrinolytic Therapy Within 30 Minutes of ED Arrival" NoFibrinolytic
such that NoFibrinolytic.authoredOn during EDwSTEMI.period
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
Denominator Exceptions |
|
define "Denominator Exceptions":
"Received tPA in Another Facility within 24 hours Prior to Admission"
union "ED Encounter with a Documented Reason for No PCI Performed Within 90 Minutes of ED Arrival"
union "ED Encounter with a Documented Reason for Not Administering Fibrinolytic Therapy Within 30 Minutes of ED Arrival"
|
Library Name |
Name |
FHIRHelpers |
ToConcept |
|
/*
@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
*/
define function ToConcept(concept FHIR.CodeableConcept):
if concept is null then
null
else
System.Concept {
codes: concept.coding C return ToCode(C),
display: concept.text.value
}
|
Library Name |
Name |
CQMCommon |
encounterDiagnosis |
|
/*
@description: Returns the Condition resources referenced by the diagnosis element of the Encounter
*/
define fluent function encounterDiagnosis(Encounter Encounter ):
Encounter.diagnosis D
return singleton from ([Condition] C where C.id = D.condition.reference.getId())
|
Library Name |
Name |
QICoreCommon |
getId |
|
/*
@description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).
@comment: This function can be used to determine the logical id of a given resource. It can be used in
a single-server environment to trace references. However, this function does not attempt to resolve
or distinguish the base of the given url, and so cannot be used safely in multi-server environments.
*/
define fluent function getId(uri String):
Last(Split(uri, '/'))
|
Library Name |
Name |
QICoreCommon |
prevalenceInterval |
|
/*
@description: Returns an interval representing the normalized prevalence period of a given Condition.
@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
onset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting
interval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary.
*/
define fluent function prevalenceInterval(condition Condition):
if condition.clinicalStatus ~ "active"
or condition.clinicalStatus ~ "recurrence"
or condition.clinicalStatus ~ "relapse" then
Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
else
(end of condition.abatementInterval()) abatementDate
return if abatementDate is null then
Interval[start of condition.onset.toInterval(), abatementDate)
else
Interval[start of condition.onset.toInterval(), abatementDate]
|
Library Name |
Name |
CMS996FHIRAptTxforSTEMI |
currentemergencyDepartmentArrivalTime |
|
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 |
CMS996FHIRAptTxforSTEMI |
currentemergencyDepartmentDepartTime |
|
define fluent function currentemergencyDepartmentDepartTime(EDEncounter Encounter):
end of ( singleton from ( ( ( EDEncounter.location ) ) EDLocation
where CQMCommon.GetLocation ( EDLocation.location ).type in "Emergency Department Visit"
)
).period
|
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 |
Status |
isEncounterPerformed |
|
//Encounter, Performed
//General usage unless required otherwise by measure intent (e.g., follow-up encounters)
define fluent function isEncounterPerformed(Enc List<Encounter>):
Enc E
where E.status in {'finished', 'arrived', 'triaged', 'in-progress', 'onleave'}
|
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.
If the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval
*/
define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>, Timing>):
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)
when choice is Timing then
Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval<DateTime>
else
null as Interval<DateTime>
end
|
Library Name |
Name |
Status |
isAssessmentPerformed |
|
//This library contains functions that are based on QDM 5.6 to QICore 4.1.1 March 2023 (https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns---QICore-v4.1.1). The functions may appear similar to some QICoreCommon functions but different in that they have constraints that are relevant for measures authored by NCQA.
//Assessment, Performed
define fluent function isAssessmentPerformed(Obs List<Observation>):
Obs O
where O.status in { 'final', 'amended', 'corrected' }
and exists ( O.category ObservationCategory
where ( ObservationCategory ) ~ "survey"
)
|
Library Name |
Name |
Status |
isInterventionOrder |
|
//Intervention, Order: active and completed only
define fluent function isInterventionOrder(ServiceRequest List<ServiceRequest>):
ServiceRequest S
where S.status in { 'active', 'completed' }
and S.intent = 'order'
|
Library Name |
Name |
Status |
isInterventionPerformed |
|
//Intervention, Performed
define fluent function isInterventionPerformed(Proc List<Procedure>):
Proc P
where P.status ~ 'completed'
|