Data & evidence
Build a replay-safe restaurant event ledger
A restaurant reporting system should produce the same accepted result when it receives the same source message twice. It should also explain what changed when a source corrects a message. Those are different requirements. A duplicate must not add a second sale. A correction must not be discarded merely because its order identifier has appeared before. This guide builds a small, reproducible event ledger that handles both situations and leaves an intelligible trail for a manager, analyst and reviewer.
The central example is Lantern Table, an invented restaurant group. Every identifier, amount and incident in this guide is fictional. The example is not a representation of any delivery platform's contract, webhook format or settlement rules. Amounts are integer minor units in a fictional currency called CU, where this laboratory explicitly defines 100 minor units as one CU. That definition belongs to the example; real currencies and systems need their own unit contract.
Download the nine-row intake CSV and expected answers with test cases to reproduce the laboratory.
You will create a raw intake log, choose business-event keys, classify retries, apply one correction, calculate an order balance and test a replay. The final result is a signed order balance of 8,200 minor units, or 82.00 CU. A separate payment observation also reports 8,200. Agreement is useful evidence in this scenario, but it does not prove that a real payout is complete, that all costs are recorded, or that revenue has been recognised correctly.
TRY THE CASE
Replay orders and inspect revisions or conflicting events
Fictional inputs and stated model boundaries. The worked calculations and downloadable records below remain available without JavaScript.
- Retain raw delivery
- Validate identity, units and payload
- Same key and same payload? Keep one candidate; retain retry evidence
- Same key and conflicting payload? Hold affected order for review
- Apply accepted revision semantics
- Calculate current eligible events
- Reconcile row counts and replay
- Publish scoped balance with provenance
1. The decision this system supports
Lantern Table's reporting lead needs to answer a narrow operational question: “What is the latest accepted order amount after the accepted correction to the refund?” The lead is not asking whether the customer received good service, whether the bank deposit is final, or whether an accountant should recognise revenue on a particular date. Putting those decisions in separate boxes prevents the ledger from becoming a collection of unexplained totals.
Before designing tables, write down the user, decision, timing and failure cost. In this case the user is an outlet analyst; the decision is whether a specific order requires investigation; the timing is a daily review after source delivery; and the failure cost is a mistaken escalation or missed discrepancy. A sales dashboard might tolerate a provisional correction flag. An automated payment instruction would require a much stronger process. The same data model should not silently inherit permission to make both decisions.
The team chooses a practical release rule: the order view can be labelled “accepted for analysis” only when every retained raw row has a disposition, the current business events have a unique identity, and the calculation can be reproduced from the manifest. This is an internal design choice, not a published restaurant-industry standard. Its purpose is to make uncertainty visible before the number reaches a person who might act on it.
2. Why an order identifier is not enough
One order can produce a sale, payment, refund, correction and status notification. Treating the order identifier as a unique key for the entire ledger would allow only one of those facts to survive. The opposite mistake is to treat every incoming row as a new financial fact. That approach preserves messages but doubles the business amount whenever a source retries delivery.
Think of three identities. A transport message identifies one delivery attempt. A business event identifies the fact being communicated. An order identifies the commercial object to which several facts refer. The source may supply useful identifiers for one level and leave another level ambiguous. Your data contract must say which fields are authoritative and what happens when they are absent. Do not fill the gap with a random identifier and then call the result deduplicated.
Lantern Table uses a composite namespace: source, outlet, event identifier and revision. The source and outlet distinguish independently assigned identifiers. The event identifier joins revisions of the same fact. The revision distinguishes a corrected version from its predecessor. An order identifier remains a grouping field. It is not sufficient evidence that two rows mean the same event.
The small teaching model displays order balances using an outlet/order key. Its declared input domain therefore rejects a slash inside either identifier; it also requires a nonblank intake reference so every disposition has a raw-evidence pointer. This is an explicit restriction of the demonstration, not a rule for real provider identifiers. A production system accepting arbitrary identifiers should use collision-safe structured keys and separate display labels. Concatenating two unrestricted strings with a separator can merge distinct orders, such as outlet A/B with order C and outlet A with order B/C.
PostgreSQL's primary and unique constraints can enforce explicitly chosen keys, while not-null constraints can prevent missing required values. They cannot decide the business meaning of an identifier for you. See PostgreSQL's constraint documentation.
3. Keep raw intake separate from accepted facts
The raw intake log answers “What arrived?” The accepted-event view answers “What do our documented rules currently accept?” Keeping both avoids a false choice between preserving evidence and preventing duplicate calculations. A retry can remain in intake while being excluded from the accepted amount. A correction can remain beside the original while replacing its contribution to the current view.
For the laboratory, intake contains a sequential intake number, transport identifier, source namespace, outlet, order identifier, event identifier, revision, event type, amount, arrival timestamp and raw-file reference. An additional disposition table records the decision, reason, rule version, reviewer if needed, and decision time. These fields are sufficient for the small exercise; they are not a universal production schema.
Never edit a raw amount merely to make the accepted total reconcile. If a source message is wrong, preserve that message and record the correction as a separate fact or documented disposition. A spreadsheet implementation can use protected raw and decision sheets. A database implementation can use separate permissions and append-only operational conventions. “Append-only” describes the intended workflow; it does not prove that an administrator or compromised account cannot change the underlying storage.
4. The nine intake rows
The dataset deliberately includes two namespaces, an exact retry and a correction. Positive order amounts increase the order balance. Negative refund amounts decrease it. Payment observations are stored but excluded from this particular order-balance calculation. All rows belong to a synthetic exercise and contain no customer contact information.
| Intake | Transport | Source | Outlet | Order | Event | Revision | Type | Minor units |
|---|---|---|---|---|---|---|---|---|
| I01 | T01 | POS-A | North | O100 | S100 | 1 | sale | 10000 |
| I02 | T02 | POS-A | North | O100 | S100 | 1 | sale | 10000 |
| I03 | T03 | POS-A | North | O100 | R100 | 1 | refund | -1500 |
| I04 | T04 | POS-A | North | O100 | R100 | 2 | refund | -1800 |
| I05 | T05 | BANK-B | North | O100 | P100 | 1 | payment | 8200 |
| I06 | T06 | POS-A | South | O100 | S100 | 1 | sale | 6500 |
| I07 | T07 | POS-A | South | O100 | R100 | 1 | refund | -500 |
| I08 | T08 | POS-A | North | O101 | S101 | 1 | sale | 4000 |
| I09 | T09 | POS-A | North | O101 | C101 | 1 | cancellation | -4000 |
I02 is an exact business-event retry of I01: its transport identifier is different, but its business key and payload agree. I04 is not a duplicate of I03. It is revision 2 of refund event R100. In this contract revisions are replacement snapshots of that event's amount, so the current refund is -1,800, not the sum of -1,500 and -1,800. South's O100 remains distinct from North's O100.
5. Define the contract before calculating
The example's event contract has five rules. First, required identity fields cannot be blank. Second, source, outlet, event and revision identify one candidate version. Third, two rows with that same key and the same interpreted payload are retries. Fourth, two rows with the same key and different payloads are a conflict that requires quarantine. Fifth, the largest accepted revision is the current replacement value for one event.
The contract also defines the signed amount convention and eligible types. Sale, refund and cancellation contribute to the order balance. Payment is a reconciliation observation. A real system may use separate capture, authorisation, settlement, adjustment and reversal events; their semantics must be documented independently. Do not map unfamiliar statuses to a familiar label because the names look similar.
This contract is useful only because it is explicit. A source might instead communicate refund deltas, in which case summing distinct refund events could be correct. Another source might reuse revision numbers after an account migration. Another might send late corrections with a lower apparent sequence. Before adopting the laboratory's winner rule, obtain an authoritative source definition and test representative records. When you cannot verify the meaning, retain the item as unresolved rather than creating an apparently precise balance.
6. Classify retries without destroying them
Start by sorting on a stable intake sequence for reproducibility, not because the first arrival is necessarily economically authoritative. Compare rows at the candidate-version key: source, outlet, event and revision. I01 and I02 share that key. Their relevant payload includes order O100, type sale and amount 10,000. Because the payload agrees, retain one accepted candidate and mark the other as an exact retry.
Your record of the retry should point to the accepted candidate. It should also preserve its own raw-file location and transport identifier. This lets someone investigate whether the retry was harmless, unexpectedly frequent, or associated with a source delivery problem. The financial total should not change, but the operational delivery metric may legitimately count two attempts.
Do not compare only the monetary amount. Two different events can have identical amounts. Do not compare only the order identifier. Several valid events can belong to one order. Do not compare an entire unnormalised JSON string if the source can change field order or add transport metadata. Define which interpreted fields establish payload equivalence and retain the original representation alongside that decision. A hashing strategy is only as meaningful as the representation it hashes.
7. Deal with conflicting duplicates
Now inject a tenth row, I10, with the same source, outlet, event S100 and revision 1 as I01, but amount 10,200. The candidate-version identity is the same and the payload differs. “Keep the latest arrival” would quietly rewrite the sale. “Keep the first arrival” would quietly ignore contrary evidence. Neither is a defensible default unless a verified source contract explicitly resolves this situation.
The laboratory quarantines the conflict and marks the North O100 balance as blocked pending review. The reviewer gathers the source export, event definition and any formally supplied correction. If the source confirms a revision-2 sale, that becomes a new candidate. If the source identifies I10 as an invalid delivery, record the disposition and supporting reference. The reviewer does not simply overwrite I10 with 10,000.
A useful exception entry states the conflicting key, both intake references, the affected outputs, the owner, the next evidence required and the current release decision. Avoid accusatory labels such as “fraud” when the only observation is a conflicting data row. The distinction matters operationally: a parser defect, source correction, merge mistake and malicious alteration demand different responses. An anomaly is a reason to investigate, not a conclusion about a person.
8. Apply replacement revisions
After exact retries are classified and conflicts cleared, group candidate versions by source, outlet and event identifier. Choose the highest accepted revision under the contract. For North refund R100, revision 1 contributes -1,500 in the historical version view, but revision 2 contributes -1,800 in the current view. The old revision remains visible with a superseded status.
The incremental effect of accepting revision 2 is -300 relative to the previously accepted state. That is a useful change explanation. It is different from saying the current refund is -300. The current refund is -1,800; the change in the refund is -300. Put both labels beside the numbers so an analyst does not accidentally add the difference to a view that already uses the latest replacement value.
If a revision number is missing or cannot be ordered reliably, do not invent one from arrival time without a stated policy. A timestamp may describe creation, export, processing or delivery, and those clocks can differ. The team might choose a manual review route, a source-supplied version field, or a formally approved precedence rule. Document the limitation in the output until the source semantics are established.
9. Calculate each order balance
North O100 has current sale S100 of 10,000 and current refund R100 of -1,800. Its accepted order balance is therefore 8,200 minor units. The payment observation P100 is also 8,200 but is not added to that balance. Adding it would count the payment and the order value together, producing 16,400 without an economic interpretation defined by this exercise.
South O100 has a sale of 6,500 and a refund of -500, giving 6,000. North O101 has a sale of 4,000 and cancellation of -4,000, giving zero under the sample contract. The group order balance is 8,200 plus 6,000 plus zero, or 14,200. It is not a bank balance, contribution margin or profit figure. Those require their own eligible records and definitions.
The exercise is deliberately small enough to reconcile by hand. That is a strength when testing a production implementation. If the expected result cannot be explained independently of the code, a green test may merely confirm that two copies of the same mistaken logic agree. Keep a manual workpaper with the current rows and signed arithmetic, then compare the implementation with that workpaper.
10. Build an explanatory output, not just a total
For each order, show the current balance, included current events, superseded versions, retry count, unresolved conflict count and source arrival watermark. The watermark describes how far intake has progressed; it does not prove that the source has delivered everything that should exist. A separate completeness process must compare expected deliveries with received deliveries.
North O100's explanation should read: one current sale, one current refund, one superseded refund revision, one exact retry and one separate payment observation. That sentence is more useful than a “verified” badge because a reader can understand the scope of the calculation. The result is accepted under a named contract and intake cutoff. It has not been independently certified as the restaurant's complete financial position.
An investigation link should open the relevant evidence, not a wall of unrelated raw data. Managers generally need the disposition and business effect first, with technical details available progressively. Analysts need row references, keys and rule versions. Reviewers need to reproduce the decision. Designing those layers explicitly makes the same system usable without asking every person to become a database engineer.
11. Replay the entire dataset
Replay means feeding the same nine intake rows through the processing rules again. A correct replay for this contract creates no additional accepted financial effects. The current North O100 balance remains 8,200, South O100 remains 6,000, and North O101 remains zero. The system may record a new processing run and new transport observations, but those operational records must not change the accepted business amounts.
Write the replay test before optimising throughput. Record the input manifest, contract version, processing version and expected outputs. Run the pipeline once, capture its accepted-event set, then run the same input again and compare both the totals and the accepted keys. Matching totals alone can hide an added sale and an added refund that cancel each other.
Also test partial replay. Replaying only I03 after I04 has been accepted must not restore the older refund as current. The rule chooses the highest accepted revision, not the most recent processing run. This single test catches an important class of late-arrival defects. It shows why correctness depends on a defined event lifecycle rather than the order in which a script happened to read files.
12. Test failure between steps
Imagine processing accepts a candidate event and crashes before recording the run as finished. On restart, the pipeline sees the same input. If acceptance and the completion marker are unrelated operations, the system may add the event again or skip a partially handled item. The small laboratory cannot prescribe one transaction design for every architecture, but it can prescribe the observable requirement: restart must not produce an unexplained duplicate business effect.
Design a deliberate failure test after each state transition: raw receipt, validation, candidate registration, disposition, current-view refresh and output publication. For each failure point, state what the next run is allowed to repeat and what it must detect as already applied. Capture the resulting row identities and totals. A test that merely restarts an empty application does not demonstrate recovery of a partially completed operation.
In a database, transactions and uniqueness constraints can contribute to the design. In a file-based workflow, an immutable input manifest, stable keys, staged outputs and atomic publication may be appropriate. The exact implementation depends on storage, concurrency and failure modes. Do not describe a collection of files as transactionally safe unless you have tested and documented the actual guarantees it provides.
13. Separate arrival order from business order
Suppose I04, revision 2 of the refund, arrives before I03, revision 1. Under the laboratory's revision contract, the current refund remains -1,800 after both are processed. Arrival order does not change which revision is current. The raw log still records that revision 2 arrived first, which may be useful when diagnosing source delivery behaviour.
Now suppose a refund arrives before the sale it references. The team can retain it as an orphan candidate, mark the order provisional, and resolve the relationship when the sale arrives. It should not discard the refund because the sale is temporarily absent. It should not immediately infer that the sale never existed either. The disposition needs to distinguish a temporary dependency gap from a definitively invalid relationship.
Define the review deadline and output behaviour for orphans. A provisional dashboard may show an unresolved negative balance with an explanation. An export used for a formal decision may block that order entirely. These are workflow decisions, not mathematical consequences. Name the owner who can approve the policy and the evidence required to move from provisional to accepted.
14. Use integer units carefully
Integer minor units make this example's additions exact and easy to inspect. They do not remove every monetary problem. You still need a currency, a scale, a sign convention and a rounding policy for allocations or percentages. A value of 8,200 is meaningless if one source means minor units and another means whole currency units.
When a fee calculation produces fractions of a minor unit, preserve the pre-rounding calculation and apply a documented business rule at the required level. Rounding every line and rounding an order total can produce different results. The ledger should retain enough information to explain the chosen method without pretending that one policy is correct for every contract or jurisdiction.
PostgreSQL documents exact numeric representation for quantities where exactness is required. The specific storage choice is separate from the business policy for currency units and rounding. See PostgreSQL numeric types. For the replay test, compare integer amounts before formatting them as 82.00 CU. Display strings should not become the authoritative calculation inputs.
15. Make missing data different from zero
A zero order balance in North O101 has an explanation: a 4,000 sale and a -4,000 cancellation. That is different from an order whose amount is missing. Replacing missing values with zero would make both look identical while destroying an important uncertainty. The output should distinguish a known zero from an unavailable or invalid amount.
Inject a sale with a blank amount and another with a blank event identifier. Both should fail the relevant contract checks. The first cannot contribute a known monetary value. The second cannot safely participate in the chosen identity model. Do not manufacture a zero amount or a surrogate business identity merely to keep the pipeline moving. A technical row identifier can preserve intake, but it does not establish the missing business fact.
Show the impact of held records. If a missing amount belongs to North O100, its accepted balance is no longer sufficient for the intended decision. If it belongs to an unrelated order outside the selected review, that order can remain blocked while North O100 stays usable. This is why exception impact should be traced to outputs rather than expressed only as a global percentage of valid rows.
16. Design a human review workpaper
A reviewer should receive a compact case containing the question, affected key, competing records, current rule, financial effect and supporting source evidence. The workpaper must also state what the reviewer is allowed to decide. Accepting a source correction is different from inventing an adjustment to force a reconciliation. The latter may require a separate accounting or operational approval.
For the conflict introduced in section 7, the workpaper shows sale revision 1 at 10,000 and 10,200, with both raw references. It identifies the 200-unit disagreement and the reports affected. It asks whether the source can supply a reliable corrected event or identify an invalid delivery. The reviewer records the evidence reference and decision reason. The pipeline then applies a versioned disposition rather than relying on an analyst's memory.
Do not put unnecessary personal information into the case. An order's financial identity and a source ticket reference may be sufficient. Customer names, phone numbers and addresses often add exposure without helping resolve an event-key conflict. The exact privacy obligations depend on jurisdiction and processing purpose, but a purpose-led field inventory is useful in any implementation.
17. Preserve a meaningful provenance chain
The chain should connect an output amount to current accepted events, those events to candidate versions, those versions to dispositions and those dispositions to raw intake. Processing-run identifiers connect the calculation to code and contract versions. A separate manifest lists input files and parameters. This is a practical design for the exercise, not a requirement to adopt one particular provenance technology.
The W3C PROV overview provides a general framework for provenance concepts and interchange. Lantern Table's workpaper uses a simpler set of linked records so a non-specialist can follow the chain. The value comes from being able to answer a concrete question, such as “Why did this refund change by 300?” rather than from displaying a complex graph for its own sake.
Test the chain by choosing one number in the final report and asking someone unfamiliar with the build to locate its source rows. If they need the original developer to explain undocumented steps, the evidence is incomplete. Record the missing explanation as a usability defect. Reproducibility includes another person's ability to understand and rerun the work, not merely the original author's ability to regenerate it.
18. Set useful operating metrics
The operational dashboard can show exact retry rate, conflict count, orphan age and unresolved amount exposure. Define every denominator. A retry rate based on transport attempts answers a delivery question. A proportion of affected orders answers a business-impact question. Neither is automatically a quality score, and comparing them as though they were the same creates misleading improvement claims.
For the nine-row intake, one row is an exact retry, so retries are one of nine intake rows under that definition. There are eight retained candidate-version rows before choosing current revisions. One candidate version is superseded, leaving seven current event rows across all types. Of those, six contribute to order balances because one current payment observation is excluded. These counts answer different questions and should not be substituted for each other.
Avoid setting a universal acceptable retry percentage. Some sources intentionally retry delivery to improve reliability. A high retry rate may be operationally normal and financially harmless when idempotence works. A single conflicting payload can be more consequential than many exact retries. Prioritise exceptions using decision impact, not just volume or how impressive a percentage looks.
19. Plan changes to the contract
Suppose a new source release changes refund revision semantics from replacement snapshots to deltas. The existing calculation would be wrong if it continued choosing only the latest revision. Treat this as a contract change with a new version, migration examples and an explicit effective boundary. Do not silently edit the meaning of an existing field in historical runs.
Create a compatibility table containing old interpretation, new interpretation, affected sources, effective records and expected output differences. Re-run the nine-row laboratory under both definitions to show why the distinction matters. If a historical restatement is required, preserve the old report and publish a labelled replacement with a reason and date. A correction should make the audit trail clearer, not erase the fact that a previous decision used another definition.
Include business users in the review. A technically valid schema change can alter a manager's interpretation of refunds, cancellations or payment timing. The release note should state the operational effect in ordinary language, with a before-and-after example. Listing only a database column change leaves the people using the report unable to assess whether their routine decision needs to change.
20. A practical implementation sequence
Begin with one source and one narrowly defined decision. Capture representative raw records, including retries and corrections, and create the contract workpaper. Build a hand-calculated fixture before connecting a live feed. Add raw intake, validation, candidate identity, disposition and the current view in that order. Produce an explanation page alongside the total from the first version.
Next, add controlled failure injection and replay. Test exact duplicates, conflicting duplicates, out-of-order revisions, orphan events, missing amounts, missing identity and cross-outlet collisions. Do not expand the source count until these cases are understandable. An integration that works only for the happy path becomes much harder to repair after several dashboards depend on its output.
Finally, operate a small parallel run. Compare the new ledger with the existing process, classify differences and obtain owner approval for the intended reporting scope. A difference is not automatically a defect in the new system or evidence that the old system was wrong. Trace it to definitions, timing, source coverage or calculation. Release only the decisions for which the evidence is sufficient.
21. Advanced extension: corrections after a report cutoff
A daily report needs both an event interpretation and a cutoff policy. Imagine revision 2 arrives after yesterday's report was published. The current live view can change to 8,200 while yesterday's published snapshot remains 8,500. That is not necessarily a contradiction. One is the latest accepted state and the other is the state known at the earlier cutoff. The output needs to name which question it answers.
For reproducible historical analysis, retain the processing cutoff and accepted disposition versions used in each publication. A later rerun should either reproduce the old “known at the time” report or intentionally restate it under a labelled policy. It must not accidentally rewrite history because the current event table has changed. This distinction becomes important when managers review a decision made before the correction was available.
The workpaper for a late correction should show the original published value, new value, difference, source arrival time and affected periods. The reviewer decides whether to restate, carry the change into a later operational report or escalate for a separate accounting assessment. The event ledger provides evidence; it does not independently decide a financial-reporting treatment beyond its authorised scope.
22. Advanced extension: scale without weakening identity
At larger volumes, teams may partition intake, process sources concurrently or cache current views. Each optimisation introduces questions about ordering, concurrency and publication. The acceptance requirements should remain unchanged: a retry creates no second business effect, a conflict remains visible, a correction follows the documented semantics, and an output can be traced to its accepted inputs.
Do not replace the composite identity with a shorter convenient field merely to improve a query. If a performance design requires a derived key, retain the original namespace and verify that the encoding cannot create collisions within the supported domain. Database-generated row identifiers are useful references but do not replace business identity. An analyst must still be able to explain why two source records are considered the same candidate version.
Measure performance with realistic failure cases, not only clean batches. A system may be fast while silently accepting conflicts or slow only when a review queue is overloaded. Track queue age and publication delay separately from calculation duration. The business needs to know when a result is available and what unresolved evidence could change it, rather than receiving a throughput number that omits the hard part of the workflow.
23. Acceptance checklist and expected answers
The first run must produce North O100 at 8,200, South O100 at 6,000 and North O101 at zero. Replaying the complete intake must leave those results unchanged. Replaying only the older refund must not make it current. Adding a conflicting sale revision must create a held exception, not a silently changed amount. Adding a blank identity or amount must create a specific validation result.
The row-accounting workpaper should show nine intake rows, one exact retry, eight distinct candidate versions, one superseded version, seven current event rows and six current order-balance contributors. The current payment observation is retained separately. If your implementation reports another count, inspect what the count means before declaring a defect. The names in the output must make that distinction clear to the reviewer.
For every failed fixture, store the observed output, expected output, rule version and explanation of the repair. Re-run the entire fixture set after changing identity or revision logic because a fix to one case can break another. Passing this small laboratory demonstrates conformance with this documented example. It does not certify completeness, security, accounting treatment or platform compatibility for an actual restaurant installation.
24. Exercises with review questions
First, change the current refund to -2,100 using revision 3. Before running anything, calculate the expected North O100 balance and change from the previous accepted state. The balance should be 7,900; the change should be -300. Explain why the current refund and the incremental correction are different numbers. Then replay revision 2 and confirm that the current state remains revision 3.
Second, add a South O101 sale of 4,000. It must not merge with North O101. Explain which field prevents the collision and what would happen if the outlet namespace were dropped. Third, add a second independent refund event R101 of -700 to North O100. Under the contract, this is another business event, so it contributes alongside the current R100 revision. Explain why deduplicating only by order would lose valid information.
Finally, ask a colleague to reproduce the baseline without reading your implementation. Give them the raw CSV, event contract, disposition workpaper and expected answers. Record every clarification they need. Those questions are design feedback for the reader experience. A useful institutional framework is one a team can operate, challenge and improve together, rather than a long document that depends on its author to make sense.
25. A release meeting that tests understanding
Before the team releases the example workflow, hold a short review using questions rather than presentation slides. Ask the outlet manager what the 8,200 means. A useful answer names the order, source scope, latest accepted sale and refund, and reporting cutoff. If the answer is simply “the amount the restaurant earned,” the report needs a clearer label. The calculation may be right while the decision it encourages is wrong.
Ask the analyst to explain I02 without deleting it. They should identify an exact business-event retry, show its link to I01, and distinguish the financial effect from the delivery-attempt count. Ask the reviewer to explain why I04 replaces I03. Their answer must refer to the sample's replacement-revision contract, rather than a general rule that the newest-looking row always wins. These questions reveal whether the design is understood well enough to survive staff changes.
Then introduce the conflicting I10 row. The meeting should stop treating the North O100 total as sufficient for the intended decision. The participants identify the owner, evidence request and affected outputs. If they instead propose entering an unexplained balancing adjustment, revisit the authority boundary. A reporting pipeline should not create economic facts to conceal a data disagreement.
Record the decisions from this meeting in a short release note. State the supported source, event semantics, tested failure cases, remaining limitations and person responsible for changes. Schedule a review when the source contract changes or an unrepresented exception appears. A calendar date alone is not evidence that the workflow remains correct; it is an opportunity to check the evidence and update the tests. This operational review turns a useful calculation into a maintainable company process.
Sources and method boundaries
The original laboratory applies general data-management ideas using invented restaurant records. The external references support narrow technical concepts: PostgreSQL constraints, exact numeric types, and the W3C provenance overview. They do not endorse this website or validate an invented merchant result. Source-specific event meanings must be obtained from the relevant provider before using this design with real records.
The proposed ledger and workpapers are teaching designs, not a ready-made connection to a POS, bank or delivery account. No credentials or real customer records are needed to run the sample. Keep the source contract, implementation tests and human review evidence together. The aim is a smaller number of well-supported decisions, with enough detail for another person to understand why the result is trustworthy within its stated limits.
Research sources and scope
- www.postgresql.org — primary reference ↗Composite unique keys, not-null and foreign-key constraints can enforce explicitly defined row relationships; row CHECK constraints do not establish arbitrary cross-row guarantees.
- www.w3.org — primary reference ↗The PROV family supplies a framework for representing provenance and interchange; the restaurant implementation here is an original teaching design.
- www.postgresql.org — primary reference ↗Exact numeric arithmetic is appropriate when exact monetary representation is required; display rounding and business rounding policy remain separate decisions.
Build on the foundations
These introductory resources are already available in the existing website library.
