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 β¦