Skip to content

feat: Add AI-powered weekly financial digest#943

Open
168062576-tech wants to merge 1 commit intorohitdash08:mainfrom
168062576-tech:feature/weekly-digest
Open

feat: Add AI-powered weekly financial digest#943
168062576-tech wants to merge 1 commit intorohitdash08:mainfrom
168062576-tech:feature/weekly-digest

Conversation

@168062576-tech
Copy link
Copy Markdown

Summary

This PR implements an AI-powered weekly financial digest feature as requested in issue #121. The feature provides users with personalized insights, highlights, and actionable tips based on their weekly spending patterns.

Features

Backend

  • Week Summary Generation: Aggregates weekly financial data (income, expenses, categories, transactions)
  • AI-powered insights: Uses Gemini API to generate personalized summaries with:
    • Highlights (wins/achievements)
    • Insights (spending patterns)
    • Warnings (potential issues)
    • Tips (actionable recommendations)
  • Heuristic fallback: Pure Python implementation when Gemini API key is not available
  • Week-over-week comparisons: Percentage changes vs previous week
  • Upcoming bills integration: Shows bills due within the week
  • Email endpoint: Prepares email content (placeholder for future SMTP integration)

API Endpoints

  • GET /weekly-digest/weekly-summary - Get weekly digest with AI insights
  • POST /weekly-digest/weekly-summary/send-email - Send digest email (placeholder)

Frontend

  • API Client: Full TypeScript type definitions
  • WeeklyDigest.tsx: UI page with summary cards, insights, categories breakdown
  • Navigation: Added 'Weekly Digest' to Navbar
  • Route: /weekly-digest (protected route)

Tests

  • 6 backend integration tests
  • 3 frontend component tests

Acceptance Criteria for Issue #121

  • Production ready implementation ✅
  • Comprehensive tests included ✅
  • AI-powered insights via Gemini API with heuristic fallback ✅

Closes #121

## Summary

Adds an AI-powered weekly financial digest feature that generates
actionable insights, highlights, and tips based on user spending patterns.

## Features

### Backend
- **Week Summary Generation**: Aggregate weekly financial data
- **AI-powered insights**: Uses Gemini API to generate personalized insights
- **Heuristic fallback**: Pure Python implementation when AI unavailable
- **Week-over-week comparisons**: Percentage changes vs previous week
- **Top spending categories**: Breakdown by expense category
- **Upcoming bills integration**: Bills due this week
- **Email endpoint**: Prepares email content (placeholder)

### Backend API
- GET /weekly-digest/weekly-summary - Get weekly digest with AI insights
- POST /weekly-digest/weekly-summary/send-email - Send digest email

### Frontend
- **API Client**: TypeScript types and API functions
- **Page Component**: WeeklyDigest.tsx with summary cards, insights, categories
- **Navigation**: Added 'Weekly Digest' to Navbar menu
- **Route**: /weekly-digest (Protected Route)

### Tests
- 6 Backend integration tests
- 3 Frontend component tests

## Acceptance Criteria (Issue rohitdash08#121)
- ✅ Production ready implementation
- ✅ Includes tests
- ✅ Documentation ready for future email integration
- ✅ AI-powered insights via Gemini API with heuristic fallback
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