This is a WhatsApp bot that allows users to send shopping receipts (Turkish and English) which it processes, extracts data using Google Cloud Vision API, formats the data using Google Gemini LLM, calculates the Malawi Kwacha equivalent, and tracks monthly expenses with automated reporting at the end of the month.
# WhatsApp Receipt Processing Agent (Dr Budget)
This is a personal WhatsApp bot that processes Turkish and English purchase receipts, extracts data using OCR, preprocesses the data using Google Gemini, converts Turkish Lira to Malawi Kwacha, and tracks monthly expenses with automated reporting through SMS.
## 🌟 Features
- **📸 Receipt Processing**: Send receipt photos via WhatsApp and get automatic data extraction through Google Cloud Vision OCR
- **🤖 AI-Powered**: Uses Google Gemini LLM for accurate Turkish receipt processing
- **💱 Currency Conversion**: Hardcoded TRY to MWK exchange rates (POS/ATM)
- **📊 Monthly Tracking**: Automatic expense tracking with monthly summaries
- **📱 Dual Delivery**: Monthly reports via both WhatsApp and SMS
- **✋ Manual Entry**: Add expenses without receipts
- **📈 Analytics**: Detailed spending insights and merchant breakdown
## 🏗️ Architecture
```
WhatsApp Bot (User Interface)
↓
Flask Application (app.py)
↓
Message Handler (processes commands/images)
↓
OCR Service (Google Cloud Vision) → LLM Service (Google Gemini)
↓
Exchange Rate Service (hardcoded rates)
↓
Database Service (PostgreSQL)
↓
Monthly Tracking + SMS/WhatsApp Delivery
```
## 🛠️ Tech Stack
- **Backend**: Flask (Python 3.11)
- **Database**: PostgreSQL (SQLAlchemy ORM)
- **APIs**:
- WhatsApp Business API
- Google Cloud Vision (OCR)
- Google Gemini (LLM)
- Amazon SNS (SMS)
- **Scheduling**: APScheduler
- **Hosting**: Render (free tier)
## 📋 Prerequisites
1. **WhatsApp Business API Access**
- Facebook Developer Account
- WhatsApp Business App
- Verified phone number
2. **Google Cloud Services**
- Google Cloud Vision API enabled
- Google Gemini API access
- Service account credentials
3. **AWS Account** (for SMS)
- Amazon SNS service
- AWS access keys
## 🚀 Quick Setup
### 1. Clone and Install
```bash
git clone
github.com
cd expensetracker
pip install -r requirements.txt
```
### 2. Environment Variables
Create a `.env` file:
```e …