ORIGINAL COMPANY-CONTEXT PRACTICE
Track bottle batches through corrections
Original practice scenario: Design a synthetic beverage traceability system connecting production batches, packaging lots and distributor shipments, including later data corrections.
Written for independent practice using company context; this is not a verified question from a company interview.
A REASONED APPROACH
Model answer.
Model traceability as versioned relationships between independently identified lots. The system must distinguish physical lineage from commercial shipment records and retain the evidence behind corrections.
Work through it
- Define identifiers and quantities for production, packaging and shipment entities; represent splits and merges with explicit edges and units.
- Validate conservation rules where applicable, quarantine conflicting scans and append corrections with author, time and reason rather than deleting history.
- Support bounded upstream and downstream searches from a lot, with tests for returns, partial shipments, duplicate events and missing links.
Tradeoffs to discuss
- An append-only history supports investigation but requires clear views of current accepted lineage and disputed evidence.
Common pitfalls
- A scanned label alone does not establish physical authenticity.
- Do not assume every source reports events immediately or in causal order.