How campuscodehub/smartride works
SmartRide is a Flask student carpooling prototype. A student signs in and creates a profile, then submits a passenger request or driver offer; the server validates and geocodes the journey, persists it, and for offers retrieves candidate requests, screens them, verifies road detours, and selects an optimised passenger group for the results dashboard. The sampled service code supports the matching and optimisation links; README documents maps and other product capabilities, but frontend-template wiring and some routes were not sampled, so those relationships are omitted or documented only where explicit.
Main entry points: app.py Flask routes · matching_service.py Matching orchestrator · clerk-auth.js Clerk profile UI · group_route_optimiser.py Route optimiser
Components 21
Web journeys
- Flask routes
app.py - Journey forms
templates/find_ride.html - Results dashboard
templates/ride_offer_results.html - Interactive maps
static/js/ride-matches.js
Identity and profiles
- Clerk profile UI
static/js/clerk-auth.js - Journey auth
static/js/journey-auth.js - Clerk verification
auth.py - Clerk identity
Journey data
- TiDB persistence
db.py - Address geocoding
services/geocoding.py - TiDB Cloud
Matching engine
- Matching orchestrator
services/matching_service.py - Geographic screening
services/matching.py - Detour verification
services/route_verification.py - Group selection
services/group_selection.py - Route optimiser
services/group_route_optimiser.py - Stop sequencing
services/group_optimisation.py
Geospatial services
- Nominatim
- OSRM routing
- OpenStreetMap
Other components
- Student
Connections 24
- Student → Clerk profile UI: signs in
README.md - Clerk profile UI → Clerk identity: loads session
static/js/clerk-auth.js - Student → Journey forms: submits journey
README.md - Journey forms → Journey auth: submits form
static/js/journey-auth.js - Journey auth → Flask routes: posts journey
static/js/journey-auth.js - Flask routes → Clerk verification: authenticates request
app.py - Clerk verification → Clerk identity: verifies token
auth.py - Clerk profile UI → Flask routes: profile API
static/js/clerk-auth.js - Flask routes → TiDB persistence: persists profile
app.py - Flask routes → Address geocoding: geocodes locations
app.py - Address geocoding → Nominatim: queries address
services/geocoding.py - Flask routes → TiDB persistence: stores journey
README.md - Flask routes → Matching orchestrator: requests results
app.py - Matching orchestrator → TiDB persistence: loads offer and requests
services/matching_service.py - Matching orchestrator → Geographic screening: screens candidates
services/matching_service.py - Matching orchestrator → Detour verification: verifies matches
services/matching_service.py - Detour verification → OSRM routing: checks road routes
README.md - Matching orchestrator → Group selection: selects passenger group
services/matching_service.py - Group selection → Route optimiser: evaluates groups
services/group_selection.py - Route optimiser → Stop sequencing: builds stop orders
services/group_route_optimiser.py - Route optimiser → OSRM routing: requests duration matrix
services/group_route_optimiser.py - Flask routes → Results dashboard: renders results
README.md - Results dashboard → Interactive maps: displays journey
README.md - Interactive maps → OpenStreetMap: uses map data
README.md