Overview

In Tutorial #6C, the following message was produced:

 MSH|^~\&|||||20010925225438||ADT^A08|testid||2.3.1
 EVN
 PID|||123456||Smith^John^Peter||12/03/1956|M|||1 Nowhere Street^""^Nowhereville^MN^1234
 PV1||||||||||||||||||||PU

In this tutorial we will use the HL7Connect development environment tools to analyse and improve this message.

Using the HL7 Message Viewer

To use the HL7 Message Viewer take the following steps:

  1. Select File | New | HL7 Message
  2. Paste the HL7 Message from above into this
  3. Select File | Save As... | Convert6.hl7 to get a screen similar to the following

    Screen Shot

  4. To find any problems with this message complete the following steps (This stage is covered in more detail in Tutorial 7, for now just follow the instructions.):

    Select the 'Simple Validation Profile' item to get a screen similar to the following:

    Screen Shot

This now gives us a 4 issues to deal with.

  1. MSH-11 [Processing ID]: required but not provided

    Using the HL7 Dictionary and looking up the MSH segment we get the following details for the MSH-11 Field:

    Screen Shot

    To overcome this problem we will set MSH-11 to P

  2. EVN-2 [Recorded Date/Time]: required but not provided

    To overcome this problem we will set EVN-2 to the current date and time.

  3. PID-7 [Date/Time Of Birth]: is a Timestamp but the format is wrong

    This is dealt with by changing the format of the Date of Birth

  4. PV1-2 [Patient Class]: required but not provided

    Looking up the HL7 Dictionary we get the following details for this field:

    Screen Shot

    We will assume that the feed only contains In patients

Updated Scripts

The scripts are now updated to incorporate these updates (This script should replace the previous version):

Language    Script
VBScript   
    function Convert(aEvent)
      set m = aEvent.Msg
      m.Version = "2.3.1"
      m.Event = "A08"
      m.MessageType = "ADT"
      m.MsgID = "testid"
      m.AddMSHForBuild
      m.Element("MSH-11").AsString   = "P"
      m.AddSegment("EVN")
      m.Element("EVN-2").AsString    = CStr(Now)
      ' Note that Now is a native VBScript function and hence the prefix
      ' HL7Connect_ is required to force the script to use the Now function
      ' from HL7Connect
      m.Element("EVN-2").AsString    = HL7Connect_Now.FormatTimeStamp("yyyymmddhhnnss")
      m.AddSegment("PID")
      m.AddSegment("PV1")
      m.Element("PV1-2").AsString    = "I"

      m.Element("PID-3-1").AsString  = aEvent.Fields.items(1)                     ' MRN
      m.Element("PID-5-1").AsString  = aEvent.Fields.items(2)                     ' Surname
      m.Element("PID-5-2").AsString  = aEvent.Fields.items(3)                     ' Firstname
      m.Element("PID-5-3").AsString  = aEvent.Fields.items(4)                     ' MiddleNames
      set dob = TDateAndTime()
      dob.ReadDate "mm/dd/yyyy", aEvent.Fields.items(5), true
      m.Element("PID-7").AsString    = dob.FormatTimeStamp("yyyymmddhhnnss")      ' Date of Birth
      m.Element("PID-8").AsString    = aEvent.Fields.items(6)                     ' Sex
      m.Element("PID-11-1").AsString = aEvent.Fields.items(7)                     ' Address1
      m.Element("PID-11-2").AsString = aEvent.Fields.items(8)                     ' Address2
      m.Element("PID-11-3").AsString = aEvent.Fields.items(9)                     ' Suburb
      m.Element("PID-11-4").AsString = aEvent.Fields.items(10)                    ' State
      m.Element("PID-11-5").AsString = aEvent.Fields.items(11)                    ' Postcode
      m.Element("PV1-20").AsString   = aEvent.Fields.items(13)                    ' Financial Code
    end function
   
Javascript   
    function Convert(aEvent){
      var m; // message
      var dob; // date of birth
      m = aEvent.Msg;
      m.Version = '2.3.1';
      m.Event = 'A08';
      m.MessageType = 'ADT';
      m.MsgID = 'testid';
      m.AddMSHForBuild;
      m.Element('MSH-11').AsString   = 'P';
      m.AddSegment('EVN');
      m.Element('EVN-2').AsString    = HL7Connect_Now.FormatTimeStamp('yyyymmddhhnnss');
      m.AddSegment('PID');
      m.AddSegment('PV1');
      m.Element('PV1-2').AsString    = 'I';

      m.Element('PID-3-1').AsString  = aEvent.Fields.items(1);                     // MRN
      m.Element('PID-5-1').AsString  = aEvent.Fields.items(2);                     // Surname
      m.Element('PID-5-2').AsString  = aEvent.Fields.items(3);                     // Firstname
      m.Element('PID-5-3').AsString  = aEvent.Fields.items(4);                     // MiddleNames
      dob = TDateAndTime();
      dob.ReadDate('mm/dd/yyyy', aEvent.Fields.items(5), true);
      m.Element('PID-7').AsString    = dob.FormatTimeStamp('yyyymmddhhnnss');      // Date of Birth
      m.Element('PID-8').AsString    = aEvent.Fields.items(6);                     // Sex
      m.Element('PID-11-1').AsString = aEvent.Fields.items(7);                     // Address1
      m.Element('PID-11-2').AsString = aEvent.Fields.items(8);                     // Address2
      m.Element('PID-11-3').AsString = aEvent.Fields.items(9);                     // Suburb
      m.Element('PID-11-4').AsString = aEvent.Fields.items(10);                    // State
      m.Element('PID-11-5').AsString = aEvent.Fields.items(11);                    // Postcode
      m.Element('PV1-20').AsString   = aEvent.Fields.items(13);                    // Financial Code
    };
   

Running this updated script gives the following result:

Screen Shot

Now load the resulting message into a HL7 Message window and check that all the Parsing Notes are now dealt with.


© Kestral Computing P/L 2000-2010.