Hide
Proposed Solution:
Changes are highlighted by the asterisks.
Current QDM Version of "MedicationOrderPeriod":
define function "MedicationOrderPeriod"(MedOrder "Medication, Order" ):
MedOrder Order
let startDate: date from Coalesce(Order.relevantPeriod.low, Order.authorDatetime),
***totalDaysSupplied: Coalesce(Order.supply.value /(Order.dosage.value * ToDaily(Order.frequency)), Order.daysSupplied) * ( 1 + Coalesce(Order.refills, 0) )***
return if startDate is null then null
else if totalDaysSupplied is not null then Interval[startDate, startDate + Quantity { value: totalDaysSupplied - 1, unit: 'day' }]
else if Order.relevantPeriod.high is not null then Interval[startDate, date from end of Order.relevantPeriod]
else null
Proposed QI-Core Aligned Version of "MedicationOrderPeriod":
define function "MedicationOrderPeriod"(MedOrder "Medication, Order" ):
MedOrder Order
let startDate: date from Coalesce(Order.relevantPeriod.low, Order.authorDatetime),
*** totalDaysSupplied: Coalesce(Order.daysSupplied, Order.supply.value /(Order.dosage.value * ToDaily(Order.frequency))) * ( 1 + Coalesce(Order.refills, 0) )***
return if startDate is null then null
else if totalDaysSupplied is not null then Interval[startDate, startDate + Quantity { value: totalDaysSupplied - 1, unit: 'day' }]
else if Order.relevantPeriod.high is not null then Interval[startDate, date from end of Order.relevantPeriod]
else null
Current QDM Version of "MedicationDispensedPeriod":
define function "MedicationDispensedPeriod"(MedDispense "Medication, Dispensed" ):
MedDispense Dispense
let startDate: date from Coalesce(Dispense.relevantPeriod.low, Dispense.relevantDatetime, Dispense.authorDatetime),
***totalDaysSupplied: Coalesce(Dispense.supply.value /(Dispense.dosage.value * ToDaily(Dispense.frequency)), Dispense.daysSupplied)***
return if startDate is null then null
else if totalDaysSupplied is not null then Interval[startDate, startDate + Quantity { value: totalDaysSupplied - 1, unit: 'day' }]
else if Dispense.relevantPeriod.high is not null then Interval[startDate, date from end of Dispense.relevantPeriod]
else null
Proposed QI-Core Aligned Version of "MedicationDispensedPeriod":
define function "MedicationDispensedPeriod"(MedDispense "Medication, Dispensed" ):
MedDispense Dispense
let startDate: date from Coalesce(Dispense.relevantPeriod.low, Dispense.relevantDatetime, Dispense.authorDatetime),
***totalDaysSupplied: Coalesce(Dispense.daysSupplied, Dispense.supply.value /(Dispense.dosage.value * ToDaily(Dispense.frequency)))***
return if startDate is null then null
else if totalDaysSupplied is not null then Interval[startDate, startDate + Quantity { value: totalDaysSupplied - 1, unit: 'day' }]
else if Dispense.relevantPeriod.high is not null then Interval[startDate, date from end of Dispense.relevantPeriod]
else null
Rationale for Change:
This update will bring the QDM version of the two functions closer in alignment with the FHIR-based QI-Core version that is currently in development.
Show
Proposed Solution:
Changes are highlighted by the asterisks.
Current QDM Version of "MedicationOrderPeriod":
define function "MedicationOrderPeriod"(MedOrder "Medication, Order" ):
MedOrder Order
let startDate: date from Coalesce(Order.relevantPeriod.low, Order.authorDatetime),
***totalDaysSupplied: Coalesce(Order.supply.value /(Order.dosage.value * ToDaily(Order.frequency)), Order.daysSupplied) * ( 1 + Coalesce(Order.refills, 0) )***
return if startDate is null then null
else if totalDaysSupplied is not null then Interval[startDate, startDate + Quantity { value: totalDaysSupplied - 1, unit: 'day' }]
else if Order.relevantPeriod.high is not null then Interval[startDate, date from end of Order.relevantPeriod]
else null
Proposed QI-Core Aligned Version of "MedicationOrderPeriod":
define function "MedicationOrderPeriod"(MedOrder "Medication, Order" ):
MedOrder Order
let startDate: date from Coalesce(Order.relevantPeriod.low, Order.authorDatetime),
*** totalDaysSupplied: Coalesce(Order.daysSupplied, Order.supply.value /(Order.dosage.value * ToDaily(Order.frequency))) * ( 1 + Coalesce(Order.refills, 0) )***
return if startDate is null then null
else if totalDaysSupplied is not null then Interval[startDate, startDate + Quantity { value: totalDaysSupplied - 1, unit: 'day' }]
else if Order.relevantPeriod.high is not null then Interval[startDate, date from end of Order.relevantPeriod]
else null
Current QDM Version of "MedicationDispensedPeriod":
define function "MedicationDispensedPeriod"(MedDispense "Medication, Dispensed" ):
MedDispense Dispense
let startDate: date from Coalesce(Dispense.relevantPeriod.low, Dispense.relevantDatetime, Dispense.authorDatetime),
***totalDaysSupplied: Coalesce(Dispense.supply.value /(Dispense.dosage.value * ToDaily(Dispense.frequency)), Dispense.daysSupplied)***
return if startDate is null then null
else if totalDaysSupplied is not null then Interval[startDate, startDate + Quantity { value: totalDaysSupplied - 1, unit: 'day' }]
else if Dispense.relevantPeriod.high is not null then Interval[startDate, date from end of Dispense.relevantPeriod]
else null
Proposed QI-Core Aligned Version of "MedicationDispensedPeriod":
define function "MedicationDispensedPeriod"(MedDispense "Medication, Dispensed" ):
MedDispense Dispense
let startDate: date from Coalesce(Dispense.relevantPeriod.low, Dispense.relevantDatetime, Dispense.authorDatetime),
***totalDaysSupplied: Coalesce(Dispense.daysSupplied, Dispense.supply.value /(Dispense.dosage.value * ToDaily(Dispense.frequency)))***
return if startDate is null then null
else if totalDaysSupplied is not null then Interval[startDate, startDate + Quantity { value: totalDaysSupplied - 1, unit: 'day' }]
else if Dispense.relevantPeriod.high is not null then Interval[startDate, date from end of Dispense.relevantPeriod]
else null
Rationale for Change:
This update will bring the QDM version of the two functions closer in alignment with the FHIR-based QI-Core version that is currently in development.