Convert HL7 to XML

Return to Tutorial Directory

Steps

Welcome to this detailed guide on converting HL7 messages to XML files using HL7 Soup's Integration Host. Follow these steps to set up your environment and begin the conversion process. If you're new to HL7, consider checking out the introductory HL7 tutorials before starting.

  1. Install Integration Host

    Download and install the free trial of HL7 Soup Integration Host from the official website.

  2. Load Sample HL7 Files

    Import the sample HL7 files into HL7 Soup to prepare for conversion.

  3. Create a New Receiver

    Setup a new receiver with TCP message type and default settings in HL7 Soup.

  4. Insert Current Message Template

    Load the HL7 message format into your new receiver using the 'Insert Current Message' option.

  5. Configure the Output Settings

    Configure the file output settings to direct the converted XML files to a specified directory.

  6. Create XML Template

    Prepare an XML template that mirrors the structure of the output files you need.

  7. Bind Values Using Transformers

    Map values from the HL7 message to the XML template using transformers.

  8. Start Receiving Messages

    Activate the receiver to start processing incoming HL7 messages.

  9. Send HL7 Messages

    Configure and start sending HL7 messages through your system to be converted.

  10. Review Output XML Files

    Check the converted XML files in the designated directory to ensure accuracy.

By following these steps, you'll be able to convert HL7 messages into XML files efficiently, using HL7 Soup's powerful Integration Host.

Video Transcript

Convert HL7 to XML:

Hello and welcome to this tutorial where we'll show you how to convert HL7 messages into XML files.

To start with I'm going to load up the free trial of HL7 Soup, so I can grab this sample HL7 files. You can see here that there's a twelve of them that are ready for me to import and they are of varying types. What I'm going to convert them to is this XML file here. It's a very basic XML file that represents a patient. I've got the first and last name of the patient, their birthday information, and their address. We've kept it nice and simple for the tutorial.

All we do now is create a new receiver in HL7 Soup. We're just going to receive a TCP message, which is the standard for HL7. We could also bring it in from a directory scan but in this case, I'm just going to pretty much take the default settings. I am going to call it ‘Receive HL7’ and I'm just going to take the default server, the port is going to be 22222. The message type will obviously be HL7 and on the other settings I'm just going to take the default.

First of all, I need a message for my Message Template, which represents the general HL7 message that I'm going to be receiving. I'm going to right-click here on the Message Template text box and select ‘Insert Current Message’. What that's doing is taking the HL7 message from the main screen of HL7 Soup.

That's setup and ready to receive, now we just need to tell it to send somewhere. I just add a new activity to my workflow and select it to be a File Writer so it writes out to a file. I'm going to rename this activity to ‘Write XML File’ and give it a file name and path. I'm going to ask it to write one record per file and then I'm going to ask it to move the file to another directory after processing. When HL7 Soup copies the file to the new directory it automatically makes sure that all the files have a unique file name. It doesn't matter that I've made the XML file names all the same. I'm also going to tell it to write to an XML file.

Now what I need is a template representing our message. For that, I'm going to copy the text from my existing XML message and I'm going to paste it in.

Great, so now it's going to write out the XML message, all we've got to do is bind the values from that inbound HL7 message, and we're going to put them into this XML message. We do this by using transformers.

So, I'm going to click here on my Write XML File activity to view the Transformers. You'll now see it's automatically converted the two Message Templates into tree views of each of them. I can see my patient and all of its fields, and my HL7 message and all of its fields. The original messages are also accessible if I click on the trees.

The general goal of transformers is to take the values from the Source and map them to values in the Destination. Let me show you how that's done. Firstly, I'm going to find my HL7 message patients first name that's in the PID- 5.2 and I drag that across to the first name of the XML file. You can see it's created a mapping between the two. It's generated XPath representing the destinations XML and it has HL7 syntax representing the HL7 part.

I repeat this for the other fields. I can drag the family name and map that to the last name, and the birthday mapped to the date time of birth, and my patients address goes to the AddressLine1, and the City, and Country. That is all the mappings that I need and so that's it that's my entire workflow written.

I'm going to now save and close this and go back to the main screen of HL7 Soup. We now click to start receiving. That's now sitting there waiting to receive those HL7 messages.

Because I'm just going to send the sample messages that I have from HL7 Soup, I'm going to create a new sender from within HL7 Soup, and I'm going to take all the defaults. The only thing of note is that it's on the same port (22222) that I was using in the Receiver, and I've told it to move next every second. Actually, I'll tell it to move next rapidly so processing is faster. I can now save and close this.

I could now send individual messages one at a time by clicking the send button, but instead, I'm just going to press play and start sending them all through. Because I had the very last message selected it's going to ask me to jump back to the first message, so I'll say yes and then they're all processed.

You can see all 12 have been processed very quickly. So, I can view those now in the temporary directory that I created, and you can see that each has been given a unique file name.

I can now load these files up inside Notepad++ and you'll see each of them has their own details including the address and whatever was available in those HL7 messages directly in the XML

If you found this video helpful please don't forget to subscribe to my channel, and don't forget HL7 Soup has a free 30-day trial so you can follow along in these videos.

If you found this video helpful, you would help me out by ‘liking’ this video.

Download 30 Day Free Trial of HL7 Soup