The RXG (Pharmacy/Treatment Give) segment describes a single scheduled instance of giving a medication or treatment to a patient. It bridges the encoded order (RXE) and the actual administration (RXA): the RXG specifies what should be given, in what amount, on what schedule, and from which dispensed lot. It is the central detail segment of the RGV (Pharmacy/Treatment Give) message.
Purpose
The RXG segment exists to communicate the give instruction for a specific administration occurrence. Once a medication has been ordered and dispensed, the system that manages administration needs to know precisely what to give at each scheduled time: the product, the give amount and units, the dosage form, the rate, and substance traceability such as lot number and expiration. The RXG carries those details and links each give to its sub-ID counters so that multiple gives derived from a single dispense can be tracked individually.
Used in
The RXG segment appears in RGV messages (Pharmacy/Treatment Give), where it conveys each scheduled give within an order group. It is typically preceded by an ORC order-control segment and accompanied by one or more RXR (route) segments, references the encoded order in the related RXE segment, and is the precursor to the administration recorded in an RXA segment.
Field-by-field reference
Source: HAPI HL7v2 v2.5.1 javadocs (RXG javadoc) for sequence, name, data type, and repetition. Length is not published in the javadocs (—); Required and Table # are filled from the HL7 v2.5.1 standard where well-established.
| Seq | Name | Data Type | Length | Req | Repeat | Table # | Description |
|---|---|---|---|---|---|---|---|
| RXG-1 | Give Sub-ID Counter | nm | — | R | — | — | Sequential counter for each give instance |
| RXG-2 | Dispense Sub-ID Counter | nm | — | O | — | — | Links this give to its dispense event |
| RXG-3 | Quantity/Timing | tq | — | R | — | — | Quantity and timing of the give |
| RXG-4 | Give Code | ce | — | R | — | — | Coded identifier of the medication to give |
| RXG-5 | Give Amount - Minimum | nm | — | R | — | — | Minimum amount to give per administration |
| RXG-6 | Give Amount - Maximum | nm | — | O | — | — | Maximum amount to give per administration |
| RXG-7 | Give Units | ce | — | R | — | — | Units for the give amount |
| RXG-8 | Give Dosage Form | ce | — | O | — | — | Form in which the drug is given |
| RXG-9 | Administration Notes | ce | — | O | Y | — | Notes or instructions for administration |
| RXG-10 | Substitution Status | id | — | O | — | HL70167 | Whether a substitution occurred |
| RXG-11 | Dispense-to Location | la2 | — | O | — | — | Location to which the drug is dispensed |
| RXG-12 | Needs Human Review | id | — | O | — | HL70136 | Flag indicating manual review is required |
| RXG-13 | Pharmacy/Treatment Supplier's Special Administration Instructions | ce | — | O | Y | — | Special administration instructions |
| RXG-14 | Give Per (Time Unit) | st | — | O | — | — | Time unit over which the dose is given |
| RXG-15 | Give Rate Amount | st | — | O | — | — | Rate at which the drug is given |
| RXG-16 | Give Rate Units | ce | — | O | — | — | Units for the give rate |
| RXG-17 | Give Strength | nm | — | O | — | — | Strength of the medication to give |
| RXG-18 | Give Strength Units | ce | — | O | — | — | Units for the give strength |
| RXG-19 | Substance Lot Number | st | — | O | Y | — | Lot number of the substance given |
| RXG-20 | Substance Expiration Date | ts | — | O | Y | — | Expiration date of the substance given |
| RXG-21 | Substance Manufacturer Name | ce | — | O | Y | HL70227 | Manufacturer of the substance given |
| RXG-22 | Indication | ce | — | O | Y | — | Reason or indication for giving the drug |
| RXG-23 | Give Drug Strength Volume | nm | — | O | — | — | Volume associated with the drug strength |
| RXG-24 | Give Drug Strength Volume Units | cwe | — | O | — | — | Units for the drug strength volume |
| RXG-25 | Give Barcode Identifier | cwe | — | O | — | — | Barcode identifier scanned at give time |
| RXG-26 | Pharmacy Order Type | id | — | O | — | HL70480 | Type of pharmacy order (inpatient/outpatient) |
Most-used fields
The fields most integrations depend on are RXG-1 (Give Sub-ID Counter), which uniquely orders each give occurrence, and RXG-3 (Quantity/Timing), which carries the schedule for that give. RXG-4 (Give Code) identifies the medication, while RXG-5 and RXG-7 (Give Amount - Minimum and Give Units) define the dose. RXG-2 (Dispense Sub-ID Counter) links the give back to its dispense, and traceability-conscious sites populate RXG-19 (Substance Lot Number) and RXG-20 (Substance Expiration Date). RXG-25 (Give Barcode Identifier) is increasingly used to support bedside barcode-medication-administration workflows.
Version differences (2.3 to 2.8.2)
In v2.3 the RXG segment ended near field 22, covering the give amounts, rate, lot, expiration, and indication. v2.4 stabilized the give-rate and strength fields. v2.5 and v2.5.1 added fields 23 through 26: Give Drug Strength Volume, Give Drug Strength Volume Units, Give Barcode Identifier (RXG-25, supporting BCMA), and Pharmacy Order Type (RXG-26). Releases from v2.6 through v2.8.2 refined several coded data types toward CWE and clarified table bindings, while the v2.5.1 field sequence documented here remained stable.
Common mistakes
A frequent error is omitting RXG-1 (Give Sub-ID Counter) or failing to keep it distinct across gives, which prevents correlating each scheduled give with its later RXA administration. Another is neglecting RXG-2 (Dispense Sub-ID Counter), severing the link to the dispense event. Integrators sometimes confuse RXG (the give instruction) with RXA (the recorded administration) — they are distinct steps. Units (RXG-7) must accompany give amounts. The repeating fields (RXG-9, RXG-13, RXG-19, RXG-20, RXG-21, RXG-22) require the repetition separator (~), and lot/expiration repetitions should stay aligned.
Examples
A minimal valid RXG segment:
RXG|1|1|1^^^20260612120000^^R|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|1||CAP
A fully-populated RXG segment:
RXG|1|1|1^^^20260612120000^^R|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|1|1|CAP|CAP^Capsule^HL70488|Give with water~Confirm allergy band|G|WARD3^^^^^^^^Pharmacy|N|Verify identity before giving|day|1|CAP^Capsule^HL70488|500|mg|LOT44821|20271231|00093^Teva^MFR|J01CA04^Bacterial infection^ICD10|5|mL|BC0012345678^Scan OK^LOCAL|O
Annotated breakdown:
RXG|1|1|1^^^20260612120000^^R|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|1||CAP|...
| | | | | |
| | | | | +--> RXG-7 Give Units (CAP)
| | | | +-----> RXG-5 Give Amount - Minimum (1)
| | | +--------------------------------------------------> RXG-4 Give Code (NDC for Amoxicillin)
| | +-----------------------------------------------------------------------> RXG-3 Quantity/Timing (start 20260612120000, priority R)
| +-------------------------------------------------------------------------> RXG-2 Dispense Sub-ID Counter (1)
+---------------------------------------------------------------------------> RXG-1 Give Sub-ID Counter (1)
In context inside an RGV message (give report):
MSH|^~&|PHARMSYS|GENHOSP|EHR|GENHOSP|20260612120000||RGV^O15^RGV_O15|MSG00074510|P|2.5.1
PID|1||MRN556677^^^GENHOSP^MR||Calloway^Dana^E||19840722|F
ORC|RE|ORD778899^EHR|RX0000457821^PHARMSYS|||||20260612120000|||AA1234567^Welby^Marcus^^^^Dr
RXG|1|1|1^^^20260612120000^^R|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|1||CAP|CAP^Capsule^HL70488|Give with water|G|WARD3|N
RXR|PO^By mouth^HL70162
A second in-context excerpt (IV give with barcode and lot):
MSH|^~&|PHARMSYS|GENHOSP|EHR|GENHOSP|20260612130000||RGV^O15^RGV_O15|MSG00074511|P|2.5.1
PID|1||MRN112233^^^GENHOSP^MR||Okafor^Jane^L||19771103|F
ORC|RE|ORD778900^EHR|RX0000457822^PHARMSYS|||||20260612130000|||BB7654321^Patel^Anya^^^^Dr
RXG|1|1|1^^^20260612130000^^R|0338-0049-04^Sodium Chloride 0.9% IV^NDC|1000||mL|SOL^Solution^HL70488|Infuse over 8 hours|N|||N||day|125|mL/hr|||LOT77310|20270630|0338^Baxter^MFR||1000|mL|BC0099887766^Scan OK^LOCAL
RXR|IV^Intravenous^HL70162
FHIR mapping
No segment-level ConceptMap is published in the v2-to-FHIR IG for RXG. Conceptually, an RXG segment corresponds to a FHIR MedicationAdministration resource (and, for the planned-give aspect, MedicationRequest): the Give Code maps to medication, the give amount and units to dosage.dose, the quantity/timing to scheduling and dosage.rate, and lot/expiration to administration traceability. Because no published ConceptMap exists, integrators must define field-level mappings themselves.
Engine considerations
RXG carries two leading sub-ID counters (RXG-1 and RXG-2) that engines must preserve exactly, since they tie gives to dispenses and to later administrations. The numerous CE and CWE composites require correct component (^) and subcomponent (&) handling, and the repeating fields (RXG-9, RXG-13, RXG-19, RXG-20, RXG-21, RXG-22) must be iterated by repetition (~). Engines should keep lot and expiration repetitions aligned, preserve empty trailing fields when re-emitting RXG, and validate that give amounts carry units.
How Vorro parses and produces RXG
Vorro parses RXG positionally into typed fields, preserving the RXG-1 and RXG-2 sub-ID counters so give-to-dispense and give-to-administration linkages remain intact. CE/CWE/XCN composites are decomposed into individually addressable components, and repeating fields are exposed as ordered collections with aligned lot and expiration repetitions. When producing RXG, Vorro emits only mapped fields while maintaining correct positions with placeholder delimiters, normalizes coded values against configured terminologies (NDC, RxNorm, route and dosage-form tables), and verifies that give amounts and strengths are paired with their unit fields before serialization.
