The RXD (Pharmacy/Treatment Dispense) segment records a single dispensing event for a medication or treatment. It captures what was actually dispensed — the product, the actual amount and units, the dispense date/time, lot and expiration details, and the dispensing provider — and is the central detail segment of the RDS (Pharmacy/Treatment Dispense) message. Where RXE describes the encoded order, RXD describes the fulfillment of that order.
Purpose
The RXD segment exists to report the concrete act of dispensing a medication. After an order has been encoded (RXE), the pharmacy fills it and reports back the realities of that fill: the exact product dispensed, the actual quantity and units, the remaining refills, and traceability data such as lot number and expiration date. This makes RXD the authoritative record of dispensing in the medication lifecycle and the basis for inventory, billing, and medication-reconciliation downstream.
Used in
The RXD segment appears in RDS messages (Pharmacy/Treatment Dispense), where it conveys the details of each dispense within an order group. It is normally preceded by an ORC order-control segment and accompanied by one or more RXR (route) segments, and it references the encoded order described by the related RXE segment.
Field-by-field reference
Source: HAPI HL7v2 v2.5.1 javadocs (RXD 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 |
|---|---|---|---|---|---|---|---|
| RXD-1 | Dispense Sub-ID Counter | nm | — | R | — | — | Sequential counter for each dispense event |
| RXD-2 | Dispense/Give Code | ce | — | R | — | — | Coded identifier of the dispensed product |
| RXD-3 | Date/Time Dispensed | ts | — | R | — | — | When the dispense occurred |
| RXD-4 | Actual Dispense Amount | nm | — | R | — | — | Quantity actually dispensed |
| RXD-5 | Actual Dispense Units | ce | — | O | — | — | Units for the actual dispense amount |
| RXD-6 | Actual Dosage Form | ce | — | O | — | — | Dosage form actually dispensed |
| RXD-7 | Prescription Number | st | — | O | — | — | Pharmacy-assigned prescription number |
| RXD-8 | Number of Refills Remaining | nm | — | O | — | — | Refills still available after this dispense |
| RXD-9 | Dispense Notes | st | — | O | Y | — | Free-text notes about the dispense |
| RXD-10 | Dispensing Provider | xcn | — | O | Y | — | Provider who performed the dispense |
| RXD-11 | Substitution Status | id | — | O | — | HL70167 | Whether a substitution occurred |
| RXD-12 | Total Daily Dose | cq | — | O | — | — | Total amount to be given per day |
| RXD-13 | Dispense-to Location | la2 | — | O | — | — | Location to which the drug is dispensed |
| RXD-14 | Needs Human Review | id | — | O | — | HL70136 | Flag indicating manual review is required |
| RXD-15 | Pharmacy/Treatment Supplier's Special Dispensing Instructions | ce | — | O | Y | — | Special dispensing instructions |
| RXD-16 | Actual Strength | nm | — | O | — | — | Strength of the product dispensed |
| RXD-17 | Actual Strength Unit | ce | — | O | — | — | Units for the actual strength |
| RXD-18 | Substance Lot Number | st | — | O | Y | — | Lot number of the dispensed substance |
| RXD-19 | Substance Expiration Date | ts | — | O | Y | — | Expiration date of the dispensed substance |
| RXD-20 | Substance Manufacturer Name | ce | — | O | Y | HL70227 | Manufacturer of the dispensed substance |
| RXD-21 | Indication | ce | — | O | Y | — | Reason or indication for the dispense |
| RXD-22 | Dispense Package Size | nm | — | O | — | — | Size of the dispense package |
| RXD-23 | Dispense Package Size Unit | ce | — | O | — | — | Units for the dispense package size |
| RXD-24 | Dispense Package Method | id | — | O | — | HL70321 | Method of dispense packaging |
| RXD-25 | Supplementary Code | ce | — | O | Y | — | Additional codes such as billing modifiers |
| RXD-26 | Initiating Location | ce | — | O | — | — | Location that initiated the dispense |
| RXD-27 | Packaging/Assembly Location | ce | — | O | — | — | Location where packaging was assembled |
| RXD-28 | Actual Drug Strength Volume | nm | — | O | — | — | Volume associated with the drug strength |
| RXD-29 | Actual Drug Strength Volume Units | cwe | — | O | — | — | Units for the drug strength volume |
| RXD-30 | Dispense to Pharmacy | cwe | — | O | — | — | Pharmacy receiving the dispense |
| RXD-31 | Dispense to Pharmacy Address | xad | — | O | — | — | Address of the receiving pharmacy |
| RXD-32 | Pharmacy Order Type | id | — | O | — | HL70480 | Type of pharmacy order (inpatient/outpatient) |
| RXD-33 | Dispense Type | cwe | — | O | — | HL70484 | Type of dispense (trial, refill, etc.) |
Most-used fields
The fields most integrations rely on are RXD-1 (Dispense Sub-ID Counter), which orders multiple dispenses within an order, RXD-2 (Dispense/Give Code), which identifies the dispensed product, and RXD-3 (Date/Time Dispensed), which timestamps the event. RXD-4 and RXD-5 (Actual Dispense Amount and Units) record exactly what was given out, while RXD-7 (Prescription Number) and RXD-8 (Number of Refills Remaining) tie the dispense back to the prescription lifecycle. Pharmacies that track traceability also depend heavily on RXD-18 (Substance Lot Number) and RXD-19 (Substance Expiration Date).
Version differences (2.3 to 2.8.2)
In v2.3 the RXD segment ended near field 21, covering the actual dispense amounts, lot, expiration, and indication. v2.4 stabilized the dispense-package fields (22–25). v2.5 and v2.5.1 added fields 26 through 33, including Initiating Location, Packaging/Assembly Location, Actual Drug Strength Volume, the dispense-to-pharmacy block (30–31), Pharmacy Order Type (RXD-32), and Dispense Type (RXD-33). Releases from v2.6 through v2.8.2 refined data types (notably moving newer coded fields to CWE) and clarified table bindings, while the v2.5.1 field sequence documented here remained stable.
Common mistakes
A common pitfall is omitting RXD-1 (Dispense Sub-ID Counter) or repeating the same value across multiple dispenses, which breaks correlation of distinct fill events. Another is confusing RXD-4 (Actual Dispense Amount, what was truly dispensed) with the ordered amount in the related RXE — they can legitimately differ. Integrators sometimes drop units (RXD-5), leaving the quantity ambiguous. The repeating fields (RXD-9, RXD-10, RXD-15, RXD-18, RXD-19, RXD-20, RXD-21, RXD-25) must be expressed with the repetition separator (~). Finally, lot and expiration data (RXD-18, RXD-19) should be paired consistently so traceability records remain coherent.
Examples
A minimal valid RXD segment:
RXD|1|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|20260612101500|30
A fully-populated RXD segment:
RXD|1|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|20260612101500|30|CAP|CAP^Capsule^HL70488|RX0000457821|2|Counseled patient~No allergies noted|PH9981^Stone^Rita^^^^RPh|G|500^mg/day|WARD3^^^^^^^^Pharmacy|N|Refrigerate after opening|500|mg|LOT44821~LOT44822|20271231~20280131|00093^Teva^MFR|J01CA04^Bacterial infection^ICD10|100|CAP|F|MOD3^Modifier|MAIN-PHARM^Main Pharmacy|PKG-LINE2^Packaging Line 2|5|mL|SAT-PHARM^Satellite Pharmacy|789 Clinic Rd^^Springfield^IL^62704|O|R^Refill^HL70484
Annotated breakdown:
RXD|1|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|20260612101500|30|CAP|...
| | | | |
| | | | +--> RXD-5 Actual Dispense Units (CAP)
| | | +-----> RXD-4 Actual Dispense Amount (30)
| | +--------------------> RXD-3 Date/Time Dispensed (20260612101500)
| +-----------------------------------------------------------------> RXD-2 Dispense/Give Code (NDC for Amoxicillin)
+-------------------------------------------------------------------> RXD-1 Dispense Sub-ID Counter (1)
In context inside an RDS message (dispense report):
MSH|^~&|PHARMSYS|GENHOSP|EHR|GENHOSP|20260612101500||RDS^O13^RDS_O13|MSG00073201|P|2.5.1
PID|1||MRN556677^^^GENHOSP^MR||Calloway^Dana^E||19840722|F
ORC|RE|ORD778899^EHR|RX0000457821^PHARMSYS|||||20260612101500|||AA1234567^Welby^Marcus^^^^Dr
RXD|1|00093-0058-01^Amoxicillin 500 MG Capsule^NDC|20260612101500|30|CAP|CAP^Capsule^HL70488|RX0000457821|2||PH9981^Stone^Rita^^^^RPh|G
RXR|PO^By mouth^HL70162
A second in-context excerpt (IV solution dispense with lot tracking):
MSH|^~&|PHARMSYS|GENHOSP|EHR|GENHOSP|20260612110000||RDS^O13^RDS_O13|MSG00073202|P|2.5.1
PID|1||MRN112233^^^GENHOSP^MR||Okafor^Jane^L||19771103|F
ORC|RE|ORD778900^EHR|RX0000457822^PHARMSYS|||||20260612110000|||BB7654321^Patel^Anya^^^^Dr
RXD|1|0338-0049-04^Sodium Chloride 0.9% IV^NDC|20260612110000|1000|mL|SOL^Solution^HL70488|RX0000457822|0||PH9981^Stone^Rita^^^^RPh|N|||N||||LOT77310|20270630|0338^Baxter^MFR
RXR|IV^Intravenous^HL70162
FHIR mapping
No segment-level ConceptMap is published in the v2-to-FHIR IG for RXD. Conceptually, an RXD segment corresponds to a FHIR MedicationDispense resource: the Dispense/Give Code maps to medication, the actual dispense amount and units to quantity, the dispense date/time to whenHandedOver or whenPrepared, the prescription number to authorizingPrescription, and lot/expiration data to batch. Because no published ConceptMap exists, integrators must define field-level mappings themselves.
Engine considerations
RXD is a long segment with numerous CE and CWE composites, so engines must correctly parse component (^) and subcomponent (&) delimiters when reading coded fields. The repeating fields (RXD-9, RXD-10, RXD-15, RXD-18, RXD-19, RXD-20, RXD-21, RXD-25) require iterating across repetition (~) instances; in particular, lot numbers and expiration dates may carry parallel repetitions that must stay aligned. Engines should preserve empty trailing fields when re-emitting RXD and validate that units accompany every populated amount and strength.
How Vorro parses and produces RXD
Vorro parses RXD positionally into typed fields, decomposing CE/CWE/XCN composites so codes, descriptions, and coding systems are individually accessible, and exposing repeating fields as ordered collections that preserve parallel alignment between lot numbers and expiration dates. When producing RXD, Vorro emits only mapped fields while keeping correct positions with placeholder delimiters, ensures RXD-1 is unique per dispense event, normalizes coded values against configured terminologies (NDC, RxNorm, manufacturer tables), and verifies that amount and strength fields are paired with their unit fields before serialization.
