ML predictions Phase 1 & 2: Budget Forecast tab and Cash Flow upgrades

Phase 1 — Budget Forecast: adds a dedicated first-class tab showing all
monthly budgets with velocity (£/day), forecast month-end total, dual
progress bars, and colour-coded overspend probability badges. Summary
bar shows budgets tracked / at-risk count / total forecast overspend.
Removes the old BudgetAlerts widget embedded in the Spending tab.

Phase 2 — Cash Flow: incorporates known recurring transactions into the
30-day projection (outflows hit on their predicted dates rather than
being smeared as averages), adds sqrt-of-time confidence bands to the
chart, and shows an upcoming recurring payments list with at-risk
highlighting for payments falling on or after the first negative-balance day.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-04-28 10:21:57 +00:00
parent 1a2c8efd01
commit 3b4787d8b9
3 changed files with 281 additions and 58 deletions

View file

@ -61,17 +61,27 @@ export interface BudgetForecastResponse {
export interface CashFlowDay {
date: string;
balance: number;
upper: number;
lower: number;
avg_inflow: number;
avg_outflow: number;
negative_risk: boolean;
}
export interface UpcomingPayment {
name: string;
date: string;
amount: number;
at_risk: boolean;
}
export interface CashFlowResponse {
current_balance: number;
avg_daily_inflow: number;
avg_daily_outflow: number;
forecast: CashFlowDay[];
negative_risk_days: string[];
upcoming_payments: UpcomingPayment[];
history_days: number;
}