A Python-based REST API deployed on Google Cloud Platform (GCP) that analyzes financial documents (credit card statements, tax returns, bank statements) to provide insights, detect anomalies, and generate comprehensive PDF reports.
- Multi-format Document Processing: Supports PDF, images (JPG, PNG), Excel (XLSX), and CSV files
- AI-Powered Data Extraction: Uses Google Gemini API for intelligent document parsing
- Comprehensive Financial Analysis:
- Category-wise spending breakdown
- Month-over-month trends
- Suspicious activity detection
- Personalized recommendations
- Professional PDF Reports: Generates detailed reports with charts and visualizations
- Async Processing: Handles concurrent requests efficiently
- Enterprise Security: End-to-end encryption, PII masking, auto-deletion
- Framework: FastAPI
- AI/ML: Google Gemini API
- PDF Generation: ReportLab + Matplotlib/Seaborn
- Deployment: Google Cloud Run
- Authentication: API Key + OAuth2
- Python 3.10+
- Google Cloud account
- Gemini API key
pip install -r requirements.txtCreate a .env file:
GEMINI_API_KEY=your_gemini_api_key
GCP_PROJECT_ID=your_project_id
ENVIRONMENT=developmentuvicorn app.main:app --reload --port 8000gcloud run deploy financial-analyzer \
--source . \
--platform managed \
--region us-central1 \
--allow-unauthenticatedUpload and analyze a financial document
Request:
curl -X POST "http://localhost:8000/analyze" \
-H "X-API-Key: your_api_key" \
-F "file=@statement.pdf"Response:
{
"job_id": "abc123",
"status": "processing",
"message": "Document uploaded successfully"
}Check processing status
Response:
{
"job_id": "abc123",
"status": "completed",
"progress": 100
}Download generated PDF report
Returns PDF file or cloud storage URL
┌─────────────┐
│ Client │
└──────┬──────┘
│
▼
┌─────────────────┐
│ FastAPI App │
└────────┬────────┘
│
┌────┴────┐
▼ ▼
┌────────┐ ┌──────────┐
│ Gemini │ │ Cloud │
│ API │ │ Storage │
└────────┘ └──────────┘
- End-to-end encryption for uploads
- PII data masking (credit card numbers, SSNs)
- Temporary storage with auto-deletion after 24 hours
- Rate limiting (100 requests/hour per API key)
- API key authentication
- Processes documents up to 50 pages
- Report generation: 30-60 seconds
- Concurrent request handling with async processing
- Auto-scaling on Cloud Run
MIT License