-
Notifications
You must be signed in to change notification settings - Fork 24
QA Gestational Age Relative to Delivery Assessment
I have a piece of logic that is looking for an estimated gestational age that starts less than one day before or concurrent with the start of time of delivery assessment that needs to start in the inpatient encounter.
In CQL I have that main logic specified as:
define "GA with TOD4":
"TOD 2" T
with "Gestational age at Delivery" G
such that G.authorDatetime less than 1 day on or before day of start of T.relevantPeriod
However, it is using the encounter time and I want it to look at time of delivery and compare it to the estimated Gestational age. One of my test cases that was checking the edge was failing and I want to understand why it was failing.
This is other CQL logic that the main logic uses:
define "Gestational age at Delivery":
["Assessment, Performed": "Estimated Gestational Age at Delivery"] G
where (G.result as Quantity) >= 37 weeks
and (G.result as Quantity) < 39 weeks
define "TOD 2":
"Encounter with age and procedures" E
with "Time of Delivery1" A
such that A.authorDatetime during E.relevantPeriod
define "Time of Delivery1":
["Assessment, Performed": "Time of Delivery"]
define "Encounter with age and procedures":
"Encounter with Age" E
with ["Procedure, Performed": "Delivery Procedures"] P
such that P.relevantPeriod starts during E.relevantPeriod
define "Encounter with Age":
"Inpatient Encounter" E
with ["Patient Characteristic Birthdate"] B
such that global."CalendarAgeInYearsAt"(B.birthDatetime, start of E.relevantPeriod) >= 8
and global."CalendarAgeInYearsAt"(B.birthDatetime, start of E.relevantPeriod) < 65
define "Inpatient Encounter":
["Encounter, Performed": "Encounter Inpatient"] E
where E.lengthOfStay <= 120 days
and E.relevantPeriod ends during "Measurement Period"
The reason is that this expression returns the Encounter, not the Time of Delivery assessment:
define "TOD 2":
"Encounter with age and procedures" E
with "Time of Delivery1" A
such that A.authorDatetime during E.relevantPeriod
So when it's used here, the relevantPeriod refers to the encounter, not the assessment
define "GA with TOD4":
"TOD 2" T
with "Gestational age at Delivery" G
such that G.authorDatetime less than 1 day on or before day of start of T.relevantPeriod
If we filter the Time of Delivery assessment to those with a GA that satisfies the filter:
define "Time of Delivery with GA":
"Time of Delivery1" A
with "Gestational age at Delivery" G
such that G.authorDatetime less than 1 day on or before day of A.authorDatetime
Then we can look only for encounters that have a time of delivery with a GA:
define "Encounters with Time of Delivery with GA":
"Encounter with age and procedures" E
with "Time of Delivery with GA" T
such that T.authorDatetime during E.relevantPeriod
Authoring Patterns - QICore v4.1.1
Authoring Patterns - QICore v5.0.0
Authoring Patterns - QICore v6.0.0
Cooking with CQL Q&A All Categories
Additional Q&A Examples
Developers Introduction to CQL
Specifying Population Criteria