Video Demos
Free HL7Connect Videos Did you know that we have some video demonstrations to ease you into HL7Connect?

Click here to see them!

Case Study 2

Case study 2 - HL7 ADT messages to application specific format - HCN Medical Director patient files

The following case study outlines a challenge to implement “” files that allow importing of patient data automatically into an Australian Patient Management software application developed by Health Communication Network Ltd, ( Russell McDonell, Technical Operations Manager for Hume Alliance of Rural Hospital in Australia, achieved the solution using HL7Connect.


Many general practitioners in Australia use the Medical Director 2 software (developed by HCN) for writing prescriptions and management of medication and patients.

Practitioners in wards and emergency departments would spend considerable time registering patient details on a PAS or PMI system. They would then need to spend additional time double entering the same information into their MD2 in order to issue prescriptions, sick leave certificates, case notes and so on. The challenge was to tap into the information already registered, thereby eliminating the time wastage associated with double entry.

Russell McDonell was faced with the challenge to import patient information from HL7 messages created by the hospital PAS or PMI systems into MD2 using the proprietary fixed length format required by MD2.


The solution was to use HL7Connect, which was already being used to route the hospital HL7 feeds, including the PAS system, to translate the HL7 message into the fixed length format required by MD2.

Russell was able to utilise HL7Connect’s scripting functionality, and wrote a JavaScript (MD2.js) which was attached to an outgoing interface in HL7Connect. The script selectively takes the required data from the HL7 message and constructs the MD2 file which can them be imported to MD2.


The logic of Russell’s script was to find the PID segment in the message. If no PID information was found then a custom error message was written to a file log and the script completed. Additionally Russell could have sent an email to administrators including himself if this scenario was rare and indicative of problems that needed to be addressed quickly.

Russell then wrote two functions that he used throughout the rest of his script to get the patient identifiers and to get selected fields throughout the PID segment.

As each field is selectively retrieved from the HL7 message, the script builds the file adding the data at the correct location within the file.

This script demonstrates how easy it is to translate messages within HL7Connect (messages that may have been received using TCP/IP, file, FTP, HTTP, dll, email, or scripted) to a file of predetermined proprietary format. The flexibility of scripting in either VB Script, JavaScript, XSLT or KScript gives users much power in customising the output of HL7 messages, by moving, adding, deleting, logging etc data fields to any format required (including HL7, xml, and other custom, proprietary format).

Key Success Factors:

  • Russell has documented the script every step of the way making the script easy to read and understand.
  • Writing small, but reusable, functions in the script saves script writing time and processing time for commonly used code throughout the script
  • Russell just had to create another OUTGOING file interface in HL7Connect and route copies of the HL7 messages TCP/IP messages already being sent and routed through HL7Connect to other systems.

    Russell has made this script available to others to use freely at the HL7Connect web site code repository at Free public access is available to this resource.

    The HL7Connect team would like to thank Russell for his contribution and making the script publicly available for others to use or extend. We wish congratulate him on this novel, and well documented approach to solving a need for his hospital users using HL7Connect.