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> |
||
|---|---|---|
| .. | ||
| src | ||
| Dockerfile | ||
| package-lock.json | ||
| package.json | ||