Well, at the risk of stepping on Ian's toes (he has spent a lot more
time on these particular archetypes and also AQL in general than me), I
would say that what we need to do is to create a data-type specific
version of this archetype for each DATA_VALUE descendant, e.g.
openEHR-EHR-CLUSTER.laboratory_test_analyte_quantity.v1 etc. For
example, I did these test archetypes some time ago to illustrate just this:
openEHR-EHR-CLUSTER.laboratory_test_analyte_quantity.v1
The definition of this is:
definition
CLUSTER[id1.1] matches { -- -
/items[id2]/value matches {
DV_QUANTITY[id0.16] matches {
normal_range matches {
DV_INTERVAL<DV_QUANTITY>[id0.17]
}
other_reference_ranges matches {
REFERENCE_RANGE<DV_QUANTITY>[id0.18] -- Quantity reference range
}
}
}
}
You can see a few others here in the ADL2 test archetype Git repo
<https://github.com/openEHR/adl-archetypes/tree/master/Example/openEHR/laboratory2>.
From my analysis, these subtypes are unavoidable in order to make
querying work, but also to enable manual specialisations e.g. into
particular analytes, which is something very useful for creating
standardised analytes and panels.
- thomas
On 02/05/2019 09:57, Georg Fette wrote:
Hi Thomas,
It depends on what you mean with "specialise". I do not wish to create
a new archetype but I rather would like to query existing instances of
the openEHR-EHR-CLUSTER.laboratory_test_analyte.v1 archetype. From
those instances I would like to query only this with specific
attributes. One constraint I am able to define is to constrain the
analyte name:
SELECT e
FROM EHR e CONTAINS CLUSTER
a[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]
WHERE a/items[at0024]/value/value = 'Calcium'
But how can I manage to as well constrain the value ? The path
openEHR-EHR-CLUSTER.laboratory_test_analyte.v1/items[at0001] is of the
type ELEMENT, which has a DATA_VALUE for its field "value". The
concrete instances of the analytes do have decendents of the
DATA_VALUE type in the place for ELEMENT[at0001]/value, e.g.
DV_QUANTITY. Is it possible to use paths to those concrete value types
in the WHERE-paths, such like:
SELECT e
FROM EHR e CONTAINS CLUSTER
a[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]
WHERE a/items[at0024]/value/value = 'Calcium' AND
a/items[at0001]/value/magnitude > 100
From a type checking point of view, this is not allowed, because the
data type at the path a/items[at0001]/value (which is DATA_VALUE) does
not contain a field "magnitude". To make this work I would have to
bind the value to the concrete type, with something like:
SELECT e
FROM EHR e CONTAINS CLUSTER
a[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]
CONTAINS DV_QUANTITY b
WHERE a/items[at0024]/value/value = 'Calcium' AND
a/items[at0001]/value = b and b/magnitude > 100
but I don't think this is allowed in AQL. I am not yet that fluent in
AQL, so I could need a little help in this.
Greetings
Georg
--
Thomas Beale
Principal, Ars Semantica <http://www.arssemantica.com>
Consultant, ABD Project, Intermountain Healthcare
<https://intermountainhealthcare.org/>
Management Board, Specifications Program Lead, openEHR Foundation
<http://www.openehr.org>
Chartered IT Professional Fellow, BCS, British Computer Society
<http://www.bcs.org/category/6044>
Health IT blog <http://wolandscat.net/> | Culture blog
<http://wolandsothercat.net/> | The Objective Stance
<https://theobjectivestance.net/>
_______________________________________________
openEHR-technical mailing list
openEHR-technical@lists.openehr.org
http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org