# s-w-leong/fireguard architecture

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

- Interactive diagram: https://gitdiagram.com/s-w-leong/fireguard
- Repository: https://github.com/s-w-leong/fireguard

## Overview

FireGuard combines a historical fire-risk dashboard with a separate local satellite-imagery comparison prototype. The dashboard workflow loads a verified, bundled dataset, ranks cells for a selected week and exposure policy, then presents monitoring plans and retrospective comparisons. Offline model development and packaging support that handoff. The satellite workflow requests before/after imagery and optionally overlays experimental U-Net change candidates. Connections follow the excerpts, SOURCE INDEX references, or README; unsampled implementation details are omitted.

Main entry points: [`app.py`](https://github.com/s-w-leong/fireguard/blob/main/app.py) (Dashboard UI), [`fireguard/select_mvp.py`](https://github.com/s-w-leong/fireguard/blob/main/fireguard/select_mvp.py) (MVP selection), [`fireguard/train_environment.py`](https://github.com/s-w-leong/fireguard/blob/main/fireguard/train_environment.py) (Logistic experiment), [`fireguard/boosted_model.py`](https://github.com/s-w-leong/fireguard/blob/main/fireguard/boosted_model.py) (Boosted challenger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Risk dashboard"]
  node_dashboard_app["Dashboard UI<br/>[app.py]"]
  node_ranking["Exposure ranking<br/>[dashboard_data.py]"]
  node_metrics["Capture metrics"]
end

subgraph group_models["Model development"]
  node_model_dev["Logistic experiment"]
  node_model_features["Feature and cohort rules<br/>[revised_model.py]"]
  node_model_select["MVP selection<br/>[select_mvp.py]"]
  node_boosted["Boosted challenger<br/>[boosted_model.py]"]
end

subgraph group_satellite["Satellite comparison"]
  node_sat_ui["Comparison interface<br/>[index.html]"]
  node_sat_server["Imagery service<br/>[server.py]"]
  node_unet_runtime["U-Net inference<br/>[model_runtime.py]"]
end

subgraph group_bundle["Runtime data"]
  node_bundle_loader["Verified data loader<br/>[data_loader.py]"]
  node_dashboard_bundle[("Dashboard bundle")]
  node_bundle_builder["Bundle builder"]
end

node_analyst(("Decision analyst"))
node_sat_user(("Satellite user"))
node_sentinel{{"Sentinel Hub"}}

node_analyst -->|"configures view"| node_dashboard_app
node_dashboard_app -->|"loads data"| node_bundle_loader
node_bundle_loader -->|"verifies and reads"| node_dashboard_bundle
node_dashboard_app -->|"ranks cells"| node_ranking
node_dashboard_app -->|"evaluates plans"| node_ranking
node_ranking -->|"computes metrics"| node_metrics
node_analyst -->|"requests new bundle"| node_bundle_builder
node_bundle_builder -.->|"builds bundle"| node_dashboard_bundle
node_model_dev -->|"uses features"| node_model_features
node_model_dev -->|"evaluates weekly"| node_metrics
node_model_select -->|"uses cohort rules"| node_model_features
node_model_select -->|"uses experiment helpers"| node_model_dev
node_boosted -->|"uses features"| node_model_features
node_boosted -->|"checks adoption gate"| node_model_select
node_boosted -->|"uses experiment helpers"| node_model_dev
node_model_select -.->|"supplies selected model"| node_bundle_builder
node_sat_user -->|"chooses comparison"| node_sat_ui
node_sat_ui -->|"requests imagery"| node_sat_server
node_sat_server -->|"requests scenes"| node_sentinel
node_sat_server -->|"runs optional analysis"| node_unet_runtime

click node_dashboard_app "https://github.com/s-w-leong/fireguard/blob/main/app.py"
click node_bundle_loader "https://github.com/s-w-leong/fireguard/blob/main/data_loader.py"
click node_dashboard_bundle "https://github.com/s-w-leong/fireguard/tree/main/data/dashboard"
click node_ranking "https://github.com/s-w-leong/fireguard/blob/main/fireguard/dashboard_data.py"
click node_metrics "https://github.com/s-w-leong/fireguard/blob/main/fireguard/monitoring_metrics.py"
click node_bundle_builder "https://github.com/s-w-leong/fireguard/blob/main/fireguard/dashboard_bundle.py"
click node_model_dev "https://github.com/s-w-leong/fireguard/blob/main/fireguard/train_environment.py"
click node_model_features "https://github.com/s-w-leong/fireguard/blob/main/fireguard/revised_model.py"
click node_model_select "https://github.com/s-w-leong/fireguard/blob/main/fireguard/select_mvp.py"
click node_boosted "https://github.com/s-w-leong/fireguard/blob/main/fireguard/boosted_model.py"
click node_sat_ui "https://github.com/s-w-leong/fireguard/blob/main/satellite_app/index.html"
click node_sat_server "https://github.com/s-w-leong/fireguard/blob/main/satellite_app/server.py"
click node_unet_runtime "https://github.com/s-w-leong/fireguard/blob/main/satellite_app/model_runtime.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_dashboard_app,node_ranking,node_metrics,node_sat_user toneBlue
class node_model_dev,node_model_features,node_model_select,node_boosted toneAmber
class node_sat_ui,node_sat_server,node_unet_runtime toneMint
class node_bundle_loader,node_dashboard_bundle,node_bundle_builder toneRose
class node_analyst,node_sentinel toneIndigo
```

## Components

### Risk dashboard

- [Dashboard UI](https://github.com/s-w-leong/fireguard/blob/main/app.py): `app.py`
- [Exposure ranking](https://github.com/s-w-leong/fireguard/blob/main/fireguard/dashboard_data.py): `fireguard/dashboard_data.py`
- [Capture metrics](https://github.com/s-w-leong/fireguard/blob/main/fireguard/monitoring_metrics.py): `fireguard/monitoring_metrics.py`

### Model development

- [Logistic experiment](https://github.com/s-w-leong/fireguard/blob/main/fireguard/train_environment.py): `fireguard/train_environment.py`
- [Feature and cohort rules](https://github.com/s-w-leong/fireguard/blob/main/fireguard/revised_model.py): `fireguard/revised_model.py`
- [MVP selection](https://github.com/s-w-leong/fireguard/blob/main/fireguard/select_mvp.py): `fireguard/select_mvp.py`
- [Boosted challenger](https://github.com/s-w-leong/fireguard/blob/main/fireguard/boosted_model.py): `fireguard/boosted_model.py`

### Satellite comparison

- [Comparison interface](https://github.com/s-w-leong/fireguard/blob/main/satellite_app/index.html): `satellite_app/index.html`
- [Imagery service](https://github.com/s-w-leong/fireguard/blob/main/satellite_app/server.py): `satellite_app/server.py`
- [U-Net inference](https://github.com/s-w-leong/fireguard/blob/main/satellite_app/model_runtime.py): `satellite_app/model_runtime.py`

### Runtime data

- [Verified data loader](https://github.com/s-w-leong/fireguard/blob/main/data_loader.py): `data_loader.py`
- [Dashboard bundle](https://github.com/s-w-leong/fireguard/tree/main/data/dashboard): `data/dashboard`
- [Bundle builder](https://github.com/s-w-leong/fireguard/blob/main/fireguard/dashboard_bundle.py): `fireguard/dashboard_bundle.py`

### Other components

- **Decision analyst**
- **Satellite user**
- **Sentinel Hub**

## Connections

- Decision analyst → Dashboard UI: configures view (evidence: `README.md`)
- Dashboard UI → Verified data loader: loads data (evidence: `app.py`)
- Verified data loader → Dashboard bundle: verifies and reads (evidence: `data_loader.py`)
- Dashboard UI → Exposure ranking: ranks cells (evidence: `app.py`)
- Dashboard UI → Exposure ranking: evaluates plans (evidence: `app.py`)
- Exposure ranking → Capture metrics: computes metrics (evidence: `fireguard/dashboard_data.py`)
- Decision analyst → Bundle builder: requests new bundle (evidence: `README.md`)
- Bundle builder → Dashboard bundle: builds bundle
- Logistic experiment → Feature and cohort rules: uses features (evidence: `fireguard/train_environment.py`)
- Logistic experiment → Capture metrics: evaluates weekly (evidence: `fireguard/train_environment.py`)
- MVP selection → Feature and cohort rules: uses cohort rules (evidence: `fireguard/select_mvp.py`)
- MVP selection → Logistic experiment: uses experiment helpers (evidence: `fireguard/select_mvp.py`)
- Boosted challenger → Feature and cohort rules: uses features (evidence: `fireguard/boosted_model.py`)
- Boosted challenger → MVP selection: checks adoption gate (evidence: `fireguard/boosted_model.py`)
- Boosted challenger → Logistic experiment: uses experiment helpers (evidence: `fireguard/boosted_model.py`)
- MVP selection → Bundle builder: supplies selected model
- Satellite user → Comparison interface: chooses comparison (evidence: `README.md`)
- Comparison interface → Imagery service: requests imagery (evidence: `README.md`)
- Imagery service → Sentinel Hub: requests scenes (evidence: `README.md`)
- Imagery service → U-Net inference: runs optional analysis (evidence: `satellite_app/server.py`)
