Long time reader, first time poster
Given a composition C that has multiple instances of the same observation archetype O, should I be able to query for all instances of O?
A trivial example: for the given ehr, there is one composition that contains two progress_note observations.
Using EHRBase and the query below, I only get one of the observations returned.
FROM EHR e
CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.progress_note.v1]
WHERE e/ehr_id/value = $ehr_id
If I add a second composition with multiple notes, I get 2 results; one note form each composition.
Is this expected? If so, how/can my query be adjusted to return all progress notes in this example?
Hi Alex, selecting observation and filtering by archetype id should return all the instances of the observations complying with that archetype, single or multiple inside the same compo.
EhrBase is quite mature, so I too would expect your query to return two observations, given a composition with two observations.
There used to be a period during which EhrBase team were talking about implementing behaviour that would be more intuitive for users who may be less exposed to query languages such as SQL or XQuery etc.
AQL’s story is kind of complicated when it comes to how it behaves. I advocated for it to have a formal execution semantics for years (literally) but we could not get that effort off the ground (for good reasons). So as things stand, each vendor may or may not give you an explanation of how it functions, but these days most implementations converge in terms of results, except when they don’t
I still think the outcome should be what you’re expecting. If you’re able to perform a GET from the REST api and share the json form (or XML) of your compositions, we can speculate with a bit more confidence.
Re the history of the semantics discussion, these may make interesting (or boring )reading:
A discussion about Archetype Query Language semantics – Musings of a confused technology addict. (serefarikan.com)
Archetype Query Language, The Confusing Bits – Musings of a confused technology addict. (serefarikan.com)
Archetype Query Language, The Confusing Bits, II – Musings of a confused technology addict. (serefarikan.com)
serefarikan/aql-discussion: examples in xquery and sparql to discuss aql semantics (github.com)
thank you for your kind words @Seref, but in this case, it is a known bug (AQL Not returning multiple diagnosis from one composition · Issue #1019 · ehrbase/ehrbase · GitHub). The team is currently working on a revision of EHRbase’s AQL engine which will address this behavior amongst others. Once this is done, EHRbase will also finally be released as 1.0.