While developing the standard, the HL7 committee realized it was impossible
to standardize all the aspects of data exchange in the healthcare industry. This is
why they provided a framework for the addition of custom information into HL7
messages, more commonly referred to as Z-segments. You may define a custom
segment and include it in any HL7 message. These segments
should be named starting with letter Z, (e.g. ZPD for custom patient
demographics information). Applications that do not know the meaning
of your Z-segments should simply ignore these segments.
The downside of the Z-segment approach is that you cannot expect
any particular piece of information to be in a specific place. While one
vendor will send this information in some segment of the standard,
another will send it in a custom Z-segment.
When selecting a toolkit to deal with HL7 integration,
it is extremely important that your code be shielded from the
actual message structure.
When you refer to a field such as PID.ExternalId in your code, you
will have to change your code if this piece of information begins to appear
instead in a ZPD segment.