Greg Caulton wrote:
> Question on the query below, if at0004 occurs *only* once in the
> archetype model, in the position
> data[at0001]/events[at0002]/data[at0003]/items[at0004]/value, could
> one theoretically have the shorter query
>   
Greg,
while it is sometimes the case that an at-code is unique within the 
archetype, there are many archetypes where this is not so. The general 
case is that a leaf-level at-code will re-appear on numerous leaf nodes, 
due to multiple Events, or multiple panel items in a pathology test 
battery or somesuch.

However, using the Xpath // construct, one could achieve what you are 
after, which would make the query slightly shorter.

- thomas beale
> SELECT o/items[at0004]/value
> FROM EHR [uid = $ehrUid] CONTAINS OBSERVATION o
> [openEHR-EHR-OBSERVATION.respiration.v1]
> WHERE o/items[at0004]/value/magnitude >  $n
>
> The reason I ask is it would be tempting to store (in my data model)
> the single discrete value at0004 to map to my equivalent item.
>
> Of course that would break if a new data element was added in a
> position (fabricated)
> data[at0001]/events[at0099]/data[at00100]/items[at0004]/value but the
> simplicity is tempting.
>
> thanks
>
> Greg
> http;//www.patientos.org
>   




Reply via email to