Smart transit for UVA. Real-time bus tracking with ML-powered arrival predictions.
HoosRide is an iOS app that helps University of Virginia students and staff navigate the UVA transit system with live bus locations, intelligent trip planning, and machine learning-based arrival time predictions.
- Real-time bus locations on all UVA routes
- Color-coded routes (Orange, Gold, Green, Purple, Silver + Health shuttles)
- Live vehicle positions with heading and load indicators
- Route filtering and nearest-bus detection
- Tap stops to see serving routes; tap vehicles for details
- Location-aware routing with Apple Maps integration
- 25+ curated UVA destination aliases (type "JPJ", "O-Hill", "Barracks", etc.)
- Optimized route selection using live vehicle positions
- Walking + transit combined itineraries
- Route explanation badges β tells you why a route was chosen
- Confidence indicators based on active bus count and ML predictions
- CoreML Gradient Boosted Tree model trained on UVA transit data
- Adaptive delay corrections with calibrated confidence scoring
- On-device observation collection for model improvement
- Transparent source tracking (CoreML vs heuristic fallback)
- Offline / degraded mode with connection state tracking
- Stale data indicators with automatic retry
- JSON-based master route data with hardcoded fallback
- Graceful failure: static routes shown when API is unreachable
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β iOS App (Swift 6) β
β β
β ββββββββββββββββββββ ββββββββββββββββ βββββββββββββββββββββ β
β β SwiftUI Views β β MapKit Map β β CoreML Predictor β β
β β ContentView β β TransitMap β β MLArrivalPredict. β β
β β TripPlannerView β β MapViewModel β β ArrivalPredictor β β
β ββββββββββ¬ββββββββββ ββββββββ¬ββββββββ ββββββββββ¬βββββββββββ β
β ββββββββββββββββ¬βββββββββββββββββββββββββ β
β β β
β βββββββββββββ΄ββββββββββββ β
β β Routing Engine β β
β β Trip planning + β β
β β route scoring + β β
β β vehicle ETA calc β β
β βββββββββββββ¬ββββββββββββ β
β β β
β ββββββββββββ ββββββββββ΄βββββββββ ββββββββββββββββββββββββ β
β β Location β β TranslocService β β MasterDataLoader β β
β β Manager β β (API client) β β (JSON β Swift models)β β
β ββββββββββββ ββββββββββ¬βββββββββ ββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β
TransLoc REST API
(real-time data)
| Tool | Version |
|---|---|
| Xcode | 16.0+ |
| iOS | 17.0+ |
| Swift | 6.0 |
# Open in Xcode
open HoosRide.xcodeproj
# Build & Run (β+R) β targets iPhone simulator
# No API keys needed β TransLoc API is public for UVA# Run all unit tests (32 tests)
xcodebuild -project HoosRide.xcodeproj -scheme HoosRide \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' test
# Or press β+U in XcodeFor best results, set the simulator location to UVA:
- In Simulator: Features β Location β Custom Location
- Latitude:
38.0356, Longitude:-78.5034
HoosRide/
βββ HoosRide/
β βββ HoosRideApp.swift # App entry point
β β
β βββ # Views
β βββ ContentView.swift # Trip planner UI + view model
β βββ MapView.swift # Live transit map + MapViewModel
β βββ TripStepRow.swift # Individual trip step rendering
β βββ RouteExplanationBadge.swift # Why-this-route explanation
β βββ ConnectionStatusBanner.swift # Offline/stale data indicator
β βββ SettingsView.swift # App settings
β β
β βββ # Routing & Planning
β βββ RoutingEngine.swift # Route optimization + scoring
β βββ PlannedTrip.swift # Trip model + RouteChoiceReason
β βββ TripStep.swift # Walk/ride/transfer/arrival steps
β β
β βββ # Data & Services
β βββ TranslocService.swift # TransLoc API client
β βββ MasterData.swift # Route/stop canonical data
β βββ master_routes.json # JSON route configuration
β βββ UVADestinations.swift # 25+ curated campus aliases
β βββ LocationSearchService.swift # Apple Maps search integration
β βββ LocationManager.swift # GPS/location handling
β βββ GeocodingService.swift # Address β coordinate
β βββ GeoUtilities.swift # Distance, formatting helpers
β β
β βββ # ML & Prediction
β βββ MLArrivalPredictor.swift # CoreML model wrapper
β βββ ArrivalPredictor.swift # Prediction orchestration
β βββ ObservationCollector.swift # On-device learning data
β β
β βββ # Models
β βββ TransitModels.swift # PlaceResult, BusRoute, RouteCandidate
β βββ TransitSnapshot.swift # Immutable transit state snapshot
β βββ TransitStop.swift # Stop model
β βββ BusVehicle.swift # Vehicle model
β
βββ HoosRideTests/
βββ HoosRideTests.swift # 32 unit tests
| Metric | Value |
|---|---|
| MAE | 1.76 min |
| RΒ² | 0.55 |
| vs Heuristic | 50% better |
The trained CoreML model (BusArrivalPredictor.mlpackage) ships bundled in the
Xcode project β Xcode picks it up automatically at build time. No external
toolchain required to build the app.
| Component | Source |
|---|---|
| Wait time estimation | ML (CoreML) when vehicles present; heuristic fallback |
| Delay adjustment | ML with 50% blending weight |
| Confidence scoring | Calibrated weighted factors |
| Ride time | Segment-based heuristic |
| Walking time | Distance / speed constant |
| Route | Color | Area |
|---|---|---|
| Orange | π | JPA β Madison Ave β Stadium |
| Gold | π‘ | Hereford β North Grounds β Barracks Rd |
| Green | π’ | Hereford β Rugby Rd β Grady Ave |
| Purple | π£ | Fontaine Research Park β Medical Center |
| Silver | βͺ | JPJ β Emmet St β JPA β North Grounds |
| Route | Description |
|---|---|
| Fontaine Shuttle | Medical Center β Fontaine Research Park |
| Health Stadium | Medical Center β Scott Stadium |
- JSON + Hardcoded Fallback for master route data β JSON loads first, hardcoded Swift data serves as safety net
- Observation pattern (
@Observable) overObservableObjectβ cleaner SwiftUI integration, no@Publishedboilerplate - Immutable
TransitSnapshotfor thread-safe routing β snapshot is built once per refresh cycle - Walking effort multiplier (1.6Γ) β a 12-min bus ride beats an 8-min walk because riding is less effort
- ML blending at 50% β positional ETA as base, ML delay layered on top to avoid overcorrection
- Degraded mode over crashes β always show something (static routes) rather than empty screen
HoosRide uses the TransLoc v1 API (no key required for UVA):
| Endpoint | Purpose |
|---|---|
/v1/vehicle_statuses |
Live bus positions |
/v1/arrivals |
ETA predictions |
/v1/routes |
Route metadata |
32 tests across 4 test suites:
- RoutingEngineTests (15): Walk vs bus, stop matching, route preference, edge cases, delayed vehicles
- TransitModelTests (4): PlaceResult detection, route segments, vehicle equality, walking speeds
- GeoUtilitiesTests (6): Distance, heading, formatting
- MLPredictorTests (3): Prediction validity, rush hour detection, ETA adjustment
- Route data requires app update if UVA changes routes (JSON helps but still bundled)
- ETA confidence drops significantly when no active vehicles are tracked
- ML model trained primarily on synthetic data β real-world accuracy improves with observation collection
- Single-seat trips only β no transfer routing between different bus lines
- Walking time estimates use straight-line distance (no sidewalk routing)
MIT License β see LICENSE for details.
Built for UVA students who wait at bus stops. π§‘π