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 |
AntithromboticTherapyByEndofHospitalDay2FHIR |
SDE Sex |
|
define "SDE Sex":
SDE."SDE Sex"
|
Library Name |
Name |
TJCOverall |
Non Elective Inpatient Encounter with Age |
|
define "Non Elective Inpatient Encounter with Age":
["Encounter": "Nonelective Inpatient Encounter"] NonElectiveEncounter
where AgeInYearsAt(date from start of NonElectiveEncounter.period ) >= 18
and NonElectiveEncounter.period ends during day of "Measurement Period"
|
Library Name |
Name |
TJCOverall |
Ischemic Stroke Encounter |
|
define "Ischemic Stroke Encounter":
"Non Elective Inpatient Encounter with Age" NonElectiveEncounterWithAge
where NonElectiveEncounterWithAge.principalDiagnosis().code in "Ischemic Stroke"
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with Antithrombotic Therapy |
|
define "Encounter with Antithrombotic Therapy":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with ["MedicationAdministration": "Antithrombotic Therapy for Ischemic Stroke"] Antithrombotic
such that Antithrombotic.status in { 'in-progress', 'completed' }
and Antithrombotic.effective.toInterval ( ) starts during day of ( start of IschemicStrokeEncounter.hospitalizationWithObservation ( ) ).CalendarDayOfOrDayAfter ( )
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Numerator |
|
define "Numerator":
"Encounter with Antithrombotic Therapy"
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Initial Population |
|
define "Initial Population":
TJC."Ischemic Stroke Encounter"
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
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 |
AntithromboticTherapyByEndofHospitalDay2FHIR |
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 |
AntithromboticTherapyByEndofHospitalDay2FHIR |
SDE Ethnicity |
|
define "SDE Ethnicity":
SDE."SDE Ethnicity"
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter Less Than Two Days |
|
define "Encounter Less Than Two Days":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
where IschemicStrokeEncounter.hospitalizationWithObservation ( ).lengthInDays ( ) < 2
|
Library Name |
Name |
TJCOverall |
Intervention Comfort Measures |
|
define "Intervention Comfort Measures":
( ["ServiceRequest": code in "Comfort Measures"] SR
where SR.status in { 'active', 'completed', 'on-hold' }
and SR.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
and SR.doNotPerform is not true
)
union ( ["Procedure": "Comfort Measures"] InterventionPerformed
where InterventionPerformed.status in { 'completed', 'in-progress' }
)
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with Comfort Measures during Day of or Day After Arrival |
|
define "Encounter with Comfort Measures during Day of or Day After Arrival":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with TJC."Intervention Comfort Measures" ComfortMeasure
such that Coalesce(start of ComfortMeasure.performed.toInterval(), ComfortMeasure.authoredOn) during day of ( start of IschemicStrokeEncounter.hospitalizationWithObservation ( ) ).CalendarDayOfOrDayAfter ( )
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Thrombolytic Therapy Medication or Procedures |
|
define "Thrombolytic Therapy Medication or Procedures":
( ["MedicationAdministration": "Thrombolytic tPA Therapy"] ThrombolyticMedication
where ThrombolyticMedication.status in { 'in-progress', 'completed' }
return {
id: ThrombolyticMedication.id,
effective: ThrombolyticMedication.effective
}
)
union ( ["Procedure": "Intravenous or Intraarterial Thrombolytic tPA Therapy"] ThrombolyticProcedure
where ThrombolyticProcedure.status = 'completed'
return {
id: ThrombolyticProcedure.id,
effective: ThrombolyticProcedure.performed
}
)
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with Thrombolytic Therapy Medication or Procedures |
|
define "Encounter with Thrombolytic Therapy Medication or Procedures":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with "Thrombolytic Therapy Medication or Procedures" ThrombolyticTherapy
such that ThrombolyticTherapy.effective.toInterval ( ) starts during Interval[start of IschemicStrokeEncounter.hospitalizationWithObservation ( ) - 24 hours, end of IschemicStrokeEncounter.hospitalizationWithObservation ( ) )
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with Thrombolytic Therapy Prior to Arrival |
|
define "Encounter with Thrombolytic Therapy Prior to Arrival":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
where exists ( ( IschemicStrokeEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
where ( EncounterDiagnosis.code in "Intravenous or Intraarterial Thrombolytic tPA Therapy Prior to Arrival" )
)
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with Thrombolytic Therapy Documented As Already Given |
|
define "Encounter with Thrombolytic Therapy Documented As Already Given":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with [Condition: "Intravenous or Intraarterial Thrombolytic tPA Therapy Prior to Arrival"] PriorTPA
such that PriorTPA.recordedDate during CQMCommon."HospitalizationWithObservation" ( IschemicStrokeEncounter )
and PriorTPA.isActive ( )
and PriorTPA.verificationStatus is not null
and PriorTPA.verificationStatus ~ QICoreCommon."confirmed"
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with Thrombolytic Therapy Given Prior To Arrival Or During Hospitalization |
|
define "Encounter with Thrombolytic Therapy Given Prior To Arrival Or During Hospitalization":
"Encounter with Thrombolytic Therapy Medication or Procedures"
union "Encounter with Thrombolytic Therapy Prior to Arrival"
union "Encounter with Thrombolytic Therapy Documented As Already Given"
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Denominator Exclusions |
|
define "Denominator Exclusions":
"Encounter Less Than Two Days"
union "Encounter with Comfort Measures during Day of or Day After Arrival"
union "Encounter with Thrombolytic Therapy Given Prior To Arrival Or During Hospitalization"
|
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 |
AntithromboticTherapyByEndofHospitalDay2FHIR |
SDE Race |
|
define "SDE Race":
SDE."SDE Race"
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Reason for Not Ordering Antithrombotic |
|
define "Reason for Not Ordering Antithrombotic":
["MedicationNotRequested": medication in "Antithrombotic Therapy for Ischemic Stroke"] NoAntithromboticOrder
where NoAntithromboticOrder.status = 'completed'
and NoAntithromboticOrder.intent = 'order'
and ( NoAntithromboticOrder.reasonCode in "Medical Reason for Not Providing Treatment"
or NoAntithromboticOrder.reasonCode in "Patient Refusal"
)
return {
id: NoAntithromboticOrder.id,
authoredOn: NoAntithromboticOrder.authoredOn
}
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Reason for Not Administering Antithrombotic |
|
define "Reason for Not Administering Antithrombotic":
["MedicationAdministrationNotDone": medication in "Antithrombotic Therapy for Ischemic Stroke"] MedicationAdm
where ( MedicationAdm.statusReason in "Medical Reason for Not Providing Treatment"
or MedicationAdm.statusReason in "Patient Refusal"
)
return {
id: MedicationAdm.id,
authoredOn: MedicationAdm.recorded
}
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Documented Reason for No Antithrombotic Ordered or Administered |
|
define "Documented Reason for No Antithrombotic Ordered or Administered":
"Reason for Not Ordering Antithrombotic"
union "Reason for Not Administering Antithrombotic"
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with Documented Reason for No Antithrombotic Ordered or Administered Day Of or Day After Hospital Arrival |
|
define "Encounter with Documented Reason for No Antithrombotic Ordered or Administered Day Of or Day After Hospital Arrival":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with "Documented Reason for No Antithrombotic Ordered or Administered" NoAntithrombotic
such that NoAntithrombotic.authoredOn during day of ( start of IschemicStrokeEncounter.hospitalizationWithObservation ( ) ).CalendarDayOfOrDayAfter ( )
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with Pharmacological Contraindications for Antithrombotic Therapy Given Day Of or Day After Hospital Arrival |
|
define "Encounter with Pharmacological Contraindications for Antithrombotic Therapy Given Day Of or Day After Hospital Arrival":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with ["MedicationAdministration": "Pharmacological Contraindications For Antithrombotic Therapy"] PharmacologicalContraindications
such that PharmacologicalContraindications.status in { 'in-progress', 'completed' }
and PharmacologicalContraindications.effective.toInterval ( ) starts during day of ( start of IschemicStrokeEncounter.hospitalizationWithObservation ( ) ).CalendarDayOfOrDayAfter ( )
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Encounter with An INR Greater Than 3.5 |
|
define "Encounter with An INR Greater Than 3.5":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with ["Observation": "INR"] INR
such that INR.value as Quantity > 3.5
and INR.status in { 'final', 'amended', 'corrected' }
and INR.issued during day of ( start of IschemicStrokeEncounter.hospitalizationWithObservation ( ) ).CalendarDayOfOrDayAfter ( )
|
Library Name |
Name |
AntithromboticTherapyByEndofHospitalDay2FHIR |
Denominator Exceptions |
|
define "Denominator Exceptions":
"Encounter with Documented Reason for No Antithrombotic Ordered or Administered Day Of or Day After Hospital Arrival"
union "Encounter with Pharmacological Contraindications for Antithrombotic Therapy Given Day Of or Day After Hospital Arrival"
union "Encounter with An INR Greater Than 3.5"
|
Library Name |
Name |
CQMCommon |
principalDiagnosis |
|
/*
@description: Returns the condition that is specified as the principal diagnosis for the encounter
*/
define fluent function principalDiagnosis(Encounter Encounter ):
singleton from ((Encounter.diagnosis D where D.rank = 1 and D.use ~ "Billing") PD
return singleton from ([Condition] C where C.id = PD.condition.reference.getId())
)
|
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 |
TJCOverall |
CalendarDayOfOrDayAfter |
|
define fluent function CalendarDayOfOrDayAfter(StartValue DateTime):
Interval [date from (StartValue), date from (StartValue) + 1 day]
|
Library Name |
Name |
CQMCommon |
hospitalizationWithObservation |
|
/*
@description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter
*/
define fluent function hospitalizationWithObservation(TheEncounter Encounter ):
TheEncounter Visit
let ObsVisit: Last([Encounter: "Observation Services"] LastObs
where LastObs.status = 'finished'
and LastObs.period ends 1 hour or less on or before start of Visit.period
sort by end of period
),
VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
EDVisit: Last([Encounter: "Emergency Department Visit"] LastED
where LastED.status = 'finished'
and LastED.period ends 1 hour or less on or before VisitStart
sort by end of period
)
return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]
|
Library Name |
Name |
FHIRHelpers |
ToString |
|
define function ToString(value uri): value.value
|
Library Name |
Name |
FHIRHelpers |
ToCode |
|
/*
@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
*/
define function ToCode(coding FHIR.Coding):
if coding is null then
null
else
System.Code {
code: coding.code.value,
system: coding.system.value,
version: coding.version.value,
display: coding.display.value
}
|
Library Name |
Name |
CQMCommon |
lengthInDays |
|
/*
@description: Calculates the difference in calendar days between the start and end of the given interval.
*/
define fluent function lengthInDays(Value Interval<DateTime> ):
difference in days between start of Value and end of Value
|
Library Name |
Name |
CQMCommon |
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 |
CQMCommon |
HospitalizationWithObservation |
|
/*
@description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter
@deprecated: This function is deprecated. Use the fluent function `hospitalizationWithObservation()` instead.
*/
define function "HospitalizationWithObservation"(TheEncounter Encounter ):
TheEncounter Visit
let ObsVisit: Last([Encounter: "Observation Services"] LastObs
where LastObs.status = 'finished'
and LastObs.period ends 1 hour or less on or before start of Visit.period
sort by end of period
),
VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
EDVisit: Last([Encounter: "Emergency Department Visit"] LastED
where LastED.status = 'finished'
and LastED.period ends 1 hour or less on or before VisitStart
sort by end of period
)
return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]
|
Library Name |
Name |
QICoreCommon |
isActive |
|
/* Candidates for FHIRCommon */
/*
@description: Returns true if the given condition has a clinical status of active, recurrence, or relapse
*/
define fluent function isActive(condition Condition):
condition.clinicalStatus ~ "active"
or condition.clinicalStatus ~ "recurrence"
or condition.clinicalStatus ~ "relapse"
|
Library Name |
Name |
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
}
|