HL7 Soup always made it easy to work with HL7, but the HL7 standard isn't exactly standard around the world. Different countries and organisations publish their own schemas for working with their HL7. Here we look at validating your messages with these schemas, specifically focusing on the ITK used in the UK's NHS.
ITK for the UK's NHS:
Hello, and welcome to this tutorial where we look at making our HL7 messages conform to those of the Interoperability toolkit (ITK) used extensively in the UK’s NHS.
I’d like to start by explaining why this toolkit is so important when doing HL7 integration work.
HL7s biggest strength, its flexibility is also its greatest weakness. Inconsistencies between implementations add to the costs, but also lead to errors that ultimately put patients at risk.
The ITK seeks to address this by putting in place a more defined standard for your HL7 messages.
The great thing for us integrators is that once we have an integration with one ITK site, the next can be done much faster, reducing costs.
I’m going to start by going into HL7 soup and looking at some of the difficulties you have when working with HL7 in the UK.
HL7 Soup comes with a great list of example messages, but all of these are really focused internationally, they come from different sources around the world.
Further the dropdowns, although helpful, are often very American centric. If we look for instance at the patients race your options are distinctly American. So I’m going to navigate now to the ITK website and we are going to try and make this somewhat more British.
Firstly, here is the address of the ITK Toolkit http://systems.hscic.gov.uk/interop/itk
I’ve already signed up to this website, so all I have to do now is navigate to ITK Releases, and then scroll down and I find the NHS Interoperability Toolkit HL7v2. You can click on that and you need to subscribe to this, but it only takes a few seconds, then you can download the toolkit to your computer.
Once you have it, it can be extracted out, and you end up with these directories here.
There is all sorts of useful information here, but I am just going to focus on how we can validate your messages. So I going to start by going into schema, and you will find the full xsd list that defines ITK HL7 messages. So I just need to copy those, and I’m going to put them into the hl7 soup directory %appdata%\hl7soup\customschemas\
Now I will just restart HL7 soup for those changes to take effect.
Now if I head back to HL7 Soup, we will see it is using the ITK HL7 schemas. That mean that if I scroll down to the Race (PID-10) we find it empty. That’s because it has no values in the ITK standard, but if I continue down to Ethnic Group (PID-22) you’ll see we now have a far more British selection of values.
Now I’m going to replace HL7 Soups example messages with those that come with the ITK Toolkit. I’m going to go back into the toolkits directory and navigate to the examples at
And search for all the example message by typing *.txt. Here I get back all the HL7 messages and accompanying scenarios. Now I just drag and drop these into HL7 Soup.
I’m now prompted if I would like to add all of these files into one tag, and I’m going to say “Yes”.
We now have the list of messages that are available in the ITK toolkit loaded into HL7 Soup.
Now the first thing you are going to notice is that HL7 Soup is highlighting some errors to us. If I take a closer look, we are told that the patents birth date is invalid. If I look closer I can see that the date is in fact invalid as it specifies a thirteenth month.
So to fix this I’m going to right click and create a filter where the Patients birth date equals an invalid date.
Now I can see all three invalid messages, I’m just going to fix one of the by making it the twelfth month, then right clicking and selecting to update all three filtered messages to the same value.
Let’s see what else HL7 Soup can provide for us when working in the ITK.
Firstly if we look at an ADT^A04 message we will see it has Z-Segments. You can see that these are fully described in the HL7 Segments grid. If I click on the Message Type drop down we will see the full Segment definition available to us, including the Z-Segments. ZU1 – Additional PV info, ZU3 – Attendance Details, ZU4 – Waiting List, ZU6 – Labour & Delivery, ZU7- Birth Details, ZU8 – Misc Demographic Details.
I can just double click on these to insert the Segment into my message.
I can also create validation rules to make sure all my future messages are ITK compliant.
To do this, I navigate to the Highlights and Validation screen, and I will create a new highlight set. I’ll call it “ITK NHS”, and then I will remove the existing validation that was cloned into my new set by clicking “Clear All”.
Now I can generate my validation rules off the current message.
I click “Generate”, and then I can select to highlight “Red” and make invalid, any message that has an invalid date. When I click ok we see that it has generated a list of validation rules for me. Then I will click “Generate” again and this time I will select to make all fields with the wrong data table values invalid. This ensures that all values map to those in the ITK tables.
Clicking OK will also add these to my list of rules.
I can even export this set to other colleges, who can use these rules to make sure their messages are also ITK compliant.
Now if we had back to the messages we will see what this has done.
I can see that I have some messages that are now invalid. Rather than scrolling through all the messages I’m just going to create a filter that highlights all the invalid messages. Now I just see the invalid ones I see that some of the data table values are not available. I have already checked these against the ITK documentation and found that the example values are actually wrong. So I can now just go through each of these and fix them up till I have a full set of valid messages.
This shows just how difficult working with HL7 can be, that even the providers of the toolkit can still have faults in their examples. HL7 Soup makes light work of this.
Finally, if I save these messages to %appdata%\HL7Soup\Sample HL7 Message.txt, they will replace the standard hl7 soup messages with the ITK ones. Now HL7 Soup will always load with messages suitable to the UK, and I will have full validation to make sure that I am ITK compliant.
Finally I would like to add that other countries and organisations have their own schemas defined. You can use this technique to have HL7 Soup define and validate those messages too.