Library Name |
Name |
CQMCommon |
Inpatient Encounter |
|
define "Inpatient Encounter":
[Encounter: "Encounter Inpatient"] EncounterInpatient
where EncounterInpatient.status = 'finished'
and EncounterInpatient.period ends during day of "Measurement Period"
|
Library Name |
Name |
PCMaternal |
Encounter with Age Range |
|
define "Encounter with Age Range":
CQMCommon."Inpatient Encounter" InpatientEncounter
where AgeInYearsAt(date from start of InpatientEncounter.period) in Interval[ 8, 65 )
|
Library Name |
Name |
PCMaternal |
Delivery Encounter with Age Range |
|
define "Delivery Encounter with Age Range":
"Encounter with Age Range" EncounterWithAge
with ["Procedure": "Delivery Procedures"] DeliveryProcedure
such that DeliveryProcedure.status = 'completed'
and DeliveryProcedure.performed.toInterval ( ) starts during EncounterWithAge.hospitalizationWithEDOBTriageObservation ()
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Calculated Gestational Age Greater than or Equal to 20 Weeks |
|
define "Delivery Encounters with Calculated Gestational Age Greater than or Equal to 20 Weeks":
PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
where DeliveryEncounter.calculatedGestationalAge ( ) >= 20
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Estimated Gestational Age Assessment Greater than or Equal to 20 Weeks |
|
define "Delivery Encounters with Estimated Gestational Age Assessment Greater than or Equal to 20 Weeks":
PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
where DeliveryEncounter.calculatedGestationalAge ( ) is null
and ( DeliveryEncounter.lastEstimatedGestationalAge ( ) >= 20 weeks )
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Gestational Age Greater than or Equal to 20 Weeks Based on Coding |
|
define "Delivery Encounters with Gestational Age Greater than or Equal to 20 Weeks Based on Coding":
PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
let CGA: DeliveryEncounter.calculatedGestationalAge ( ),
EGA: DeliveryEncounter.lastEstimatedGestationalAge ( )
where CGA is null
and EGA is null
and exists ( ( DeliveryEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
where EncounterDiagnosis.code in "20 to 42 Plus Weeks Gestation"
)
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters At Greater than or Equal to 20 Weeks Gestation |
|
define "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation":
"Delivery Encounters with Calculated Gestational Age Greater than or Equal to 20 Weeks"
union "Delivery Encounters with Estimated Gestational Age Assessment Greater than or Equal to 20 Weeks"
union "Delivery Encounters with Gestational Age Greater than or Equal to 20 Weeks Based on Coding"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Asthma |
|
define "Risk Variable Asthma":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Acute or Persistent Asthma"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Placental Accreta Spectrum |
|
define "Risk Variable Placental Accreta Spectrum":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Placenta Accreta"
or TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Placenta Increta or Percreta"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Neuromuscular |
|
define "Risk Variable Neuromuscular":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Neuromuscular Disease"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Hypertension |
|
define "Risk Variable Hypertension":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Hypertension"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion |
|
define "Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsNoOrUTD ( ) in "Severe Maternal Morbidity Diagnoses"
or exists ( ["Procedure": "Severe Maternal Morbidity Procedures"] SMMProcedures
where SMMProcedures.status = 'completed'
and SMMProcedures.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
)
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Expiration |
|
define "Delivery Encounters with Expiration":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.hospitalization.dischargeDisposition in "Patient Expired"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Blood Transfusion |
|
define "Delivery Encounters with Blood Transfusion":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
with ["Procedure": "Blood Transfusion"] BloodTransfusion
such that BloodTransfusion.status = 'completed'
and BloodTransfusion.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Severe Obstetric Complications |
|
define "Delivery Encounters with Severe Obstetric Complications":
"Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion"
union "Delivery Encounters with Expiration"
union "Delivery Encounters with Blood Transfusion"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Hysterectomy |
|
define "Delivery Encounters with Hysterectomy":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
with ["Procedure": "Hysterectomy"] Hysterectomy
such that Hysterectomy.status = 'completed'
and Hysterectomy.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Cardiac Conversion, Tracheostomy or Ventilation Procedures |
|
define "Cardiac Conversion, Tracheostomy or Ventilation Procedures":
["Procedure": "Conversion of Cardiac Rhythm"]
union ["Procedure": "Tracheostomy"]
union ["Procedure": "Ventilation"]
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures |
|
define "Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
with "Cardiac Conversion, Tracheostomy or Ventilation Procedures" ConvTrachVentProcedures
such that ConvTrachVentProcedures.status = 'completed'
and ConvTrachVentProcedures.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
SOC with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC |
|
define "SOC with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC":
( "Delivery Encounters with Severe Obstetric Complications" SOCEncounter
where exists ( ( SOCEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
where EncounterDiagnosis.code in "Placenta Increta or Percreta"
)
and ( exists "Delivery Encounters with Blood Transfusion"
or exists "Delivery Encounters with Hysterectomy"
)
)
//The following logic keeps encounter in the numerator if there is an additional SOC besides Blood Transfusion or Hysterectomy
except ( ( "Delivery Encounters with Severe Obstetric Complications" SOCEncounter
where ( SOCEncounter.pOAIsNoOrUTD ( ) in "Severe Maternal Morbidity Diagnoses" )
)
union "Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures"
union "Delivery Encounters with Expiration"
)
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Preterm Birth |
|
define "Risk Variable Preterm Birth":
/* CGA = Calculated Gestational Age. EGA = Estimated Gestational Age. */
( PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
let CGA: DeliveryEncounter.calculatedGestationalAge ( ),
EGA: DeliveryEncounter.lastEstimatedGestationalAge ( )
where CGA in Interval[20, 36]
or ( CGA is null
and ( EGA >= 20 weeks
and EGA <= 36 weeks
)
)
)
union ( PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
let CGA: DeliveryEncounter.calculatedGestationalAge ( ),
EGA: DeliveryEncounter.lastEstimatedGestationalAge ( )
where CGA is null
and EGA is null
and DeliveryEncounter.pOAIsYesOrExempt ( ) in "Preterm Birth"
)
|
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 |
SevereObstetricComplicationsFHIR |
SDE Payer |
|
define "SDE Payer":
SDE."SDE Payer"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Placental Abruption |
|
define "Risk Variable Placental Abruption":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Placental Abruption"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with COVID and Respiratory Condition or Procedure |
|
define "Delivery Encounters with COVID and Respiratory Condition or Procedure":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where exists ( ( TwentyWeeksPlusEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
where EncounterDiagnosis.code in "COVID 19 Confirmed"
)
and ( exists ( ( TwentyWeeksPlusEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
where EncounterDiagnosis.code in "Respiratory Conditions Related to COVID 19"
)
or exists ( ["Procedure": "Respiratory Support Procedures Related to COVID 19"] COVIDRespiratoryProcedure
where COVIDRespiratoryProcedure.status = 'completed'
and COVIDRespiratoryProcedure.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
)
)
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Denominator Exclusion |
|
define "Denominator Exclusion":
"Delivery Encounters with COVID and Respiratory Condition or Procedure"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Morbid Obesity |
|
define "Risk Variable Morbid Obesity":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Morbid or Severe Obesity"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Preexisting Diabetes |
|
define "Risk Variable Preexisting Diabetes":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Preexisting Diabetes"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Bariatric Surgery |
|
define "Risk Variable Bariatric Surgery":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Bariatric Surgery"
|
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 |
SevereObstetricComplicationsFHIR |
SDE Race |
|
define "SDE Race":
SDE."SDE Race"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Placenta Previa |
|
define "Risk Variable Placenta Previa":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Placenta Previa"
|
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 |
SevereObstetricComplicationsFHIR |
SDE Sex |
|
define "SDE Sex":
SDE."SDE Sex"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Bleeding Disorder |
|
define "Risk Variable Bleeding Disorder":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Bleeding Disorder"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable First White Blood Cell Count Lab Test |
|
//First resulted value 24 hours prior to start of encounter and before time of delivery
//Report white blood cell count as 10*3/uL
define "Risk Variable First White Blood Cell Count Lab Test":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
let FirstWBC: First(["USCoreLaboratoryResultObservationProfile": "White blood cells count lab test"] WBC
where WBC.issued during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation() - 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
and WBC.status in { 'final', 'amended', 'corrected' }
and WBC.value is not null
sort by issued.earliest()
)
return {
EncounterId: TwentyWeeksPlusEncounter.id,
FirstWBCResult: FirstWBC.value as Quantity,
Timing: FirstWBC.issued
}
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable First Hematocrit Lab Test |
|
//First resulted value 24 hours prior to start of encounter and before time of delivery
//Report hematocrit as %
define "Risk Variable First Hematocrit Lab Test":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
let FirstHematocrit: First(["USCoreLaboratoryResultObservationProfile": "Hematocrit lab test"] Hematocrit
where Hematocrit.issued during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation() - 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
and Hematocrit.status in { 'final', 'amended', 'corrected' }
and Hematocrit.value is not null
sort by issued.earliest()
)
return {
EncounterId: TwentyWeeksPlusEncounter.id,
FirstHematocritResult: FirstHematocrit.value as Quantity,
Timing: FirstHematocrit.issued
}
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Severe Preeclampsia |
|
define "Risk Variable Severe Preeclampsia":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Severe Preeclampsia"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Anemia |
|
define "Risk Variable Anemia":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Anemia"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Cardiac Disease |
|
define "Risk Variable Cardiac Disease":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Cardiac Disease"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Long Term Anticoagulant Use |
|
define "Risk Variable Long Term Anticoagulant Use":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Long Term Anticoagulant Use"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Systolic Blood Pressure |
|
//First resulted value 24 hours prior to start of encounter and before time of delivery
//Report systolic blood pressure as mm[Hg]
//Systolic blood pressure value cannot be null per QICore profile requirement.
define "Risk Variable Systolic Blood Pressure":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
let FirstSystolicBP: First(["observation-bp"] BP
where BP.effective.earliest() during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation() - 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
and BP.status in { 'final', 'amended', 'corrected' }
and BP.component.value is not null
sort by effective.earliest()
)
return {
EncounterId: TwentyWeeksPlusEncounter.id,
FirstSBPResult: FirstSystolicBP.component C
where C.code ~ "Systolic blood pressure"
return C.value as Quantity,
Timing: FirstSystolicBP.effective.earliest ( )
}
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Substance Abuse |
|
define "Risk Variable Substance Abuse":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Substance Abuse"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Renal Disease |
|
define "Risk Variable Renal Disease":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Renal Disease"
|
Library Name |
Name |
PCMaternal |
Variable Calculated Gestational Age |
|
define "Variable Calculated Gestational Age":
// This definition establishes a variable of CGA (Calculated Gestational Age). CGA is a supplemental data element to store the calculated gestational age result from the "CalculatedGestationalAge" function. The data element enables the capturing and saving of the CGA for data analysis post data receipt. Hospitals do not need to submit any additional data to comply with this definition
"Delivery Encounter with Age Range" DeliveryEncounter
let CGA: DeliveryEncounter.calculatedGestationalAge()
// return { QualifyingEncounter, CGA }
return {
EncounterID: DeliveryEncounter.id,
CalculatedCGA: CGA
}
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
SDE Variable Calculated Gestational Age |
|
define "SDE Variable Calculated Gestational Age":
//This definition establishes a variable of CGA (Calculated Gestational Age). CGA is a supplemental data element to store the calculated gestational age result from the "CalculatedGestationalAge" function. The data element enables the capturing and saving of the CGA for data analysis post data receipt. Hospitals do not need to submit any additional data to comply with this definition.
PCMaternal."Variable Calculated Gestational Age"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Gastrointestinal Disease |
|
define "Risk Variable Gastrointestinal Disease":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Gastrointestinal Disease"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions |
|
define "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions":
"Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion"
union "Delivery Encounters with Expiration"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only |
|
define "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only":
"Delivery Encounters with Severe Obstetric Complications"
intersect "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Pulmonary Hypertension |
|
define "Risk Variable Pulmonary Hypertension":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Pulmonary Hypertension"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Thyrotoxicosis |
|
define "Risk Variable Thyrotoxicosis":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Thyrotoxicosis"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Other Preeclampsia |
|
define "Risk Variable Other Preeclampsia":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Mild or Moderate Preeclampsia"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Initial Population |
|
define "Initial Population":
PCMaternal."Delivery Encounter with Age Range"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Economic Housing Instability |
|
define "Risk Variable Economic Housing Instability":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Economic Housing Instability"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable HIV |
|
define "Risk Variable HIV":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "HIV in Pregnancy Childbirth and Puerperium"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
SOC Excluding Blood Transfusions Only with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC |
|
define "SOC Excluding Blood Transfusions Only with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC":
( "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only" SOCExcludingTransfusion
where exists ( ( SOCExcludingTransfusion.encounterDiagnosis ( ) ) EncounterDiagnoses
where EncounterDiagnoses.code in "Placenta Increta or Percreta"
)
and ( exists "Delivery Encounters with Blood Transfusion"
or exists "Delivery Encounters with Hysterectomy"
)
)
//The following logic keeps encounter in the numerator if there is an additional SOC besides Blood Transfusion or Hysterectomy
except ( ( "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only" SOCExcludingTransfusion
where SOCExcludingTransfusion.pOAIsNoOrUTD ( ) in "Severe Maternal Morbidity Diagnoses"
)
union "Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures"
union "Delivery Encounters with Expiration"
)
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Heart Rate |
|
//First resulted value 24 hours prior to start of encounter and before time of delivery
//Report heart rate as beats/min
//Heart rate value cannot be null per QICore profile requirement.
define "Risk Variable Heart Rate":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
let FirstHeartRate: First(["observation-heartrate"] HeartRate
where HeartRate.effective.earliest() during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation() - 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
and HeartRate.status in { 'final', 'amended', 'corrected' }
sort by effective.earliest()
)
return {
EncounterId: TwentyWeeksPlusEncounter.id,
FirstHRResult: FirstHeartRate.value as Quantity,
Timing: FirstHeartRate.effective.earliest ( )
}
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Maternal Age |
|
define "Risk Variable Maternal Age":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
let MaternalAge: AgeInYearsAt(date from start of TwentyWeeksPlusEncounter.period)
return { TwentyWeeksPlusEncounter, MaternalAge }
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Mental Health Disorder |
|
define "Risk Variable Mental Health Disorder":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Mental Health Disorder"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Obstetrical VTE |
|
define "Risk Variable Obstetrical VTE":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Venous Thromboembolism in Pregnancy"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Autoimmune Disease |
|
define "Risk Variable Autoimmune Disease":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Autoimmune Disease"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Previous Cesarean |
|
define "Risk Variable Previous Cesarean":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Previous Cesarean"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Gestational Diabetes |
|
define "Risk Variable Gestational Diabetes":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Gestational Diabetes"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Risk Variable Multiple Pregnancy |
|
define "Risk Variable Multiple Pregnancy":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Multiple Pregnancy"
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
Denominator |
|
define "Denominator":
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation"
|
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 |
SevereObstetricComplicationsFHIR |
SDE Ethnicity |
|
define "SDE Ethnicity":
SDE."SDE Ethnicity"
|
Library Name |
Name |
PCMaternal |
hospitalizationWithEDOBTriageObservation |
|
/*define function "HospitalizationWithEDOBTriageObservation"(Encounter Encounter ):
HospitalizationWithEDOBTriageObservation returns the total interval from the start of any immediately prior emergency department visit or OB Triage visit through the observation visit to the discharge of the given encounter
Encounter Visit
let ObsVisit: Last(["Encounter": "Observation Services"] LastObs
where LastObs.period ends 1 hour or less on or before start of Visit.period
and LastObs.status = 'finished'
sort by
end of period
),
VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
EDOBTriageVisit: Last(["Encounter": "ED Visit and OB Triage"] LastEDOBTriage
where LastEDOBTriage.period ends 1 hour or less on or before VisitStart
and LastEDOBTriage.status = 'finished'
sort by
end of period
)
return Interval[Coalesce(start of EDOBTriageVisit.period, VisitStart),
end of Visit.period]*/
define fluent function hospitalizationWithEDOBTriageObservation (TheEncounter Encounter ):
/*hospitalizationWithEDOBTriageObservation returns the total interval from the start of any immediately prior emergency department visit or OB Triage visit through the observation visit to the discharge of the given encounter*/
TheEncounter Visit
let ObsVisit: Last(["Encounter": "Observation Services"] LastObs
where LastObs.period ends 1 hour or less on or before start of Visit.period
and LastObs.status = 'finished'
sort by
end of period
),
VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
EDOBTriageVisit: Last(["Encounter": "ED Visit and OB Triage"] LastEDOBTriage
where LastEDOBTriage.period ends 1 hour or less on or before VisitStart
and LastEDOBTriage.status = 'finished'
sort by
end of period
)
return Interval[Coalesce(start of EDOBTriageVisit.period, VisitStart),
end of Visit.period]
|
Library Name |
Name |
PCMaternal |
calculatedGestationalAge |
|
define fluent function calculatedGestationalAge (TheEncounter Encounter ):
//Gestational Age = (280-(Estimated Delivery Date minus Reference Date/Delivery Date))/7
( 280 - ( difference in days between TheEncounter.lastTimeOfDelivery () and TheEncounter.lastEstimatedDeliveryDate( )) ) div 7
|
Library Name |
Name |
PCMaternal |
lastTimeOfDelivery |
|
define fluent function lastTimeOfDelivery (TheEncounter Encounter ):
Last(["Observation": "Date and time of obstetric delivery"] TimeOfDelivery
where TimeOfDelivery.value as DateTime is not null
and TimeOfDelivery.status in { 'final', 'amended', 'corrected' }
and TimeOfDelivery.effective.earliest () during TheEncounter.hospitalizationWithEDOBTriageObservation ()
and TimeOfDelivery.value as DateTime during TheEncounter.hospitalizationWithEDOBTriageObservation()
sort by effective.earliest()
).value as DateTime
|
Library Name |
Name |
QICoreCommon |
earliest |
|
/*
@description: Given an interval, return the starting point if the interval has a starting boundary specified,
otherwise, return the ending point
*/
define fluent function earliest(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):
(choice.toInterval()) period
return
if (period."hasStart"()) then start of period
else end of period
|
Library Name |
Name |
PCMaternal |
lastEstimatedDeliveryDate |
|
/*===============================================================*/
/* 03/14/2022 from MATGlobalCommonFunctionsv7.000 - latest QDM */
/* even though this PCMaternalFHIR was derived from */
/* PCMaternal=2.1.000 cql, to make next update easier. */
/* Will need to re-insert "Global". in front of these */
/* function names later (whereever they are directly used.*/
define fluent function lastEstimatedDeliveryDate (TheEncounter Encounter ):
/*This function identifies the last time the EDD was assessed 42 weeks or less prior to or on delivery and stores the result of that assessment.*/
Last(["Observation": "Delivery date Estimated"] EstimatedDateOfDelivery
where EstimatedDateOfDelivery.value as DateTime is not null
and EstimatedDateOfDelivery.status in { 'final', 'amended', 'corrected' }
and EstimatedDateOfDelivery.effective.earliest ( ) 42 weeks or less before or on TheEncounter.lastTimeOfDelivery ()
sort by effective.earliest ( )
).value as DateTime
|
Library Name |
Name |
PCMaternal |
lastEstimatedGestationalAge |
|
/*define fluent function lastEstimatedGestationalAge (TheEncounter Encounter ):
Last(["Observation": "Estimated Gestational Age at Delivery"] EstimatedGestationalAge
where EstimatedGestationalAge.value is not null
and EstimatedGestationalAge.status in { 'final', 'amended', 'corrected' }
and EstimatedGestationalAge.effective.earliest() 24 hours or less before or on TheEncounter.lastTimeOfDelivery ()
sort by effective.earliest ()
).value as Quantity*/
define fluent function lastEstimatedGestationalAge (TheEncounter Encounter ):
Last(["Observation": "Estimated Gestational Age at Delivery"] EstimatedGestationalAge
let EGATiming: EstimatedGestationalAge.effective.earliest() where
(EGATiming 24 hours or less before or on TheEncounter.lastTimeOfDelivery ()
and EstimatedGestationalAge.value is not null
and EstimatedGestationalAge.status in { 'final', 'amended', 'corrected' }) or
(EGATiming same day as TheEncounter.lastTimeOfDelivery ()
and EGATiming during TheEncounter.hospitalizationWithEDOBTriageObservation()
and EstimatedGestationalAge.value is not null)
sort by effective.earliest ())
.value as Quantity
|
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 |
SevereObstetricComplicationsFHIR |
pOAIsYesOrExempt |
|
define fluent function pOAIsYesOrExempt(TheEncounter Encounter):
TheEncounter.diagnosis EncounterDiagnoses
where EncounterDiagnoses.diagnosisPresentOnAdmission in "Present On Admission is Yes or Exempt"
return EncounterDiagnoses.condition.getCondition ( ).code
|
Library Name |
Name |
FHIRHelpers |
ToString |
|
define function ToString(value uri): value.value
|
Library Name |
Name |
CQMCommon |
getCondition |
|
/*
@description: Returns the Condition resource for the given reference
*/
define fluent function getCondition(reference Reference):
singleton from ([Condition] C where C.id = reference.reference.getId())
|
Library Name |
Name |
SevereObstetricComplicationsFHIR |
pOAIsNoOrUTD |
|
/*define function "FirstLabTestWithEncounterId"(LabList List<Observation>, CCDE String ):
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
let FirstLab: First(LabList Lab
//(first resulted value 24 hours prior to start of encounter and before time of delivery)
where Lab.issued.earliest() during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation()- 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
and Lab.status in {'final', 'amended', 'corrected'}
and Lab.value is not null
sort by issued.earliest())
return {
EncounterId: TwentyWeeksPlusEncounter.id,
FirstResult: FirstLab.value as Quantity,
Timing: FirstLab.issued
}
define function "FirstPhysicalExamWithEncounterId"(ExamList List<Observation>, CCDE String):
"Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
let FirstExam: First(ExamList Exam
where Exam.effective.earliest() during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation()- 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
and Exam.status in {'final', 'amended', 'corrected'}
and Exam.value is not null
sort by effective.earliest() )
return {
EncounterId: TwentyWeeksPlusEncounter.id,
FirstResult: FirstExam.value as Quantity,
Timing: FirstExam.effective.earliest()
}
define "Risk Variable Lab and Physical Exam Results":
flatten{
// First physical exams (vital signs): Report heart rate as {beats}/min, systolic blood pressure as mm[Hg]
"FirstPhysicalExamWithEncounterId"([Observation: "Heart rate"], 'FirstHeartRate'),
"FirstPhysicalExamWithEncounterId"([Observation: "Systolic blood pressure"], 'FirstSystolicBP'),
//First lab tests: Report hematocrit as %, white blood cell count as 10*3/uL
"FirstLabTestWithEncounterId"([Observation: "Hematocrit lab test"], 'FirstHematocrit'),
"FirstLabTestWithEncounterId"([Observation: "White blood cells count lab test"], 'FirstWhiteBloodCell')
}*/
define fluent function pOAIsNoOrUTD(TheEncounter Encounter):
TheEncounter.diagnosis EncounterDiagnoses
where EncounterDiagnoses.diagnosisPresentOnAdmission in "Present on Admission is No or Unable To Determine"
return EncounterDiagnoses.condition.getCondition ( ).code
|
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
}
|