In ten days the clocks go back. Is your medication schedule ready?
Contents
On the last Sunday of October most of Europe goes back from summer time to standard time, and the hour from 02:00 to 03:00 happens twice. For most software this is a small annoyance. In a hospital it can mean a dose documented twice, or an infusion total calculated over the wrong number of hours.
Siobhan wrote a very good story here some weeks ago about a renewal test that failed one night a year. This is the clinical member of the same family of bugs, with the rules we use.
What actually goes wrong
- The duplicated hour. A medication given at 02:30 the first time and another one at 02:30 the second time look identical if you store local time without an offset. Sorting by the local timestamp puts them in random order.
- Durations. "Every 8 hours" scheduled by wall clock from 22:00 gives 06:00, but that night there were 9 real hours in between. For most drugs this is fine. For some it is not, and those schedules must run on elapsed time.
- Daily balances. Fluid balance is usually summed over 24 hours. That night has 25. The totals look one hour high unless the logic knows.
- Interfaces. HL7 v2 timestamps very often have no offset. Two systems on two servers with a different time zone configuration will disagree, silently.
Rules that help
- Store instants in UTC or with an explicit offset, and convert to local time only for display. In Postgres use
timestamptz, which stores the instant, and set the session time zone for display. - Keep dates that are dates as dates. A birth date or a planned admission day is not an instant. Do not store it as midnight UTC.
- In FHIR a
dateTimethat contains a time must have an offset. Validate that you send one. FHIR also allows partial dates like1950-03when the day is unknown, so your code should accept them instead of inventing the first of the month. - For HL7 v2, agree in the interface specification which time zone the timestamps without offset mean, and write it down. Log the raw value next to the parsed one.
- Test it. Pin the clock to 01:30 local time on the night of the change and run the medication scheduling tests. Do the same for the spring change, where 02:30 does not exist at all.
On the ward the night of the change was always a little bit strange. The paper charts had a special line for the second 02:00. I still think that was good design, because it made the problem visible. Software tends to hide it.
Written by
Hannah Weiss
Clinical informatics engineer in Berlin. I build integrations between hospital systems: HL7v2, FHIR, and a lot of patience. Formerly a nurse, which explains my opinions about alert fatigue.
Get the best of #vitals_and_variables weekly
One email each Monday with the most useful posts. No spam; unsubscribe in one click.
Comments
Sign in to join the conversation.
Sign in to comment