Why do laboratory results belongs to a template?

I am a beginner to OpenEHR. I’m viewing this template https://ckm.openehr.org/ckm/templates/1013.26.14 . The structure within this template seems to be counterintuitive to me. I think that some of the sections (e.g. lab results, allergic history) should kept separate from that “lump” of structure and the template should only keep references to these sections. Keeping these sections separately also facilitates the reuse of information for contexts other than heart failure clinic.

1 Like

Templates are used to define the structure of a clinical document. You may define them as required for your use case. Generally a template is defined to include all the data points that you want that particular clinical documents to contain. At run time you use instances of the template to create your documents as compositions.

While retrieving the data, you have 2 options 1. get the entire document(composition) 2. Query the required data from one document or across documents using AQL. In case you want to refer to data contained in one composition in another composition, you can use links.

So whether you keep some data(like the lab results) as part of the same composition(document) or in a separate composition and link to it is an implementation detail.

I hope this helps

1 Like

It seems to me that data querying in OpenEHR rigidly relies on data structure of committed data that may be difficult to use in different contexts. Although OpenEHR has template that can be tailored to be use in different contexts, but once the data that are structured by some template are commited to the database, the structure of that data is fixed and the path in subsequent queries must be specified based on that fixed structure.

That fixed structure makes the data difficult to be re-used in contexts other than one when originally committed. As in the example of heart failure template, the laboratory result (CBC, HbA1C) fixedly belongs to the template despite that data can be used in many other contexts.

If laboratory want to retrieve HbA1C values measured on different patients for some maintenance reason, it has to specify path for each individual template that store HbA1C to properly query.

Also for the allergic history section in the example template, if the patient needs his/her allergy to be cured (if it can be cured) and enter to allergy clinic, an allergy history that is already committed by heart failure clinic using the example template should be readily retrieve and use in this context. I know that can be achieved by AQL, but if the allergic history are scattered on different templates, we have to write different paths for each templates.

That will be solved by the CDR’s AQL implementation. Templates only specialise (implement) standardise archetypes e.g. lab result, so the path will be the same wether the lab result is implemented in a heart failure template or a diabetes checkup template.

AQL is extremely flexible in querying. In fact that is one of the biggest strengths of openEHR. You can either restrict your queries to a particular template or across any occurrence of the archetype across templates.

In the first case you get only data from the compositions created using one template and in the second case you get data across multiple templates.



So the paths are consistent between templates. Only the template id will be different, and a CDR implements that part of the query for you.
If you look at the example at: https://specifications.openehr.org/releases/QUERY/latest/AQL.html#_matches
it queries (any) COMPOSITION c that contains an (microbiology archetype) OBSERVATION.

1 Like

To add a bit more to @joostholslag, the whole idea of AQL is that querying is based on the archetypes, regardless of the template (indeed, regardless of software product) in which any given archetype was used.

The blog post - openEHR technical basics for HL7 and FHIR users might help (it has cartoons :wink:


Thank you very much!. It is my misunderstanding about AQL.

1 Like