We have created two templates with same archetype sign/symptom created using same composition encounter v1,
While inserting data we have inserted two data points one is observation, and other is for cluster for template1
Where as, for the second template we have inserted for only cluster.
SO, when we try to fetch the data inserted for both templates, we are getting only one row for template1 where we had inserted for both data points(observation and cluster), but expected was 2 rows for both templates. This expected result was working in version 20, but the same is not working on 23.
Below is AQL used :
{
âqâ : âSELECT e/ehr_id/value as ehrId, c/uid/value as composition_id, c1/items[at0001]/value/value as name, o1/data[at0001]/events[at0002]/data[at0003]/items[at0004]/value/value as story,c/archetype_details/template_id/value as template FROM ehr e[ehr_id/value=â{{ehrId}}â] CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.encounter.v1] contains (observation o1[openEHR-EHR-OBSERVATION.story.v1] or cluster c1[openEHR-EHR-CLUSTER.symptom_sign.v1]) where (c1/items[at0001]/value/value=âencounter-test-oneâ and c/archetype_details/template_id/value =âencounter-signsymptom-1.en.v0â and o1/data[at0001]/events[at0002]/data[at0003]/items[at0004]/value/value=âTestâ) or (c1/items[at0001]/value/value=âtest-encounter-twoâ and c/archetype_details/template_id/value =âencounter-signsyptom-2.en.v0â)â
}
Can you please help us identify the issue in new version, since it was working in version 20.
Hi @Mancini,
I guess youâre question is related to Behaviour of logical operators(OR, AND, NOT) in FROM Clause - #32 by pablo.
Both are product-related questions, and best is to place them (or similar future questions) under Platform - openEHR section.
This section is a placeholder for question on AQL specifications, and therefore should be more generic or conceptual, not necessarily focused on a specific product.
Also, it would be nice if you could format next time the SQL and extract it from the JSON - so that it gets more readable.
However, if you now follow @birger.haarbrandt recommendation and Iâm sure youâll get an answer to your issue.
This confuses me, where is the CLUSTER located in the COMPOSITION? A COMPO canât have a CLUSTER directly in it, it should have some entry, the entry would have some structure and the structure the cluster.
Can you provide sample templates and compositions?
I see the -5 file to have data in the observation, but the -3 doesnât have data in the observation, it seems this is the only data point âencounter-signsymptom-5.en.v0/story_history/any_event:0/symptom_sign/symptom_sign_nameâ in the -5 file.
And this âencounter-signsymptom-3.en.v0/story_history/any_event:0/story:0â might be only a name, not data in a data structure. So not sure where is the cluster you mention. Maybe I donât see it (Iâm not used to custom formats, personally prefer canonical JSON).
Also there is a strange underscore in the _end_time and _health_care_facility, those are normal attributes like the rest, I think the underscore prefix might not be right. If those work, then maybe the CDR isnât consistent in attribute naming.