Incorrect Aggregate Example

XMLWordPrintableJSON

    • Type: Change Request
    • Resolution: Not Persuasive
    • Priority: Medium
    • Clinical Quality Language (FHIR)
    • 1.5 [deprecated]
    • Clinical Decision Support
    • Developers Guide
    • 12. Aggregate Queries
    • Hide

      I think for list-valued operators, null is treated the same as an empty list (we made this change in 1.3 to align with FHIRPath behavior), so

      `(null as List<Integer>) union (null as List<Integer>)`

      See Union (List): https://cql.hl7.org/2020May/09-b-cqlreference.html#union-1

      Show
      I think for list-valued operators, null is treated the same as an empty list (we made this change in 1.3 to align with FHIRPath behavior), so `(null as List<Integer>) union (null as List<Integer>)` See Union (List): https://cql.hl7.org/2020May/09-b-cqlreference.html#union-1
    • Chris Moesel/Ben Hamlin: 25-0-0

      The second aggregate example looks like this:

      define RolledOutIntervals:
        MedicationRequestIntervals M
          aggregate R starting (null as List<Interval<DateTime>>): R union ({
            M X
              let S: Max({ end of Last(R) + 1 day, start of X }),
                E: S + duration in days of X
              return Interval[S, E]
          }) 

      If I understand it correctly, however, it will always result in null – because you specify the starting value of R as null – and null union anything is always null.  So the null will just propagate all the way through the aggregation.  You probably want R starting (List{} as List<Interval<DateTime>>) (or something like that).

            Assignee:
            Unassigned
            Reporter:
            cmoesel
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: