Introduction
In this tutorial you will learn how to create a VMD file for an HL7 Lab (ORU) message.
We will start with a simple VMD (similar to demo.vmd) that already contains the ADT and Catchall message grammars. Then we will extend it by adding the Lab (ORU) message grammar, this will give it similar functionality to the example/demo.vmd. This way you can compare it to example/demo.vmd, and you can try it out in the basic tutorials.
Adding a different message to the VMD will follow the same general pattern, just use your own message definition.
If you have any questions about using Chameleon please contact us at support@interfaceware.com.
Lab 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.
Message Identity
- Message Type: ORU
- Events: All
Message Structure
- MSH segment (required)
- PATIENT segment group (optional)
- PID segment (required)
- ORDER segment group (repeating)
- ORDER_DETAIL group (optional)
- OBR segment segment (required)
- OBSERVATION segment group (optional, repeating)
- OBX segment
- ORDER_DETAIL group (optional)
Note: If you are observant you will have noticed that the ORDER_DETAIL segment group is not required (because it is not repeating). Removing the ORDER_DETAIL group would improve the design, by simplifying the structure and still performing the same function.
However the world is not perfect and we are required to follow the specification we have been given (in this case the supplied example/demo.vmd structure). By not changing the design we are able to use the VMD we create as a “drop-in” replacement for the example/demo.vmd in our tutorials (if we had changed the structure it would require code changes when processing Lab messages).
Tutorial Instructions [top]
- Download the demo_lab.vmd VMD file:
This is the file created in the Chameleon: Chameleon: Creating a simple ADT Message VMD tutorial, and does not yet contain the ORU Lab message.
- Double click on the file to open it in Chameleon:
Chameleon is a Windows only program that is bundled with the Iguana for Windows install.
You should see something like this:
- Click the toolbar Message button to create a new message definition:
- Rename the message definition to Lab, click on the name twice (slowly) and type in Lab:
- Double click Lab > Identity and enter “Unsolicited transmission of an observation message” in the Description:
- Add the OBR and OBX segments to the VMD:
- Choose menu option Workspace>Import Segments From Library…:
This will open the “Import Segments From Library” wizard:
- Click Next, select the OBR and OBX segments, click Next and then Finish:
The OBR and OBX segments should be added to the VMD:
- Choose menu option Workspace>Import Segments From Library…:
- Build the message definition to match the Lab Message Definition.
- This is the Message Structure definition:
- MSH segment (required)
- PATIENT segment group (optional)
- PID segment (required)
- ORDER segment group (repeating)
- ORDER_DETAIL segment group (optional)
- OBR segment (required)
- OBSERVATION segment group (optional, repeating)
- OBX segment
- ORDER_DETAIL segment group (optional)
- Double click the Lab Message Grammar to edit it:
- Add the MSH segment, by dragging it into the message grammar pane:
- Add the optional PATIENT group.
- Right click below MSH in the Segment Grammar pane and choose the Insert Group… menu option:
- Type in the group name PATIENT” and click Ok:
- Select the Optional check box:
Note: If the PATIENT segment is out of order just drag it below the MSH segment.
- Right click below MSH in the Segment Grammar pane and choose the Insert Group… menu option:
- Add the PID segment by dragging it onto the PATIENT group.
- Insert the repeating ORDER group using the right click menu.
- Select the Repeating check box, and 0 for unlimited repeats:
- Select the Repeating check box, and 0 for unlimited repeats:
- Insert the ORDER_DETAIL group.
- Right click on ORDER and choose the Insert Group… menu option.
- Select the Optional check box.
- Right click on ORDER and choose the Insert Group… menu option.
- Drag the OBR segment into the ORDER_DETAIL group.
- Insert the OBSERVATION group.
- Right click on ORDER and choose the Insert Group… menu option.
- Select the Optional check box.
- Select the Repeating check box, and 0 for unlimited repeats.
- Notice the angle brackets that indicate that <OBSERVATION> is optional & repeating:
- Right click on ORDER and choose the Insert Group… menu option.
- Drag the OBX segment into the OBSERVATION group.
- The finished Message Grammar should look this:
- This is the Message Structure definition:
- Compare the new message grammar to example/demo.vmd.
- Download this version of demo.vmd for comparison.
The demo.vmd file supplied with different versions of Iguana has changed over the years — so if you already have one on your system it may not exactly match the downloaded one (but it should be similar).
- Double click on the downloaded vmd file to open it in Chameleon.
- Comparing the two message grammars shows that the downloaded demo.vmd is considerably more complex, but the segments and groups in our file are in the same order (which is important):
- Download this version of demo.vmd for comparison.
- Change the Identity settings to match the Lab Message Definition.
- This is the Message Identity definition:
- Message Type: ORU
- Events: All
- Double click on Identity to open the settings dialog:
- Set the criteria to match the ORU message type.
- Click on the ellipsis (…) in the Segment column and select the MSH segment:
- Click on the ellipsis (…) in the Field column and choose the Message Code:
- Type “ORU” in Value column:
- Click on the ellipsis (…) in the Segment column and select the MSH segment:
- Set the criteria to match all event.
- No action is required, the Identity will match all events by default.
Tip: To constrain the Identity to only match certain events you would need to add a Trigger Event, like this:
In this case only the two triggers R01 and R02 (separated by a vertical bar”|”) would be recognized.
- No action is required, the Identity will match all events by default.
- This is the Message Identity definition:
- Save the changes to the VMD file.
- Test the demo_lab.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_message.vmd files to th eproject, 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_message.vmd', data = Data} end
- The channel should look like this:
- Add the demo.vmd file and the demo_message.vmd files to th eproject, using the [+] link:
- 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||||||
- Compare the both versions of the parsed ORU message.
As you can see the parsing worked with both VMD files:
- Create a test channel: