AI-powered kombi fare enforcement system for Zimbabwe
# 🛡️ FareGuard
AI-powered kombi fare enforcement system for Zimbabwe. Protects students and commuters from overcharging using anomaly detection, anonymous reporting, and a real-time authority dashboard.
## 🚨 Problem
Students in Harare using kombis face:
- Overcharging — fares 40–60% above official rates
- No reporting system — no way to verify or report abuse
- Students overpay, miss school, or walk long distances
## ✅ Solution
FareGuard provides:
- **Anonymous public reporting** — any commuter can report overcharging
- **AI anomaly detection** — flags fares that deviate more than 20% from official rates
- **Risk scoring engine** — ranks kombis by overcharging risk based on report history
- **Authority dashboard** — VCZELA/MOT officials manage kombis, verify reports, suspend offenders
- **Public fare checker** — anyone can verify official fares before boarding
## 🛠️ Tech Stack
- **Backend:** Python, Flask
- **Database:** MySQL
- **Frontend:** Jinja2, HTML, CSS
- **AI:** Rule-based anomaly detection + weighted risk scoring
## 📁 Project Structure
```
fareguard/
├── app.py # Flask app — routes, AI logic, auth
├── schema.sql # MySQL database schema + seed data
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── static/css/ # Stylesheets
└── templates/ # Jinja2 HTML templates
├── base.html
├── login.html
├── dashboard.html
├── report.html
├── fare_check.html
├── kombis.html
├── reports.html
├── risk_analysis.html
└── routes.html
```
## ⚙️ Setup
1. Create the database in phpMyAdmin — run `schema.sql`
2. Copy `.env.example` to `.env` and fill in your MySQL credentials
3. Install dependencies:
```
pip install -r requirements.txt
```
4. Run the app:
```
set FLASK_APP=app.py
python app.py
```
5. Visit `
localhost`
## 👤 Create Admin User
In phpMyAdmin, run:
```sql
INSERT INTO users (username, password_hash, role)
VALUES ('admin', ' ', 'admin');
```
Generate ha …