Skip to main content

Class: Hl7Context

The Hl7Context class represents the parsing context for an HL7 message.

MSH-1: https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.1

MSH-2: https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.2

See this tutorial on MSH, and why it's a bad idea to use anything other than the default values: https://www.hl7soup.com/HL7TutorialMSH.html

Constructors

constructor

new Hl7Context(segmentSeparator?, fieldSeparator?, componentSeparator?, repetitionSeparator?, escapeCharacter?, subcomponentSeparator?)

Parameters

NameTypeDefault value
segmentSeparatorstring'\r'
fieldSeparatorstring`'
componentSeparatorstring'^'
repetitionSeparatorstring'~'
escapeCharacterstring'\\'
subcomponentSeparatorstring'&'

Defined in

packages/core/src/hl7.ts:16

Properties

segmentSeparator

Readonly segmentSeparator: string = '\r'

Defined in

packages/core/src/hl7.ts:17


fieldSeparator

Readonly fieldSeparator: string = '|'

Defined in

packages/core/src/hl7.ts:18


componentSeparator

Readonly componentSeparator: string = '^'

Defined in

packages/core/src/hl7.ts:19


repetitionSeparator

Readonly repetitionSeparator: string = '~'

Defined in

packages/core/src/hl7.ts:20


escapeCharacter

Readonly escapeCharacter: string = '\\'

Defined in

packages/core/src/hl7.ts:21


subcomponentSeparator

Readonly subcomponentSeparator: string = '&'

Defined in

packages/core/src/hl7.ts:22

Methods

getMsh1

getMsh1(): string

Returns the MSH-1 field value based on the configured separators.

Returns

string

The HL7 MSH-1 field value.

Defined in

packages/core/src/hl7.ts:29


getMsh2

getMsh2(): string

Returns the MSH-2 field value based on the configured separators.

Returns

string

The HL7 MSH-2 field value.

Defined in

packages/core/src/hl7.ts:37