How syedhaider037/fuel-route-planner works
Fuel Route Planner is a Django API and Leaflet map that turns two US locations into a GeoJSON route, an optimal fuel-stop plan, and trip costs. The request flow runs from the API view through trip orchestration, local or remote place resolution, routing, nearby-stop indexing, and fuel planning before returning the response; the map page presents that API result. The graph also captures offline stop-data preparation and the documented ORS/OSRM and map-tile integrations. Edges are limited to relationships shown in excerpts or stated in the README; unsampled map-page implementation details are not inferred.
Main entry points: prepare_stops.py Prepare stops command · trip.py Trip orchestration · ors.py Routing client · geocode_unplaced.py Geocode unplaced
Components 21
Trip Request
- Route API
fuel/views.py - Trip orchestration
fuel/trip.py - API errors
fuel/api_errors.py
Places and Routing
- Place resolution
fuel/places.py - Routing client
fuel/ors.py - OpenRouteService
- OSRM demo
Fuel Planning
- Stop index
fuel/stops.py - Fuel planner
fuel/planner.py
Stop Data Preparation
- Fuel price source
data/fuel_prices.csv - Stop preparation
fuel/prepare.py - Prepare stops command
fuel/management/commands/prepare_stops.py - Geocode unplaced
fuel/management/commands/geocode_unplaced.py - Command utilities
fuel/management/commands/_shared.py - Prepared stop data
data/stops.csv - Local place data
data/us_places.csv - Fallback places
data/fallback_places.csv
Map Presentation
- Map page
fuel/views.py - Leaflet interface
fuel/templates/fuel/map.html - OpenStreetMap tiles
Other components
- Trip requester
Connections 25
- Trip requester → Route API: submits trip
README.md - Route API → Trip orchestration: plans trip
fuel/views.py - Route API → API errors: shapes errors
fuel/views.py - Trip orchestration → Place resolution: resolves places
fuel/trip.py - Place resolution → Routing client: geocodes text
fuel/places.py - Trip orchestration → Routing client: requests route
fuel/trip.py - Routing client → OpenRouteService: calls routing
README.md - Routing client → OSRM demo: falls back
README.md - Trip orchestration → Stop index: finds nearby stops
fuel/trip.py - Trip orchestration → Fuel planner: plans purchases
fuel/trip.py - Stop index → Prepared stop data: loads
README.md - Place resolution → Local place data: loads
README.md - Prepare stops command → Stop preparation: cleans and places
fuel/management/commands/prepare_stops.py - Prepare stops command → Command utilities: loads Census inputs
fuel/management/commands/prepare_stops.py - Prepare stops command → Fuel price source: reads prices
fuel/management/commands/prepare_stops.py - Prepare stops command → Prepared stop data: writes stops
fuel/management/commands/prepare_stops.py - Prepare stops command → Local place data: writes places
fuel/management/commands/prepare_stops.py - Geocode unplaced → Stop preparation: finds unplaced towns
fuel/management/commands/geocode_unplaced.py - Geocode unplaced → Routing client: geocodes towns
fuel/management/commands/geocode_unplaced.py - Geocode unplaced → Command utilities: loads Census inputs
fuel/management/commands/geocode_unplaced.py - Geocode unplaced → Fallback places: writes geocodes
fuel/management/commands/geocode_unplaced.py - Map page → Leaflet interface: renders
fuel/views.py - Trip requester → Map page: opens map
README.md - Leaflet interface → Route API: requests trip
README.md - Leaflet interface → OpenStreetMap tiles: draws with tiles
README.md