-
Question
-
Resolution: Referred to External Party for Resolution
-
Blocker
-
None
-
BONNIE
-
Bonnie QDM
-
Follow-Up Care for Children Prescribed ADHD Medication (ADD)
-
CMS136
-
QDM/CQL
-
Test TestCMD
-
Our goal is to test the updated logic in CMS136 before submitting them by 9/10 via CRP for public comment.
Dear Bonnie Team,
I noticed an unexpected performance with "Coalesce" in the first "if then" statement of this function "MedicationOrderPeriod". The intent of the first "if then" statement is as such: if relevantPeriod.end is available, return an interval starting with relevantPeriod.start and ending with releavntPeriod.end; if relevantPeriod.start is null, use authorDatetime instead.
Please find test case set up and result below. I would appreciate your assistance in pinpointing whether this is a cql-execution or logic issue. Thank you in advance!
define function "MedicationOrderPeriod"(Order "Medication, Order"): if Global.HasEnd ( Order.relevantPeriod ) then Interval[Coalesce(start of Order.relevantPeriod, Order.authorDatetime), end of Order.relevantPeriod] else ( Coalesce(Order.daysSupplied, Order.supply /(Order.dosage * ToDaily(Order.frequency)))* ( 1 + Coalesce(Order.refills, 0)) ) durationInDays let startDatetime: Coalesce(start of Order.relevantPeriod, Order.authorDatetime) return if durationInDays is not null then Interval[startDatetime, startDatetime + System.Quantity { value: durationInDays.value, unit: 'days' }] else null
Test case:
- Medication, Order
- relevantPeriod.start: null
- relevantPeriod.end: 1/4/2012 8:15am
- authorDatetime: 1/2/2012 8:00am
- Refills: 1
- Dosage: 50 'mg'
- Supply: 150 'mg'
- Frequency: SNOMEDCT 229797004
- Days Supplied: 10
Expected output vs actual:
- Expected: 1/2/2012 8:00am - 1/14/2012 8:15am
- Actual: Invalid date - 1/14/2012 8:15am