Add a Z segment to a Lab Message VMD

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 example/demo.vmd) 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 example/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.

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 Chameleon: 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.
    Note: Chameleon is a Windows only program that is bundled with the Iguana for Windows install.
    You should see something like this:
  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:
    2. Rename the composite to SN.
      Click on the name twice (slowly) and type in “SN”:
    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:
    2. Rename the segment to ZLR.
      Click on the name twice (slowly) and type in “ZLR”:
    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. Open a basic channel that uses the example/demo.vmd.
      We used our “Mapping HL7 to HL7” channel from the Mapping Messages: HL7 to HL7 tutorial:
    2. Add this Lab message to the sample data:
      MSH|^~\\&|MESA_RPT_MGR|EAST_RADIOLOGY|REPOSITORY|XYZ|||ORU^R01|MESA3b781ae8|P|2.3.1||||||||\r
      PID|||CR3^^^ADT1||CRTHREE^PAUL|||||||||||||PatientAcct||||||||||||\r
      OBR|||||||20010501141500.0000||||||||||||||||||F||||||||||||||||||\r
      OBX|1|HD|SR Instance UID||1.113654.1.2001.30.2.1||||||F||||||\r
      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||||||\r
      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\r
    3. Add demo_lab_zlr.vmd to the project, using the [Add…] link:
    4. Duplicate the hl7.parse{} statement demo_lab_zlr.vmd:
    5. As you can see the ZLR segment is parsed correctly:

More Information [top]

Leave A Comment?