Raqib AI is a dual-model Traffic Intelligence Hub designed for Libya. It utilizes advanced machine learning (XGBoost) and data analysis to predict road accident severity and provide actionable safety recommendations.
# 🚦 Raqib AI - Traffic Decision Support System (DSS)
**Live Demo:**
raqib-ai.nafusah.tech
Raqib AI is a dual-model Traffic Intelligence Hub designed for Libya. It utilizes advanced machine learning (XGBoost) and data analysis to predict road accident severity and provide actionable safety recommendations.
## 🚀 Quick Start - Docker (Recommended)
The easiest way to run the entire system (both models + API + Gateway) is using Docker Compose.
### Prerequisites
- Docker and Docker Compose installed.
### Installation
1. Clone the repository.
2. Build and start the containers:
```bash
docker-compose up -d --build
```
3. Access the system at:
- **Main System Status (JSON):**
localhost
- **Model Design 1 Dashboard:**
localhost
- **Model Design 2 Dashboard:**
localhost
---
## đź› Manual Local Installation
If you prefer to run the models independently without Docker:
### Prerequisites
- Python 3.9+ installed.
### Steps for each model (Design 1 or Design 2)
1. **Navigate to the model folder:**
```bash
cd model_desgin_1 # or model_desgin_2
```
2. **Install dependencies:**
```bash
pip install -r requirements.txt
```
3. **Train the AI Models (Mandatory for the first time):**
This will sync data from Kaggle and generate weights (`.pkl`) and stats summary (`.json`).
```bash
python train.py
```
4. **Launch the Dashboard (Streamlit):**
```bash
streamlit run app.py
```
5. **Launch the API (Flask):**
```bash
python api.py
```
---
## 📊 Feature Highlights
- **Model Design 1:** Focuses on statistical classification and classic ML.
- **Model Design 2:** Advanced XGBoost model integrating vehicle and driver data.
- **Lightweight Mode:** Once trained, the system runs using model weights (`.pkl`) and a tiny JSON summary, requiring NO local CSV storage.
- **Auto-Sync:** Real-time data synchronization from Kaggle HUB.
## đź”— Routing Architecture
The system uses an Nginx gateway to route traffic:
- `/mod1/` -> Dash …