UCLH-DHCT / emap

All core Emap functions (monorepo)
2 stars 1 forks source link

Core processor logic (orphan data problem) #30

Closed skeating closed 1 month ago

skeating commented 1 month ago

The HL7 messages that Emap has been ingesting up to this point tend to be highly redundant. Every message contains basic patient demographic/encounter data. This means that if we receive messages out of order, keeping the database in a usable state at all intermediate points is not too hard. For example, if we receive a test order for a patient that we haven't yet received any other information for (admission, demographics, etc) we can still create the encounter/mrn/demographics from that message alone.

Unfortunately this is not the case for waveform data. The only patient ID info we have in a waveform HL7 message is the bed location, the time, and (presumably) the machine identifier. This raises the possibility that we will receive some waveform data and have no idea which encounter to attach it to.

NB: Although it may seem unlikely that a patient would start generating ventilator/monitor data before we have seen their admit messages, consider what happens if the main HL7 feed goes down for a bit but the waveform feed doesn't.

I can see several ways around this problem:

We currently don't store any orphan data in Emap, so this will be a new paradigm for us.

A closely related problem:

We may need to actively monitor the overall liveness of our data, and perform whatever fix we come up with for this problem in this case. Possible heuristics to answer the question "Is patient A definitely still assigned to bed 1?":

Other solution is to fix it up later when the feed comes back, but that involves a lot of continuously rechecking stuff, and we will have been giving out wrong information in the meantime. And then we will need that audit table!

jeremyestein commented 1 month ago

Closing because this is a design discussion not a task, and to the extent it's an epic I have merged it with #27

For design discussion see https://github.com/UCLH-DHCT/emap/blob/jeremy/hf-data/docs/dev/features/waveform_hf_data.md