Case study
What the second restaurant broke
A forecasting and reporting system that worked at one restaurant, and what happened when a second one was added. Every assumption that failed had looked correct for months, because one restaurant cannot tell you which of its habits are facts.
The thing I got wrong
I built the operational tooling against the restaurant I knew best. It read the daily sales export, produced the forecast the schedule is built from, and replaced a reporting cycle that had been compiled by hand. It was measured, it worked, and I believed the machinery was the reason it worked.
Then a second restaurant was added, and the honest summary is this: a meaningful share of what I had built was not modelling restaurants. It was modelling one restaurant, and some of it was actively making the second one worse.
None of what follows was found by code review. All of it was found by pointing the same system at a second building.
The vocabulary bug that would have forecast two weeks of zero sales
The forecast adjusts for school calendars, because school state
genuinely moves a quick-service restaurant's day. The first restaurant's
calendar writes No School for a closure. The second one
writes Christmas Break across twelve days and
Thanksgiving Break across six.
The holiday matcher saw Christmas Break and matched
Christmas Day, which carries a closure factor of 0.0, because on the
actual holiday the restaurant is shut. Applied to a twelve-day school
break, that is a forecast of two weeks of zero sales at
a restaurant that was open and trading the entire time.
It never reached a schedule, because it was caught while the second restaurant's history was being graded. But it had been sitting in working, tested, validated code for months. It could not fire at the first restaurant, because the first restaurant never used the word.
The same class of mistake sat next to it: one restaurant records a
weather closure as Snow Day, the other as
Ice storm. Same weather, different vocabulary, and the
second spelling matched no pattern at all.
The machinery was hurting one of the two restaurants
The forecast blends two estimators: a factor model that decomposes a day into its drivers, and a plain median of the last eight matching weekdays. One line of arithmetic, one weight.
I assumed the factor model was the valuable half and the median was the floor it beat. Measured across both restaurants, the weight that produces the best accuracy is not the same at each, and they do not merely differ by a little. They want opposite weights.
| Weight on the factor model | First restaurant | Second restaurant |
|---|---|---|
| 0.00, pure median | 80.00% | 86.57% |
| 0.25 | 81.07% | 86.76% |
| 0.50 | 81.74% | 86.66% |
| 0.75 | 81.96% | 86.37% |
| 1.00, pure factor model | 81.79% | 85.89% |
The first restaurant leans on the factor decomposition, because school state really does swing its sales. The second leans on the median, because conditioning on school state there mostly throws away data.
The line that is hard to write is the bottom right. At the second restaurant, the factor model alone scores 85.89 percent against a plain median's 86.57 percent. The machinery I was most proud of was losing to the simplest possible estimator, and it had been losing from the first day it was pointed at that building. With one restaurant I had no way to know. The weight now lives in configuration, per restaurant, because there is no single right answer to put in the code.
A feature I built, measured, and deleted
A reasonable proposal came out of a planning meeting: the holiday forecast uses last year's analog, and a multi-year average captures shape better, so take the shape from earlier years and the level from last year. Each approach is thin exactly where the other is strong.
I built it and graded it against 304 holiday rows:
| Holiday hourly | Ordinary weeks | All in | |
|---|---|---|---|
| Shipped analog | 78.16% | 86.18% | 85.91% |
| Earlier years' shape at last year's level | 77.66% | 86.18% | 85.89% |
It loses. Not by much, and not ambiguously. The blend preserves the day total by construction and only moves money between hours, so the question was narrow: is a five-year average shape a better within-day distributor than last year's actual shape? No, by about half a point.
It should have been predictable, and the reason is the useful part. Averaging five years of shape assumes the shape held still. It did not. A late-evening hour that used to carry real volume at that restaurant now carries a small fraction of it. An averaged shape averages across a restaurant that changed; last year's shape reflects the restaurant as it currently is.
The code was removed rather than parked behind a flag, and the measurement was written up where the proposal would come back, so that the next person to have the same good idea finds the answer instead of rebuilding it.
A restaurant we do not operate was adopted as ours
The ingestion side produced the most alarming failure. The reporting export began returning a third restaurant, one the group does not operate, alongside the two it does.
The classifier answered ? for that document. It answers
? for a document that names no restaurant at all, too, and
the batch logic adopts a ? into the batch's restaurant
whenever exactly one is named. So a foreign restaurant's file sitting
next to one of ours was quietly absorbed as ours.
A checksum did catch the specific pairing that was tried, but only by luck: the two restaurants' sales differed enough to trip a day-total comparison. Worse, it reported the problem as a mismatch between the hourly figures and the day-part total, which sends an operator hunting for a bad export or a point-of-sale fault rather than telling them they had grabbed the wrong restaurant entirely.
Two fixes, and the second matters more than the first. A named
foreign restaurant is now refused by its own identifier. And
not ours and not stated stopped being the same
answer, because collapsing them is what let the adoption happen.
What this means for an implementation role
This is the case study I would want read, because the work is the job.
An implementation consultant's entire function is the second restaurant. The product works at the customers it already has. The question on every new account is which of its apparent truths were facts about the software and which were facts about the last customer, and the answer is never available from inside the existing deployment. It arrives as a vocabulary difference, a configuration that has no single correct value, or a default that is quietly wrong for this site.
Three habits came out of this that I would bring to someone else's product:
- Per-site configuration beats a better global default. Two restaurants wanted opposite weights. There was no number I could have picked that served both, and looking harder at one of them would not have revealed it.
- An error message should name the cause, not the symptom. "Hours do not match the day total" sent people toward the wrong investigation. "This file is from a restaurant you do not operate" ends it.
- Measure the thing you are proud of against the dumbest alternative. If the sophisticated path cannot beat a median, the median ships. I would rather find that in a backtest than have a customer find it in their numbers.
Scope and honesty
The accuracy figures here are percentages from graded backtests on real operating history. They carry no revenue, no location and no identifying detail, and the tables are the measurements as recorded, including the ones where my own work lost.
Components of this system have been used in live restaurant operations. The full platform is not in production, has no customers, and is not a commercial product. The holiday blend described above was never shipped at all. I am describing engineering and operations judgment, not a sold piece of software.