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:
STEP 1: Use the following sample data and z-segment specifications
Append the following ZPD segment, holding additional demographic information to the ADT^A01 message:
ZPD|1|jane.doe@example.com|164^CM|||
-
ZPD-1: SetID - (ST, Required).
-
ZPD-2: EmailAddress - (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|||
STEP 2: Use the annotation window to see your sample message and parsed node tree
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.
STEP 3: Open your test.vmd file and create the necessary composites and ZPD segment
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:
-
Click
and + Add Composite.
-
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
-
-
Click
Add a Segment:
-
Click + Add Segment.
-
In the Segment window, click
. Enter the following information:
-
Name: ZPD
-
Description: Additional Patient Demographics
-
ZPD-1: SetID - (ST, Required).
-
ZPD-2: EmailAddress - (ST, Optional).
-
ZPD-3:Height - (CQ, Optional).
-
-
Click
.
STEP 4: Add the ZPD Segment to the ADTA01 Message Definition
-
Click on the ADTA01 message definition and click
.
-
Click + Add Child and select the ZPD segment from the dropdown.
-
Click
STEP 5: Now take a look at the parsed HL7 node tree
The ZPD segment is now recognized by hl7.parse{}
and returned in the parsed HL7 node tree, ready for processing!