Skip to content

feat: add smart weekly financial digest with AI insights#950

Open
bbb-build wants to merge 1 commit intorohitdash08:mainfrom
bbb-build:feat/weekly-digest
Open

feat: add smart weekly financial digest with AI insights#950
bbb-build wants to merge 1 commit intorohitdash08:mainfrom
bbb-build:feat/weekly-digest

Conversation

@bbb-build
Copy link
Copy Markdown

Summary

Implements Issue #121: Smart digest with weekly financial summary — a comprehensive weekly financial digest system that aggregates expenses, income, and trends, then generates AI-powered insights.

What's included

Backend (Flask/Python):

  • WeeklyDigest SQLAlchemy model with week bounds, financial totals, category breakdown, trend data, and AI insights
  • services/digest.py — Full digest generation pipeline: aggregation → trend computation → AI insights (Gemini with heuristic fallback)
  • 4 REST endpoints (GET /digest/weekly, GET /digest/weekly/<date>, GET /digest/history, POST /digest/generate)
  • Redis caching (10-min TTL), upsert-on-regenerate, JWT-protected
  • PostgreSQL schema + indexes for efficient queries

Frontend (React/TypeScript):

  • Digest page with summary cards (income, expenses, net flow + trend arrows)
  • Top spending categories with visual breakdown
  • AI insights display section
  • Week-over-week comparison grid
  • Past digests browser with week navigation
  • Integrated into app routing and navbar

Tests:

  • 12 pytest cases covering generation, trends, caching, auth, edge cases (empty weeks, invalid dates)

Technical decisions

  • Follows existing patterns exactly (dashboard.py structure, ai.py integration, cache.py usage)
  • Heuristic fallback when Gemini API is unavailable
  • Unique constraint on (user_id, week_start) prevents duplicate digests
  • Week boundaries: Monday 00:00 → Sunday 23:59:59

Resolves #121

/claim #121

- Add WeeklyDigest model with trend tracking
- Implement digest generation service with AI-powered insights
- Add REST endpoints for weekly digest CRUD
- Create React dashboard for viewing weekly summaries
- Include trend comparison with previous weeks
- Add comprehensive test coverage

Resolves rohitdash08#121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smart digest with weekly financial summary

1 participant