Testing HL7 v2 NTE: The Fields Your System Actually Needs to Handle
NTE is the segment that shows up almost everywhere and gets tested almost nowhere. It can trail a PID, an OBX, an ORC, an OBR, or a dozen other segments to carry a free-text note, and because it never anchors a message on its own, most test suites only exercise it in the one or two spots someone happened to remember.
NTE (Notes and Comments) is a general-purpose HL7 v2 segment that attaches free-text commentary to whatever segment came before it. It has no fixed home in the message structure — it can follow PID, OBX, ORC, OBR, and many others, repeating as many times as needed. Its three core fields are a sequence number, a coded source for who or what generated the note, and the comment text itself.
The fields that actually matter in practice
Example
Two synthetic NTE segments following an OBX result, both from a lab (L) source. The identifiers, values, and text are fabricated for this example.
Where this trips people up
Because NTE can legally follow almost any segment, test generators tend to hardcode it into just one or two familiar spots — usually trailing OBX — and never exercise it after PID, ORC, or OBR, where receiving systems often have completely separate parsing paths for the same segment type. Teams also frequently build test messages with a single short NTE-3 value and never check what happens when the comment repeats several times or runs past a few hundred characters, which is exactly the scenario that exposes truncation bugs, delimiter-escaping mistakes, and off-by-one errors in how a system reassembles multi-segment notes into one field.