A production-ready Streamlit application for analyzing M-Pesa statements (PDF and CSV) with AI-powered financial insights using Google Gemini.
- Multi-Format Support: Upload standard M-Pesa PDF or CSV statements.
- Interactive Dashboard:
- Financial Overview (Income, Expenses, Savings).
- Monthly Trends.
- Category Breakdown (Airtime, Pay Bill, etc.).
- Daily Activity Heatmaps.
- Transaction Explorer: Searchable and filterable transaction history.
- AI Financial Advisor: Get personalized spending summaries and recommendations powered by Google Gemini.
- Privacy First: Data is processed locally in memory. Only summarized statistics are sent to the AI (and only when you request it).
- Python 3.10+
- A Google Gemini API Key (Get one here)
-
Clone the repository
git clone <your-repo-url> cd pesaView
-
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configuration Copy
.env.exampleto.envand add your API key:cp .env.example .env
Edit
.env:GEMINI_API_KEY=your_actual_api_key_here
Run the Streamlit app:
streamlit run app.pyThe application will open in your browser at http://localhost:8501.
Supported columns (auto-detected):
Receipt No.Completion TimeDetailsPaid InWithdrawnBalance
The parser supports standard personal M-Pesa statements generated from the mySafaricom App or USSD *234#.
Run unit tests:
pytest- Streamlit: Web UI
- Pandas: Data processing
- Plotly: Interactive visualizations
- pdfplumber: PDF extraction
- Google Generative AI: Financial insights