HL7 Answer: You can place the Z-segment anywhere in the HL7 message. There is no rule in HL7 that dictates where a Z-segment should be located in a message. One popular approach is to insert the Z-segment in the message so it is grouped with similar information contained in the message. For example, if you are storing insurance specific data, you may want to create a ZIN segment and place it in the insurance group in your message directly after the IN3 segment.
Another approach is to place any Z-segments at the end of your message, so systems that are configured to parse the ‘standard’ HL7 format can read the segments in the order they expect them without making modifications to their configuration. Subsequently, if they need the data in the Z-segment, they can modify their parser to extract the data.
HL7 Question 2: In our customer’s interface specification, if they have not defined a Z-segment yet they send some Z-segments, should I throw an HL7 conformance error or not?
HL7 Answer: You should be prepared to accept that Z-segment in the HL7 message. It’s unfortunately very common to build your processing based on a system’s specifications and then find differences in the format once you receive actual HL7 messages. We have written a white paper on HL7 conformance checking, if you need additional information.
When you are in the testing and development phase of your healthcare integration implementation, you should ensure you can parse the structure that you will be receiving. If you are not interested in the data in the Z-segment, you may not reference it in your processing, but you still need to take into account that the format of the message will include it. If the Z-segment is at the end of the message, then you may not have to account for it since you can parse the complete HL7 message without addressing the Z-segment. How you address this issue will depend on the application you use to parse the HL7 messages.
If there are more questions about working with HL7 Z-segments, please post a reply. We welcome the questions and feedback.
Latest posts by Mike Stockemer (see all)
- Supporting CDA in Clinical Applications, Part 2: XML and HTML Rendering - March 8, 2011
- Supporting CDA in Clinical Applications, Part 1: Introduction - March 1, 2011
- Comparing HL7 Messages to HL7 Documents - January 25, 2008