Fresh, complete, and fit to use
Three warehouses usually send daily dispatches.
The interview prompt
Three warehouses usually send daily dispatches. W1 reports ten rows, W2 reports a sealed empty batch, and W3 sends nothing. The company-wide latest timestamp is two minutes old. Can finance certify the day?
Build the check from the expected population
Start from the effective list of active warehouses for that business day. Left join manifests and receipts to it. W1 is complete only if its observed facts match the expected batch, row count, and other controls. W2 has explicit evidence of zero, assuming the manifest is authoritative. W3 is unknown. Starting from the received facts would omit both W2 and W3 and leave the dashboard pleasantly green.
If each warehouse is equally relevant to a coverage metric, two of three sites have accounted for the day. That is 66.7% site coverage, conditional on the first two passing their controls. It gives no basis to claim that 66.7% of units were observed. The silent warehouse might account for most of the volume.
Give operations a provisional estimate only when the decision supports it, and annotate which sites or periods are missing. A certification process can withhold the release. Once W3 arrives, recompute just the affected scope, make the new version visible, and retain an audit of which readers saw the provisional value. A quality check becomes useful when it changes a consumer action.
The model behind the answer
At 8 a.m. the pipeline reports success. Its newest dispatch is two minutes old. One warehouse has nevertheless sent nothing since midnight. A fresh maximum timestamp tells Maya very little about the missing warehouse.
Define the promised population and deadline together. Suppose each active warehouse produces a manifest of sealed dispatch batches. Check the highest complete batch and its expected record count for each site. An explicitly empty manifest can certify a quiet morning. Silence leaves the distinction between no dispatches and a missing feed unresolved. Reconcile quantity as well as row count if a single row can hold many books.
Give the consumer a named owner, affected period, and visible status when a check fails. A provisional operations total can carry the missing-site warning. An official extract whose definition requires every site can wait for repair. Agree on the recovery action while negotiating the contract. Open Data Contract Standard · What Are We Reconciling?
Try it in SQLite
Distinguish a quiet site from a silent one
W1 sent two dispatches, W2 certified an empty batch, and W3 never reported. Try starting from receipts instead of the expected warehouse list. The count check verifies cardinality. The membership review uses a separate expected roster and substitutes D9 for D2.
Tables and sample data
Each run starts with fresh sample data. Use Ctrl+Enter or ⌘+Enter to run. Only your browser processes the query.
Review the difference between a count and a certificate
An agent’s check matches the expected count and verifies that each observed ID is unique. Replace expected dispatch D2 with an unrelated D9. W1 still has two distinct IDs. Ask the reviewer whether the supplied manifest contains enough information to detect that swap.
Reviewer decision. A count-only manifest cannot establish membership. In the lab compare the observed IDs with an independently supplied roster. The review should identify both missing D2 and unexpected D9. Retain the row-count control for its actual purpose and make the certification label say which evidence passed.
Further reading. Data Contracts, 1st ed., on staging and auditing data before making it available to consumers.
One more question
W1 sent ten rows, exactly as promised, but all ten have the same dispatch ID. Which checks detect that?
Check your reasoning
Count distinct business identities, check uniqueness at the declared grain, and reconcile the quantity to a separately produced control where available. Row count and freshness independently pass this failure. A duplicate can also mask a missing event in the same batch.
Previous · Migrate the consumers that depend on the field · Next · Where should each representation live · Complete series map