Class: Hl7Field
The Hl7Field class represents one HL7 field. A field is a collection of components.
Constructors
constructor
• new Hl7Field(components, context?)
Creates a new HL7 field.
Parameters
| Name | Type | Description |
|---|---|---|
components | string[][] | The HL7 components. |
context | Hl7Context | Optional HL7 parsing context. |
Defined in
packages/core/src/hl7.ts:327
Properties
context
• Readonly context: Hl7Context
Defined in
packages/core/src/hl7.ts:319
components
• Readonly components: string[][]
Defined in
packages/core/src/hl7.ts:320
Methods
get
▸ get(component, subcomponent?, repetition?): string
Returns an HL7 component by index.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
component | number | undefined | The component index. |
subcomponent? | number | undefined | Optional subcomponent index. |
repetition | number | 0 | Optional repetition index. |
Returns
string
The string value of the specified component.
Deprecated
Use getComponent() instead. This method will be removed in a future release.
Defined in
packages/core/src/hl7.ts:340
getComponent
▸ getComponent(component, subcomponent?, repetition?): string
Returns an HL7 component by index.
Note that the index is 1-based, not 0-based.
For example, to get the first component, use getComponent(1).
This aligns with HL7 component names such as MSH.9.2.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
component | number | undefined | The component index. |
subcomponent? | number | undefined | Optional subcomponent index. |
repetition | number | 0 | Optional repetition index. |
Returns
string
The string value of the specified component.
Defined in
packages/core/src/hl7.ts:358
toString
▸ toString(): string
Returns the HL7 field as a string.
Returns
string
The HL7 field as a string.
Defined in
packages/core/src/hl7.ts:372
parse
▸ Static parse(text, context?): Hl7Field
Parses an HL7 field string into an Hl7Field object.
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The HL7 field text. |
context | Hl7Context | Optional HL7 parsing context. |
Returns
The parsed HL7 field.
Defined in
packages/core/src/hl7.ts:382