Process an HL7v2 MDM^T02 medical document notification to ingest a clinical document

domain: hl7.org · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

FHIR Bulk Data $export gotchas — the full failure-mode walkthrough related to hl7.org, checked against official docs, with linked verified routes.

Steps

  1. Receive the MDM^T02 message (Medical Document Management — Original Document Notification with Content) via your MLLP listener; T02 indicates the document content is embedded in the message as opposed to T01 which is a pointer-only notification
  2. Parse the EVN segment for event date/time and TXA segment for document metadata: document type code in TXA-2, activity date/time in TXA-4, originating provider in TXA-9, document status in TXA-17 (AU for authenticated, DI for dictated), and unique document ID in TXA-12
  3. Extract the OBX segments that follow the TXA segment; for embedded documents OBX-2 will typically be 'ED' (encapsulated data) or 'TX' (text); for ED type, OBX-5 contains the document encoded as base64 (or plain text for TX) along with the encoding type and MIME type
  4. Decode the document content from base64 if applicable; the document may be a CDA (Clinical Document Architecture) XML document, plain text, or a PDF depending on the sending system
  5. Correlate the document to the patient using the PID segment in the MDM message and the visit using PV1 if present; store the document with appropriate indexing by document type, date, and provider
  6. Send an ACK and, if your system requires document management workflow, track authentication status using TXA-17 — documents in dictated or transcribed status may need to be updated via subsequent MDM messages as they move through the authentication workflow

Known gotchas

Related routes

Handle non-standard Z-segments and repeating-field quirks when mapping HL7v2 messages to FHIR resources
healthcare · 6 steps · unrated
Parse an HL7 v2 ADT (Admit/Discharge/Transfer) message to extract patient and event data
hl7v2 · 6 steps · unrated
Invoke the FHIR $docref operation to retrieve clinical documents for a patient in DocumentReference form
hl7.org · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans