# jingxiang-17/lumawalk architecture

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

- Interactive diagram: https://gitdiagram.com/jingxiang-17/lumawalk
- Repository: https://github.com/jingxiang-17/lumawalk

## Overview

LumaWalk combines a walking-safety backend with a geospatial data pipeline and a routing-service package. In the evidenced safety workflow, a client starts a route session; the buddy API projects route geometry, stores session state in memory, and evaluates telemetry pings for deviation or inactivity before dispatching a local alert. The pipeline’s scripts and shared configuration are present, but their broader data handoffs are not established here. Routing-service internals and the Flutter application’s Dart product logic are not represented by the supplied excerpts, so their connections remain unspecified.

Main entry points: [`backend/buddy_service/router.py`](https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/router.py) (Buddy sessions), [`data_pipeline/scripts/config.py`](https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/config.py) (Pipeline settings), [`backend/main.py`](https://github.com/jingxiang-17/lumawalk/blob/main/backend/main.py) (FastAPI app), [`data_pipeline/scripts/01_fetch_osm.py`](https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/01_fetch_osm.py) (OSM network fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_safety["Buddy safety API"]
  node_api["FastAPI app<br/>[main.py]"]
  node_buddy["Buddy sessions<br/>[router.py]"]
  node_schemas["Request schemas<br/>[schemas.py]"]
  node_spatial["Spatial calculations<br/>[spatial.py]"]
  node_alert["Emergency dispatch<br/>[router.py]"]
end

subgraph group_routing["Route service"]
  node_routing_service["Route planning API"]
end

subgraph group_pipeline["Geospatial pipeline"]
  node_fetch_osm["OSM network fetch<br/>[01_fetch_osm.py]"]
  node_patch_lit["Lighting patch<br/>[02_patch_lit.py]"]
  node_buffers["Haven buffers<br/>[03_buffers.py]"]
  node_pipeline_config["Pipeline settings<br/>[config.py]"]
end

node_client(("Walking user"))

node_client -->|"calls API"| node_api
node_api -->|"mounts router"| node_buddy
node_buddy -->|"validates requests"| node_schemas
node_buddy -->|"calculates geometry"| node_spatial
node_buddy -->|"queues alert"| node_alert
node_fetch_osm -->|"imports settings"| node_pipeline_config
node_patch_lit -->|"imports settings"| node_pipeline_config
node_buffers -->|"imports settings"| node_pipeline_config

click node_api "https://github.com/jingxiang-17/lumawalk/blob/main/backend/main.py"
click node_buddy "https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/router.py"
click node_schemas "https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/schemas.py"
click node_spatial "https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/spatial.py"
click node_alert "https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/router.py"
click node_routing_service "https://github.com/jingxiang-17/lumawalk/tree/main/backend/routing_service"
click node_fetch_osm "https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/01_fetch_osm.py"
click node_patch_lit "https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/02_patch_lit.py"
click node_buffers "https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/03_buffers.py"
click node_pipeline_config "https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/config.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_buddy,node_schemas,node_spatial,node_alert,node_client toneBlue
class node_routing_service toneAmber
class node_fetch_osm,node_patch_lit,node_buffers,node_pipeline_config toneMint
```

## Components

### Buddy safety API

- [FastAPI app](https://github.com/jingxiang-17/lumawalk/blob/main/backend/main.py): `backend/main.py`
- [Buddy sessions](https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/router.py): `backend/buddy_service/router.py`
- [Request schemas](https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/schemas.py): `backend/buddy_service/schemas.py`
- [Spatial calculations](https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/spatial.py): `backend/buddy_service/spatial.py`
- [Emergency dispatch](https://github.com/jingxiang-17/lumawalk/blob/main/backend/buddy_service/router.py): `backend/buddy_service/router.py`

### Route service

- [Route planning API](https://github.com/jingxiang-17/lumawalk/tree/main/backend/routing_service): `backend/routing_service`

### Geospatial pipeline

- [OSM network fetch](https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/01_fetch_osm.py): `data_pipeline/scripts/01_fetch_osm.py`
- [Lighting patch](https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/02_patch_lit.py): `data_pipeline/scripts/02_patch_lit.py`
- [Haven buffers](https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/03_buffers.py): `data_pipeline/scripts/03_buffers.py`
- [Pipeline settings](https://github.com/jingxiang-17/lumawalk/blob/main/data_pipeline/scripts/config.py): `data_pipeline/scripts/config.py`

### Other components

- **Walking user**

## Connections

- Walking user → FastAPI app: calls API (evidence: `backend/main.py`)
- FastAPI app → Buddy sessions: mounts router (evidence: `backend/main.py`)
- Buddy sessions → Request schemas: validates requests (evidence: `backend/buddy_service/router.py`)
- Buddy sessions → Spatial calculations: calculates geometry (evidence: `backend/buddy_service/router.py`)
- Buddy sessions → Emergency dispatch: queues alert (evidence: `backend/buddy_service/router.py`)
- OSM network fetch → Pipeline settings: imports settings (evidence: `data_pipeline/scripts/01_fetch_osm.py`)
- Lighting patch → Pipeline settings: imports settings (evidence: `data_pipeline/scripts/02_patch_lit.py`)
- Haven buffers → Pipeline settings: imports settings (evidence: `data_pipeline/scripts/03_buffers.py`)
