Adding Z-Segments to a VMD

HL7 messages can sometimes have Z-segments. A Z-segment is a custom segment that is not part of the official HL7 standard but is defined locally by information systems to meet specific integration needs.

These segments, often labeled with a “Z” prefix (such as ZPD, ZIN, or ZPR), allow organizations to extend the HL7 message structure by adding fields that are unique to their workflows or data requirements.

In IguanaX, you can modify standard HL7v2 message structures to add custom Z-segments as required. We previously created a VMD, now let’s modify the VMD message definition to support a Z-segment:

Append the following ZPD segment, holding additional demographic information to the ADT^A01 message:

ZPD|1|jane.doe@example.com|164^CM|||
  • ZPD-1: Set ID - (ST, Required).

  • ZPD-2: Email Address - (ST, Optional).

  • ZPD-3: Height - (CQ, Optional).

The full sample message:

MSH|^~\&|MESA_ADT|XYZ_ADMITTING|iFW|ZYX_HOSPITAL|||ADT^A01|103102|P|2.4|||||||| EVN||200007010800||||200007010800 PID|||583295^^^ADT1||DOE^JANE||19610615|M-||2106-3|123 MAIN STREET^^GREENSBORO^NC^27401-1020|GL|(919)379-1212|(919)271-3434~(919)277-3114||S||PATID12345001^2^M10|123456789|9-87654^NC NK1|1|BATES^RONALD^L|SPO|||||20011105 PV1||E||||||5101^NELL^FREDERICK^P^^DR|||||||||||V1295^^^ADT1|||||||||||||||||||||||||200007010800|||||||| PV2|||^ABDOMINAL PAIN OBX|1|HD|SR Instance UID||1.123456.2.2000.31.2.1||||||F|||||| AL1|1||^PENICILLIN||PRODUCES HIVES~RASH AL1|2||^CAT DANDER DG1|001|I9|1550|MAL NEO LIVER, PRIMARY|19880501103005|F|| PR1|2234|M11|111^CODE151|COMMON PROCEDURES|198809081123 ROL|45^RECORDER^ROLE MASTER LIST|AD|CP|KATE^SMITH^ELLEN|199505011201 GT1|1122|1519|BILL^GATES^A IN1|001|A357|1234|BCMD|||||132987 IN2|ID1551001|SSN12345678 ZPD|1|jane.doe@example.com|164^CM|||

Notice the ZPD segment is not included in the parsed HL7 node tree. This is because it has not been added to the VMD structure and Iguana does not recognize it.

Open test.vmd, and take a look at the segments and composites listed in the VMD. Notice anything? There is no ZPD segment and no CQ (Quantity with Units) composite. Let’s add them:

Add a Composite:

  1. Click and + Add Composite.

  1. Click and enter the following details to create the composite:

    • Name: CQ

    • Description: Quantity with Units

    • CQ-1: Quantity, NM (Numeric), Optional

    • CQ-2: Units, ST (String), Optional

  1. Click

Add a Segment:

  1. Click + Add Segment.

  1. In the Segment window, click . Enter the following information:

    • Name: ZPD

    • Description: Additional Patient Demographics

    • ZPD-1: Set ID - (ST, Required).

    • ZPD-2: Email Address - (ST, Optional).

    • ZPD-3: Height - (CQ, Optional).

  1. Click .

  1. Click on the ADTA01 message definition and click .

  1. Click + Add Child and select the ZPD segment from the dropdown.

  1. Click

The ZPD segment is now recognized by hl7.parse{} and returned in the parsed HL7 node tree, ready for processing!