ADT encounter notifications
Watch ADT admit, discharge and transfer events and notify the care teams and organizations that follow the patient, from a roster kept as a multi-column code table.
Care managers, primary care practices and health plans want to know when one of their patients is admitted to, discharged from or transferred between facilities. An encounter notification service reads ADT events, checks each patient against the rosters of the organizations that subscribe, and sends each subscriber a short notification. This recipe builds that service on the engine, with the roster kept as a code table with named columns.
Source and destination
The flow takes ADT from the MLLP listener, matches the patient against the subscriber roster, and sends a notification for each match.
flowchart LR
A[Registration system] -->|ADT A01, A03, A04, A08| B[MedHook engine]
B --> C{On a roster?}
C -->|yes| D[Subscriber notification]- Source: HL7v2 ADT^A01 (admit), A03 (discharge), A04 (register) and A08 (update) over MLLP.
- Destination: the subscriber's care team by email, through the SMTP Sender. A webhook, FHIR server or HL7v2 receiver works the same way with its own send step.
The roster
Keep the roster as a code table with one row per patient each subscriber follows. The sending facility and the patient's MRN together pick the row, so one table serves every facility that sends ADT. Synthetic Demo Health rows:
| facility | mrn | program | notify_to |
|---|---|---|---|
| DEMO_NORTH | TP-1001 | Demo Care Partners | care-team@partners.example |
| DEMO_SOUTH | TP-1001 | Demo Health Plan | case-mgmt@plan.example |
| DEMO_NORTH | TP-2002 | Demo Primary Care | front-desk@primary.example |
On Code tables, paste the rows as CSV under the header facility,mrn,program,notify_to, or upload the subscriber's export. Refresh it the same way, or with PUT /api/code-tables/{id} and columns and rows from a scheduled job. Edit opens it as a grid for a one-off change.
Build it
- Create an MLLP workflow that accepts
ADT^A01,ADT^A03,ADT^A04andADT^A08. - Add a Data map that builds a small event:
facilityfromMSH.4,eventfromMSH.9.2,mrnfromPID.3.1, andsubscriberfromPID.3.1too (the code table replaces it). - Add a Code table step on
encounter_roster:- Fields:
subscriber - Match on columns:
facility=facility, mrn - Return column:
*(the whole row) - When a code is unknown: Use the default value, with an empty default.
- Fields:
- Add a destination with a filter
subscriber.notify_toexists, so patients on no roster are not sent, and an SMTP Sender send step:- To:
${subscriber.notify_to} - Subject:
${event} at ${facility} for ${subscriber.program} - Body: the minimum the care team needs, such as the event and the facility, and a link back to the record in their own system.
- To:
The step's settings as JSON:
{
"transformType": "code-table",
"codeTableName": "encounter_roster",
"config": {
"fields": ["subscriber"],
"matchColumns": ["facility=facility", "mrn"],
"returnColumn": "*",
"onMissingCode": "default",
"default": ""
}
}Check it
Open the workflow's Build tab, paste a synthetic ADT^A01 from DEMO_NORTH for TP-1001, and choose Run test. The code table step's output shows subscriber as the Demo Care Partners row, and the send step would mail care-team@partners.example. A message for an MRN on no roster stops at the destination filter.
What exists today
- The MLLP trigger narrows events by message type, and filters narrow them by any field, such as the facility in MSH-4.
- The built-in template HL7v2 over MLLP → JSON webhook posts every message as JSON to one URL. See HL7v2 over MLLP to a JSON webhook.
- A workflow can send to several destinations, each with its own filter. See Build a channel with several destinations.
- Code tables have named columns: match on any columns, such as facility plus MRN, and return any column or the whole row.
- The SMTP Sender adapter sends an email per message, to recipients set on the step.