Skip to content
Recipes

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.

On this page

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:

facilitymrnprogramnotify_to
DEMO_NORTHTP-1001Demo Care Partnerscare-team@partners.example
DEMO_SOUTHTP-1001Demo Health Plancase-mgmt@plan.example
DEMO_NORTHTP-2002Demo Primary Carefront-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

  1. Create an MLLP workflow that accepts ADT^A01, ADT^A03, ADT^A04 and ADT^A08.
  2. Add a Data map that builds a small event: facility from MSH.4, event from MSH.9.2, mrn from PID.3.1, and subscriber from PID.3.1 too (the code table replaces it).
  3. 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.
  4. Add a destination with a filter subscriber.notify_to exists, 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.

The step's settings as JSON:

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.

Reference