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
- Ordering Provider’s Address (XAD, optional)
- Ordering Facility Name (XON, optional)
- Ordering Facility Address (XAD, optional)
- Ordering Facility Phone (XTN, optional)
- Patient’s Age (SN, optional)
- Next of Kin/Associated Party Name (XPN, optional)
- Next of Kin/Associated Party Relationship (CE, optional)
- Next of Kin/Associated Party Address (XAD, optional)
- Next of Kin/Associated Party Phone (XTN, optional)
Tutorial Instructions [top]
- 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. - Double click on the file to open it in Chameleon, you should see something like this:
- Create the SN Composite data type (required for the fifth ZLR field “Patient’s Age”).
- Click the toolbar Composite button to create a new composite:
- Rename the composite to SN.
Click on the name twice (slowly) and type in “SN”:
- Double click on the SN composite to edit it.
- This is the SN Composite definition:
-
Comparator (ST, optional)
- Num1 (NM, optional)
- Separator/Suffix (ST, optional)
- Num2 (NM, optional)
-
- Add the first field Comparator.
Paste “Comparator” into the name column:
- Click the ellipsis (…) in the Data Type column and choose ST from the list:
- Repeat the process for the remaining fields.
- Enter “Structured Numeric” as the Description.
- The completed SN Composite should look like this:
- Click the toolbar Composite button to create a new composite:
- Create a new segment to match the ZLR Segment Definition.
- Click the toolbar Segment button to create a new segment:
- Rename the segment to ZLR.
Click on the name twice (slowly) and type in “ZLR”:
- Double click on the ZLR segment to edit it.
- These are the field definitions for the ZLR Segment:
- Ordering Provider’s Address (XAD, optional)
- Ordering Facility Name (XON, optional)
- Ordering Facility Address (XAD, optional)
- Ordering Facility Phone (XTN, optional)
- Patient’s Age (SN, optional)
- Next of Kin/Associated Party Name (XPN, optional)
- Next of Kin/Associated Party Relationship (CE, optional)
- Next of Kin/Associated Party Address (XAD, optional)
- Next of Kin/Associated Party Phone (XTN, optional)
- Add the first field Ordering Provider’s Address.
Paste “Ordering Provider’s Address” into the name column:
- Click the ellipsis (…) in the Data Type column and choose XAD from the list:
The newly created field should look like this:
- Repeat the process for the remaining fields.
- Enter “Legacy additional lab info” as the Description.
- The completed ZLR Segment should look like this:
- Click the toolbar Segment button to create a new segment:
- Add the ZLR segment to Lab ORUmessage.
- Double click the Lab Message Grammar to edit it:
- Drag the ZLR segment into the Segment Grammar pane:
- 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.
- Double click the Lab Message Grammar to edit it:
- Save the changes to the VMD file.
- Test the demo_lab_zlr.vmd file in a project.
- Create a test channel:
You can also use an existing test channel if you don’t mind replacing the main() module code.
- Add the demo.vmd file and the demo_lab_zlr.vmd files to the project, using the [+] link:
- 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
- The channel should look like this:
- 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
- As you can see the ZLR segment is parsed correctly:
- Create a test channel: