Skip to content
The Path

Module 5 · The integrator’s job·11 min

Reading an interface specification

What the vendor must give you, Z-segments, and the questions to ask.

Before you write a single rule in an interface engine, you read a document: the interface specification. It is the contract between two pieces of software. When it is vague, the surprises show up in production, on a Friday evening.

Here is the kind of message a good specification should let you read without guessing. It comes from the polysomnography software at the Leleux Clinic, and it contains one line the standard does not describe.

The sleep lab sends a result to the hospital record. The last line, ZSL, is a local segment specific to this vendor.

ORU^R01^ORU_R01· Observation result (unsolicited)
||||||||||||||||
||||||||
|||||||
|||||||||||
|||||

A permissive standard, a precise contract

HL7 v2 leaves a lot of freedom. Many fields are optional. Many code tables are defined locally. Two “HL7 compliant” systems can therefore fail to understand each other.

The standard has an answer for this: the message profile. It is a precise, unambiguous description of one or more messages for a given use case. HL7 v2.5.1 gives it a whole section of chapter 2. A profile states three things:

  • what data travels in the message;
  • in which format;
  • who acknowledges what, sender and receiver.

In real life you will rarely get an official XML profile. You will get a PDF of 20 to 200 pages. The name differs, the expected content is the same. A message can even point to its profile: MSH-21 (Message Profile Identifier) exists for that.

What a specification must contain

Section The question it answers
Messages and events Which types (ORU^R01, ADT^A01, ADT^A08), in which direction?
Segments and fields Which segments are sent, which fields are filled, with which cardinality?
Usage Is each element R, RE, O, C, CE or X?
Code sets Which values for sex, patient class, test codes?
Z-segments Which local segments, and what does each field hold?
Acknowledgements Original or enhanced mode, response time, what happens on error?
Order On an AE or with no ACK, does the queue block or skip the message?
Corrections How do a cancellation, a merge, a corrected result travel?
Transport MLLP or files, address, port, encryption?
Characters Which value in MSH-18?
Volumes How many messages per day, with which peaks?

Usage: sharper than optionality

The standard marks each field R (required), O (optional), C (conditional) or X (not supported). A profile goes further with usage codes:

Code Meaning for the sender Meaning for the receiver
R Always populated May reject if absent
RE Populated whenever the data is known Does not reject if missing
C Populated if the condition is true Follows the condition
CE Like C, but may stay empty if the data is unknown Does not reject if missing
X Never sent May ignore or reject
O Not decided yet Not testable

A field required by the standard stays required in every profile. An optional field, on the other hand, can become R, RE or X in your project. That is where the contract gets its precision. The lesson on conformance profiles gives the exact rules for that step.

Z-segments: the local extension

The whole standard reserves the letter Z for local use. No official segment will ever start with Z. A vendor that needs to send data HL7 does not cover creates a Z-segment and adds it to the message.

In the example above, ZSL is this vendor’s “Sleep Lab” segment. Its definition exists only in their specification:

Field Content (defined by the vendor)
ZSL-1 Set ID
ZSL-2 Recording type: PSG or PG (polygraphy)
ZSL-3 Montage used, local code
ZSL-4 Total recording time, in minutes
ZSL-5 Device identifier

Click the ZSL line in the message. The tool has nothing to tell you about it: that is expected. No generic tool knows a Z-segment. Without the vendor document, 480 is just a number. The lesson on Z-segments tells you when to accept one.

The questions to ask the vendor

The list you can paste into your first email:

Topic Question
Version Which exact version in MSH-12?
Messages Which events do you send, which do you accept?
Identifiers Which patient identifier do you expect in PID-3, with which authority and type?
Codes Are your test codes local or LOINC? Can you provide the list?
Z-segments Which ones, and can you switch them off?
Acknowledgements Do you answer AA, AE, AR? After how many seconds? What happens with no ACK?
Errors Do you return a readable ERR segment?
Characters Which actual byte encoding, and which value in MSH-18?
Duplicates How do you handle an MSH-10 you have already received?
Order Do you guarantee message order? On an AE, do you block the queue or move on?
Corrections How do you send a corrected result (OBX-11 = C)? A cancelled admission (A11)? A merge (A40)?
Clearing Do you send "" to clear a value, or leave the field empty?
Volumes Average volume, peak, bulk resends?
Testing Do you have a test environment and anonymized sample messages?

And in FHIR?

Same idea, more formal. A FHIR server publishes a CapabilityStatement describing what it can do, and profiles (StructureDefinition) that constrain each resource. Z-segments become extensions, declared and published.

Check your understanding

1 of 4

The polysomnography software vendor sends you their specification. It only says “We support HL7 v2.5.1”. What do you do?

+50 XPPass the quiz (3 correct answers) to complete the lesson.

Reviewed and checked on 27 September 2026