Overview

In Tutorial #5C, we translated the Financial Code with the function translatefincodessimple. In Tutorial #5D, we dealt with the patient identifiers in the PID segment with the function translatepid. In this tutorial, we will combine these operations.

We will create a master function that calls the 2 previously defined slave functions.

Function return values

The functions translatefincodessimple and translatepid both return a value of False if there is an error, otherwise True. We will use these return values to decide in the master (calling) function if it is safe to proceed.

Scripts

Select the script you are using then cut/paste the following code into your translate5.vbs OR translate5.js editor window.

Language   Script
VBScript  
    function translate(aEvent)

      if translatepid(aEvent) = False then
        translate = False
        exit function
      end if

      if translatefincodessimple(aEvent) = False then
        translate = False
        exit function
      end if

      translate = True

    end function
   
Javascript  
    function translate(aEvent){
      if (translatepid(aEvent) == false)
        return(false);

       if (translatefincodessimple(aEvent) == false)
        return(false);

      return(true);
    }
   

Testing the script

We will now test the script. To do this take the following steps:

  1. Make sure you have the correct host name, sendto and sendfrom values in the SendEmail procedure of the earlier functions (if you use SendEmail).
  2. Change the procedure selected in testcase5.tci to translate.

It is suggested that you try the following scenarios:

  1. A translation that works. You may like to use the message below, which is a copy of the original message.

       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||||||
      
  2. A translation that does not work, due to failure of the financial code translation. Paste the following HL7 message in the HL7 Message window of testcase5.tci and retest. (Note: PRIV is now changed to PRIX in the PV1 segment.) If possible, check both a case where the SendEmail procedure is invoked, and a case where it is not.

       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|||||PRIX||||||
      
  3. A translation that does not work, due to failure of the PID segment identifier handling. Paste the following HL7 message in the HL7 Message window of testcase5.tci and retest. (Note: PAS is now changed to PAX in the PID segment.) If possible, check both a case where the SendEmail procedure is invoked, and a case where it is not.

       MSH|^~\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A01|MSG00001|P|2.3.1|EVN|A01|198808181123||
       PID|1||123456^^^^MR^PAX~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||||||
      


© Kestral Computing P/L 2000-2010.