The Interface: Week 4
The Weekly · Week 4 · Stream
The Interface
Next drop Monday Oct 12, 16:00 UTC6 inFirst in coral_mesa_9943The challenge
You're a data engineer at a hospital. Every lab result reaches it as an HL7 message: 1 result per message, text segments, | between the fields, filed under the specimen's accession number. An interface engine logs each message as 1 JSON line, and the quality team needs 1 clean row per result from that log. Write the code that turns the log into that table.
The mess
Results come from the hospital's lab and an outside reference lab, over separate links. The lab keeps its own patient index, days behind registration. A result goes out when entered and again each time it is verified or changed. The engine logs its acknowledgements, notes and test runs in the same file. A sender that hears no acknowledgement sends again. Some lines end before their message does.
1,000,000 messages
Click a column for its requirements, or click the bottom of the sheet to see the 10 sample rows to produce.
Notes from the quality team
- For 1 result, corrected beats final beats W beats preliminary.
- A time with no offset is the sender's local time.
- The hospital is in US Eastern, the reference lab in US Central.
- received_at, connection and other engine extras are bookkeeping.
- 2 layers write the log in turn, and each escapes what it gets.
How you're scored
- +1the right value. A right null counts.
- 0null where the source held a value. Silence is free.
- −1a wrong value. Silent corruption costs.
- −2a row that should not exist: no matching key, or a second row for the same key. The last row for a key is the one scored.