feat: add weekly financial summary endpoint#1075
Open
jimes0813 wants to merge 2 commits into
Open
Conversation
- New GET /insights/weekly-summary endpoint - AI-powered (Gemini) weekly analytics with heuristic fallback - Week-over-week spend comparison, category breakdown, daily trends - Full test suite (4 tests covering heuristic, AI, fallback, categories) - Includes /claim rohitdash08#121 in PR body for bounty Closes rohitdash08#121
Merges improvements from code review (PLA/France): Security: - SEC-1: API key removed from client headers, server-side only - SEC-2: urllib replaced with httpx (explicit SSL verify=True) - SEC-3: Broad except Exception split into 4 precise types Performance: - N+1 queries (8/req) → single CASE WHEN aggregation - Date boundary fix: spent_at <= week_end → spent_at < next_day - Response caching (Flask-Caching, 1h TTL) - Rate limiting (Flask-Limiter, 20/min) Quality: - 11 tests (up from 4), parametrized exceptions - DB savepoint isolation fixture - ref_date validation (future/malformed → 400) - Locale-aware AI responses (en/zh/es via Accept-Language) - WEEKLY_PERSONA in config, locale-aware persona builder Closes rohitdash08#121 /claim rohitdash08#121
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
Weekly financial summary endpoint with AI + heuristic dual-path.
Changes (v2 — French Code Review Integration)
Security
Performance
Quality
Files
Claim
/claim #121
Closes #121