feat: Smart digest with weekly financial summary (Issue #121)#636
Open
dagangtj wants to merge 2 commits intorohitdash08:mainfrom
Open
feat: Smart digest with weekly financial summary (Issue #121)#636dagangtj wants to merge 2 commits intorohitdash08:mainfrom
dagangtj wants to merge 2 commits intorohitdash08:mainfrom
Conversation
- Implements weekly financial summary API endpoint - Provides income/expense analysis with trends - Generates automated insights and recommendations - Supports custom date ranges and Gemini API enhancement - Closes rohitdash08#121
- Add weekly_financial_summary function with AI insights - Create /weekly-summary API endpoint - Include comprehensive tests and documentation - Ready for production deployment
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.
FinMind Issue #121: Smart digest with weekly financial summary
🎯 功能实现
新增功能
周度财务摘要API端点 (
GET /api/insights/weekly-summary)智能数据分析
自动化洞察生成
📊 响应示例
{ "period": { "start_date": "2026-02-24", "end_date": "2026-03-01", "previous_period": {"start": "2026-02-17", "end": "2026-02-23"} }, "totals": { "income": 1250.50, "expenses": 980.75, "net_flow": 269.75, "savings_rate": 21.58 }, "trends": { "income_change_pct": 5.2, "expenses_change_pct": -3.1, "max_spend_day": "2026-02-28", "max_spend_amount": 215.50, "top_category": "dining", "top_category_amount": 320.25 }, "daily_breakdown": { "2026-02-24": {"total": 150.25, "categories": {"groceries": 85.50, "transport": 64.75}}, // ... 其他天 }, "insights": { "key_insights": [ "优秀储蓄习惯!本周储蓄率达到21.58%", "支出较上周下降3.1%,节省效果明显", "2026-02-28是本周支出最高日", "'dining'类别支出最多" ], "recommendations": [ "继续保持当前储蓄节奏", "继续保持节约习惯", "回顾2026-02-28的消费决策", "为'dining'类别设置专项预算" ], "summary": "基于本周财务数据的自动化分析" }, "method": "heuristic" }🔧 技术实现
新增文件/修改
app/services/ai.py- 新增周报摘要核心逻辑weekly_financial_summary()- 主函数_weekly_totals()- 周度总额计算_weekly_category_trends()- 分类趋势分析_generate_weekly_insights_heuristic()- 洞察生成app/routes/insights.py- 新增API端点weekly_summary()- 路由处理函数🧪 测试覆盖
📚 文档
🚀 使用方式
API调用
前端集成
✅ 验收标准达成
🔮 未来扩展
此PR完整实现了Issue #121的所有要求,提供生产就绪的周报摘要功能。