SevKohler / OMOCL

Apache License 2.0
5 stars 2 forks source link

Multiple events on OBSERVATION #7

Open bjornna opened 7 months ago

bjornna commented 7 months ago

This is good work on a great concept!

I have a question related to how you will deal with multiple EVENT on an OBSERVATION.

I am working on ETL for openEHR data. To extract i.e. Body Temperature I use the following AQL. The example illustrates how I query for only POINT_EVENT and also support for multiple versions of the archetype.

The latter, versions of archetype, could be done safer to only allow specific versions. Currently there are v1 and v2 published over the years.

select
   pe/time/value as 'time',
   pe/data[at0001]/items[at0004]/value/magnitude as 'value',
   pe/data[at0001]/items[at0004]/value/units as 'unit',
   temp/data[at0002]/origin/value as 'origin',
   temp/protocol[at0020]/items[at0021]/value/value AS 'location_of_measurement',
   temp/data[at0002]/events[at0003]/state[at0029]/items[at0030]/value/value AS 'body_exposure',
   c/name/value as 'composition_name',
   c/context/start_time/value as 'start_time',
   c/context/end_time/value as 'end_time',
   temp/archetype_details/archetype_id/value as 'archetype_id'
from
   composition c
      contains observation temp[openEHR-EHR-OBSERVATION.body_temperature.v*]
         contains POINT_EVENT pe
order by
   temp/data[at0002]/origin/value desc,
   pe/time/value desc
SevKohler commented 7 months ago

We do a mapping for each version. There are changes in the versions, that can be breaking. Also usually its not more than two stable versions in 99% in the cases (for now) That why we write: archetype_id: "openEHR-EHR-ACTION.medication.v1" This allows the ETL to act specific for each version. If its the same you can copy paste. Otherwise, one could use a OMOCL-file and specify it as default, if there is no specific one.

SevKohler commented 7 months ago

Ah sry i got the question wrong. Usually we create one table row for each of the e.g. Measurements, since OMOP has no 0..n of value for the Measurement Table. In general event series are not very well represented in OMOP. For the case of blood pressure you would, if you want to link the context, use FACT_RELATIONSHIPS to relate them. Yet, these relationships find sparse use in OMOP and miss support in many tools. Therefore, either map only something like a mean, or each of them. Otherwise there is also upper and lower range for DV_QUANTITY.

SevKohler commented 7 months ago

@bjornna btw if you search for an ETL engine you can try https://github.com/SevKohler/Eos and also check how the OMOP mappings look.