# benji-carr/seattle-area-public-safety-dashboard architecture

> Architecture diagram of the GitHub repository benji-carr/seattle-area-public-safety-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/benji-carr/seattle-area-public-safety-dashboard
- Repository: https://github.com/benji-carr/seattle-area-public-safety-dashboard

## Overview

The repository combines Seattle public-safety dashboards with a neighborhood-level crime forecasting system. Dashboard users enter through the Dash app, which loads crime contexts and renders interactive analysis; separate data modules support crime, calls, use of force, SPD events, and population. Forecast production refreshes SPD call data, builds a validated feature panel, generates forecasts from a locked XGBoost artifact, and monitors forecast performance. The README documents source collection, snapshots, and presentation responsibilities. Some dashboard and production relationships are supported only by the SOURCE INDEX; unsampled subsystems are shown without speculative links.

Main entry points: [`app.py`](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/app.py) (Dash application), [`dashboard/crime_dashboard_data.py`](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_dashboard_data.py) (Crime dashboard data), [`forecasting/features/xgboost.py`](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/features/xgboost.py) (Target features), [`dashboard/crime_dashboard_components.py`](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_dashboard_components.py) (Crime components)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dash_ui["Dashboard presentation"]
  node_app["Dash application<br/>[app.py]"]
  node_crime_components["Crime components"]
  node_crime_figures["Crime figures"]
  node_crime_controls["Crime controls<br/>[crime_controls.py]"]
  node_analysis_windows["Analysis windows"]
end

subgraph group_dash_data["Dashboard data"]
  node_crime_data["Crime dashboard data"]
  node_crime_source["Crime source<br/>[crime_source.py]"]
  node_crime_snapshot[("Crime snapshot<br/>[crime_snapshot.py]")]
  node_crime_classification["Crime classification"]
  node_population["Population data"]
  node_population_snapshot[("Population snapshot")]
  node_calls_support["Calls support data"]
  node_call_refresh["Call metrics refresh"]
  node_spd_data["SPD dashboard data"]
  node_spd_source["SPD source<br/>[spd_source.py]"]
  node_spd_snapshot[("SPD snapshot<br/>[spd_snapshot.py]")]
  node_uof_data["Use-of-force data"]
  node_uof_source["Use-of-force source<br/>[uof_source.py]"]
  node_uof_snapshot[("Use-of-force snapshot<br/>[uof_snapshot.py]")]
end

subgraph group_forecast_model["Forecast modeling"]
  node_target_features["Target features<br/>[xgboost.py]"]
  node_calendar_features["Calendar features<br/>[calendar.py]"]
  node_backtest["XGBoost backtests<br/>[xgboost.py]"]
  node_sarima["SARIMA backtests<br/>[sarima.py]"]
  node_top10_eval["Top-10 evaluation<br/>[top10.py]"]
end

subgraph group_forecast_ops["Forecast production"]
  node_forecast_source["SPD forecast data refresh<br/>[data_refresh.py]"]
  node_production_model["Production XGBoost<br/>[xgboost.py]"]
  node_inference["Forecast inference<br/>[inference.py]"]
  node_forecasts[("Forecast snapshots<br/>[paths.py]")]
  node_monitoring["Forecast monitoring<br/>[monitoring.py]"]
  node_orchestration["Daily orchestration<br/>[orchestration.py]"]
end

node_user(("Dashboard user"))
node_spd_calls[("SPD call records")]
node_seattle_open_data["Seattle Open Data"]
node_forecast_runner["Daily runner"]

node_user -->|"opens"| node_app
node_app -->|"loads context"| node_calls_support
node_app -->|"loads context"| node_crime_data
node_app -->|"renders"| node_crime_components
node_app -->|"uses"| node_crime_figures
node_app -->|"uses"| node_crime_controls
node_crime_components -->|"uses"| node_crime_data
node_crime_components -->|"uses"| node_crime_controls
node_crime_components -.->|"uses"| node_crime_figures
node_crime_controls -->|"uses"| node_analysis_windows
node_crime_figures -->|"uses"| node_crime_data
node_crime_figures -->|"uses"| node_analysis_windows
node_crime_data -->|"classifies"| node_crime_classification
node_crime_data -->|"loads"| node_crime_snapshot
node_crime_data -->|"loads"| node_population_snapshot
node_population -.->|"persists"| node_population_snapshot
node_calls_support -->|"loads"| node_spd_snapshot
node_call_refresh -.->|"refreshes"| node_spd_snapshot
node_uof_data -->|"fetches"| node_uof_source
node_uof_data -->|"loads"| node_uof_snapshot
node_spd_data -.->|"loads"| node_spd_snapshot
node_spd_source -.->|"fetches"| node_seattle_open_data
node_crime_source -.->|"fetches"| node_seattle_open_data
node_uof_source -.->|"fetches"| node_seattle_open_data
node_forecast_runner -->|"runs"| node_orchestration
node_orchestration -->|"refreshes data"| node_forecast_source
node_orchestration -->|"runs inference"| node_inference
node_orchestration -->|"runs monitoring"| node_monitoring
node_forecast_source -->|"fetches calls"| node_spd_source
node_forecast_source -->|"builds panel"| node_target_features
node_inference -->|"builds features"| node_target_features
node_inference -->|"loads model"| node_production_model
node_inference -.->|"writes forecasts"| node_forecasts
node_monitoring -.->|"reads snapshots"| node_forecasts
node_monitoring -->|"evaluates ranks"| node_top10_eval
node_monitoring -->|"prepares panel"| node_target_features
node_target_features -->|"adds calendar"| node_calendar_features
node_backtest -->|"uses features"| node_target_features
node_backtest -->|"compares baseline"| node_sarima
node_production_model -->|"trains from"| node_backtest
node_forecast_source -->|"collects"| node_spd_calls

click node_app "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/app.py"
click node_crime_components "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_dashboard_components.py"
click node_crime_figures "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_dashboard_figures.py"
click node_crime_controls "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_controls.py"
click node_analysis_windows "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/analysis_windows.py"
click node_crime_data "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_dashboard_data.py"
click node_crime_source "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_source.py"
click node_crime_snapshot "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_snapshot.py"
click node_crime_classification "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_classification.py"
click node_population "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/population_service.py"
click node_population_snapshot "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/population_snapshot.py"
click node_calls_support "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_call_support_data.py"
click node_call_refresh "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/call_metrics_refresh.py"
click node_spd_data "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/spd_dashboard_data.py"
click node_spd_source "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/spd_source.py"
click node_spd_snapshot "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/spd_snapshot.py"
click node_uof_data "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/uof_dashboard_data.py"
click node_uof_source "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/uof_source.py"
click node_uof_snapshot "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/uof_snapshot.py"
click node_forecast_source "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/data_refresh.py"
click node_target_features "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/features/xgboost.py"
click node_calendar_features "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/features/calendar.py"
click node_backtest "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/backtests/xgboost.py"
click node_sarima "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/backtests/sarima.py"
click node_top10_eval "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/evaluation/top10.py"
click node_production_model "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/xgboost.py"
click node_inference "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/inference.py"
click node_forecasts "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/paths.py"
click node_monitoring "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/monitoring.py"
click node_orchestration "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/orchestration.py"
click node_forecast_runner "https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/scripts/forecasting/run_xgboost_daily_pipeline.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_app,node_crime_components,node_crime_figures,node_crime_controls,node_analysis_windows,node_user toneBlue
class node_crime_data,node_crime_source,node_crime_snapshot,node_crime_classification,node_population,node_population_snapshot,node_calls_support,node_call_refresh,node_spd_data,node_spd_source,node_spd_snapshot,node_uof_data,node_uof_source,node_uof_snapshot,node_spd_calls toneAmber
class node_target_features,node_calendar_features,node_backtest,node_sarima,node_top10_eval toneMint
class node_forecast_source,node_production_model,node_inference,node_forecasts,node_monitoring,node_orchestration toneRose
class node_seattle_open_data toneIndigo
class node_forecast_runner toneTeal
```

## Components

### Dashboard presentation

- [Dash application](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/app.py): `app.py`
- [Crime components](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_dashboard_components.py): `dashboard/crime_dashboard_components.py`
- [Crime figures](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_dashboard_figures.py): `dashboard/crime_dashboard_figures.py`
- [Crime controls](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_controls.py): `dashboard/crime_controls.py`
- [Analysis windows](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/analysis_windows.py): `dashboard/analysis_windows.py`

### Dashboard data

- [Crime dashboard data](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_dashboard_data.py): `dashboard/crime_dashboard_data.py`
- [Crime source](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_source.py): `dashboard/crime_source.py`
- [Crime snapshot](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_snapshot.py): `dashboard/crime_snapshot.py`
- [Crime classification](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_classification.py): `dashboard/crime_classification.py`
- [Population data](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/population_service.py): `dashboard/population_service.py`
- [Population snapshot](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/population_snapshot.py): `dashboard/population_snapshot.py`
- [Calls support data](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/crime_call_support_data.py): `dashboard/crime_call_support_data.py`
- [Call metrics refresh](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/call_metrics_refresh.py): `dashboard/call_metrics_refresh.py`
- [SPD dashboard data](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/spd_dashboard_data.py): `dashboard/spd_dashboard_data.py`
- [SPD source](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/spd_source.py): `dashboard/spd_source.py`
- [SPD snapshot](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/spd_snapshot.py): `dashboard/spd_snapshot.py`
- [Use-of-force data](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/uof_dashboard_data.py): `dashboard/uof_dashboard_data.py`
- [Use-of-force source](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/uof_source.py): `dashboard/uof_source.py`
- [Use-of-force snapshot](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/dashboard/uof_snapshot.py): `dashboard/uof_snapshot.py`

### Forecast modeling

- [Target features](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/features/xgboost.py): `forecasting/features/xgboost.py`
- [Calendar features](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/features/calendar.py): `forecasting/features/calendar.py`
- [XGBoost backtests](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/backtests/xgboost.py): `forecasting/backtests/xgboost.py`
- [SARIMA backtests](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/backtests/sarima.py): `forecasting/backtests/sarima.py`
- [Top-10 evaluation](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/evaluation/top10.py): `forecasting/evaluation/top10.py`

### Forecast production

- [SPD forecast data refresh](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/data_refresh.py): `forecasting/production/data_refresh.py`
- [Production XGBoost](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/xgboost.py): `forecasting/production/xgboost.py`
- [Forecast inference](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/inference.py): `forecasting/production/inference.py`
- [Forecast snapshots](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/paths.py): `forecasting/paths.py`
- [Forecast monitoring](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/monitoring.py): `forecasting/production/monitoring.py`
- [Daily orchestration](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/forecasting/production/orchestration.py): `forecasting/production/orchestration.py`

### Other components

- **Dashboard user**
- **SPD call records**
- **Seattle Open Data**
- [Daily runner](https://github.com/benji-carr/seattle-area-public-safety-dashboard/blob/main/scripts/forecasting/run_xgboost_daily_pipeline.py): `scripts/forecasting/run_xgboost_daily_pipeline.py`

## Connections

- Dashboard user → Dash application: opens (evidence: `README.md`)
- Dash application → Calls support data: loads context (evidence: `app.py`)
- Dash application → Crime dashboard data: loads context (evidence: `app.py`)
- Dash application → Crime components: renders (evidence: `app.py`)
- Dash application → Crime figures: uses (evidence: `app.py`)
- Dash application → Crime controls: uses (evidence: `app.py`)
- Crime components → Crime dashboard data: uses (evidence: `dashboard/crime_dashboard_components.py`)
- Crime components → Crime controls: uses (evidence: `dashboard/crime_dashboard_components.py`)
- Crime components → Crime figures: uses
- Crime controls → Analysis windows: uses (evidence: `dashboard/crime_controls.py`)
- Crime figures → Crime dashboard data: uses (evidence: `dashboard/crime_dashboard_figures.py`)
- Crime figures → Analysis windows: uses (evidence: `dashboard/crime_dashboard_figures.py`)
- Crime dashboard data → Crime classification: classifies (evidence: `dashboard/crime_dashboard_data.py`)
- Crime dashboard data → Crime snapshot: loads (evidence: `dashboard/crime_dashboard_data.py`)
- Crime dashboard data → Population snapshot: loads (evidence: `dashboard/crime_dashboard_data.py`)
- Population data → Population snapshot: persists
- Calls support data → SPD snapshot: loads (evidence: `dashboard/crime_call_support_data.py`)
- Call metrics refresh → SPD snapshot: refreshes
- Use-of-force data → Use-of-force source: fetches (evidence: `dashboard/uof_dashboard_data.py`)
- Use-of-force data → Use-of-force snapshot: loads (evidence: `dashboard/uof_dashboard_data.py`)
- SPD dashboard data → SPD snapshot: loads
- SPD source → Seattle Open Data: fetches
- Crime source → Seattle Open Data: fetches
- Use-of-force source → Seattle Open Data: fetches
- Daily runner → Daily orchestration: runs (evidence: `scripts/forecasting/run_xgboost_daily_pipeline.py`)
- Daily orchestration → SPD forecast data refresh: refreshes data (evidence: `forecasting/production/orchestration.py`)
- Daily orchestration → Forecast inference: runs inference (evidence: `forecasting/production/orchestration.py`)
- Daily orchestration → Forecast monitoring: runs monitoring (evidence: `forecasting/production/orchestration.py`)
- SPD forecast data refresh → SPD source: fetches calls (evidence: `forecasting/production/data_refresh.py`)
- SPD forecast data refresh → Target features: builds panel (evidence: `forecasting/production/data_refresh.py`)
- Forecast inference → Target features: builds features (evidence: `forecasting/production/inference.py`)
- Forecast inference → Production XGBoost: loads model (evidence: `forecasting/production/inference.py`)
- Forecast inference → Forecast snapshots: writes forecasts (evidence: `forecasting/production/inference.py`)
- Forecast monitoring → Forecast snapshots: reads snapshots (evidence: `forecasting/production/monitoring.py`)
- Forecast monitoring → Top-10 evaluation: evaluates ranks (evidence: `forecasting/production/monitoring.py`)
- Forecast monitoring → Target features: prepares panel (evidence: `forecasting/production/monitoring.py`)
- Target features → Calendar features: adds calendar (evidence: `forecasting/features/xgboost.py`)
- XGBoost backtests → Target features: uses features (evidence: `forecasting/backtests/xgboost.py`)
- XGBoost backtests → SARIMA backtests: compares baseline (evidence: `forecasting/backtests/xgboost.py`)
- Production XGBoost → XGBoost backtests: trains from (evidence: `forecasting/production/xgboost.py`)
- SPD forecast data refresh → SPD call records: collects (evidence: `forecasting/production/data_refresh.py`)
