Skip to main content
Version: v0.0.4

Interface: Acknowledgment

Typed view of an inbound ACK. accepted / error / rejected are derived from MSA-1 against HL7 Table 0008 and are mutually exclusive; all three are false when MSA-1 is absent or not a recognized code (fail-safe).

Example

import { interpretAck, parseHL7 } from "@cosyte/hl7";
const ack = interpretAck(parseHL7(rawAck));
if (ack.accepted) {
// safe to consider the message acknowledged
} else if (ack.rejected) {
for (const e of ack.errors) console.error(e.conditionCode, e.severity);
}

Properties

accepted

readonly accepted: boolean

True iff MSA-1 is a positive accept (AA/CA).


code?

readonly optional code?: string

MSA-1 acknowledgment code (HL7 Table 0008), verbatim. Omitted when absent.


controlId?

readonly optional controlId?: string

MSA-2 message control id (the correlated inbound MSH-10), surfaced as the field's canonical wire text (Field.text): the whole field, delimiters included, never truncated to the first component. Note this is the re-escaped form: a properly-escaped id arrives as its wire bytes (ID\S\X), and an HL7 explicit-null MSA-2 surfaces as the literal two-character "". Omitted when absent/empty.


error

readonly error: boolean

True iff MSA-1 is an error acknowledgment (AE/CE).


errors

readonly errors: readonly AckErrorEntry[]

Every ERR segment in document order ( [] when none ).


rejected

readonly rejected: boolean

True iff MSA-1 is a reject acknowledgment (AR/CR).