Problem Description

This tutorial describes the development of a message translation script to convert a message from the format produced by a Patient Administration System (PAS) to a format acceptable to a Laboratory Information System (LIS).

The sample PAS message below is based on the A01 example in the HL7 2.3.1 standard. We will be using this message to test our solutions in this tutorial. (Note that the areas that need adjusting are shown in red.)

MSH|^~\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A01|MSG00001|P|2.3.1|
EVN|A01|198808181123||
PID|1||123456^^^^MR^PAS~123456789^^^USSSA^SS~4321234^^^DL^NTA||JONES^WILLIAM^A^III||19610615|M||C|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(91-9)379-1212|(919)271-3434||S||PATID12345001^2^M10^ADT1^AN^A|123456789|987654^NC|
NK1|1|JONES^BARBARA^K|WI^WIFE||||NK^NEXT OF KIN
PV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J.|||SUR||||ADM|A0|||||PRIV||||||

For this hypothetical tutorial, 2 issues are described that make the format of the PAS messages unacceptable to the LIS:

This case is hypothetical. It bears no relationship to existing systems.

Once we have done the translation, the HL7 message being sent to the LIS will look as follows (Note the adjusted areas are shown in red):

MSH|^~\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A01|MSG00001|P|2.3.1|
EVN|A01|198808181123||
PID|1|123456|||JONES^WILLIAM^A^III||19610615|M||C|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(91-9)379-1212|(919)271-3434||S||PATID12345001^2^M10^ADT1^AN^A|123456789|987654^NC|
NK1|1|JONES^BARBARA^K|WI^WIFE||||NK^NEXT OF KIN
PV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J.|||SUR||||ADM|A0|||||PR||||||

For the purposes of this tutorial, it is assumed that the PAS sends messages to the LIS via HL7Connect, and that on HL7Connect there is a single Incoming Interface for the ADT feed from the PAS, and a single Outgoing Interface for the ADT Feed to go to the LIS. While other interfaces for these systems might exist on HL7Connect, they are not relevent to this tutorial.

This tutorial describes Javascript and VBScript scripts that will translate the messages from the PAS to a format acceptable to the LIS.

Translate Function Names

As each translate function is developed, it will be given a new name. This allows you to collect multiple functions into a single script file. The first function will be called translatetest, the second translatefincodessimple, and so on.

This approach will also enable the use of a master function that calls the working functions.

Time of Translation

In principle, the translation can be applied on receiving or sending, as described below:

For this tutorial, the message will be translated when it is sent to the LIS system.

Issue 1: Financial Code Substitution

Background Information

This table lists the financial codes recognised by the PAS:

NK   Financial Status Not Known
NC   No Charge
PRIV   Private Patient
GOV   Charge to Government (Medicare)
MIL   Veterans Affairs
RES   Research

This table lists the financial codes recognised by the LIS:

HP   Hospital Patient
PR   Private Patient
MC   Medicare
VA   Veterans Affairs
MR   Medical Research

Each code will need to be substituted by a different code. In this fictional case, there is an almost one-to-one equivalence between the codes. We will assume that the Laboratory wishes to translate both "NK" and "NC" to "HP", which leads to the following translation table:

NK   HP
NC   HP
PRIV   PR
GOV   MC
MIL   VA
RES   MR

This code translation can be done either in a script, or by using a lookup table stored in a database. This tutorial will show you how to use both techniques.

Issue 2: Moving PID-3 into PID-2

The PAS system provides a series of patient identifiers in PID-3. The LIS wants a single identifier in PID-2. This single identifier is sent by the PAS system in PID-3 with an assigning authority of "PAS". To carry out this action, we will need to take the following steps:

  1. Identifying the correct repeat of PID-3
  2. Placing the first component of this repeat into PID-2
  3. Clearing the contents of PID-3

Testing the script in HL7Connect

Once the translations have been done and tested in the development environment, the final step will be to test the translations on the HL7Connect server itself.


© Kestral Computing P/L 2000-2010.