Schedule a demo
Segment

Observation result

Carries a single observation or result value, including the observation identifier (typically LOINC-coded), value type (numeric, coded, string, and others), observation value, units, reference range, abnormal flags, and observation status. It is the most widely used result segment in HL7 v2, appearing in ORU (unsolicited results), ADT, order messages, and many others. Lab systems, vital signs monitors, radiology systems, and virtually all clinical systems send OBX segments to report discrete results to EHRs and clinical data repositories.

33fields
2required
v2.9HL7 version
obx.py
from zato.hl7v2 import OBX

obx = OBX()
obx.value_type = 'NM'
obx.observation_value = '182'
obx.units = 'mg/dL'
obx.references_range = '70-110'
obx.observation_result_status = 'F'

Build OBX segments in Python

How to construct and work with real-world OBX segments.

1

Numeric lab result

Blood glucose observation with units and reference range

from zato.hl7v2.v2_9 import OBX
from zato.hl7v2.v2_9 import CWE, NM

obx = OBX()
obx.set_id_obx = '1'
obx.value_type = 'NM'
obx.observation_identifier = CWE(
    identifier='2345-7',
    text='Glucose',
    name_of_coding_system='LN'
)
obx.observation_value = '182'
obx.units = CWE(identifier='mg/dL')
obx.reference_range = '70-110'
obx.interpretation_codes = CWE(identifier='H')
obx.observation_result_status = 'F'
2

Coded observation

Blood type result using coded values

from zato.hl7v2.v2_9 import OBX
from zato.hl7v2.v2_9 import CWE

obx = OBX()
obx.set_id_obx = '1'
obx.value_type = 'CWE'
obx.observation_identifier = CWE(
    identifier='882-1',
    text='ABO and Rh group',
    name_of_coding_system='LN'
)
obx.observation_value = CWE(
    identifier='278149003',
    text='Blood group A Rh(D) positive',
    name_of_coding_system='SCT'
)
obx.observation_result_status = 'F'
obx.date_time_of_the_observation = '20240315120000'
3

Vital signs observation

Blood pressure systolic reading with body site

from zato.hl7v2.v2_9 import OBX
from zato.hl7v2.v2_9 import CWE

obx = OBX()
obx.set_id_obx = '1'
obx.value_type = 'NM'
obx.observation_identifier = CWE(
    identifier='8480-6',
    text='Systolic blood pressure',
    name_of_coding_system='LN'
)
obx.observation_value = '120'
obx.units = CWE(identifier='mm[Hg]')
obx.reference_range = '90-120'
obx.interpretation_codes = CWE(identifier='N')
obx.observation_result_status = 'F'

Learn by building

Step-by-step guides for working with HL7 v2 in Zato.

Frequently asked questions

OBX carries observation and result data in HL7v2 messages. It transmits lab results, vital signs, diagnostic findings, and any measured or observed clinical data. OBX segments are found in ORU (unsolicited observation), ADT, and other message types.

Configure an MLLP channel in Zato to listen for incoming HL7v2 messages. Your Python service builds or receives OBX segments directly:

from zato.hl7v2.v2_9 import OBX, CWE

obx = OBX()
obx.value_type = 'NM'
obx.observation_identifier = CWE(
    identifier='2345-7',
    text='Glucose'
)
obx.observation_value = '182'

Use the validate function to check field lengths, cardinality, required fields, and datatype conformance:

from zato.hl7v2 import validate_message

result = validate_message(raw_oru)
if result.is_valid:
    print('Message is valid')
for error in result.errors:
    print(error.message)

Yes, you can map OBX fields to a FHIR Observation resource:

from zato.fhir.r4_0_1 import Observation

obs = Observation()
obs.status = 'final'
obs.code = obx.observation_identifier
obs.valueString = obx.observation_value

Use semantic Python names instead of positional notation:

# Instead of OBX.3, use:
obx.observation_identifier

# Instead of OBX.11, use:
obx.observation_result_status

# Instead of OBX.5, use:
obx.observation_value

Zato connects to any system that speaks HL7v2 over MLLP or FHIR over REST. This includes Epic, Cerner, Meditech, Allscripts, and other EHR platforms.

Yes, Zato has built-in MLLP support for sending and receiving HL7v2 messages. MLLP channels handle the framing protocol automatically.

Zato supports HL7 v2.9, which is backward compatible with earlier versions including v2.3, v2.5, and v2.7. Standard segments and datatypes are available as typed Python classes.

Yes. Zato handles both HL7v2 and FHIR natively, so you can parse v2 messages and build FHIR resources with IG-specific extensions in the same service. Typed Python classes are available for both protocols, including extensions from US Core, UK Core, Da Vinci, and other Implementation Guides.

OBX field reference

Complete list of fields in the OBX segment, HL7 v2.9.

#Python nameDatatypeUsageRepeatableTable
1set_id_obxSIOptionalNo-
2value_typeIDOptionalNoHL70125
3observation_identifierCWERequiredNoHL70622
4observation_sub_idOGOptionalNo-
5observation_valuevariesOptionalYes-
6unitsCWEOptionalNoHL70623
7reference_rangeSTOptionalNo-
8interpretation_codesCWEOptionalYesHL70078
9probabilityNMOptionalNo-
10nature_of_abnormal_testIDOptionalYesHL70080
11observation_result_statusIDRequiredNoHL70085
12effective_date_of_reference_rangeDTMOptionalNo-
13user_defined_access_checksSTOptionalNo-
14date_time_of_the_observationDTMOptionalNo-
15producers_idCWEOptionalNoHL70624
16responsible_observerXCNOptionalYes-
17observation_methodCWEOptionalYesHL70626
18equipment_instance_identifierEIOptionalYes-
19date_time_of_the_analysisDTMOptionalNo-
20observation_siteCWEOptionalYesHL70163
21observation_instance_identifierEIOptionalNo-
22mood_codeCNEOptionalNoHL70725
23performing_organization_nameXONOptionalNo-
24performing_organization_addressXADOptionalNo-
25performing_organization_medical_directorXCNOptionalNo-
26patient_results_release_categoryIDOptionalNoHL70909
27root_causeCWEOptionalNoHL70914
28local_process_controlCWEOptionalYesHL70915
29observation_typeIDOptionalNoHL70936
30observation_sub_typeIDOptionalNoHL70937
31action_codeIDOptionalNo-
32observation_value_absent_reasonCWEOptionalYesHL70960
33observation_related_specimen_identifierEIPOptionalYes-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python