Request
Alder Dispatch needs to accept a shipment feed only when duplicate IDs agree and unique delivered units equal the expected total.
Result
Build a deterministic decision function. Return "review" for conflicting duplicates, "mismatch" for a clean feed with the wrong total and "accept" for a clean matching feed.
Alder Dispatch received two versions of a shipment feed and needs a reconciliation decision. A repeated ID may be a duplicate event or a conflicting record, so simply adding every row can overstate delivered units. You will build evidence in five small functions, keeping your earlier work between steps. First identify repeated IDs, then find conflicting quantities, calculate a deduplicated total and compare it with a stated order balance. The last step returns a recommendation backed by those results. The data is fictional. A feed with two identical copies is different from one that reports two quantities for the same ID. The checks include both cases and an empty feed, so the recommendation cannot be hard-coded to the displayed example.
Count duplicate IDs.