Add a Z segment to a Lab Message VMD

Introduction

In this tutorial you will learn how to add a Z segment to an HL7 message in a VMD file.

We will start with a simple VMD (similar to demo.vmd supplied with Iguana) that already contains the ADT, Lab (ORU) and Catchall message grammars. Then we will extend it by adding the ZLR segment to the Lab (ORU) message grammar. This way you can compare it to demo.vmd, and you can try it out in the basic tutorials.

Adding a different Z segment to the VMD will follow the same general pattern, just use your own Z segment and message definition.

Note: The demo.vmd file supplied with different versions of Iguana has changed over the years — so yours may not exactly match the one used here (but it will be similar).

You can download this version of demo.vmd which is the one we use on this page.

If you have any questions about using Chameleon please contact us at support@interfaceware.com.

ZLR Message Definition [top]

This message definition is a simplified version of the message grammar from the example/demo.vmd, but it is sufficient to parse the sample Lab message included in our sample data.

Segment Structure

  1. Ordering Provider’s Address (XAD, optional)
  2. Ordering Facility Name (XON, optional)
  3. Ordering Facility Address (XAD, optional)
  4. Ordering Facility Phone (XTN, optional)
  5. Patient’s Age (SN, optional)
  6. Next of Kin/Associated Party Name (XPN, optional)
  7. Next of Kin/Associated Party Relationship (CE, optional)
  8. Next of Kin/Associated Party Address (XAD, optional)
  9. Next of Kin/Associated Party Phone (XTN, optional)

Tutorial Instructions [top]

  1. Download the demo_lab_zlr.vmd VMD file.
    Note: This is the file created in the Creating a Lab Message VMD tutorial, and does not yet contain the ZLR segment.
  2. Double click on the file to open it in Chameleon, you should see something like this:
    chameleon view vmd
  3. Create the SN Composite data type (required for the fifth ZLR field “Patient’s Age”).
    1. Click the toolbar Composite button to create a new composite:
      chameleon add composite
    2. Rename the composite to SN.
      Click on the name twice (slowly) and type in “SN”:
      chameleon composite
    3. Double click on the SN composite to edit it.
    4. This is the SN Composite definition:
      1. Comparator (ST, optional)
      2. Num1 (NM, optional)
      3. Separator/Suffix (ST, optional)
      4. Num2 (NM, optional)
    5. Add the first field Comparator.
      Paste “Comparator” into the name column:
    6. Click the ellipsis (…) in the Data Type column and choose ST from the list:
    7. Repeat the process for the remaining fields.
    8. Enter “Structured Numeric” as the Description.
    9. The completed SN Composite should look like this:
  4. Create a new segment to match the ZLR Segment Definition.
    1. Click the toolbar Segment button to create a new segment:
      chameleon new segment
    2. Rename the segment to ZLR.
      Click on the name twice (slowly) and type in “ZLR”:
      chameleon segments
    3. Double click on the ZLR segment to edit it.
    4. These are the field definitions for the ZLR Segment:
      1. Ordering Provider’s Address (XAD, optional)
      2. Ordering Facility Name (XON, optional)
      3. Ordering Facility Address (XAD, optional)
      4. Ordering Facility Phone (XTN, optional)
      5. Patient’s Age (SN, optional)
      6. Next of Kin/Associated Party Name (XPN, optional)
      7. Next of Kin/Associated Party Relationship (CE, optional)
      8. Next of Kin/Associated Party Address (XAD, optional)
      9. Next of Kin/Associated Party Phone (XTN, optional)
    5. Add the first field Ordering Provider’s Address.
      Paste “Ordering Provider’s Address” into the name column:
    6. Click the ellipsis (…) in the Data Type column and choose XAD from the list:

      The newly created field should look like this:
    7. Repeat the process for the remaining fields.
    8. Enter “Legacy additional lab info” as the Description.
    9. The completed ZLR Segment should look like this:
  5. Add the ZLR segment to Lab ORUmessage.
    1. Double click the Lab Message Grammar to edit it:
    2. Drag the ZLR segment into the Segment Grammar pane:
    3. The updated Message Grammar should look like this:

      Note: If the ZLR segment is in the wrong place you can drag it to the correct position.
  6. Save the changes to the VMD file.
  7. Test the demo_lab_zlr.vmd file in a project.
    1. Create a test channel:

      You can also use an existing test channel if you don’t mind replacing the main() module code.

    2. Add the demo.vmd file and the demo_lab_zlr.vmd files to the project, using the [+] link:iguana add vmd
    3. Paste this code into the main module:
      function main(Data)
         -- Parse an HL7 message
         local Msg, Name = hl7.parse{vmd = 'demo.vmd', data = Data}
         local Msg, Name = hl7.parse{vmd = 'demo_lab_zlr.vmd', data = Data}
            
      end
    4. The channel should look like this:
      iguana main module
    5. Add this Lab message to the sample data:
      MSH|^~\&|MESA_RPT_MGR|EAST_RADIOLOGY|REPOSITORY|XYZ|||ORU^R01|MESA3b781ae8|P|2.3.1||||||||
      PID|||CR3^^^ADT1||CRTHREE^PAUL|||||||||||||PatientAcct||||||||||||
      OBR|||||||20010501141500.0000||||||||||||||||||F||||||||||||||||||
      OBX|1|HD|SR Instance UID||1.113654.1.2001.30.2.1||||||F||||||
      OBX|2|TX|SR Text||Radiology Report History Cough Findings PA evaluation of the chest demonstrates the lungs to be expanded and clear.  Conclusions Normal PA chest x-ray.||||||F||||||
      ZLR|20 Delphi Cres.^Suite 15^Chicago^IL^55037^^^^|St. Micheals|20 Delphi Cres.^Suite 15^Chicago^IL^55037|^^^^^555^555-5555||Smith^Fred|Employer|567 Miller Lane^^Chicago^IL^68230|^^^^^666^666-6666
    6. As you can see the ZLR segment is parsed correctly:
      iguana view message

More Information [top]

Leave A Comment?