Typed HL7v2 message with parsed segment structs.
A TypedMessage is the result of converting a RawMessage through the
HL7v2.TypedParser. Known segments (MSH, PID, PV1, etc.) are represented as
their typed struct, Z-segments as HL7v2.Segment.ZXX structs, and truly
unknown segments are preserved as raw {name, fields} tuples.
Escape sequences
Typed field values preserve HL7 escape sequences literally (e.g. \F\,
\S\, \R\, \E\, \T\, \Xhh\). The parser does not
decode them automatically because doing so would lose the distinction between
a literal delimiter and an escaped one, breaking round-trip fidelity.
To decode escape sequences in a field value, call HL7v2.Escape.decode/2
explicitly:
sep = msg.separators
decoded = HL7v2.Escape.decode(pid.patient_name |> hd() |> to_string(), sep)To encode delimiter characters before setting a field, use HL7v2.Escape.encode/2.