Skip to content

feat: budget health service & Health dashboard#71

Merged
trob9 merged 4 commits intomainfrom
feature/health
Apr 9, 2026
Merged

feat: budget health service & Health dashboard#71
trob9 merged 4 commits intomainfrom
feature/health

Conversation

@trob9
Copy link
Copy Markdown
Collaborator

@trob9 trob9 commented Apr 9, 2026

What's this?

Adds a Health feature to Float — real-time financial health signals across all budget buckets, with projections, notifications, and actionable recommendations.

Changes

Backend

  • HealthService computes per-bucket metrics each time they're requested:
    • Spend % through the current trickle cycle
    • Daily allowance remaining until next trickle (the key intuitive signal)
    • At-risk flag: will this bucket hit $0 before the trickle refills it?
    • Overall health score (0–100) rolled up across all buckets
  • GET /api/health — returns the full HealthSummary
  • PUT /api/buckets/:id/trickle/apply-suggestion — one-tap trickle update from a recommendation
  • Migration 00010bucket_health_notifications table tracks last-notified timestamp per bucket so push alerts fire at most once per day
  • Webhook handler calls health check post-classification and sends push if a bucket crosses into at-risk

Frontend

  • New /health page — overall score card, 30-day SVG forecast chart, buckets ranked worst-to-best, trickle recommendations with one-tap Apply
  • Dashboard bucket cards updated with:
    • Smooth gradient background (green → amber → red) driven by spend %
    • Spend-fill progress bar (fills left→right as budget is consumed)
    • Budget: $X/day label on healthy buckets, Recovery: $X/day on at-risk ones
    • Stale badge on buckets with no active trickle
  • Bucket detail — health banner with daily allowance, days until trickle, and a sliding toggle for per-bucket alerts
  • Nav — Classify → Health (ECG heart icon); classification rules moved inline into bucket edit
  • Added .dockerignore to stop macOS node_modules from breaking the Linux build

Demo data

Seed scenario updated to 9 Apr 2026 with four distinct health states so the feature is immediately visible in demo mode:

Bucket Health Why
Groceries 🔴 Critical $190 of $200 weekly budget gone on day 2
Eating Out 🟠 Warning $140 of $200 fortnightly budget spent
Transport 🟡 OK $81 of $180 monthly, 22 days to go
Japan Trip 🟢 Great Only $180 of $1,000 monthly touched
Savings ⚫ Stale No trickle, last deposit 6 weeks ago

trob9 added 3 commits April 9, 2026 17:54
Adds a new Health feature that gives users at-a-glance financial health
signals across their buckets, replacing the Classify tab in the nav.

- New `HealthService` in `go/service/health.go` that computes per-bucket
  health metrics: spend percentage through the current trickle cycle,
  daily allowance until next trickle, at-risk projection (will the bucket
  hit $0 before the trickle replenishes?), and an overall health score
  (0-100) rolled up across all buckets.
- New API endpoints:
  - `GET /api/health` — returns full HealthSummary with per-bucket data
  - `PUT /api/buckets/:id/trickle/apply-suggestion` — one-tap trickle
    adjustment from a health recommendation
- Migration `00010_health_notifications.sql` — tracks per-bucket
  notification cooldown so push alerts fire at most once per day per bucket.
- Webhook handler now calls health check after transaction classification;
  sends push notification if a bucket crosses into at-risk state.

- **Health page** (`/health`) — full dashboard with overall score card,
  30-day SVG forecast chart, buckets ranked worst-to-best, and trickle
  adjustment recommendations with a one-tap Apply button.
- **Bucket cards** on the dashboard now show:
  - Smooth health gradient background (green → amber → red) based on
    spend percentage through the current trickle cycle
  - Spend-fill progress bar (fills left→right as budget is used)
  - "Budget: $X/day" on healthy buckets, "Recovery: $X/day" on at-risk ones
  - Stale badge for buckets with no active trickle
- **Bucket detail** — health banner above the trickle card showing daily
  allowance, days until next trickle, and a per-bucket alerts toggle
  (replaces old bell icon with a proper sliding toggle).
- **Nav** — Classify tab replaced with Health tab (ECG heart icon).
  Classification rules moved inline into bucket edit flow.
- Added `.dockerignore` to prevent macOS node_modules leaking into the
  Linux build container.

Updated seed scenario to today (9 Apr 2026) with four distinct health
states: Groceries (critical), Eating Out (warning), Transport (ok),
Japan Trip (great), Savings (stale — no trickle).
The health notification DB methods were written by hand, causing
go generate to produce drift detected by CI. Moved the queries into
db/queries/health_notifications.sql and regenerated via sqlc.
Changed to 8081 locally to avoid a port conflict but that broke the
screenshots CI check which curls localhost:8080.
@trob9 trob9 merged commit f8814e2 into main Apr 9, 2026
9 checks passed
@trob9 trob9 deleted the feature/health branch April 9, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant