HL7 Modules: Receiving and Processing Messages

Last Updated: 12/12/2018 Introduced in Version:

Receiving Messages

Once you have enabled a Receiver to start receiving messages the new messages will display under Recent Messages on the left side of the Interface dashboard.  Messages that have an error occur will display under Open Tasks and the Reciever will appear on the right side under Name. In this example, a File Reciever was set up and is displayed under Name>FileReceiver.

 

 

If you right-click one of the messages in the recent list you will get an action that allows you to view the message.  In the next Figure – Received Message you can see the receiver (or message source) for this message.  In the designer folders view the whole HL7 message structure, and on the right-hand side, you have the ability to edit the message. 

There is an indicator on the bottom of this window that notifies whether or not the parser encountered any errors for the current message. 

messageParser

 

Processing Messages

On the interface there are 3 distinct views:

  1. Interface Dashboard – a view of the most important data related to your messages being processed on this interface.
  1. Designer View – a Decisions designer project where you can build flows, forms, rules, and reports related to this interface.
  1. Folder View – an administrative view of all of the data in this interface. An interface is really a ‘folder’ of data elements and can have messages, tasks, and more.

To define how this interface processes and deals with HL7 messages you need to switch to the Designer View shown in the next Figure – Designer View of Interface.

 

 

In this view, you can see 3 workflows that are automatically created for you.  These three workflows have three different jobs:

  1. Pre-Processing Flow
  2. Processing Flow
  3. Post Processing Flow
Important Note: All HL7 Interface flows expect a message envelope which contains multiple HL7 messages.

 

Pre Processing Flow

This flow gets the HL7 message as text before the message is parsed into an actual HL7 object.  The purpose of this flow is to allow you to perform manipulations on the message that may be required to make the message process successfully. 

If you have a system that sends nonstandard or malformed data but does this consistently or according to some rules you can make changes to the messages before the main processing happens within the Decisions platform. 

Because this flow works with the text of the message you can use any of the standard text and rule steps available in Decisions.  We also provide a number of flow steps specific for helping deal with HL7 text that is in the ER7 format (broken up by pipe characters typically).

 

  1. Add Segment At Position

Inserts the specified text (assumed to be a segment) at a position in a String[] of segments. 

Example:

PID|1|Some Value|Some Value

PV2|1|Some Value|Some Value

Add Segment (PV1|1|Some Value) at position 2 would yield:

PID|1|Some Value|Some Value

PV1|1|Some Value

PV2|1|Some Value|Some Value

  1. Clean Special Chars Before Segment Start

HL7 relies on newline and carriage return characters that sometimes cause problems.  You can use this step to remove these special characters.

  1. For Each Segment Array in Envelope

This takes the main text of the whole HL7 message which is assumed to be a list of messages and gives you each individual message as a String[] of segments one at a time.

  1. Get Data From Segment By Position

Gets data from a specific segment by the position of the data in the segment. 

For Example: PID|1|First Value|Second Value

The PID segment, position 2 is the text “First Value”

  1. Get First Segment By Type

Returns a segment from the array of segments by segment type name.

  1. Get Segment Position

Gets the position or index of a specific segment.

  1. Get Segments By Type

Gets all segments of a specific type as a String[]

  1. Join Messages Into Envelope

Takes a String[] and converts it into a string with “message separator” characters in between each message.

  1. Join Segments Into Message

Takes a String[] and converts it into an HL7 message with “segment separator” characters in between each segment.

  1. Remove All Segments By Type

Removes all the segments with a matching type name.

  1. Replace Data In Segment By Position

Substitutes new data in a segment by the position value.

  1. Split Envelope Into Messages

Splits an envelope (string) into a String[] by the message separator character.

  1. Split Message Into Segments

Splits a message into a String[] of segments by the segment separator character.

 

Processing Flow

The processing flow is where the Decisions HL7 engine provides the most value.  By default, this flow is set up to do no work, so out of the box you can simply use the Decisions HL7 Mediator to receive messages from systems and send them right back out again unmodified.  This can be very useful to create a single hub where messages are distributed to a wide range of systems in your environment, but the processing flow lets you inject behavior. 

There is not enough that can be said about the importance of this part of the HL7 Mediator.  This processing flow allows you to the following very simple examples:

  1. Stop the message and assign tasks to people (alerts, corrections, notifications)
  2. Transform the message using databases, web services, math, text manipulation and more
  3. Store the messages in other systems
  4. Transform the message data
  5. Have people manually correct the message data
  6. Compare the message data to other systems and allow it or discard it
  7. Merge messages with other messages

Input to the Processing Flow

The processing flow takes an HL7 Message Envelope as input.  This envelope may have multiple HL7 messages in it. 

Output of the Processing Flow

The flow outputs the same HL7 Message Envelope with messages changed, removed, or added so that the interface can send these messages along to other systems via the configured emitters.

 

Workflow Steps

The processing flow also has a special set of HL7 message specific steps that can be used in the workflow engine.  Most of these steps will have an obvious use to someone familiar with HL7 messages and syntax, however; A few of these steps require explanation because they are particularly useful. 

 

  1. For Each Abstract Message in Envelope

This step iterates through all of the HL7 messages in the envelope and allows you to work with one message at a time until your work is complete.  This is commonly used with the Cast Message as Another Message Type step which lets you treat a message as another type. 

  1. For Each Message in Envelope

This step is similar to the one above except that you specify the message types you expect to be processing and you get separate paths for each message type to modify this message in the workflow.

 

 

       3. Send to Interface

This step allows you to send a message directly to an interface at a specific ‘stage’ of the processing. 

          Pre Processing

          Processing

          Post Processing

          Emitter

Post Processing

The post-processing flow behaves as the counterpart to the preprocessing flow.  It takes the raw HL7 text that the processing flow has passed through and allows it to be modified before it is sent over to receiving systems via the emitters.  This allows you, once again, to accommodate systems and services that do not support the standards appropriately

 

Links

HL7 Module: Overview

HL7 Modules: Setting up Receivers & Emitters

Additional Resources