core.hl7segment
Home > @medplum/core > Hl7Segment
Hl7Segment class
The Hl7Segment class represents one HL7 segment. A segment is a collection of fields. The name field is the first field.
Signature:
export declare class Hl7Segment
Constructors
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(fields, context) | Creates a new HL7 segment. |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| context | readonly | Hl7Context | |
| fields | readonly | Hl7Field[] | |
| name | readonly | string |
Methods
| Method | Modifiers | Description |
|---|---|---|
| get(index) | Returns an HL7 field by index. | |
| getComponent(fieldIndex, component, subcomponent, repetition) | Returns an HL7 component by field index and component index. This is a shortcut for Note that both indexex are 1-based, not 0-based. For example, to get the first component, use This aligns with HL7 component names such as MSH.9.2. | |
| getField(index) | Returns an HL7 field by index. Note that the index is 1-based, not 0-based. For example, to get the first field, use This aligns with HL7 field names such as PID.1, PID.2, etc. Field zero is the segment name. | |
| parse(text, context) | static | Parses an HL7 segment string into an Hl7Segment object. |
| toString() | Returns the HL7 segment as a string. |