feat(insights): Add weekly financial summary feature#406
Open
qwldcl-del wants to merge 1 commit intorohitdash08:mainfrom
Open
feat(insights): Add weekly financial summary feature#406qwldcl-del wants to merge 1 commit intorohitdash08:mainfrom
qwldcl-del wants to merge 1 commit intorohitdash08:mainfrom
Conversation
- Add /insights/weekly-summary endpoint for generating weekly digests - Implement weekly summary AI service with: - Week-over-week spending comparison - Category breakdown - Daily spending pattern - Upcoming bills - Trend analysis (increasing/decreasing/stable) - AI-powered insights and tips (via Gemini) - Add comprehensive tests for weekly summary - Update OpenAPI spec with new endpoint - Update README with new endpoint documentation Implements: Smart digest with weekly financial summary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new
/insights/weekly-summaryendpoint that generates weekly financial digests with trends and insights.Changes
New Endpoint:
/insights/weekly-summaryweek(optional): Week offset (0 = current week, -1 = last week, etc.)X-Gemini-Api-Key(optional header): Use custom Gemini API keyX-Insight-Persona(optional header): Custom AI personaFeatures
Response Example
{ "week_start": "2025-08-11", "week_end": "2025-08-17", "trend": "increasing", "method": "heuristic", "analytics": { "week_over_week_change_pct": 15.5, "current_week_expenses": 350.0, "previous_week_expenses": 303.0, "current_week_income": 500.0, "net_flow": 150.0, "top_categories": [...], "daily_spending": {...} }, "upcoming_bills": [...], "insights": [...], "tips": [...] }Testing
test_insights.py:test_weekly_summary_returns_weekly_datatest_weekly_summary_analytics_structuretest_weekly_summary_with_billstest_weekly_summary_with_week_offsettest_weekly_summary_prefers_user_gemini_keytest_weekly_summary_falls_back_when_gemini_failstest_weekly_summary_with_incomeDocumentation
README.mdwith new endpointopenapi.yamlwith full API specificationImplementation Details
Closes: Smart digest with weekly financial summary