# M-Pesa Statement Analyzer
A web application that processes M-Pesa PDF statements and calculates the total amount spent on transaction costs/fees.
## Features
- 📄 **PDF Upload**: Drag & drop or browse to upload M-Pesa statement PDFs
- 🔐 **Password Protection**: Handles password-protected M-Pesa statements (6-digit passwords)
- 💰 **Cost Analysis**: Automatically extracts and calculates total transaction costs
- 📊 **Detailed Breakdown**: Shows individual transaction costs and summary statistics
- 📱 **Responsive Design**: Works on desktop and mobile devices
- 🎨 **Modern UI**: Clean, professional interface
## How to Use
1. **Start the Application**
```bash
# Using Python (recommended)
python -m http.server 8000
# Or using Node.js (if you have it installed)
npx http-server -p 8000
```
2. **Open in Browser**
Navigate to `
localhost` in your web browser
3. **Upload M-Pesa Statement**
- Click the upload area or drag and drop your M-Pesa PDF statement
- If the PDF is password-protected, enter the 6-digit password when prompted
- The application will process the PDF and extract transaction data
4. **View Results**
- See total transaction costs
- View number of transactions processed
- Check average cost per transaction
- Review detailed transaction breakdown
## Supported Transaction Types
The analyzer can detect and process costs from various M-Pesa transaction types:
- Send Money
- Withdraw Cash
- Buy Goods
- Pay Bill
- Airtime Purchase
- Data Bundle Purchase
- General transaction fees and charges
## Technical Details
### Built With
- **HTML5**: Structure and semantics
- **CSS3**: Styling and responsive design
- **JavaScript**: PDF processing and data analysis
- **PDF.js**: Mozilla's PDF parsing library
### How It Works
1. Detects if the uploaded PDF is password-protected
2. Prompts for 6-digit password if needed (typical M-Pesa statement protection)
3. Uses PDF.js to extract text content from uploaded PDF files
4. Applies regex patterns to identify …