Skip to content

kdsecdev/accra-transit-optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚌 Accra Transit Optimizer

AI-powered transit optimization for Accra’s public transport (Trotros) Built with a sleek Flutter app (Cupertino-style) + FastAPI backend + ML models for route and demand prediction.


📦 Project Structure

accra-transit-optimizer/
│
├── backend/                  # FastAPI backend
│   ├── api/                  # API routes and logic
│   ├── models/               # Trained ML models
│   ├── utils/                # GTFS & preprocessing
│   ├── data/                 # GTFS data & generated features
│   ├── main.py               # API entry point
│   └── requirements.txt      # Python deps
│
├── frontend/                 # Flutter app
│   ├── lib/
│   │   ├── screens/          # Main UI (home, analytics, routes)
│   │   ├── services/         # API integration
│   │   ├── providers/        # State management
│   │   └── main.dart         # App entry point
│   ├── pubspec.yaml
│   └── assets/               # Branding, splash

🚀 Features

✅ GTFS stop parsing & mapping ✅ ML demand prediction model ✅ AI-suggested optimal routes ✅ Dynamic analytics dashboard ✅ Realtime GPS location detection ✅ Sleek Cupertino-inspired UI ✅ Auto-filled coordinates with override ✅ Toast-based error handling ✅ Hosted FastAPI backend (Render)


🧠 Tech Stack

Layer Technology
Backend FastAPI, Python, Scikit-learn, XGBoost
Frontend Flutter 3.x (Cupertino), Provider
Mapping flutter_map + OpenStreetMap
Data GTFS Accra 2016 + synthetic GPS
ML Models Route optimization, demand prediction

🔧 Setup Instructions

▶️ Backend (FastAPI)

cd backend/
python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install -r requirements.txt
python train_models.py
uvicorn main:app --reload

📱 Frontend (Flutter)

cd frontend/
flutter pub get
flutter run -d chrome       # Or `-d android`

📡 API Endpoints (Deployed on Render)

Method Endpoint Description
GET /api/v1/stops All stops (with optional demand)
POST /api/v1/predict_demand Predict demand for stop & time
GET /api/v1/suggest_routes AI-optimized route suggestions
GET /api/v1/suggest_routes_from_to Suggest based on start → end
GET /api/v1/analytics Returns analytics summary
POST /api/v1/submit_gps Submit live GPS data

📄 Docs: https://accra-transit-optimizer.onrender.com/docs


✨ App Highlights

  • 📍 GPS Location Detection

    • Auto-prefills coordinates
    • Toasts: e.g., “Location Detected: 5.6, -0.18”
  • 🗺️ Flutter Map UI

    • Displays GTFS stops & route markers
    • Highlights viable paths with polylines
  • 📊 Analytics Screen

    • Fetches live analytics from /analytics
    • Stylish cards: peak hours, high-traffic stops, etc.
  • 🔄 Route Suggestions

    • From start → end (user input or GPS)
    • Filters: demand threshold & viability

💅 Design & UX

  • 🍎 Cupertino-style (rounded, elegant)
  • 🧭 Responsive layouts
  • 🎨 Splash screen with minimal branding
  • 🔔 Toast feedback for all actions

🔮 Future Enhancements

  • 🔄 Live trotro tracking via real-time GPS
  • 🧠 Model auto-retraining
  • 📊 Admin dashboard (Web)
  • 🚏 Stop clustering & demand heatmaps
  • 📅 Schedule optimization (OR-Tools)

🙌 Credits

  • Lead Developer: [Caleb Botchway / DEVKD.]
  • Data Source: 2016 Accra GTFS
  • Frameworks: Flutter, FastAPI, Scikit-learn, OSMnx, GTFS-Kit

📜 License

MIT License — free to use, modify & contribute.


🚀 Optimizing Accra’s future, one route at a time.


About

Accra Transit Optimizer for BridgeLabs Hackathon

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors