Reference·OBX Segment·OBX-2
HL7 v2 Reference

HL7 v2 OBX-2 (Value Type): Format, Values, and Testing Notes

Jul 27, 2026 · 4 min read
← OBX-1 OBX-3 →

OBX-2 is a two-character code, but it decides everything about how the field right after it should be read — treat a coded result like a number, or a narrative report like a discrete value, and the data comes out wrong without any parsing error to catch it.

Quick answer

OBX-2 is the second field of the HL7 v2 OBX segment — a coded value type that tells a receiving system how to interpret the data format of OBX-5, the actual observation value.

Valid code values

NM
Numeric — a plain number, most common for lab results
ST
String — short free text
TX
Text — longer free-text narrative, e.g. a report body
CE
Coded Entry — a coded value with a text description
DT
Date — a date-only value
TS
Timestamp — a full date and time value
SN
Structured Numeric — supports comparators like > or <

Example

Synthetic example Generated by Synthibase
OBX|1|NM|2823-3^Potassium^LN||4.2|mmol/L|3.5-5.1|N|||F|||202607261430

NM in OBX-2 tells the parser that the OBX-5 value (4.2) should be read as a plain number. Synthetic result — not a real patient.

Where this trips people up

A lot of test suites are built entirely from numeric lab results, so every OBX-5 parsing rule ends up hardcoded around NM. When a CE result (a coded impression), a TX result (a pathology narrative), or an SN result (a titer reported as ">1:320") shows up in production, the same parsing logic either throws on non-numeric input or silently truncates it — and because OBX-2 was never checked first, the failure looks like a data-quality problem rather than the type-handling bug it actually is.

How to Test HL7 v2 OBX: A Field-by-Field Breakdown
How to Write EDI Test Cases That Actually Catch Go-Live Failures
Healthcare API Testing Guide: FHIR and X12
Generate every OBX value type automatically
Synthibase generates synthetic OBX segments across numeric, coded, and text value types, so parsing logic gets tested against more than just the NM happy path.
Start free trial →
This page is written independently by Synthibase for testing and informational purposes. It is not an official publication of HL7 International or X12/Washington Publishing Company, and is not a substitute for reviewing the official standard or your trading partner's companion guide. See our Terms of Service for full legal terms.