Skip to main content

Class: Hl7Segment

The Hl7Segment class represents one HL7 segment. A segment is a collection of fields. The name field is the first field.

Constructors

constructor

new Hl7Segment(fields, context?)

Creates a new HL7 segment.

Parameters

NameTypeDescription
fieldsstring[] | Hl7Field[]The HL7 fields.
contextHl7ContextOptional HL7 parsing context.

Defined in

packages/core/src/hl7.ts:164

Properties

context

Readonly context: Hl7Context

Defined in

packages/core/src/hl7.ts:155


name

Readonly name: string

Defined in

packages/core/src/hl7.ts:156


fields

Readonly fields: Hl7Field[]

Defined in

packages/core/src/hl7.ts:157

Methods

get

get(index): Hl7Field

Returns an HL7 field by index.

Parameters

NameTypeDescription
indexnumberThe HL7 field index.

Returns

Hl7Field

The HL7 field.

Defined in

packages/core/src/hl7.ts:179


toString

toString(): string

Returns the HL7 segment as a string.

Returns

string

The HL7 segment as a string.

Defined in

packages/core/src/hl7.ts:187


parse

Static parse(text, context?): Hl7Segment

Parses an HL7 segment string into an Hl7Segment object.

Parameters

NameTypeDescription
textstringThe HL7 segment text.
contextHl7ContextOptional HL7 parsing context.

Returns

Hl7Segment

The parsed HL7 segment.

Defined in

packages/core/src/hl7.ts:197