Skip to content

πŸ“ capstone 2026 - Achchala, Adriel, Anastan, Bhakti, Dev

Notifications You must be signed in to change notification settings

achchala/risk-map-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MGTE Capstone 2026

Project Overview

ML model to predict crash risk levels for road segments in Toronto using open traffic collision data. The model outputs risk labels (Low/Medium/High) and confidence scores per road segment, suitable for visualization as heatmaps or geo-layers.

The project consists of three main components:

  1. ML Pipeline: Python-based data processing, feature engineering, and model training
  2. Backend API: Flask REST API server that serves predictions to the iOS app
  3. iOS App: SwiftUI mobile application for visualizing risk predictions on an interactive map

Project Structure

risk-map-model/
β”œβ”€β”€ data/                          # Raw datasets (not in git)
β”‚   β”œβ”€β”€ Traffic_Collisions_Open_Data_*.xlsx
β”‚   β”œβ”€β”€ TOTAL_KSI_*.csv
β”‚   └── Centreline - Version 2 - 4326.geojson
β”œβ”€β”€ src/                           # Source code
β”‚   β”œβ”€β”€ data_processing/           # Data cleaning and spatial joins
β”‚   β”‚   β”œβ”€β”€ data_loader.py
β”‚   β”‚   └── spatial_join_fast.py
β”‚   β”œβ”€β”€ feature_engineering/       # Feature creation and risk labeling
β”‚   β”‚   β”œβ”€β”€ feature_creator.py
β”‚   β”‚   └── label_generator.py
β”‚   β”œβ”€β”€ models/                    # Model training and evaluation
β”‚   β”‚   β”œβ”€β”€ model_trainer.py
β”‚   β”‚   └── model_evaluator.py
β”‚   └── visualization/             # Interactive maps and dashboards
β”‚       └── risk_mapper.py
β”œβ”€β”€ outputs/                       # Generated outputs (not in git)
β”‚   β”œβ”€β”€ maps/                      # Interactive risk maps (HTML)
β”‚   β”œβ”€β”€ models/                    # Trained model artifacts
β”‚   β”‚   └── toronto_risk_model.joblib
β”‚   └── reports/                   # Analysis reports and data exports
β”‚       └── toronto_road_risk.geojson
β”œβ”€β”€ ios-app/                       # iOS mobile application
β”‚   β”œβ”€β”€ RiskMapApp/                # SwiftUI iOS application
β”‚   β”‚   β”œβ”€β”€ RiskMapApp.swift       # App entry point
β”‚   β”‚   β”œβ”€β”€ ContentView.swift      # Main tab view
β”‚   β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   β”‚   └── RiskModels.swift   # Data models
β”‚   β”‚   β”œβ”€β”€ Services/
β”‚   β”‚   β”‚   β”œβ”€β”€ RiskService.swift  # API service
β”‚   β”‚   β”‚   └── RouteService.swift # Route planning service
β”‚   β”‚   └── Views/
β”‚   β”‚       β”œβ”€β”€ MapView.swift      # Map with risk annotations
β”‚   β”‚       β”œβ”€β”€ RiskDetailView.swift
β”‚   β”‚       β”œβ”€β”€ RiskListView.swift
β”‚   β”‚       └── SettingsView.swift
β”‚   β”œβ”€β”€ README.md
β”‚   └── QUICK_START.md
β”œβ”€β”€ backend-api/                   # Flask API server
β”‚   β”œβ”€β”€ app.py                     # API endpoints
β”‚   β”œβ”€β”€ requirements.txt           # Python dependencies
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ QUICK_SETUP.md            # Google Maps API setup
β”‚   └── INTEGRATION.md            # Integration details
β”œβ”€β”€ run_risk_analysis.py           # Main pipeline script
β”œβ”€β”€ config.py                      # Configuration settings
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ README.md                      # This file
└── TECHNICAL_OVERVIEW.md          # Detailed technical documentation

Installation

Prerequisites

  • Python 3.8+
  • iOS 17.0+ (for iOS app)
  • Xcode 15.0+ (for iOS app)

Usage

1. Run ML Pipeline

First, place your datasets in the data/ folder, then run:

python run_risk_analysis.py

2. Start Backend API

cd backend-api
python app.py

3. Run iOS App

  1. Open in Xcode:

    cd ios-app/RiskMapApp
    open RiskMapApp.xcodeproj
  2. Configure API endpoint in RiskMapApp/Services/RiskService.swift:

    private let baseURL = "http://localhost:8000/api" 
  3. Set up signing:

    • Select the RiskMapApp target
    • Go to Signing & Capabilities
    • Select your development team
  4. Build and run (⌘ + R)

Documentation

  • Technical Overview: See TECHNICAL_OVERVIEW.md for detailed technical documentation
  • Backend API: See backend-api/README.md and backend-api/INTEGRATION.md
  • iOS App: See ios-app/README.md and ios-app/QUICK_START.md
  • Google Maps Setup: See backend-api/QUICK_SETUP.md

About

πŸ“ capstone 2026 - Achchala, Adriel, Anastan, Bhakti, Dev

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •