How eccureuil/fuel-route-optimizer works
Fuel Route Optimizer is a Django service and map UI that turns origin/destination addresses into a truck-feasible, low-cost fuel-stop plan. The primary request path geocodes both endpoints, fetches route geometry, filters nearby stations, validates range feasibility, and selects stops; results include route and station data for visualization. A separate import command loads and deduplicates station pricing data, while a cached endpoint reuses successful route responses. The excerpts show these principal connections; some implementation details are omitted, so uncertain wiring is not represented.
Main entry points: urls.py API routes · fuel_optimizer.py Optimization planner · views.py Route handler · import_stations.py Station importer
Components 16
API and UI
- API routes
routing/urls.py - Route handler
routing/views.py - Cached route
routing/views.py - Map page handler
routing/views.py - Interactive map
routing/templates/routing/route_map.html - Route cache
Route planning
- Optimization planner
routing/services/fuel_optimizer.py - Corridor filtering
routing/services/fuel_optimizer.py - Range validation
routing/services/fuel_optimizer.py - Greedy stop selection
routing/services/fuel_optimizer.py
Station data
- Station records
routing/models.py - Station importer
routing/management/commands/import_stations.py - Station workbook
fuel-prices-enriched-with-coordinates.xlsx
External services
- Mapbox adapter
routing/services/mapbox_service.py - Mapbox APIs
Other components
- Route requester
Connections 16
- Route requester → API routes: requests route
- API routes → Route handler: dispatches
- API routes → Cached route: dispatches
- API routes → Map page handler: dispatches
- Map page handler → Interactive map: renders
- Cached route → Route cache: checks and stores
- Cached route → Route handler: computes cache miss
- Route handler → Mapbox adapter: geocodes and routes
- Mapbox adapter → Mapbox APIs: requests APIs
- Route handler → Optimization planner: plans fuel stops
- Optimization planner → Corridor filtering: filters stations
- Corridor filtering → Station records: queries candidates
- Optimization planner → Range validation: validates range
- Optimization planner → Greedy stop selection: selects stops
- Station importer → Station workbook: loads data
- Station importer → Station records: deduplicates and inserts