BizTalk Accelerator for HL7 extends the capabilities of BizTalk Server for health care providers. Health Level 7 (HL7) is an industry-standard application protocol for electronic data exchange of information.
The Minimal Lower Layer Protocol (MLLP) is the most common mechanism for exchanging the HL7 data. MLLP uses the TCP/IP protocol to transfer the data. MLLP delimiters are used to recognize the start and the end of message.

In BizTalk are often different Receive Ports used for each message type that is sent to BizTalk but some healthcare applications support only one connection. As always there are different solutions but in this example I’m going to use the ESB toolkit to create a MLLP On Ramp and use business rules to determine on the basis of the message type which routing slip or itinerary has to be initiated.

The following tasks must be performed:

  • Create a BizTalk project with the required HL7 schemas for the HL7 v2.X message types.
  • Create maps to transform the HL7 messages to the destination messages.
  • Create a pipeline with the HL7 disassembler pipeline component and necessary ESB Toolkit components.
  • Create an itinerary for each message type to process the messages.
  • Create business rules to determine which itinerary has to be initiated.
  • Create a Receive Port & location that uses the Minimal Lower Layer Protocol (MLLP) and the custom pipeline.

 

Before You Begin

You have to install the BizTalk 2013 Accelerator for HL7 & ESB Toolkit before you perform the steps later in this How-to topic:

BizTalk 2013 Accelerator for HL7
Download the BizTalk2013 Accelerators Beta file from the Download Center
 
Run the downloaded BizTalk2013AcceleratorsBeta.exe from your hard drive and choose the directory from which to install the downloaded product.
 
From the directory where you extracted your files, run Setup.exe and follow the instructions to install the BizTalk 2013 Accelerator for HL7.
InstallAccelerator
 
The installation is fairly simple. Perform a custom installation to install also the MLLP test tools.
HL7Accelerator_3
 
ESB Toolkit
With BizTalk Server 2013 Beta, ESB Toolkit is now fully integrated with BizTalk Server. Also, the
ESB Toolkit configuration experience is simplified to enable a quick setup. The installation and configuration is described on MSDN and in an older blog post.
            

Steps

Create a BizTalk project with the required HL7 schemas for the HL7 2.X message types.
the HL7 Accelerator comes with 1300 predefined schemas to match almost every 2.X (2.1 through 2.5.1) message type.
First you will need add the following core schemas:
datatypes_XXX.xsd, segments_XXX.xsd, and tablevalues_XXX.xsd
AddExistingSchema1
 
The segments_XXX.xsd schema will be imported again in the HL7 schema
SetImportLocation
 
Regardless of the specific HL7 version that you are processing, you will always have an MSH segment. Because of the backward-compatibility rules, the version 2.5 MSH segment is appropriate for all prior versions.
MSH segment
 
 
Create maps to transform the HL7 messages to the destination messages.
You almost always need a map to transform the HL7 message to the required message type.
In this example I’m transforming the HL7 message to a canonical message for internal
BizTalk Server use.
HL7_to_Canonical_Map
 
 
Create a pipeline with the HL7 disassembler pipeline component and necessary ESB Toolkit components.
Create a custom pipeline in Visual Studio with the HL7 message disassembler pipeline component to convert the message to XML. Add the ESB Itinerary Selector  and the ESB Dispatcher components to select the itinerary.
HL7ReceivePipeline
 
 
Create an itinerary for each message type to process the messages.
Create an itinerary for each message type to transform and route the HL7 messages.
Export the itineraries to the itinerary database so they can be used by the Itinerary Selector component.
itinerary
 
 
Create business rules to determine which itinerary has to be initiated.
Create business rules for each message type and set the Itinerary Name based on the
ContextMessage Type.
Publish and deploy the policy.
BusinessRuleComposer
 
 
Create a Receive Port & location that uses the Minimal Lower Layer Protocol (MLLP) and the custom pipeline.
When the HL7 projects are deployed to BizTalk you can create a Receive Port and Receive Location that uses the MLLP adapter and the custom pipeline.
In the MLLP Transport Properties dialog box, the following properties are required:

- Connection Name : Name of monitored connection.
- Host : Specify a local interface on which to listen for incoming connections
- Port : Local port ID to listen on
MLLP properties
 
With the custom pipeline it’s necessary to set the name of the business rule policy that is called to determine the itinerary.
Use the Configure Pipeline dialog box to configure the following Itinerary Selector component properties:
a. Click the ItineraryFactKey property, and then type Resolver.Itinerary.
b. Click the ResolverConnectionString property, and then type
BRI:\\policy=MyPolicy;useMsg=true;recognizeMessageFormat=true
ReceiveLocation
 
 

To test the MLLP onramp, business rules and itineraries

You can use the command-line tools from the Accelerator for HL7 to send encoded MLLP messages to BizTalk.
The structure of an MLLP message is given below:
<SB> + <Message> + <EB> + <CR>

<SB> = Start Block. Messages are prefixed with start byte
<Message> = HL7 Message
<EB> = End Block. Messages are terminated with end byte
<CR> = Carriage Return
MLLPencodedMessage
 
The following shows the syntax you use to invoke the mllpsend command-line tool:
mllpsend.exe [/I <IP>] [/P <PORT>] [/TWOWAY] [/REPEAT <n>] [/F <FILENAME> /SB nn /EB nn /CR nn
mllpsend
 
When BizTalk receives the HL7 v2 message it’s converted to XML in the pipeline by the HL7 message disassembler pipeline component .  The Itinerary Selector component calls the Business Rule engine that determines the message type and set’s the itinerary. In my example itinerary that is executed, the message is transformed to a canonical message and routed to the destination folder.
CanonicalMessage
 
 

Conclusion

The BizTalk Accelerator for HL7 works well with the ESB Toolkit. In this example I've skipped however the Acknowledgement (ACK) messages. Maybe nice to check out in a future post if it's possible to use the ESB toolkit to return the ACK and NACK messages!