Receive the raw EDI 214 flat file or HTTPS POST from your EDI translator; identify the AT5 segment (Bill of Lading Details) for shipment identification and the B10 segment for shipment number and carrier SCAC
Iterate over AT7 segments (Shipment Status Details); each AT7 contains the shipment status code (e.g. X1=Arrived at Terminal, X3=Delivered), the status reason code, and the event date/time in AT7-07 and AT7-08
Extract L11 segments adjacent to each AT7 to capture reference numbers (purchase order, PRO, BOL) associated with that status event
Map AT7-01 status codes to your canonical tracking states using the ANSI X12 004010 or 004030 code list; retain the raw code alongside the canonical state for audit
Persist each AT7 event as an immutable record keyed by (shipment_id, status_code, event_datetime); apply an ISA control number check to detect and skip duplicate 214 transmissions
Emit a downstream notification only for status codes that represent a state change relative to the current highest-priority status for the shipment; suppress out-of-order events using event_datetime comparison
Known gotchas
Some carriers omit the AT7 stop-level event loop entirely and include only a single top-level status in the B10 segment; your parser must handle both loop-present and loop-absent structures without error
Event timestamps in AT7-07 and AT7-08 are in local time with a separate time zone code in AT7-09; failing to convert to UTC before persistence causes phantom late deliveries when comparing across time zones
EDI 214s from LTL carriers frequently include multiple AT7 loops for intermediate terminal scans that do not represent delivery exceptions; filtering purely on status code without context can suppress legitimate exception alerts
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp