From model output to a reviewable forecast
How forecasts and actual sales get into the application and what one row holds.
Documented design
- A read-only connection to a data warehouse supplies the model's forecasts, actual sales and master data. The repository holds no model training or inference code.
- One forecast table keeps three volumes per row: the model volume, the adjusted volume and the final volume, plus the workflow columns (flag, submitter, rejection reason). The adjustment paths do not change the model volume; reverting an adjustment copies it back.
- A row is identified by the forecast month, the target month, the customer, the product and a lead time of one to six months.
- A daily job at 07:00 reads the trigger months flagged in a warehouse event table. For each month not yet marked as synced it loads the forecast in chunks of 5,000 rows and then marks the month. A month that fails stays pending and is retried the next day. The same run replaces the previous day's month of actual sales.
- A monthly job on the first day syncs employees and product colors. An admin route can reload the whole forecast table in one transaction, which also replaces the adjustments.
Design rationale
- Keeping the model volume untouched beside the adjusted and final volumes means a review can always be compared with, or reverted to, what the model produced.
- Marking a month as synced only after it loads makes a failed day retry on its own.
Data warehouse
Model forecasts, actual sales, master data
Daily sync
Trigger months, 5,000-row chunks
Forecast table
Model, adjusted and final volume per row
Review and approval
Cell-level workflow
Forecast monthTarget monthCustomerProductLead time (1 to 6 months)Sales group and office