Schedule a demo
Segment

Dietary orders, supplements, and preferences

Communicates dietary orders, nutritional supplements, and patient food preferences within diet-related messages. It specifies whether the entry represents a diet, supplement, or preference, along with an optional service period and a coded value identifying the specific item. It appears in diet order messages (O03, O19) and is used by dietary and nutrition systems to plan and prepare patient meals.

4fields
2required
v2.9HL7 version
ods.py
from zato.hl7v2 import ODS

ods = ODS()
ods.type_ = 'D'
ods.text_instruction = 'Low sodium'

Build ODS segments in Python

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

1

Diet order

Standard dietary order with type, service period, diet code, and text instruction

from zato.hl7v2.v2_9 import ODS
from zato.hl7v2.v2_9 import CWE

ods = ODS()
ods.type_ = 'D'
ods.service_period = CWE(
    identifier='BRK',
    text='Breakfast',
    name_of_coding_system='HL70627'
)
ods.diet_supplement_or_preference_code = CWE(
    identifier='DAB',
    text='Diabetic',
    name_of_coding_system='HL70628'
)
ods.text_instruction = 'No added sugar'
2

Supplement order

Nutritional supplement entry with service period and coded supplement type

from zato.hl7v2.v2_9 import ODS
from zato.hl7v2.v2_9 import CWE

ods = ODS()
ods.type_ = 'S'
ods.service_period = CWE(
    identifier='LUN',
    text='Lunch',
    name_of_coding_system='HL70627'
)
ods.diet_supplement_or_preference_code = CWE(
    identifier='ENS',
    text='Ensure',
    name_of_coding_system='HL70628'
)
ods.text_instruction = 'Chocolate flavor'
3

Patient preference

Food preference entry with preference code and free-text instruction

from zato.hl7v2.v2_9 import ODS
from zato.hl7v2.v2_9 import CWE

ods = ODS()
ods.type_ = 'P'
ods.diet_supplement_or_preference_code = CWE(
    identifier='VEG',
    text='Vegetarian',
    name_of_coding_system='HL70628'
)
ods.text_instruction = 'No dairy products'

Learn by building

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

Frequently asked questions

ODS communicates dietary orders, nutritional supplements, and patient food preferences. The type field distinguishes between diets (D), supplements (S), and preferences (P). It appears in diet order messages and is consumed by nutrition and food service systems.

The type_ field uses HL7 table 0159. Common values are D (Diet), S (Supplement), and P (Preference):

from zato.hl7v2.v2_9 import ODS

ods = ODS()

# D = Diet
ods.type_ = 'D'

# S = Supplement
ods.type_ = 'S'

# P = Preference
ods.type_ = 'P'

The diet_supplement_or_preference_code field uses CWE with HL7 table 0628:

from zato.hl7v2.v2_9 import ODS, CWE

ods = ODS()
ods.type_ = 'D'
ods.diet_supplement_or_preference_code = CWE(
    identifier='DAB',
    text='Diabetic',
    name_of_coding_system='HL70628'
)

The service_period field uses CWE with HL7 table 0627 to indicate when the diet applies:

from zato.hl7v2.v2_9 import ODS, CWE

ods = ODS()
ods.service_period = CWE(
    identifier='BRK',
    text='Breakfast',
    name_of_coding_system='HL70627'
)

The text_instruction field is a simple string for additional dietary notes:

from zato.hl7v2.v2_9 import ODS

ods = ODS()
ods.type_ = 'D'
ods.text_instruction = 'No added sugar'

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.

ODS field reference

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

#Python nameDatatypeUsageRepeatableTable
1type_IDRequiredNoHL70159
2service_periodCWEOptionalNoHL70627
3diet_supplement_or_preference_codeCWERequiredNoHL70628
4text_instructionSTOptionalNo-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python