Skip to main content
Version: v0.0.3

Function: batchMissingTrailer()

batchMissingTrailer(position, header, expectedTrailer): Hl7ParseWarning

Build a BATCH_MISSING_TRAILER warning. Emitted by splitBatch() (attached to BatchSplitResult.warnings) when an envelope header opens a scope that is never closed: a BHS batch header with no matching BTS trailer, or an FHS file header with no matching FTS trailer (HL7 v2 Ch. 2 §2.10.3: each envelope segment is optional, but a profile such as an IIS file-submission spec may mandate the full frame). splitBatch does not enforce such a rule: it splits, warns, and leaves the accept/reject decision to the caller; the parse never throws for this.

The message carries only the header/trailer segment names: NEVER a field value, so no PHI is exposed. position references the unmatched header segment (FHS/BHS).

Parameters

position

Hl7Position

"FHS" | "BHS"

expectedTrailer

"BTS" | "FTS"

Returns

Hl7ParseWarning

Example

import { batchMissingTrailer } from "@cosyte/hl7";
const w = batchMissingTrailer({ segmentIndex: 0 }, "BHS", "BTS");