In a warehouse mock recall, an inventory table shows how many cases of fresh cucumbers sit in cooler zone B, yet cannot join which supplier lot arrived at dock 3, which portion was cut into retail trays at the distribution center, and which stores received each resulting lot.
That gap is a retail food lot traceability event mapping problem rather than a scanner problem. Inventory tables track mutable balances by SKU and bin; in this design, traceability lives in an append-only event ledger recording handoffs and transformations against immutable lot identifiers.
This guide uses one federal rule—the FDA FSMA Food Traceability Final Rule (21 CFR Part 1, Subpart S, implementing FSMA Section 204(d))—and two GS1 standards—EPCIS Standard 2.0 and Core Business Vocabulary (CBV) Standard 2.0—to map lot identifiers and events into an ERP and WMS schema. All three are third-party public documents; none of these organizations or illustrative entities is an Insonl client.
What retail operations must record
Under the rule, covered firms that manufacture, process, pack, or hold foods on the Food Traceability List (FTL)—or foods containing an FTL ingredient in the same form—must keep Key Data Elements (KDEs) for specific Critical Tracking Events (CTEs). FDA notes that the original compliance date was January 20, 2026, and that its 30-month extension to July 20, 2028 remains proposed; meanwhile, enacted Public Law 119-37, § 780 (H.R. 5371) bars using funds appropriated by that Act to administer or enforce the rule before July 20, 2028, which FDA states it intends to follow.
Of the seven CTEs in 21 CFR §§ 1.1325–1.1350, three govern retail distribution:
- Receiving (§ 1.1345): Receipt of an FTL food by someone other than a consumer after transport from another location, including intracompany shipments between different street addresses.
- Transformation (§ 1.1350): Manufacturing/processing or changing a food (commingling, repacking, relabeling) or its packaging/packing when the output is on the FTL, excluding initial packing and earlier steps (harvesting, cooling). Under § 1.1350© and FDA’s CTEs and KDEs table, Transformation KDEs do not apply to retail food establishments and restaurants for foods they do not ship (such as items sold directly to consumers), but apply when a distribution center (DC) or commissary processes produce and ships it to stores.
- Shipping (§ 1.1340): Arranging transport of an FTL food from one location to another, including intracompany shipments between different street addresses (excluding sales or shipments directly to consumers and donations of surplus food under § 1.1310). Firms must maintain and provide Shipping KDEs to the immediate subsequent recipient (other than a transporter), except reference document type and number, which firms must retain and are not required to send.
Two identifier rules from FDA’s Traceability Lot Code (TLC) guidance govern the data model:
- Preserve upstream TLCs on pass-through. Under § 1.1320, a TLC is assigned at initial packing of a raw agricultural commodity (other than food from a fishing vessel), first land-based receiving of food from a fishing vessel, or transformation. Under § 1.1345(b), a covered receiver of FTL food from an exempt supplier assigns a TLC if missing, except for retail food establishments and restaurants. Otherwise, handlers must not assign a new TLC when receiving or shipping a coded lot; overwriting a supplier TLC with a WMS license plate breaks upstream trace.
- Scope uniqueness to the assigning location. A TLC is unique within the records of the assigning location (the TLC Source). A location description requires business name, phone, physical address (or coordinates), and city, state, and ZIP (or comparable foreign details including country). Standard Shipping (§ 1.1340(a)(7)) and Receiving (§ 1.1345(a)(7)) require the TLC Source location description or a TLC Source Reference (such as an FDA Food Facility Registration Number or accessible web URL). By contrast, exempt-supplier receiving (§ 1.1345(b)(5)) requires the location description for where the food was received and, if applicable, the TLC Source Reference; transformation outputs (§ 1.1350(a)(2)(ii)) require the location description for where the food was transformed and, if applicable, the TLC Source Reference.
An illustrative retail receiving-and-distribution flow
Consider an illustrative, made-up flow (not from a real retailer, supplier, or Insonl client) using fresh cucumbers—one of FDA’s supply chain examples—and GS1’s reserved example prefix 952. Each GLN below identifies a site; per FDA’s FSMA Food Traceability Rule FAQs (TTLC.6), a GLN can supply part of a location description when the remaining required details are provided separately, while a GLN used as a standalone location description or TLC Source Reference must let FDA access the full location description:
- DC Receiving (
ObjectEvent,receiving): Retail DC (site GLN9521102000107) receives400 kgof bulk cucumbers (GTIN09521101001013, TLCCUC-20261119-A) from a packer (assigning site9521101000108) underPO-44012andBOL-7721. - DC Fresh-Cut Transformation (
TransformationEvent,creating_class_instance): The DC prep line consumes100 kgofCUC-20261119-Aunder work orderWO-908and outputs240fresh-cut trays (GTIN09521102002019), assigning new TLCCUT-20261120-01with the DC (9521102000107) as assigning site. - Intracompany DC Shipping (
ObjectEvent,shipping): The DC ships300 kgofCUC-20261119-A(keeping assigning site9521101000108) and240trays ofCUT-20261120-01(assigning site9521102000107) onASN-5510to Store 14 (9521102001401). - Store Receiving (
ObjectEvent,receiving): Store 14 receives both lots againstASN-5510without changing either TLC.
Below are the first three events as a made-up example payload conforming to the EPCIS 2.0 JSON-LD Context and EPCIS 2.0 JSON Schema:
{
"@context": ["https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld"],
"type": "EPCISDocument",
"schemaVersion": "2.0",
"creationDate": "2026-11-20T14:30:00Z",
"epcisBody": {
"eventList": [
{
"type": "ObjectEvent",
"eventID": "urn:uuid:10000001-0000-4000-8000-000000000001",
"eventTime": "2026-11-20T06:15:00Z",
"recordTime": "2026-11-20T06:16:00Z",
"eventTimeZoneOffset": "-05:00",
"quantityList": [
{"epcClass": "https://id.gs1.org/01/09521101001013/10/CUC-20261119-A", "quantity": 400, "uom": "KGM"}
],
"action": "OBSERVE",
"bizStep": "receiving",
"disposition": "in_progress",
"readPoint": {"id": "https://id.gs1.org/414/9521102000107/254/dock-3"},
"bizLocation": {"id": "https://id.gs1.org/414/9521102000107"},
"bizTransactionList": [
{"type": "po", "bizTransaction": "urn:epcglobal:cbv:bt:9521102000107:PO-44012"},
{"type": "bol", "bizTransaction": "urn:epcglobal:cbv:bt:9521101000108:BOL-7721"}
],
"sourceList": [{"type": "location", "source": "https://id.gs1.org/414/9521101000108"}],
"destinationList": [{"type": "location", "destination": "https://id.gs1.org/414/9521102000107"}]
},
{
"type": "TransformationEvent",
"eventID": "urn:uuid:10000002-0000-4000-8000-000000000002",
"eventTime": "2026-11-20T09:40:00Z",
"recordTime": "2026-11-20T09:41:00Z",
"eventTimeZoneOffset": "-05:00",
"transformationID": "urn:epcglobal:cbv:xform:9521102000107:WO-908",
"inputQuantityList": [
{"epcClass": "https://id.gs1.org/01/09521101001013/10/CUC-20261119-A", "quantity": 100, "uom": "KGM"}
],
"outputQuantityList": [
{"epcClass": "https://id.gs1.org/01/09521102002019/10/CUT-20261120-01", "quantity": 240}
],
"bizStep": "creating_class_instance",
"readPoint": {"id": "https://id.gs1.org/414/9521102000107/254/prep-line-2"},
"bizLocation": {"id": "https://id.gs1.org/414/9521102000107"},
"bizTransactionList": [
{"type": "prodorder", "bizTransaction": "urn:epcglobal:cbv:bt:9521102000107:WO-908"}
]
},
{
"type": "ObjectEvent",
"eventID": "urn:uuid:10000003-0000-4000-8000-000000000003",
"eventTime": "2026-11-20T13:05:00Z",
"recordTime": "2026-11-20T13:06:00Z",
"eventTimeZoneOffset": "-05:00",
"quantityList": [
{"epcClass": "https://id.gs1.org/01/09521101001013/10/CUC-20261119-A", "quantity": 300, "uom": "KGM"},
{"epcClass": "https://id.gs1.org/01/09521102002019/10/CUT-20261120-01", "quantity": 240}
],
"action": "OBSERVE",
"bizStep": "shipping",
"disposition": "in_transit",
"readPoint": {"id": "https://id.gs1.org/414/9521102000107/254/out-door-4"},
"bizTransactionList": [
{"type": "desadv", "bizTransaction": "urn:epcglobal:cbv:bt:9521102000107:ASN-5510"}
],
"sourceList": [{"type": "location", "source": "https://id.gs1.org/414/9521102000107"}],
"destinationList": [{"type": "location", "destination": "https://id.gs1.org/414/9521102001401"}]
}
]
}
}
Three standard details guide ingestion:
- Class-level URIs and units: This example uses GS1 Digital Link LGTIN URIs (
https://id.gs1.org/01/{gtin}/10/{lot}); CBV 2.0 § 8.3 also permits other class-level forms such as EPC URIs. In EPCISQuantityElement, weights carry a UN/ECE Rec 20 code ("uom": "KGM"), while discrete item counts (240trays) omituomand store a positive integerquantity. - Event semantics: The transformation uses a CBV § 8.8.3 GLN-based
transformationID(urn:epcglobal:cbv:xform:...) and omitsdisposition: active(which CBV § 7.2.3 ties to commissioning). The shipping event omitsbizLocationbecause EPCIS § 7.4.2 defines it as where goods can be found after the event; outboundreadPointandsourceListalready identify the DC. - Master data resolution: This payload carries GLNs and GTINs rather than full addresses or descriptions, so the example resolves them against versioned master tables.
Mapping CTEs, KDEs, and EPCIS fields into ERP tables
Under 21 CFR § 1.1455(g), records may span multiple sets when the Traceability Plan (§ 1.1315) identifies their format and location; lot-level linkage comes from the CTE rules (§§ 1.1325–1.1350). Five tables cover retail distribution:
| FDA CTE / KDE requirement | EPCIS 2.0 / CBV 2.0 field | Relational table and columns |
|---|---|---|
| TLC, product description, TLC Source / Reference | epcClass LGTIN URI + master catalog |
lot_master (lot_id, tlc_source_key, tlc_code, tlc_source_location_id, tlc_source_ref, gtin, product_description) |
| CTE type, local event date (shipping, receiving, or transformation completion), and handling / ship-from location | type, bizStep, eventTime + eventTimeZoneOffset (operational timestamp converted to local cte_date), readPoint (operational dock), bizLocation (receiving/transformation), sourceList entry of type: location (ship-from facility on shipping) |
traceability_events (event_row_id, event_id, is_error_declaration, normalized_event_hash, cte_type, cte_date, event_time, tz_offset, facility_location_id, read_point_code, transformation_id) |
| Immediate previous source / subsequent recipient (not transporter) | sourceList (receiving) / destinationList (shipping) of type: location; possessing_party identifies a party and needs separate facility mapping |
traceability_events (counterparty_location_id) → location_master (location_id, gln, business_name, phone, address_fields, effective_from) |
| Quantities, reporting unit, transformation inputs/outputs | quantityList, inputQuantityList, outputQuantityList |
event_lot_lines (event_row_id, lot_id, line_role in OBSERVED/INPUT/OUTPUT, quantity, epcis_uom, reporting_uom) |
| Reference document type and number | bizTransactionList (po, bol, desadv, prodorder, recadv) |
event_reference_docs (event_row_id, doc_type, doc_number, issuer_location_id) |
Store reporting_uom (such as tray or kg) on event_lot_lines even when EPCIS omits uom for a discrete count, so FDA exports always include a unit of measure.
Four constraints keep this schema sound:
- Normalize lot uniqueness on
(tlc_source_key, tlc_code). Definetlc_source_keyinlot_masterby normalizing bothlocation_masterrecords andtlc_source_refstrings into one canonical key, require at least one source column per FTL lot, and enforce uniqueness on(tlc_source_key, tlc_code)rather thantlc_codealone. - Model transformations as many-to-many graphs. A single
parent_lot_idcolumn breaks on commingled lots or multi-SKU splits. StoreINPUTandOUTPUTrows inevent_lot_lines, and for split transformations sharing atransformation_id(EPCIS § 7.4.5), join input and output lines across matchingtransformation_idevents before traversing the lot graph. - Handle append-only error declarations for both ID-bearing and ID-less events. Under EPCIS § 7.4.1.2, retracting a bad event requires appending an event identical to the original in every field—including
eventIDwhen present—except forerrorDeclaration(declarationTimerequired;reasonandcorrectiveEventIDsoptional) and the repository’srecordTime; replacement data arrives as a separate event. Keepevent_row_idas the storage primary key, scope(event_id, is_error_declaration)uniqueness to events with aneventID, and computenormalized_event_hashover canonicalized event fields excludingerrorDeclarationandrecordTimeso ID-less declarations still match their original row (a hash of the full raw payload would differ). This extends our freight shipment exception event model and ERP double-posting retry controls. - Build the 24-hour export view to suppress retracted originals. Under 21 CFR § 1.1455©(3), when FDA requests §§ 1.1325–1.1350 records to prevent or mitigate an outbreak, assist a recall, or address another public-health threat, covered entities must deliver an electronic sortable spreadsheet (with information needed to interpret it) within 24 hours or another FDA-agreed time, subject to the alternate-format exceptions in § 1.1455©(3)(iii)–(iv). The export must match each error declaration to its original
event_row_id(viaevent_idwhen present, ornormalized_event_hashwhen absent) and suppress both rows; filtering out declarations alone leaves invalidated assertions in the file. Run shift-close checks validating missing TLCs, source details, and units against each record’s KDE rules.
Where AI fits—and where deterministic code stays in charge
Keep language models out of the core ledger: lot joins, TLC immutability checks, and recall exports must remain deterministic SQL and schema validation.
AI belongs at the unstructured intake edge. When a supplier sends an X12 856 Ship Notice/Manifest or an EPCIS feed, ingest the structured records directly. When a supplier emails a PDF bill of lading or packing list, stage extracted TLCs, quantities, units, and source fields for validation against location_master and FTL flags—as weighed in EDI or emailed PDFs for supplier order integration—and route missing or uncertain lines to a receiving clerk before anything commits to traceability_events.
Next step
Before buying compliance add-ons, map how lot identifiers move across your receiving docks, ERP/WMS tables, and store transfers. Insonl offers a free AI workflow audit: we inspect your documents, schemas, and exception paths, and return a written workflow map showing where deterministic integration belongs and where AI pays off. The audit is free; Insonl charges only for follow-on engineering work if you choose to proceed.
Sources
- U.S. FDA, FSMA Final Rule on Requirements for Additional Traceability Records for Certain Foods: https://www.fda.gov/food/food-safety-modernization-act-fsma/fsma-final-rule-requirements-additional-traceability-records-certain-foods
- U.S. FDA, Food Traceability Rule: Critical Tracking Events (CTEs) and Key Data Elements (KDEs) (PDF): https://www.fda.gov/media/163132/download
- U.S. FDA, Traceability Lot Code: https://www.fda.gov/food/food-safety-modernization-act-fsma/traceability-lot-code
- U.S. FDA, Food Traceability List: https://www.fda.gov/food/food-safety-modernization-act-fsma/food-traceability-list
- U.S. FDA, Frequently Asked Questions: FSMA Food Traceability Rule: https://www.fda.gov/food/food-safety-modernization-act-fsma/frequently-asked-questions-fsma-food-traceability-rule
- GS1, EPCIS Standard, Release 2.0 (Ratified, June 2022): https://ref.gs1.org/standards/epcis/
- GS1, Core Business Vocabulary (CBV) Standard, Release 2.0 (Ratified, June 2022): https://ref.gs1.org/standards/cbv/
- GS1, EPCIS 2.0 JSON-LD Context: https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld
- GS1, EPCIS 2.0 JSON Schema: https://ref.gs1.org/standards/epcis/2.0.0/epcis-json-schema.json
- X12, 856 Ship Notice/Manifest: https://x12.org/node/4398
- Insonl, Custom ERP Development and AI Integration: https://insonl.com/services/enterprise/erp-systems
- Insonl, A Shipment Event Model for Freight Exception Alerts: https://insonl.com/journal/freight-shipment-exception-event-model
- Insonl, EDI or Emailed PDFs for Supplier Order Integration: https://insonl.com/journal/edi-vs-pdf-supplier-order-integration
- Insonl, How to Prevent ERP Double Posting When a Request Retries: https://insonl.com/journal/erp-double-posting-idempotency-retries
- Insonl, Free AI Workflow Audit: https://insonl.com/ai
