# jamesk1281/sundaydrive architecture

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

- Interactive diagram: https://gitdiagram.com/jamesk1281/sundaydrive
- Repository: https://github.com/jamesk1281/sundaydrive

## Overview

Sunday Drive builds a scenic road-routing service and a native iOS navigation app. Its data workflow turns open map and terrain inputs into scenic scores and a routable graph; the API then serves destination routes and scenic loops. In the app, drivers plan or choose a loop, compare route trade-offs, and navigate with live location, rerouting, and voice guidance. The README documents the pipeline and API flow; source excerpts and the index support selected internal links. Unsampled app capabilities are represented without guessing their call paths.

Main entry points: [`server/app.py`](https://github.com/jamesk1281/sundaydrive/blob/main/server/app.py) (Routing API), [`ios/Sources/RouteService.swift`](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/RouteService.swift) (Route API client), [`ios/Sources/NavigationModel.swift`](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/NavigationModel.swift) (Live navigation), [`pipeline/graph.py`](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/graph.py) (Road graph build)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Scenic data"]
  node_extract["Road extraction<br/>[extract.py]"]
  node_elevation["Terrain relief<br/>[elevation.py]"]
  node_landcover["Tree cover<br/>[landcover.py]"]
  node_scoring["Scenic scoring<br/>[score.py]"]
  node_graphbuild["Road graph build<br/>[graph.py]"]
  node_closures["Road closures<br/>[closures.py]"]
end

subgraph group_routing["Routing service"]
  node_router["Route search<br/>[router.py]"]
  node_loopplanner["Scenic loop planning<br/>[looper.py]"]
  node_options["Route preferences<br/>[options.py]"]
  node_api["Routing API<br/>[app.py]"]
end

subgraph group_app["iOS app"]
  node_planning["Trip planning<br/>[PlanningView.swift]"]
  node_region["Region coverage<br/>[NewEngland.swift]"]
  node_boundary["Region boundary"]
  node_routeclient["Route API client<br/>[RouteService.swift]"]
  node_navigation["Live navigation"]
  node_location["Location updates"]
  node_voice["Voice guidance<br/>[VoiceGuide.swift]"]
  node_voicecatalogue["Voice selection"]
end

subgraph group_measurement["Drive measurement"]
  node_trace["Drive recording<br/>[DriveTrace.swift]"]
  node_traceanalysis["Trace analysis<br/>[analyze_trace.py]"]
end

node_osm["OpenStreetMap data"]
node_terrain["Terrain tiles"]
node_graphdata[("Processed graph data")]
node_driver(("Driver"))

node_osm -->|"supplies roads"| node_extract
node_osm -->|"scoring input"| node_scoring
node_terrain -->|"supplies tiles"| node_elevation
node_extract -->|"road data"| node_graphbuild
node_elevation -->|"relief raster"| node_graphbuild
node_landcover -->|"tree cover"| node_scoring
node_scoring -->|"scored chunks"| node_graphbuild
node_graphbuild -->|"writes graph"| node_graphdata
node_closures -->|"writes closures"| node_graphdata
node_graphdata -->|"loads graph"| node_router
node_router -->|"route search"| node_api
node_loopplanner -->|"uses routing"| node_router
node_api -->|"plans loops"| node_loopplanner
node_api -->|"uses preferences"| node_options
node_driver -.->|"chooses trip"| node_planning
node_planning -.->|"requests routes"| node_routeclient
node_region -->|"checks boundary"| node_boundary
node_routeclient -->|"sends requests"| node_api
node_api -->|"returns routes"| node_routeclient
node_routeclient -->|"fetches reroutes"| node_navigation
node_location -.->|"provides fixes"| node_navigation
node_navigation -->|"drives guidance"| node_voice
node_navigation -->|"selects voice"| node_voicecatalogue
node_driver -->|"rates road"| node_trace
node_trace -->|"analyzes traces"| node_traceanalysis

click node_extract "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/extract.py"
click node_elevation "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/elevation.py"
click node_landcover "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/landcover.py"
click node_scoring "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/score.py"
click node_graphbuild "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/graph.py"
click node_closures "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/closures.py"
click node_router "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/router.py"
click node_loopplanner "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/looper.py"
click node_options "https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/options.py"
click node_api "https://github.com/jamesk1281/sundaydrive/blob/main/server/app.py"
click node_planning "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/PlanningView.swift"
click node_region "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/NewEngland.swift"
click node_boundary "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/NewEnglandBoundary.swift"
click node_routeclient "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/RouteService.swift"
click node_navigation "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/NavigationModel.swift"
click node_location "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/LocationManager.swift"
click node_voice "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/VoiceGuide.swift"
click node_voicecatalogue "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/VoiceCatalogue.swift"
click node_trace "https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/DriveTrace.swift"
click node_traceanalysis "https://github.com/jamesk1281/sundaydrive/blob/main/tools/analyze_trace.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_extract,node_elevation,node_landcover,node_scoring,node_graphbuild,node_closures toneBlue
class node_router,node_loopplanner,node_options,node_api,node_graphdata toneAmber
class node_planning,node_region,node_boundary,node_routeclient,node_navigation,node_location,node_voice,node_voicecatalogue toneMint
class node_trace,node_traceanalysis toneRose
class node_osm,node_terrain,node_driver toneIndigo
```

## Components

### Scenic data

- [Road extraction](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/extract.py): `pipeline/extract.py`
- [Terrain relief](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/elevation.py): `pipeline/elevation.py`
- [Tree cover](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/landcover.py): `pipeline/landcover.py`
- [Scenic scoring](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/score.py): `pipeline/score.py`
- [Road graph build](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/graph.py): `pipeline/graph.py`
- [Road closures](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/closures.py): `pipeline/closures.py`

### Routing service

- [Route search](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/router.py): `pipeline/router.py`
- [Scenic loop planning](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/looper.py): `pipeline/looper.py`
- [Route preferences](https://github.com/jamesk1281/sundaydrive/blob/main/pipeline/options.py): `pipeline/options.py`
- [Routing API](https://github.com/jamesk1281/sundaydrive/blob/main/server/app.py): `server/app.py`

### iOS app

- [Trip planning](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/PlanningView.swift): `ios/Sources/PlanningView.swift`
- [Region coverage](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/NewEngland.swift): `ios/Sources/NewEngland.swift`
- [Region boundary](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/NewEnglandBoundary.swift): `ios/Sources/NewEnglandBoundary.swift`
- [Route API client](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/RouteService.swift): `ios/Sources/RouteService.swift`
- [Live navigation](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/NavigationModel.swift): `ios/Sources/NavigationModel.swift`
- [Location updates](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/LocationManager.swift): `ios/Sources/LocationManager.swift`
- [Voice guidance](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/VoiceGuide.swift): `ios/Sources/VoiceGuide.swift`
- [Voice selection](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/VoiceCatalogue.swift): `ios/Sources/VoiceCatalogue.swift`

### Drive measurement

- [Drive recording](https://github.com/jamesk1281/sundaydrive/blob/main/ios/Sources/DriveTrace.swift): `ios/Sources/DriveTrace.swift`
- [Trace analysis](https://github.com/jamesk1281/sundaydrive/blob/main/tools/analyze_trace.py): `tools/analyze_trace.py`

### Other components

- **OpenStreetMap data**
- **Terrain tiles**
- **Processed graph data**
- **Driver**

## Connections

- OpenStreetMap data → Road extraction: supplies roads (evidence: `README.md`)
- OpenStreetMap data → Scenic scoring: scoring input (evidence: `README.md`)
- Terrain tiles → Terrain relief: supplies tiles (evidence: `README.md`)
- Road extraction → Road graph build: road data (evidence: `README.md`)
- Terrain relief → Road graph build: relief raster (evidence: `README.md`)
- Tree cover → Scenic scoring: tree cover (evidence: `README.md`)
- Scenic scoring → Road graph build: scored chunks (evidence: `README.md`)
- Road graph build → Processed graph data: writes graph (evidence: `README.md`)
- Road closures → Processed graph data: writes closures (evidence: `README.md`)
- Processed graph data → Route search: loads graph (evidence: `README.md`)
- Route search → Routing API: route search (evidence: `README.md`)
- Scenic loop planning → Route search: uses routing (evidence: `pipeline/looper.py`)
- Routing API → Scenic loop planning: plans loops (evidence: `server/app.py`)
- Routing API → Route preferences: uses preferences (evidence: `server/app.py`)
- Driver → Trip planning: chooses trip
- Trip planning → Route API client: requests routes
- Region coverage → Region boundary: checks boundary (evidence: `ios/Sources/NewEngland.swift`)
- Route API client → Routing API: sends requests (evidence: `README.md`)
- Routing API → Route API client: returns routes (evidence: `README.md`)
- Route API client → Live navigation: fetches reroutes (evidence: `ios/Sources/NavigationModel.swift`)
- Location updates → Live navigation: provides fixes
- Live navigation → Voice guidance: drives guidance (evidence: `ios/Sources/NavigationModel.swift`)
- Live navigation → Voice selection: selects voice (evidence: `ios/Sources/NavigationModel.swift`)
- Driver → Drive recording: rates road (evidence: `README.md`)
- Drive recording → Trace analysis: analyzes traces (evidence: `tools/analyze_trace.py`)
