# calumrob/lusk architecture

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

- Interactive diagram: https://gitdiagram.com/calumrob/lusk
- Repository: https://github.com/calumrob/lusk

## Overview

Lusk is an open-data observatory for Brittany. Visitors search for a territory, open its identity sheet, and explore its themes and indicators; they can also browse canonical indicator pages, maps, and source provenance. The Vue app loads and validates published payloads, then builds territory read models for rendering. A read-only API supplies bounded comparisons, while the repository also contains a distinct map-production subsystem. The README describes a broader data pipeline, but its main implementation is not present in this tree; links between these runtime areas are shown only where documented or evidenced.

Main entry points: [`app/src/router/index.ts`](https://github.com/calumrob/lusk/blob/main/app/src/router/index.ts) (Page router), [`app/src/views/TerritoireView.vue`](https://github.com/calumrob/lusk/blob/main/app/src/views/TerritoireView.vue) (Territory sheet), [`pipeline/maps/production/network.py`](https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/network.py) (Mobility network adapter), [`app/src/payload/usePayload.ts`](https://github.com/calumrob/lusk/blob/main/app/src/payload/usePayload.ts) (Payload state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Observatory app"]
  node_application["App shell<br/>[App.vue]"]
  node_router["Page router<br/>[index.ts]"]
  node_search_ui["Territory search"]
  node_search_logic["Search logic<br/>[recherche.ts]"]
  node_territory_page["Territory sheet<br/>[TerritoireView.vue]"]
  node_indicator_pages["Indicator pages<br/>[IndicateurPage.vue]"]
  node_map_page["Map explorer<br/>[MapExplorer.vue]"]
  node_sources_page["Sources page<br/>[SourcesView.vue]"]
end

subgraph group_payload["Payload and territory data"]
  node_payload_state["Payload state<br/>[usePayload.ts]"]
  node_payload_loader["Payload loader<br/>[loader.ts]"]
  node_payload_validation["Payload validation<br/>[validate.ts]"]
  node_territory_model["Territory read model"]
  node_scalar_cohort["Scalar cohorts<br/>[scalarCohort.ts]"]
  node_geometry_state["Map geometry state<br/>[useGeometrie.ts]"]
end

subgraph group_api["Read-only data API"]
  node_api_service["Territory API<br/>[main.py]"]
  node_building_comparison["Building comparisons"]
  node_observed_collections["Observed collections"]
end

subgraph group_maps["Map production"]
  node_map_runner["Map production runner<br/>[runner.py]"]
  node_network_adapter["Mobility network adapter<br/>[network.py]"]
  node_map_ground["Map ground rendering<br/>[map_ground.py]"]
  node_inspection_plate["Inspection plates"]
  node_mainland_context["Mainland context"]
  node_webp_encoding["WebP encoding<br/>[webp_encoding.py]"]
end

node_visitor(("Visitor"))

node_visitor -->|"uses"| node_application
node_application -->|"renders routes"| node_router
node_router -->|"routes to"| node_territory_page
node_router -->|"routes to"| node_indicator_pages
node_router -->|"routes to"| node_map_page
node_router -->|"routes to"| node_sources_page
node_search_ui -->|"uses"| node_search_logic
node_visitor -->|"searches"| node_search_ui
node_territory_page -.->|"acquires data"| node_payload_state
node_payload_state -->|"loads files"| node_payload_loader
node_payload_state -->|"validates"| node_payload_validation
node_payload_loader -->|"validates payload"| node_payload_validation
node_territory_page -->|"uses model"| node_territory_model
node_territory_page -->|"loads cohorts"| node_scalar_cohort
node_map_page -.->|"uses geometry"| node_geometry_state
node_visitor -->|"explores indicators"| node_indicator_pages
node_visitor -->|"checks provenance"| node_sources_page
node_api_service -->|"delegates to"| node_building_comparison
node_api_service -->|"uses reads"| node_observed_collections
node_territory_page -.->|"requests comparisons"| node_api_service
node_map_runner -->|"validates output"| node_webp_encoding
node_network_adapter -->|"uses runner"| node_map_runner
node_network_adapter -->|"uses ground"| node_map_ground
node_network_adapter -->|"uses plates"| node_inspection_plate
node_inspection_plate -->|"uses ground"| node_map_ground
node_map_runner -.->|"context input"| node_mainland_context

click node_application "https://github.com/calumrob/lusk/blob/main/app/src/App.vue"
click node_router "https://github.com/calumrob/lusk/blob/main/app/src/router/index.ts"
click node_search_ui "https://github.com/calumrob/lusk/blob/main/app/src/components/GlobalSearchBar.vue"
click node_search_logic "https://github.com/calumrob/lusk/blob/main/app/src/search/recherche.ts"
click node_territory_page "https://github.com/calumrob/lusk/blob/main/app/src/views/TerritoireView.vue"
click node_indicator_pages "https://github.com/calumrob/lusk/blob/main/app/src/views/IndicateurPage.vue"
click node_map_page "https://github.com/calumrob/lusk/blob/main/app/src/components/carte/MapExplorer.vue"
click node_sources_page "https://github.com/calumrob/lusk/blob/main/app/src/views/SourcesView.vue"
click node_payload_state "https://github.com/calumrob/lusk/blob/main/app/src/payload/usePayload.ts"
click node_payload_loader "https://github.com/calumrob/lusk/blob/main/app/src/payload/loader.ts"
click node_payload_validation "https://github.com/calumrob/lusk/blob/main/app/src/payload/validate.ts"
click node_territory_model "https://github.com/calumrob/lusk/blob/main/app/src/payload/territoryReadModel.ts"
click node_scalar_cohort "https://github.com/calumrob/lusk/blob/main/app/src/payload/scalarCohort.ts"
click node_geometry_state "https://github.com/calumrob/lusk/blob/main/app/src/geo/useGeometrie.ts"
click node_api_service "https://github.com/calumrob/lusk/blob/main/api/main.py"
click node_building_comparison "https://github.com/calumrob/lusk/blob/main/api/building_comparison.py"
click node_observed_collections "https://github.com/calumrob/lusk/blob/main/api/observed_collections.py"
click node_map_runner "https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/runner.py"
click node_network_adapter "https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/network.py"
click node_map_ground "https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/map_ground.py"
click node_inspection_plate "https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/inspection_plate.py"
click node_mainland_context "https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/mainland_context.py"
click node_webp_encoding "https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/webp_encoding.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_application,node_router,node_search_ui,node_search_logic,node_territory_page,node_indicator_pages,node_map_page,node_sources_page toneBlue
class node_payload_state,node_payload_loader,node_payload_validation,node_territory_model,node_scalar_cohort,node_geometry_state toneAmber
class node_api_service,node_building_comparison,node_observed_collections toneMint
class node_map_runner,node_network_adapter,node_map_ground,node_inspection_plate,node_mainland_context,node_webp_encoding toneRose
class node_visitor toneIndigo
```

## Components

### Observatory app

- [App shell](https://github.com/calumrob/lusk/blob/main/app/src/App.vue): `app/src/App.vue`
- [Page router](https://github.com/calumrob/lusk/blob/main/app/src/router/index.ts): `app/src/router/index.ts`
- [Territory search](https://github.com/calumrob/lusk/blob/main/app/src/components/GlobalSearchBar.vue): `app/src/components/GlobalSearchBar.vue`
- [Search logic](https://github.com/calumrob/lusk/blob/main/app/src/search/recherche.ts): `app/src/search/recherche.ts`
- [Territory sheet](https://github.com/calumrob/lusk/blob/main/app/src/views/TerritoireView.vue): `app/src/views/TerritoireView.vue`
- [Indicator pages](https://github.com/calumrob/lusk/blob/main/app/src/views/IndicateurPage.vue): `app/src/views/IndicateurPage.vue`
- [Map explorer](https://github.com/calumrob/lusk/blob/main/app/src/components/carte/MapExplorer.vue): `app/src/components/carte/MapExplorer.vue`
- [Sources page](https://github.com/calumrob/lusk/blob/main/app/src/views/SourcesView.vue): `app/src/views/SourcesView.vue`

### Payload and territory data

- [Payload state](https://github.com/calumrob/lusk/blob/main/app/src/payload/usePayload.ts): `app/src/payload/usePayload.ts`
- [Payload loader](https://github.com/calumrob/lusk/blob/main/app/src/payload/loader.ts): `app/src/payload/loader.ts`
- [Payload validation](https://github.com/calumrob/lusk/blob/main/app/src/payload/validate.ts): `app/src/payload/validate.ts`
- [Territory read model](https://github.com/calumrob/lusk/blob/main/app/src/payload/territoryReadModel.ts): `app/src/payload/territoryReadModel.ts`
- [Scalar cohorts](https://github.com/calumrob/lusk/blob/main/app/src/payload/scalarCohort.ts): `app/src/payload/scalarCohort.ts`
- [Map geometry state](https://github.com/calumrob/lusk/blob/main/app/src/geo/useGeometrie.ts): `app/src/geo/useGeometrie.ts`

### Read-only data API

- [Territory API](https://github.com/calumrob/lusk/blob/main/api/main.py): `api/main.py`
- [Building comparisons](https://github.com/calumrob/lusk/blob/main/api/building_comparison.py): `api/building_comparison.py`
- [Observed collections](https://github.com/calumrob/lusk/blob/main/api/observed_collections.py): `api/observed_collections.py`

### Map production

- [Map production runner](https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/runner.py): `pipeline/maps/production/runner.py`
- [Mobility network adapter](https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/network.py): `pipeline/maps/production/network.py`
- [Map ground rendering](https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/map_ground.py): `pipeline/maps/production/map_ground.py`
- [Inspection plates](https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/inspection_plate.py): `pipeline/maps/production/inspection_plate.py`
- [Mainland context](https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/mainland_context.py): `pipeline/maps/production/mainland_context.py`
- [WebP encoding](https://github.com/calumrob/lusk/blob/main/pipeline/maps/production/webp_encoding.py): `pipeline/maps/production/webp_encoding.py`

### Other components

- **Visitor**

## Connections

- Visitor → App shell: uses (evidence: `README.md`)
- App shell → Page router: renders routes (evidence: `app/src/App.vue`)
- Page router → Territory sheet: routes to (evidence: `app/src/router/index.ts`)
- Page router → Indicator pages: routes to (evidence: `app/src/router/index.ts`)
- Page router → Map explorer: routes to (evidence: `app/src/router/index.ts`)
- Page router → Sources page: routes to (evidence: `app/src/router/index.ts`)
- Territory search → Search logic: uses (evidence: `app/src/components/GlobalSearchBar.vue`)
- Visitor → Territory search: searches (evidence: `README.md`)
- Territory sheet → Payload state: acquires data
- Payload state → Payload loader: loads files (evidence: `app/src/payload/usePayload.ts`)
- Payload state → Payload validation: validates (evidence: `app/src/payload/usePayload.ts`)
- Payload loader → Payload validation: validates payload (evidence: `app/src/payload/loader.ts`)
- Territory sheet → Territory read model: uses model (evidence: `app/src/views/TerritoireView.vue`)
- Territory sheet → Scalar cohorts: loads cohorts (evidence: `app/src/views/TerritoireView.vue`)
- Map explorer → Map geometry state: uses geometry
- Visitor → Indicator pages: explores indicators (evidence: `README.md`)
- Visitor → Sources page: checks provenance (evidence: `README.md`)
- Territory API → Building comparisons: delegates to (evidence: `api/main.py`)
- Territory API → Observed collections: uses reads (evidence: `api/main.py`)
- Territory sheet → Territory API: requests comparisons
- Map production runner → WebP encoding: validates output (evidence: `pipeline/maps/production/runner.py`)
- Mobility network adapter → Map production runner: uses runner (evidence: `pipeline/maps/production/network.py`)
- Mobility network adapter → Map ground rendering: uses ground (evidence: `pipeline/maps/production/network.py`)
- Mobility network adapter → Inspection plates: uses plates (evidence: `pipeline/maps/production/network.py`)
- Inspection plates → Map ground rendering: uses ground (evidence: `pipeline/maps/production/inspection_plate.py`)
- Map production runner → Mainland context: context input
