Add AI cost insights dashboard; rota-informed forecast method
AI Insights: a daily Claude-generated wage cost briefing covering month-to-date pace vs budget, prior-month/prior-year comparison, rota-vs-actual variance by department, a rota-informed forecast to month-end, employee-level anomalies, and wage cost as a % of revenue. Runs on a configurable daily schedule or on demand, gated by a manual 5-minute rate limit and a daily token budget. Uses the Anthropic key configured centrally in Portal → Settings → Integrations. Also includes the rota-vs-repeat-pattern forecast method (published/ draft rota tiers with same-weekday fallback) already built into the Weekly/Monthly views, and adds a .gitignore for node_modules/dist. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
11e5a2b78a
commit
95da5ea237
26 changed files with 8914 additions and 78 deletions
13
backend/src/lib/forecasting-client.js
Normal file
13
backend/src/lib/forecasting-client.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { getConfig } from '../db.js'
|
||||
|
||||
export async function fcFetch(path) {
|
||||
const apiKey = await getConfig('forecasting_api_key')
|
||||
const baseUrl = (await getConfig('forecasting_url')) || 'http://10.10.10.113:3080'
|
||||
if (!apiKey) throw new Error('Forecasting API key not configured — add it in Settings')
|
||||
const res = await fetch(`${baseUrl}/forecasting/api/public${path}`, {
|
||||
headers: { 'X-API-Key': apiKey },
|
||||
signal: AbortSignal.timeout(15000),
|
||||
})
|
||||
if (!res.ok) throw new Error(`Forecasting API ${res.status} — ${path}`)
|
||||
return res.json()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue