health.hl7v2
ballerinax/health.hl7v2 Ballerina library
Package containing core HL7v2 capabilities to implement HL7v2 related integration
HL7 Base Package
Package Overview
This Package holds the base implementation for referred by HL7v2 protocol version implementations.
Capabilities and features
- This package contains core common processing utilities required by other version bound HL7v2 packages.
- Framework implementation for other HL7v2 packages.
- Generic HL7v2 message Parser and Encoder
- Generic HL7v2 client
Usage
To add the HL7v2 base dependency the project simply import the package as below,
import ballerinax/health.hl7v2;
Functions
createHL7WirePayload
function createHL7WirePayload(byte[] message) returns byte[]
Function to create HL7 payload with essential HL7 message Start Block character (1 byte)ASCII , i.e., <0x0B> and End Block character (1 byte)ASCII , i.e., <0x1C>.
Parameters
- message byte[] - HL7 encoded message to be wrapped
Return Type
- byte[] - Wrapped HL7 payload
encode
Encodes HL7 message model to encoded wire format.
Return Type
- byte[]|HL7Error - encoded message. HL7Error if error occurred
parse
Delegates parsing of HL7 message to the relevant HL7 version's parser.
Parameters
- message string|byte[] - HL7 Message in encoded wire format
registerCustomMessage
Register custom HL7 message for given HL7 version.
registerCustomSegment
Register custom HL7 segment for given HL7 version.
registerCustomSegmentGroup
function registerCustomSegmentGroup(string hl7Version, SegmentComponent segmentGroup)
Register custom HL7 segment group for given HL7 version.
Classes
health.hl7v2: EncodingCharacters
Holds encoding characters used in the HL7 message.
getFieldSeparator
function getFieldSeparator() returns string
getFieldSeparatorWithEscapeChars
function getFieldSeparatorWithEscapeChars() returns string
getComponentSeparator
function getComponentSeparator() returns string
getComponentSeparatorWithEscapeChars
function getComponentSeparatorWithEscapeChars() returns string
getRepetitionSeperator
function getRepetitionSeperator() returns string
getEscapeCharacter
function getEscapeCharacter() returns string
getSubcomponentSeparator
function getSubcomponentSeparator() returns string
getTruncationCharacter
function getTruncationCharacter() returns string
health.hl7v2: HL7Client
HL7 Client implementation.
sendMessage
Send a single HL7 message to given encoded HL7 message to given endpoint.
Parameters
- message Message|byte[] - HL7 message as record or encoded binary message. If record is given, it will be encoded to binary message
Return Type
Deprecated
This client is deprecated and will be removed in future releases. Use HL7Client in ballerinax.clients.hl7 instead.
health.hl7v2: HL7Registry
Registry holding HL7 related runtime metadata. NOTE: This is used for internal processing between related HL7 packages. Recommended not to update the content of this package
addPackage
function addPackage(readonly & HL7Package package)
Add HL7 package to the registry.
Parameters
- package readonly & HL7Package - package metadata
getParser
Find matching HL7 parser for given HL7 version.
Parameters
- hl7Version string - HL7 version
Return Type
getHl7MessageType
Find matching HL7 message type for given HL7 version.
Return Type
getHl7SegmentType
Find matching HL7 segment type for given HL7 version.
Return Type
getHl7SegmentGroupType
function getHl7SegmentGroupType(string hl7Version, string segmentGroupName) returns SegmentComponent?
Find matching HL7 segment group type for given HL7 version.
Return Type
- SegmentComponent? - Segment group record for specific segment group name. HL7Error is returned, if error occurred
getEncoder
Find matching HL7 encoder for given HL7 version.
Parameters
- hl7Version string - HL7 version
Constants
health.hl7v2: HL7_V2_CLIENT_ERROR
Error flag used for errors occur in HL7 client side.
health.hl7v2: HL7_V2_MSG_VALIDATION_ERROR
Error flag used when HL7 validation errors occur.
health.hl7v2: HL7_V2_PARSER_ERROR
Error flag used for HL7 event parsing errors.
Variables
health.hl7v2: hl7Registry
HL7 registry instance which holding HL7 related runtime metadata. NOTE: This is used for internal processing between related HL7 packages. Not recommended to update the content of this variable.
health.hl7v2: CARRIAGE_RETURN
Hex character to use for end of a HL7 MLLP message.
health.hl7v2: HL7_MSG_START_BLOCK
Hex character to indicate start of a HL7 MLLP message.
health.hl7v2: HL7_MSG_END_BLOCK
Hex character to indicate end of a HL7 message content.
Annotations
health.hl7v2: MessageDefinition
Annotation type for HL7 message definition.
health.hl7v2: SegmentComponentDefinition
Annotation type for HL7 segment component definition.
health.hl7v2: SegmentDefinition
Annotation type for HL7 segment definition.
health.hl7v2: TypeDefinition
Annotation type for HL7 data type definition.
Records
health.hl7v2: CompositeType
This file contains the definitions of the core HL7 data types. Composite HL7 datatype. This is constructed from composition of multiple other data types.
health.hl7v2: GenericMessage
Generic HL7 message which use to parse/construct any custom HL7 message.
Fields
- Fields Included from *Message
- name string
- anydata...
- name? string - Name of the message
- segments [Segment...] - Segments included in the message
health.hl7v2: HL7CustomDef
Fields
- segmentGroups? map<SegmentComponent> -
health.hl7v2: HL7ErrorData
HL7Error detail.
Fields
- message? string - Descriptive message about the error
- cause? error - Cause of the error
health.hl7v2: Hl7MessageDefinitionRecord
Annotation fields for HL7 message definition.
Fields
- segments? map<Hl7SegmentDefinitionRecord> - segment map of the HL7 message
- groups? map<Hl7SegmentComponentDefinitionRecord> - group map
- orderedSegments? map<Hl7SegmentDefinitionRecord[]> - segment map with the order of the segments
health.hl7v2: HL7Package
Record describing information about a package.
Fields
- hl7Version readonly & string - HL7 version supported
- name readonly & string - Package name
- parserCreator readonly & ParserCreator? - Function capable of creating Parser implementation to parse HL7 wire format to model
- encoderCreator readonly & EncoderCreator? - Function capable of creating Encoder implementation encode to HL7 model in to wire format
- parserUtils? readonly & ParserUtils? - Utility functions for parser
health.hl7v2: Hl7SegmentComponentDefinitionRecord
Annotation fields for HL7 segment component definition.
Fields
- required boolean - Whether it is required, optional
- maxReps int? - Maximum repetitions
- segments? map<Hl7SegmentDefinitionRecord> - Segment map
health.hl7v2: Hl7SegmentDefinitionRecord
Annotation fields for HL7 segment definition.
Fields
- name string - Name of the segment
- required boolean - Whether the segment is required, optional
- maxReps? int - Maximum repetitions
- segmentType? typedesc - Type of segment
- fields? map<Hl7TypeDefinitionRecord> - Field map
- segmentComponentName? string - Segment component name
health.hl7v2: Hl7TypeDefinitionRecord
Annotation fields for HL7 field definition.
Fields
- required boolean - Whether the field is required, optional
- length int? - Length of the field
- maxReps int? - Maximum repetitions
- dataType? typedesc - Type of the field
health.hl7v2: Message
HL7 message which is also called as trigger event.
Fields
- name string - Name of the HL7 message
health.hl7v2: ParserUtils
Fields
- getMessageFunc GetMessageFuncCreator -
- getSegmentFunc GetSegmentFuncCreator -
- getSegmentGroupFunc GetSegmentGroupFuncCreator -
health.hl7v2: PrimitiveType
Primitive HL7 datatype.
Fields
- value any - data held by the data instance
health.hl7v2: Segment
HL7 segment : A segment is a logical grouping of data fields.
Fields
- name string - Name of the segment
- isEmtpy boolean(default true) - Indicates whether the segment is empty
health.hl7v2: SegmentComponent
HL7 segment component which is a grouping of a set of segments.
Fields
- name string - Name of the component
- isRequired boolean(default false) - Is required
health.hl7v2: Type
Errors
health.hl7v2: HL7Error
Base HL7 error.
Object types
health.hl7v2: Encoder
HL7 Encoder interface.
encode
Encode HL7 message model to encoded wire format.
Parameters
- message Message - HL7 message model
Return Type
- byte[]|HL7Error - encoded message. HL7Error if error occurred
health.hl7v2: Parser
HL7 parser interface
parse
Parse HL7 message.
Parameters
- message string - HL7 Message in encoded wire format
Function types
health.hl7v2: ParserCreator
function() returns (Parser)
ParserCreator
Function to return to register HL7 Parser
health.hl7v2: EncoderCreator
function() returns (Encoder)
EncoderCreator
Function to return to register HL7 Encoder
health.hl7v2: GetMessageFuncCreator
function(string) returns (Message?)
GetMessageFuncCreator
Function to return the message record for specific message name
health.hl7v2: GetSegmentFuncCreator
function(string) returns (Segment?)
GetSegmentFuncCreator
Function to return the segment record for specific segment name
health.hl7v2: GetSegmentGroupFuncCreator
function(string) returns (SegmentComponent?)
GetSegmentGroupFuncCreator
Function to return the segment group record for specific segment group name
Import
import ballerinax/health.hl7v2;
Metadata
Released date: 3 days ago
Version: 3.0.1
Compatibility
Platform: any
Ballerina version: 2201.12.3
GraalVM compatible: Yes
Pull count
Total: 6917
Current verison: 0
Weekly downloads
Keywords
Healthcare
HL7
Contributors