Skip to content

Smikalo/Hack-HPI-H417

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

H417 — Safe Routing for Smarter Cities

HackHPI 2024 prototype for route planning that prioritizes safer driving experiences, not just the fastest ETA.

H417 is a multi-part prototype built during Hack HPI 2024 for the Starwit Technologies challenge. It combines:

  • a Flutter mobile client for route selection and account flows,
  • an ASP.NET Core backend for authentication and route retrieval,
  • an experimental Python / ML workspace for accident-risk modeling and route safety research.

The original project vision was to estimate road risk from historical accident data, urban metadata, and traffic-camera-derived signals, then surface a "smooth" route to drivers, istead of just the fastest route. The current repository captures that vision as a working hackathon prototype plus a separate research workspace. During the hackathon we managed to train the Pytorch model to epoch 20 and to a loss of 0.2 and put it to use in a Flutter mobile app. Backend and frontend, written in C# and Dart respectively.


Why this project exists

Most navigation products optimize for speed. This project explores a different question:

What if a routing system could trade a small amount of travel time for a meaningfully safer, smoother route?

That idea is especially relevant for:

  • insurance risks estimation,
  • logistic companies mass routing,
  • driver-assistance experiences,
  • fleet routing,
  • smart-city mobility systems,
  • future autonomous-vehicle safety layers.

What’s in the repo

Mobile app

The Flutter app lets a user:

  • register and log in,
  • choose a start and destination point on a map,
  • request either a Fast or Smooth route,
  • view the returned route on a map,
  • see project context in an in-app “About us” page.

Backend API

The ASP.NET Core backend currently provides:

  • JWT-based authentication,
  • registration and login endpoints,
  • a /api/path endpoint that returns a route polyline,
  • EF Core migrations for the user store.

ML workspace

The ml/ directory contains exploratory code for:

  • accident-risk modeling,
  • graph-based road-network processing,
  • route-risk prediction,
  • visualization and prototype dashboards.

Architecture

flowchart LR
    A[Flutter mobile app] -->|auth/register, auth/login| B[ASP.NET Core API]
    A -->|api/path| B
    B --> C[(User database via EF Core)]
    B --> D[OpenStreetMap routing service]
    E[Python / ML workspace] --> F[Accident-risk research & route safety experiments]
    F --> B
Loading

Repository structure

.
├── backend/
│   ├── AuthApp/                 # ASP.NET Core 8 Web API + JWT auth + EF Core
│   └── count_cars.py            # Camera/vision pipeline helper script
├── frontend/
│   └── H417-main/               # Flutter application
├── ml/                          # Accident prediction and route-risk experimentation
└── README.md

Tech stack

Frontend

  • Flutter
  • Dart
  • Riverpod
  • flutter_map
  • latlong2
  • geocoding
  • shared_preferences
  • JWT decoding in client

Backend

  • ASP.NET Core 8
  • C#
  • JWT Bearer authentication
  • Entity Framework Core
  • SQL Server / LocalDB (depending on build mode)

ML / data

  • Python
  • PyTorch
  • PyTorch Geometric
  • GeoPandas / OSMnx
  • Plotly / Dash / Streamlit

Quick start

1) Prerequisites

Install the following before running the project:

  • Flutter SDK for the mobile app
  • .NET 8 SDK for the backend
  • SQL Server LocalDB or another reachable SQL Server instance for auth storage
  • Python 3.8+ if you want to explore the ML workspace

2) Run the backend

From the repository root:

cd backend/AuthApp
dotnet restore
dotnet ef database update
dotnet run

Default local behavior

  • In DEBUG, the app uses:
    • Data Source=(localdb)\MSSQLLocalDB; Database=AuthDb
  • In non-debug mode, it switches to a hardcoded SQL Server connection string in Model/Auth/UserContext.cs

Local URLs

The included launch settings define local endpoints such as:

  • http://localhost:5012
  • https://localhost:7174

3) Run the Flutter app

cd frontend/H417-main
flutter pub get
flutter run

Team

Built by the H417 team:


Acknowledgements

For processing historical and metadata, we relied on the AccIndex project by Anand Deshpande, Dr. Onur Kerimoglu and Jan Meyer. To collect and process traffic camera data we used Starwit Awareness Engine. For navigation tiling features we used OpenStreetMap.

About

Realt-time car accidents prediction via computer vision bigdata stream processing of video streams from traffic cameras

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors