Skip to content

QA Gestational Age Relative to Delivery Assessment

Darren Duncan edited this page Oct 12, 2017 · 1 revision

Questions and Answers


Q&A - Gestational Age Relative to Delivery Assessment

Question

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"

Answer

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

Wiki Index

Home

Authoring Patterns - QICore v4.1.1

Authoring Patterns - QICore v5.0.0

Authoring Patterns - QICore v6.0.0

Authoring Measures in CQL

Composite Measure Development

Cooking with CQL Examples

Cooking with CQL Q&A All Categories
Additional Q&A Examples

CQL 1.3 Impact Guidance

CQL Error Messages

Developers Introduction to CQL

Discussion Items

Example Measures

Formatting and Usage Topics

Formatting Conventions

Library Versioning

Negation in QDM

QDM Known Issues

Specific Occurrences

Specifying Population Criteria

Supplemental Data Elements

Terminology in CQL

Translator Options For Measure Development

Unions in CQL

Clone this wiki locally