Skip to main content
Version: v0.0.3

Interface: BatchSplitResult

The result of splitBatch: the flattened messages (every message across every batch, in stream order: the primary surface), the nested batches, the raw file envelope segments, and the batch-level warnings (count-mismatch / missing-trailer). hadEnvelope is false for a bare passthrough (no FHS/BHS/BTS/FTS seen).

Example

import { splitBatch } from "@cosyte/hl7";
const result = splitBatch(rawBatchFile);
result.messages.length; // every message, batched or not
result.batches.length; // === result.actualBatchCount
result.warnings; // BATCH_COUNT_MISMATCH / BATCH_MISSING_TRAILER (counts only)

Properties

actualBatchCount

readonly actualBatchCount: number

The number of explicit batches split out of the stream.


batches

readonly batches: readonly Batch[]

The explicit (BHS-delimited) batches, in stream order.


declaredBatchCount?

readonly optional declaredBatchCount?: number

The last FTS-1 file batch count, when declared as a non-negative integer.


fileHeader?

readonly optional fileHeader?: BatchEnvelopeSegment

The first FHS file header, when present.


fileTrailer?

readonly optional fileTrailer?: BatchEnvelopeSegment

The last FTS file trailer, when present.


hadEnvelope

readonly hadEnvelope: boolean

false when no envelope segment was seen (bare passthrough).


messages

readonly messages: readonly BatchMessageEntry[]

Every message split out of the stream, in order: the primary surface. This includes messages that belong to no explicit batch (a bare stream, or content outside any BHS/BTS), so it is a superset of the messages reachable via batches.


warnings

readonly warnings: readonly Hl7ParseWarning[]

Batch-level warnings (count mismatch, missing trailer); counts/positions only, never PHI.