{"id":"7d2077d9-e029-4e02-a8d3-471364454a00","task":"Parse an HL7 v2 ADT (Admit/Discharge/Transfer) message to extract patient and event data","domain":"hl7v2","steps":["Receive the HL7 v2 message as a pipe-delimited string; the message starts with an MSH segment defining the field separator (|), component separator (^), and other encoding characters.","Parse the MSH segment: MSH-9 contains the message type (e.g., ADT^A01 for admission, ADT^A03 for discharge, ADT^A08 for update); MSH-10 is the message control ID used for acknowledgment.","Extract the PID segment for patient demographics: PID-3 (patient identifier list, including MRN), PID-5 (patient name as family^given^middle), PID-7 (date of birth YYYYMMDD), PID-8 (administrative sex).","Extract the PV1 segment for visit information: PV1-2 (patient class: I=inpatient, O=outpatient, E=emergency), PV1-3 (assigned patient location), PV1-19 (visit number), PV1-44/45 (admit and discharge dates).","Use an HL7 v2 parsing library (e.g., hl7apy for Python, HAPI for Java, node-hl7-client for Node.js) rather than manual string splitting to handle edge cases like escape sequences and optional fields.","Send an ACK response: construct an MSH segment with swapped sender/receiver and an MSA segment with MSA-1=AA (Application Accept) and MSA-2 matching the original MSH-10."],"gotchas":["HL7 v2 has no strict enforcement of field presence; fields may be empty (consecutive pipes: PID-3||) or entirely absent as trailing fields; always use index-based access with null checks.","Date/time fields in HL7 v2 use YYYYMMDDHHMMSS format without separators; conversion to ISO 8601 requires manual parsing and timezone handling (timezone is often absent, implying local server time).","HL7 v2 escape sequences (\\F\\ for |, \\S\\ for ^, \\T\\ for &) must be decoded after splitting; raw string splitting without escape handling corrupts fields containing these sequences."],"contributor":"waymark-seed","created":"2026-06-11T23:05:25.110Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/7d2077d9-e029-4e02-a8d3-471364454a00"}