Schedule a demo
Segment

Pharmacy/treatment give

Carries the scheduled administration ("give") instructions for a single dose from the pharmacy to the nursing or clinical application, including the give code, amount, units, dosage form, and substitution status. It appears in RGV (Pharmacy/Treatment Give) messages and is used by automated dispensing cabinets, MAR systems, and nursing applications to know exactly what to administer and when.

29fields
4required
v2.9HL7 version
rxg.py
from zato.hl7v2.v2_9 import RXG, CWE

rxg = RXG()
rxg.give_code = CWE(
    identifier='OM3', text='Omega-3')
rxg.give_amount_minimum = '1'
rxg.give_units = CWE(identifier='CAP')

Build RXG segments in Python

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

1

Vitamin D supplement dispensing

Dispenses a single Vitamin D soft gel capsule with give code, amount, units, and dosage form for a daily wellness regimen

from zato.hl7v2.v2_9 import RXG
from zato.hl7v2.v2_9 import CWE

rxg = RXG()
rxg.give_sub_id_counter = '1'
rxg.give_code = CWE(
    identifier='VITD3',
    text='Vitamin D3 1000 IU',
    name_of_coding_system='LN'
)
rxg.give_amount_minimum = '1'
rxg.give_units = CWE(
    identifier='CAP',
    text='Capsule',
    name_of_coding_system='HL70715'
)
rxg.give_dosage_form = CWE(
    identifier='SGC',
    text='Soft Gel Cap',
    name_of_coding_system='HL70716'
)
2

Multivitamin tablet with lot number and manufacturer

Gives a multivitamin tablet with substance lot number, expiration date, and manufacturer for inventory tracking

from zato.hl7v2.v2_9 import RXG
from zato.hl7v2.v2_9 import CWE

rxg = RXG()
rxg.give_sub_id_counter = '2'
rxg.dispense_sub_id_counter = '1'
rxg.give_code = CWE(
    identifier='MV',
    text='Multivitamin Daily',
    name_of_coding_system='LN'
)
rxg.give_amount_minimum = '1'
rxg.give_units = CWE(
    identifier='TAB',
    text='Tablet',
    name_of_coding_system='HL70715'
)
rxg.give_dosage_form = CWE(
    identifier='TABS',
    text='Tablet',
    name_of_coding_system='HL70716'
)
rxg.administration_notes = CWE(
    identifier='MEAL',
    text='Take with food',
    name_of_coding_system='HL70691'
)
rxg.substance_lot_number = 'LOT-2025-A'
rxg.substance_expiration_date = '20261231'
rxg.substance_manufacturer_name = CWE(
    identifier='WELLCO',
    text='WellCo Vitamins',
    name_of_coding_system='L'
)
3

Electrolyte solution with give rate and strength

Administers an electrolyte replenishment solution with give rate, strength, and volume for hydration support

from zato.hl7v2.v2_9 import RXG
from zato.hl7v2.v2_9 import CWE

rxg = RXG()
rxg.give_sub_id_counter = '3'
rxg.give_code = CWE(
    identifier='ELEC',
    text='Electrolyte Solution',
    name_of_coding_system='LN'
)
rxg.give_amount_minimum = '500'
rxg.give_units = CWE(
    identifier='ML',
    text='Milliliter',
    name_of_coding_system='HL70715'
)
rxg.give_rate_amount = '125'
rxg.give_rate_units = CWE(
    identifier='ML/HR',
    text='Milliliters per Hour',
    name_of_coding_system='HL70722'
)
rxg.give_strength = '250'
rxg.give_strength_units = CWE(
    identifier='MG',
    text='Milligram',
    name_of_coding_system='HL70723'
)

Learn by building

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

Frequently asked questions

RXG conveys the give side of a pharmacy or treatment order: what to supply, how much, in which units and form, with supporting notes, rates, strength, identifiers, and delivery context for nutrition and wellness products. It is used alongside ORC, RXE, RXO, RXR, RXD, and PID in structured messaging.

Fields 1 (give_sub_id_counter), 4 (give_code), 5 (give_amount_minimum), and 7 (give_units) are required. Fields 3 and 11 are withdrawn in the standard; leave them empty in ER7. Positions 27 and 28 are reserved before deliver-to location fields.

from zato.hl7v2.v2_9 import RXG, CWE

rxg = RXG()
rxg.give_sub_id_counter = '1'
rxg.give_code = CWE(identifier='MV', text='Multivitamin')
rxg.give_amount_minimum = '1'
rxg.give_units = CWE(identifier='TAB')

Field 2 may be empty and field 3 is withdrawn, so minimal messages often look like RXG|1||... with the give code starting in field 4.

Assign Python lists for fields such as administration_notes, special_administration_instructions, substance_lot_number, substance_expiration_date, substance_manufacturer_name, indication, and give_tag_identifier when repeatable.

from zato.hl7v2.v2_9 import RXG, CWE

rxg = RXG()
rxg.give_sub_id_counter = '1'
rxg.give_code = CWE(identifier='PROB', text='Probiotic')
rxg.give_amount_minimum = '1'
rxg.give_units = CWE(identifier='CAP')
rxg.administration_notes = [
    CWE(identifier='MEAL', text='With lunch'),
    CWE(identifier='HYDR', text='With water'),
]

RXG typically describes intended give parameters for an order group, while RXD documents an actual dispense event. Your interface specification should define how identifiers link RXG, RXD, ORC, and related segments.

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.

RXG field reference

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

#Python nameDatatypeUsageRepeatableTable
1give_sub_id_counterNMRequiredNo-
2dispense_sub_id_counterNMOptionalNo-
4give_codeCWERequiredNoHL70292
5give_amount_minimumNMRequiredNo-
6give_amount_maximumNMOptionalNo-
7give_unitsCWERequiredNoHL70715
8give_dosage_formCWEOptionalNoHL70716
9administration_notesCWEOptionalYesHL70691
10substitution_statusIDOptionalNoHL70167
12needs_human_reviewIDOptionalNoHL70136
13special_administration_instructionsCWEOptionalYesHL70738
14give_per_time_unitSTOptionalNo-
15give_rate_amountSTOptionalNo-
16give_rate_unitsCWEOptionalNoHL70722
17give_strengthNMOptionalNo-
18give_strength_unitsCWEOptionalNoHL70723
19substance_lot_numberSTOptionalYes-
20substance_expiration_dateDTMOptionalYes-
21substance_manufacturer_nameCWEOptionalYes-
22indicationCWEOptionalYesHL70694
23give_drug_strength_volumeNMOptionalNo-
24give_drug_strength_volume_unitsCWEOptionalNoHL70744
25give_barcode_identifierCWEOptionalNoHL70745
26pharmacy_order_typeIDOptionalNoHL70480
29deliver_to_patient_locationPLOptionalNo-
30deliver_to_addressXADOptionalNo-
31give_tag_identifierEIOptionalYes-
32dispense_amountNMOptionalNo-
33dispense_unitsCWEOptionalNoHL70746

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python