# anilkumara9/asignment architecture

> Architecture diagram of the GitHub repository anilkumara9/asignment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anilkumara9/asignment
- Repository: https://github.com/anilkumara9/asignment

## Overview

Fuel-Route API turns USA start and finish locations into a driving route, a minimum-cost refuelling plan, and either JSON or an interactive map. The documented workflow is handled by the HTTP views and the planner, which coordinates geocoding, routing, nearby-station matching, and fuel optimization; the planner also shapes the response geometry and summary. The map is a separate presentation path that reuses the planner. The README documents offline station data and map capabilities; unsampled module wiring is shown only where documented or directly supported by the sampled source.

Main entry points: [`fuelrouter/services/planner.py`](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/planner.py) (Trip planner), [`fuelrouter/views.py`](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/views.py) (Map page view), [`fuelrouter/urls.py`](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/urls.py) (URL dispatch), [`fuelrouter/services/geocode.py`](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/geocode.py) (Place geocoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP interface"]
  node_api["Route API<br/>[views.py]"]
  node_mapview["Map page view<br/>[views.py]"]
  node_urls["URL dispatch<br/>[urls.py]"]
  node_maptemplate["Interactive map<br/>[map.html]"]
  node_errortemplate["Map error page<br/>[map_error.html]"]
end

subgraph group_planning["Trip planning"]
  node_planner["Trip planner<br/>[planner.py]"]
  node_geocoder["Place geocoder<br/>[geocode.py]"]
  node_router["Driving router<br/>[routing.py]"]
  node_optimizer["Fuel optimizer<br/>[optimizer.py]"]
end

subgraph group_stationdata["Station data and geometry"]
  node_matcher["Station matcher<br/>[stations.py]"]
  node_geometry["Route geometry<br/>[geo.py]"]
  node_stationfile["Station price data<br/>[stations.json]"]
end

subgraph group_integrations["External integrations"]
  node_cache[("Django cache<br/>[settings.py]")]
  node_nominatim["Nominatim"]
  node_osrm["OSRM"]
  node_maptiles["OSM map tiles"]
end

node_traveler(("Trip requester"))

node_traveler -->|"requests"| node_urls
node_urls -->|"dispatches API"| node_api
node_urls -->|"dispatches map"| node_mapview
node_api -->|"plans trip"| node_planner
node_mapview -->|"plans trip"| node_planner
node_planner -->|"geocodes places"| node_geocoder
node_planner -->|"gets route"| node_router
node_planner -->|"matches stations"| node_matcher
node_planner -->|"plans refuelling"| node_optimizer
node_planner -->|"simplifies route"| node_geometry
node_geocoder -->|"queries"| node_nominatim
node_router -->|"requests route"| node_osrm
node_matcher -->|"loads data"| node_stationfile
node_matcher -->|"measures route"| node_geometry
node_geocoder -->|"reads and writes"| node_cache
node_router -->|"reads and writes"| node_cache
node_planner -->|"reads and writes"| node_cache
node_api -->|"returns JSON"| node_traveler
node_mapview -->|"renders plan"| node_maptemplate
node_mapview -->|"renders errors"| node_errortemplate
node_maptemplate -->|"loads tiles"| node_maptiles

click node_api "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/views.py"
click node_mapview "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/views.py"
click node_urls "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/urls.py"
click node_planner "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/planner.py"
click node_geocoder "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/geocode.py"
click node_router "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/routing.py"
click node_matcher "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/stations.py"
click node_optimizer "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/optimizer.py"
click node_geometry "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/geo.py"
click node_stationfile "https://github.com/anilkumara9/asignment/blob/main/fuelrouter/data/stations.json"
click node_maptemplate "https://github.com/anilkumara9/asignment/blob/main/templates/fuelrouter/map.html"
click node_errortemplate "https://github.com/anilkumara9/asignment/blob/main/templates/fuelrouter/map_error.html"
click node_cache "https://github.com/anilkumara9/asignment/blob/main/config/settings.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_mapview,node_urls,node_maptemplate,node_errortemplate toneBlue
class node_planner,node_geocoder,node_router,node_optimizer toneAmber
class node_matcher,node_geometry,node_stationfile,node_traveler toneMint
class node_cache,node_nominatim,node_osrm,node_maptiles toneRose
```

## Components

### HTTP interface

- [Route API](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/views.py): `fuelrouter/views.py`
- [Map page view](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/views.py): `fuelrouter/views.py`
- [URL dispatch](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/urls.py): `fuelrouter/urls.py`
- [Interactive map](https://github.com/anilkumara9/asignment/blob/main/templates/fuelrouter/map.html): `templates/fuelrouter/map.html`
- [Map error page](https://github.com/anilkumara9/asignment/blob/main/templates/fuelrouter/map_error.html): `templates/fuelrouter/map_error.html`

### Trip planning

- [Trip planner](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/planner.py): `fuelrouter/services/planner.py`
- [Place geocoder](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/geocode.py): `fuelrouter/services/geocode.py`
- [Driving router](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/routing.py): `fuelrouter/services/routing.py`
- [Fuel optimizer](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/optimizer.py): `fuelrouter/services/optimizer.py`

### Station data and geometry

- [Station matcher](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/stations.py): `fuelrouter/services/stations.py`
- [Route geometry](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/services/geo.py): `fuelrouter/services/geo.py`
- [Station price data](https://github.com/anilkumara9/asignment/blob/main/fuelrouter/data/stations.json): `fuelrouter/data/stations.json`

### External integrations

- [Django cache](https://github.com/anilkumara9/asignment/blob/main/config/settings.py): `config/settings.py`
- **Nominatim**
- **OSRM**
- **OSM map tiles**

### Other components

- **Trip requester**

## Connections

- Trip requester → URL dispatch: requests
- URL dispatch → Route API: dispatches API
- URL dispatch → Map page view: dispatches map
- Route API → Trip planner: plans trip
- Map page view → Trip planner: plans trip
- Trip planner → Place geocoder: geocodes places
- Trip planner → Driving router: gets route
- Trip planner → Station matcher: matches stations
- Trip planner → Fuel optimizer: plans refuelling
- Trip planner → Route geometry: simplifies route
- Place geocoder → Nominatim: queries
- Driving router → OSRM: requests route
- Station matcher → Station price data: loads data
- Station matcher → Route geometry: measures route
- Place geocoder → Django cache: reads and writes
- Driving router → Django cache: reads and writes
- Trip planner → Django cache: reads and writes
- Route API → Trip requester: returns JSON
- Map page view → Interactive map: renders plan
- Map page view → Map error page: renders errors
- Interactive map → OSM map tiles: loads tiles
