Skip to main content
Version: v0.0.3

Interface: RawSegment

A parsed HL7 segment: the top level of the positional tree. The name is the three-character segment identifier (MSH, PID, ZPI, ...) and fields is the 1-indexed positional field array (see the JSDoc on fields for the index 0 slot convention).

Example

import type { RawSegment } from "@cosyte/hl7";
const pid: RawSegment = {
name: "PID",
fields: [
{ repetitions: [], isNull: false },
],
};

Properties

fields

readonly fields: readonly RawField[]

Positional fields array using HL7 1-indexed convention for ALL segments.

  • fields[0] is the segment name / separator placeholder slot (never a data field).
  • fields[N] for N >= 1 is the HL7 N-th field.

Examples:

  • MSH: fields[0] = field-separator char, fields[1] = MSH-2 (encoding chars), fields[2] = MSH-3, ..., fields[11] = MSH-12.
  • PID: fields[0] = "PID" name placeholder, fields[1] = PID-1, fields[2] = PID-2, ....

name

readonly name: string