# warner-wvez/ora architecture

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

- Interactive diagram: https://gitdiagram.com/warner-wvez/ora
- Repository: https://github.com/warner-wvez/ora

## Overview

#### Purpose and entry point
Ora is a static GitHub Pages map for public US traffic-camera feeds, plus NYC, Illinois, and a Chicago enforcement-analysis layer. The browser entry point is `index.html`; it loads prebuilt JSON directly, renders with MapLibre GL JS, and has no server-side application or build step. Core datasets include `states/index.json`, `cameras.json`, `cameras-nyc.json`, and `cameras-chicago-enforcement.json`.

#### Client map and layer orchestration
`index.html` owns map initialization, state/layer selection, lazy loading of selected state files, camera rendering, popups, search, URL-state restoration, saved local routes, and image/video playback behavior. It treats the data repository as a static API: `states/index.json` supplies available state metadata, then `states/`.json` supplies camera features. Illinois, NYC, and Chicago are separate precomputed layers rather than state-index payloads:
- `index.html`
- `states/index.json`
- `cameras.json`

#### Camera-data ingestion pipeline
Python builders fetch heterogeneous DOT/vendor sources and normalize them into per-state JSON suitable for static consumption. Platform-specific builders encode source/API quirks, coordinate cleanup, media URL extraction, direction metadata, and whether a stream is viable in a static browser context. The shared older-511 ingestion path is `build-states.py`; newer GraphQL, MapLarge/Texas, and WSDOT each have dedicated paths:
- `build-states.py`
- `build-states-graphql.py`
- `build-states-tx.py`

Many states have dedicated extraction scripts because their public surfaces differ materially, such as ASP.NET, ArcGIS, proprietary endpoints, or site scraping:
- `build-states-ms.py`
- `build-states-wa.py`
- `build-states-ri.py`

#### Static data contract and media boundary
State outputs in `states/*.json` contain map-ready camera locations and their nested views, snapshots, and eligible HLS URLs; they are committed deployment artifacts. Some feeds are snapshot-only because streams are CORS-blocked, Referer-locked, DRM-protected, authenticated, or short-lived-token URLs. Video-capable records permit in-browser HLS playback; snapshot records remain cross-origin images and cannot be pixel-inspected by the client. Washington’s measured refresh metadata is folded from:
- `states/WA.json`
- `states/WA-refresh.json`
- `measure-refresh-wa.py`

#### Feed health pipeline
`probe-health.py` periodically probes snapshot availability and classifies views as offline, placeholder, or frozen using inexpensive ranged-image fingerprints plus persisted known placeholder signatures. Results are emitted per state beneath `states/health/` and consumed by the client to present degraded cameras before selection. The scheduled workflow reruns this data-quality job every six hours and commits changes:
- `probe-health.py`
- `.github/workflows/camera-health.yml`
- `states/health/known-placeholders.json`

#### Chicago enforcement analytics
Chicago is a separate non-video analytical layer. `build-chicago-enforcement.py` fetches Chicago Data Portal violation, location, and crash data; aggregates ticket volumes; spatially joins injury crashes near cameras; then assigns a safety-versus-revenue quadrant. Its static result is consumed alongside traffic-camera layers:
- `build-chicago-enforcement.py`
- `cameras-chicago-enforcement.json`
- `cameras-chicago-enforcement.json`

#### Runtime and external infrastructure
The deployed runtime is a static browser page, suitable for GitHub Pages. Map rendering uses MapLibre GL JS loaded from CDN, with OpenFreeMap vector tiles and optional Esri World Imagery. Camera media and metadata remain hosted by state DOTs, vendor 511 platforms, NYC DOT, Illinois/Travel Midwest, and Chicago’s open data portal. Browser constraints—not a backend proxy—define the principal integration boundary: Ora only ships media URLs that remain usable from an unrelated static origin.

Main entry points: [`index.html`](https://github.com/warner-wvez/ora/blob/main/index.html) (Map application), [`probe-health.py`](https://github.com/warner-wvez/ora/blob/main/probe-health.py) (Health probe), [`build-states.py`](https://github.com/warner-wvez/ora/blob/main/build-states.py) (Older 511 builder), [`build-states-graphql.py`](https://github.com/warner-wvez/ora/blob/main/build-states-graphql.py) (Modern source builders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Static browser runtime"]
  node_page["Map application<br/>browser entry point<br/>[index.html]"]
  node_maplibre["MapLibre + tile basemaps<br/>map rendering"]
end

subgraph group_data["Static data artifacts"]
  node_state_index["State catalog<br/>state metadata<br/>[index.json]"]
  node_state_data["Per-state camera data<br/>camera feature contract"]
  node_general_cameras["General camera layer<br/>prebuilt camera data<br/>[cameras.json]"]
  node_nyc_cameras["NYC camera layer<br/>prebuilt camera data<br/>[cameras-nyc.json]"]
  node_chicago_enforcement_data["Chicago enforcement layer<br/>analytics data"]
  node_wa_refresh["Washington refresh metadata<br/>refresh measurements<br/>[WA-refresh.json]"]
end

subgraph group_builders["Data builders"]
  node_legacy_builder["Older 511 builder<br/>Python ingestion<br/>[build-states.py]"]
  node_modern_builders["Modern source builders<br/>Python ingestion"]
  node_state_extractors["Specialized state extractors<br/>Python ingestion<br/>[build-states-ms.py]"]
  node_wa_measurement["WA refresh measurement<br/>Python measurement"]
  node_chicago_builder["Chicago analytics builder<br/>Python analytics"]
end

subgraph group_health["Feed health"]
  node_health_probe["Health probe<br/>Python quality probe<br/>[probe-health.py]"]
  node_placeholder_signatures["Known placeholders<br/>fingerprint store"]
  node_health_workflow["Six-hour health workflow<br/>GitHub Actions schedule<br/>[camera-health.yml]"]
end

subgraph group_external["External sources"]
  node_providers{{"DOTs, vendors, and open data<br/>external feeds"}}
  node_browser_media{{"Browser media boundary<br/>cross-origin media"}}
end

node_page -->|"renders map"| node_maplibre
node_page -->|"loads catalog"| node_state_index
node_page -->|"lazy-loads selected state"| node_state_data
node_page -->|"loads layer"| node_general_cameras
node_page -->|"loads layer"| node_nyc_cameras
node_page -->|"loads layer"| node_chicago_enforcement_data
node_page -->|"displays snapshots / HLS"| node_browser_media
node_legacy_builder -->|"fetches feeds"| node_providers
node_modern_builders -->|"fetches feeds"| node_providers
node_state_extractors -->|"scrapes source-specific feeds"| node_providers
node_legacy_builder -->|"writes normalized states"| node_state_data
node_modern_builders -->|"writes normalized states"| node_state_data
node_state_extractors -->|"writes state outputs"| node_state_data
node_wa_measurement -->|"measures refresh"| node_wa_refresh
node_wa_refresh -->|"folded into WA data"| node_state_data
node_chicago_builder -->|"fetches portal data"| node_providers
node_chicago_builder -->|"writes analysis"| node_chicago_enforcement_data
node_health_workflow -->|"runs every 6 hours"| node_health_probe
node_health_probe -->|"probes snapshots"| node_providers
node_placeholder_signatures -->|"known signatures"| node_health_probe
node_health_probe -.->|"assesses camera views"| node_state_data
node_browser_media -->|"cross-origin requests"| node_providers

click node_page "https://github.com/warner-wvez/ora/blob/main/index.html"
click node_state_index "https://github.com/warner-wvez/ora/blob/main/states/index.json"
click node_general_cameras "https://github.com/warner-wvez/ora/blob/main/cameras.json"
click node_nyc_cameras "https://github.com/warner-wvez/ora/blob/main/cameras-nyc.json"
click node_chicago_enforcement_data "https://github.com/warner-wvez/ora/blob/main/cameras-chicago-enforcement.json"
click node_wa_refresh "https://github.com/warner-wvez/ora/blob/main/states/WA-refresh.json"
click node_legacy_builder "https://github.com/warner-wvez/ora/blob/main/build-states.py"
click node_modern_builders "https://github.com/warner-wvez/ora/blob/main/build-states-graphql.py"
click node_state_extractors "https://github.com/warner-wvez/ora/blob/main/build-states-ms.py"
click node_wa_measurement "https://github.com/warner-wvez/ora/blob/main/measure-refresh-wa.py"
click node_chicago_builder "https://github.com/warner-wvez/ora/blob/main/build-chicago-enforcement.py"
click node_health_probe "https://github.com/warner-wvez/ora/blob/main/probe-health.py"
click node_placeholder_signatures "https://github.com/warner-wvez/ora/blob/main/states/health/known-placeholders.json"
click node_health_workflow "https://github.com/warner-wvez/ora/blob/main/.github/workflows/camera-health.yml"

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_page,node_maplibre toneBlue
class node_state_index,node_state_data,node_general_cameras,node_nyc_cameras,node_chicago_enforcement_data,node_wa_refresh toneAmber
class node_legacy_builder,node_modern_builders,node_state_extractors,node_wa_measurement,node_chicago_builder toneMint
class node_health_probe,node_placeholder_signatures,node_health_workflow toneRose
class node_providers,node_browser_media toneIndigo
```

## Components

### Static browser runtime

GitHub Pages client with no backend.

- [Map application](https://github.com/warner-wvez/ora/blob/main/index.html): browser entry point · Initializes the map and orchestrates layers, media, search, and saved routes. · `index.html`
- **MapLibre + tile basemaps**: map rendering · CDN map renderer with OpenFreeMap and optional Esri imagery.

### Static data artifacts

Committed JSON is the client data contract.

- [State catalog](https://github.com/warner-wvez/ora/blob/main/states/index.json): state metadata · Lists selectable state datasets. · `states/index.json`
- **Per-state camera data**: camera feature contract · Map-ready cameras, nested views, snapshots, and eligible HLS URLs.
- [General camera layer](https://github.com/warner-wvez/ora/blob/main/cameras.json): prebuilt camera data · `cameras.json`
- [NYC camera layer](https://github.com/warner-wvez/ora/blob/main/cameras-nyc.json): prebuilt camera data · Separate precomputed city layer. · `cameras-nyc.json`
- [Chicago enforcement layer](https://github.com/warner-wvez/ora/blob/main/cameras-chicago-enforcement.json): analytics data · Safety-versus-revenue camera classifications. · `cameras-chicago-enforcement.json`
- [Washington refresh metadata](https://github.com/warner-wvez/ora/blob/main/states/WA-refresh.json): refresh measurements · Measured feed refresh metadata folded into Washington data. · `states/WA-refresh.json`

### Data builders

Python ingestion and analytical pipelines.

- [Older 511 builder](https://github.com/warner-wvez/ora/blob/main/build-states.py): Python ingestion · Shared normalization path for older 511 sources. · `build-states.py`
- [Modern source builders](https://github.com/warner-wvez/ora/blob/main/build-states-graphql.py): Python ingestion · Dedicated GraphQL, Texas MapLarge, and WSDOT ingestion paths. · `build-states-graphql.py`
- [Specialized state extractors](https://github.com/warner-wvez/ora/blob/main/build-states-ms.py): Python ingestion · Handles materially different public source surfaces. · `build-states-ms.py`
- [WA refresh measurement](https://github.com/warner-wvez/ora/blob/main/measure-refresh-wa.py): Python measurement · `measure-refresh-wa.py`
- [Chicago analytics builder](https://github.com/warner-wvez/ora/blob/main/build-chicago-enforcement.py): Python analytics · Aggregates violations and crash proximity into quadrants. · `build-chicago-enforcement.py`

### Feed health

Scheduled feed-quality classification.

- [Health probe](https://github.com/warner-wvez/ora/blob/main/probe-health.py): Python quality probe · Classifies unavailable, placeholder, and frozen snapshots. · `probe-health.py`
- [Known placeholders](https://github.com/warner-wvez/ora/blob/main/states/health/known-placeholders.json): fingerprint store · `states/health/known-placeholders.json`
- [Six-hour health workflow](https://github.com/warner-wvez/ora/blob/main/.github/workflows/camera-health.yml): GitHub Actions schedule · Runs probes and commits refreshed health data. · `.github/workflows/camera-health.yml`

### External sources

Public maps, feeds, and data providers.

- **DOTs, vendors, and open data**: external feeds · State camera media, 511 metadata, and Chicago source data remain external.
- **Browser media boundary**: cross-origin media · Only static-origin-compatible snapshots and HLS streams are usable.

## Connections

- Map application → MapLibre + tile basemaps: renders map
- Map application → State catalog: loads catalog
- Map application → Per-state camera data: lazy-loads selected state
- Map application → General camera layer: loads layer
- Map application → NYC camera layer: loads layer
- Map application → Chicago enforcement layer: loads layer
- Map application → Browser media boundary: displays snapshots / HLS
- Older 511 builder → DOTs, vendors, and open data: fetches feeds
- Modern source builders → DOTs, vendors, and open data: fetches feeds
- Specialized state extractors → DOTs, vendors, and open data: scrapes source-specific feeds
- Older 511 builder → Per-state camera data: writes normalized states
- Modern source builders → Per-state camera data: writes normalized states
- Specialized state extractors → Per-state camera data: writes state outputs
- WA refresh measurement → Washington refresh metadata: measures refresh
- Washington refresh metadata → Per-state camera data: folded into WA data
- Chicago analytics builder → DOTs, vendors, and open data: fetches portal data
- Chicago analytics builder → Chicago enforcement layer: writes analysis
- Six-hour health workflow → Health probe: runs every 6 hours
- Health probe → DOTs, vendors, and open data: probes snapshots
- Known placeholders → Health probe: known signatures
- Health probe → Per-state camera data: assesses camera views
- Browser media boundary → DOTs, vendors, and open data: cross-origin requests
