Hi Georg,

There is no direct connection between AQL and templates.

What do I need to know about the data model structures of the templates
potentially containing this archetype ?

Nothing - you can use the CONTAINS statement to find your candidate
archetype regardless of the enclosing composition/ template

When there are multiple templates that contain this archetypes, will
they all be found by this query, no matter where the archetype is
contained in their structure?

Yes, as above

How can I constrain my query so that I only get those of a specific
template ?

The templateID is carried in the parent composition (optionally though not
normally at entry level)

select a_a, a/name/value, a/archetype_details/template_id/value
from EHR e
contains COMPOSITION a
contains EVALUATION a_a[openEHR-EHR-EVALUATION.problem_diagnosis.v1]
where a/archetype_details/template_id/value ='My lovely template'

Do templates have to be specifically mentioned in the queries or are
they handled as if they were archetypes as well ?

No - you can ignore the templateId - templates are just 'design-time
recipes' - the name of the recipe ids carried in the
''archetype_details/template_id/value' attribute but otherwise this is just
pure archetypes.


How could I change my query so that (when I receive results from
different template types) that I also get the surrounding information in
which template my archetype has been found in

select a, a_a, a/name/value, a/archetype_details/template_id/value
from EHR e
contains COMPOSITION a
contains EVALUATION a_a[openEHR-EHR-EVALUATION.problem_diagnosis.v1]
where a/archetype_details/template_id/value ='My lovely template'

In that example 'a' will return the whole containing composition - you
probably do not want to do that but you get the idea.

Ian

Dr Ian McNicoll
mobile +44 (0)775 209 7859
office +44 (0)1536 414994
skype: ianmcnicoll
email: [email protected]
twitter: @ianmcnicoll



Director, freshEHR Clinical Informatics Ltd.
CCIO inidus Ltd. [email protected]
Co-Chair, openEHR Foundation [email protected]
Hon. Senior Research Associate, CHIME, UCL


On Mon, 16 Sep 2019 at 12:52, Georg Fette <[email protected]>
wrote:

> Hello,
> I have some question related to the coupling of AQL and templates:
> Imagine I want to write an AQL query containing a certain archetype and
> that archetype is used in multiple templates in the openEHR system.
> What do I need to know about the data model structures of the templates
> potentially containing this archetype ?
> When there are multiple templates that contain this archetypes, will
> they all be found by this query, no matter where the archetype is
> contained in their structure?
> How can I constrain my query so that I only get those of a specific
> template ?
> Do templates have to be specifically mentioned in the queries or are
> they handled as if they were archetypes as well ?
> How could I change my query so that (when I receive results from
> different template types) that I also get the surrounding information in
> which template my archetype has been found in ?
> Greetings
> Georg
>
> --
> ---------------------------------------------------------------------
> Dipl.-Inf. Georg Fette      Raum: B001
> Universität Würzburg        Tel.: +49-(0)931-31-85516
> Am Hubland                  Fax.: +49-(0)931-31-86732
> 97074 Würzburg              mail: [email protected]
> ---------------------------------------------------------------------
>
>
> _______________________________________________
> openEHR-technical mailing list
> [email protected]
>
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
_______________________________________________
openEHR-technical mailing list
[email protected]
http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org

Reply via email to