Skip to main content
Version: v0.0.4

Interface: BatchEnvelopeSegment

A raw batch-envelope segment (FHS/BHS/BTS/FTS) surfaced by splitBatch. fields is the segment split on its own field separator with fields[0] holding the segment name: deliberately the raw token array, not a typed model: typed FHS/BHS field helpers beyond the raw fields are not part of this surface. Note the HL7 MSH-family indexing quirk: for FHS/BHS, fields[1] is the encoding-characters field (FHS-2/BHS-2); for BTS/FTS, fields[1] is field 1 (BTS-1 batch message count / FTS-1 file batch count).

Example

import { splitBatch } from "@cosyte/hl7";
const { fileHeader } = splitBatch("FHS|^~\\&|SENDER\r...");
fileHeader?.name; // "FHS"
fileHeader?.fields[2]; // "SENDER" (FHS-3, the File Sending Application)

Properties

fields

readonly fields: readonly string[]

Raw field tokens; fields[0] is the segment name.


name

readonly name: BatchEnvelopeName


position

readonly position: Hl7Position

Position of this envelope segment in the split stream.


raw

readonly raw: string

The verbatim segment string (line-ending normalized).