It is a Python application designed to provide insights into traffic conditions in Nairobi, Kenya.
# 🚦 TRAFFIC-FLOW-TRACKER
**Traffic Flow Tracker** is an open-source smart city traffic monitoring system designed for Nairobi. It leverages commodity hardware and Python-based simulation to provide actionable insights into traffic congestion, patterns, and route optimization.
## 🌟 Key Features
### 🏙️ Nairobi-Specific Modeling
- Monitors 8 major routes: Thika Road, Mombasa Road, Waiyaki Way, etc.
- Custom algorithms for:
- **Matatu patterns**
- **VIP convoys**
- **Rush hour surges (7–10am, 4–7pm)**
- 15% chance of dynamic events (accidents, roadworks)
### 📊 Smart Traffic Analysis
- Three-tier status system: **Light**, **Moderate**, **Heavy**
- Trend indicators: `↑↑`, `↑`, `→`, `↓`, `↓↓`
- Delay predictions ranging from **5 minutes to over 1 hour**
### 🖥️ Intuitive Dashboard
- Color-coded indicators: **Green**, **Yellow**, **Red**
- Auto-refreshes every 30 seconds
- Top 4 recommended alternative routes
## 🛠 Technologies Used
- **Python** — for simulation and backend logic
- **Tkinter** — interactive GUI
- **Pandas & NumPy** — data processing
- **Matplotlib / Seaborn** — visualizations
- **Statsmodels / SciPy** — for statistical insights
## 📄 File Breakdown
### `traffic_data.py`
- Simulates Nairobi traffic conditions using stochastic and rule-based models
- Calculates congestion levels on a scale from **0–100**
- Generates live route recommendations based on congestion severity
- Applies **GMT+3** timezone logic for accurate refresh cycles and delay predictions
### `interface.py`
- Builds a responsive GUI using **Tkinter**
- Displays traffic cards for each route with:
- Real-time congestion indicators
- Trend symbols (`↑↑`, `↑`, `→`, `↓`, `↓↓`)
- Tailored route suggestions
- Integrates a **30-second auto-refresh** system for dynamic updates
### `main.py`
- Launches the full application
- Bridges backend traffic logic with frontend GUI components
- Handles the **main event loop** for continuous operation
## 🚀 Usage
Run the application from terminal:
```bash …