FHIR Chat · sorting of lists · cql

Stream: cql

Topic: sorting of lists


view this post on Zulip Georg Fette (Feb 13 2019 at 12:02):

Hello, When I sort a list of complex objects using a "sort by" path indicating the path to a member with which to sort by, the final order of the list can be ambiguous if there are multiple objects with the same primitive indicated by the given path. How should such an ambiguity be handled in an implementation ?

view this post on Zulip Bryn Rhodes (Feb 15 2019 at 23:06):

Hi @Georg Fette, I'm not sure I follow the issue. Since the path will be evaluated for each object in the result, there wouldn't be any ambiguity with respect to a single object, right? I must be missing something, can you provide an example of what you mean?

view this post on Zulip Georg Fette (Feb 18 2019 at 07:54):

HI @Bryn Rhodes , I mean something like
[Encounter] A return Tuple { e: A, eoc: Last(A.episodeOfCare B sort by period.start) }
When there are multiple episodes of care that have the same start, which episode should be returned ?

view this post on Zulip Bryn Rhodes (Feb 18 2019 at 17:46):

Ah, I see. When the possibility of duplicates exist, the resulting order is unspecified. Looking through the spec, I see that is never stated explicitly, so I've added an STU comment (#1751) to that effect.


Last updated: Apr 12 2022 at 19:14 UTC