Stream: cql
Topic: 'with such that' semantics
Georg Fette (Oct 18 2018 at 06:53):
Hello,
I have some questions related to the 'with such that' operator in CQL
Page 41 of the CQL documentation contains this statement:
[Encounter: "Ambulatory/ED Visit"] E
with [Condition: "Acute Pharyngitis"] P
such that P.onsetDateTime during E.period
and P.abatementDate after end of E.period
I assume that the model this statement is working on is FHIR v3.0.1.
- What ensures that the encounter E is the encounter that contains the condition P ? And in which member of the encounter is the condition contained ? It could be 'diagnosis.condition'. Or the connection could be found from the other because condition contains the member 'context' which can reference the encounter. What if the resources contain two different members of the same required type ? If the connection between the resources is not explicitly given it is not clear to me how to interpret the query.
- Is it possible to use 'with such that' in a context in which the two resources are not connected at all ? That would allow queries that could find e.g. encounters that happended at the same time but are otherwise not related, like with:
[Encounter] E1 with [Encounter] E2 such that E1.period during E2.period
- Why is the 'such that' part in the operator necessary at all ? Why can't the statment from page 41 be expressed with 'where' and look like this
[Encounter: "Ambulatory/ED Visit"] E with [Condition: "Acute Pharyngitis"] P
where P.onsetDateTime during E.period and P.abatementDate after end of E.period
What is the difference between 'such that' and 'where' ?
Greetings
Georg
Last updated: Apr 12 2022 at 19:14 UTC