No description
Find a file
jtricerolph 661e219aac Fix rota-vs-actual comparison: base-cost mismatch and missing dept names
Two bugs inflating the rota variance figures in AI insights:
1. Actual cost (incl. NI oncosts) was compared against rota cost that
   silently falls back to base pay — Workforce's schedules API never
   actually supplies oncosts (confirmed: published_total_cost equals
   published_base_cost on every synced row), so every variance was
   inflated by ~14-20% for reasons unrelated to real overspend. Now
   always compares base cost on both sides, with a note in the prompt
   that this is a base-pay-only comparison.
2. Variance was summed over the full window using actual cost, but
   only over covered days using rota cost, understating rota further
   whenever coverage was incomplete. Now restricts the actual-cost side
   to the same days rota data exists for, and reports coverage (days
   w/ rota vs total) explicitly so partial coverage isn't presented as
   a confirmed figure.

Also: the employee anomalies section only had department_id (a raw
Workforce code), not department_name, since wage_actuals_detail doesn't
store it — resolved via wage_actuals so the model can say "Chef"
instead of guessing from a numeric code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-25 00:43:12 +00:00
backend Fix rota-vs-actual comparison: base-cost mismatch and missing dept names 2026-07-25 00:43:12 +00:00
frontend Add insight history view; feed recent insights back into the prompt 2026-07-24 22:01:13 +00:00
.gitignore Add AI cost insights dashboard; rota-informed forecast method 2026-07-24 20:43:18 +00:00
docker-compose.yml Initial scaffold: wages app 2026-07-23 09:03:52 +00:00
seed-app.js Initial scaffold: wages app 2026-07-23 09:03:52 +00:00