Are there any consensus, guidelines, or previous experience that could help us to decide what timezone should be used when storing date and/or time data which is actually written and saved to our (for example) Compositions within an openEHR context?
We at Karolinska University Hospital have had a few discussions on this and can see pros and cons to each approach, but thought to pose the question to the international community here.
From a developer and system perspective it is often a typical first reaction that we want to store dates and times in UTC, and then the UTC timestamps can be converted to whatever locale you want when you are displaying the content somewhere.
However, within a healthcare context maybe it does make sense for certain âclinicalâ dates/times to be written into (for example) Compositions using the local timestamp where the actual events occurred?
What we are leaning towards is that we will try to start with writing âclinicalâ date and times with the local timestamp where the actual event occurred (for example the CONTEXTâs START_TIME), and technical timestamps (for example the DV_DATE_TIME under FEEDER_AUDIT) using UTC.
Unfortunately, we do see some inconsistent behavior when querying with the data by timezone in AQL depending on the specific openEHR platform we test with and variations of timestamps either written in the composition and/or given as query parameters. It seems that this could probably be one of the main âsticking pointsâ with picking one way or the other given the state of currently available implementations?
In my mind, for example, we should be able to give a timestamp with a timezone as a value in the WHERE clause of an AQL query (e.g. WHERE c/context/start_time/value >= '2023-09-11T00:00:00.000Z'
) where the system could do a conversion of the timezone given in the query vs the timezone of all of the values it is doing the comparison against (for example that the previously mentioned WHERE clause would match and return a Composition with a context/start_time written/saved as 2023-09-10T22:00:00.000+05:00
).
I have not been able to find anything that explicitly talks about âwhichâ timezone should be saved (UTC vs local timezone, and/or a difference between âtechnicalâ vs âclinicalâ time values) and how mixed timezones are/should be compared against each other, only that there âshouldâ exist a timezone on data which is saved and ideally given as parameters to queries (as was discussed in this thread: Datetimes in AQL and API)