Skip to content

feat: Smart weekly financial digest with trends and insights#222

Open
dagangtj wants to merge 2 commits intorohitdash08:mainfrom
dagangtj:feature/weekly-digest-121
Open

feat: Smart weekly financial digest with trends and insights#222
dagangtj wants to merge 2 commits intorohitdash08:mainfrom
dagangtj:feature/weekly-digest-121

Conversation

@dagangtj
Copy link

Summary

Implements the weekly financial digest feature requested in #121.

Changes

  • New endpoint: GET /digest/weekly?year=&week= returns comprehensive weekly summary
  • Weekly summary: Total income, expenses, net flow, transaction count
  • Trends: Week-over-week expense/income change percentages
  • Category breakdown: Per-category spending with share percentages
  • Daily spending: Day-by-day expense totals for the week
  • Top transactions: Largest expenses in the period
  • Smart insights: Auto-generated observations like:
    • "Total spending increased by 15.5% compared to last week"
    • "Food spending is up 22.0% ($320 vs $262 last week)"
    • "Highest spending day: Monday at $120"

Technical Details

  • Redis caching: 10min TTL for current week, 1hr for past weeks
  • Cache invalidation on expense create/update/delete
  • ISO week handling with proper year boundary support
  • 14 tests covering endpoint and service logic

Files Changed

  • packages/backend/app/routes/digest.py - New endpoint
  • packages/backend/app/services/weekly_digest.py - Core logic
  • packages/backend/tests/test_digest.py - Test suite
  • packages/backend/app/openapi.yaml - API spec
  • README.md - Documentation

Closes #121

Implements smart weekly summary feature (closes rohitdash08#121):

- GET /digest/weekly endpoint with year/week params
- Aggregates income, expenses, transaction count per week
- Computes week-over-week trends (expense/income change %)
- Category breakdown with share percentages
- Daily spending breakdown
- Top transactions by amount
- Auto-generated insights (spending trends, category changes, peak days)
- Redis caching (10min current week, 1hr past weeks)
- Cache invalidation on expense changes
- OpenAPI spec updated
- 14 tests covering endpoint and service logic
- Documentation updated
- Add /digest/weekly API with JWT auth
- Aggregate weekly expenses, income, category breakdown
- Week-over-week spending comparison
- Upcoming bills for the week
- Smart highlights (spending trends, top category, bills due)
- Redis caching with 15min TTL
- Comprehensive test coverage (5 tests)
@dagangtj
Copy link
Author

Hi @rohitdash08, this PR is ready for review. All acceptance criteria met: production-ready implementation, tests included, and follows existing code patterns. Let me know if any changes are needed!

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.

Smart digest with weekly financial summary

1 participant