HL7 is based on messages. The HL7 standard defines a number of different types of messages, each serving a different purpose.
LEADTOOLS toolkits provide the MessageFactory and MessageConstructor classes to simplify the process of creating different messages for HL7.
As an example, in order to build an ORU_R01 HL7 message (observation result message), first start by calling MessageFactory.New which will return a message of the specified type. Next, call the MessageConstructor.CreateSegments method which will create all segments, each with empty values. Finally, call MessageConstructor.FillCommonMSH in order to fill the MSH header with typical values.
Typical values for MSH segments include the default encoding characters as specified by the HL7 standard.
HL7 messages come encoded as text messages, and are called pipe-messages because typically the pipe character ( ¦ ) is used to separate the fields.
To load a message from a given string that contains the pipe-message text, begin by creating an instance of the PipeMessageConverter class. Next, call PipeMessageConverter.PipeMessageToMessageStructure to load the message to an intermediate format called MessageStructure. Next, create an instance of MessageStructureConverter and call MessageStructureConverter.MessageStructureToMessage to convert it into an HL7 message.
The MessageStructure class is provided for added flexibility. Use this class to easily manipulate a pipe message.
The MessageStructureConverter.MessageStructureToMessage method has a number of parsing flags that cover most message parsing cases. For example, there is a parsing flag that allows messages with non-standard segments to be parsed.
Save HL7 messages to text messages (mainly pipe messages) or XML messages.
To save a message to a pipe-message from a given message object, simply call SegmentStructureConverter.MessageToPipe. It outputs text pipe messages.
XML can be useful when communicating with a web service. Use the SegmentStructureConverter.MessageToXML method to output XML text.
Note: The XML text output by the SegmentStructureConverter.MessageToXML method is totally different from HL7 V3 XML notation.
To modify the contents of a message, either set text values to IField.Value or use the solid presentation of the message to modify fields.
For example, if you have an ADT_A01message, modify the field separator as follows:
ADT_A01.MSH.Field_Separator.Value = "|";
The same technique applies when reading field values.
Each message item contains a ‘Schema” which can be accessed from INodeItem.Schema. To determine whether an item is required, call ISchemaItem.Mandatory.
One way of validating HL7 messages is to loop through all items and check their schemas (access schemas from INodeItem.Schema). For example, determine whether ISchemaItem.Mandatory is true. If it is then the item should have repetitions; otherwise, it is not valid.
Another way of doing this is to first save the item as a pipe-message, and then try to load it again. This takes advantage of the automatic validation performed when a message is loaded. Refer to the "Loading a Message" and "Saving a Message" sections, above, for more information.
Building an HL7 Network Client
Building an HL7 Network Server
Products |
Support |
Feedback: Working with HL7 messages |
Introduction |
Help Version 19.0.2017.6.21
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.