# ahmedshaban0/californiawildfire-prediction-digitaltwin architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedshaban0/californiawildfire-prediction-digitaltwin
- Repository: https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin

## Overview

This is a Streamlit wildfire-risk intelligence application: users navigate to a forecast, map, or digital-twin view; the app presents 24-hour risk estimates and environmental context on California’s grid. The principal forecast path combines regional or manual inputs with weather and cached geographic data, then uses the trained model and feature schema for risk outputs. Separate product branches provide 2D/3D visualization, performance evaluation, methodology, and system information. Relationships below are limited to excerpted imports/calls or README statements; unsampled implementation details are not inferred.

Main entry points: [`app.py`](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/app.py) (Page router), [`src/data_loader.py`](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/data_loader.py) (Grid data access), [`pages_impl/prediction.py`](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/prediction.py) (Prediction workflows), [`src/model_loader.py`](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/model_loader.py) (Inference and schema)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_router["Page router<br/>[app.py]"]
  node_theme["Shared design system<br/>[theme.py]"]
  node_overview["Overview<br/>[overview.py]"]
end

subgraph group_forecast["Risk forecasting"]
  node_prediction["Prediction workflows<br/>[prediction.py]"]
  node_data["Grid data access<br/>[data_loader.py]"]
  node_model["Inference and schema<br/>[model_loader.py]"]
  node_model_artifact["Trained pipeline"]
  node_feature_schema["Feature schema"]
  node_snapshots[("Curated snapshots")]
  node_grid[("Static grid cache")]
end

subgraph group_geospatial["Geospatial views"]
  node_map_page["Interactive map<br/>[interactive_map.py]"]
  node_leaflet["Leaflet renderer<br/>[leaflet_map.py]"]
  node_twin_page["Digital twin page<br/>[digital_twin.py]"]
  node_twin_renderer["2D/3D renderer<br/>[twin_3d.py]"]
end

subgraph group_insight["Model and context"]
  node_performance["Performance evaluation<br/>[performance.py]"]
  node_methodology["Methodology<br/>[methodology.py]"]
  node_about["About and governance<br/>[about.py]"]
end

node_user(("App user"))
node_weather(("Open-Meteo weather"))
node_firms(("NASA FIRMS detections"))

node_user -->|"navigates"| node_router
node_router -->|"applies"| node_theme
node_router -->|"routes to"| node_overview
node_router -->|"routes to"| node_prediction
node_router -->|"routes to"| node_map_page
node_router -->|"routes to"| node_twin_page
node_router -->|"routes to"| node_performance
node_router -->|"routes to"| node_methodology
node_router -->|"routes to"| node_about
node_overview -->|"loads grid data"| node_data
node_overview -->|"loads inference"| node_model
node_overview -->|"renders view"| node_twin_renderer
node_prediction -->|"loads spatial data"| node_data
node_prediction -->|"uses inference"| node_model
node_prediction -->|"renders map"| node_leaflet
node_prediction -.->|"requests forecast"| node_weather
node_model -.->|"loads pipeline"| node_model_artifact
node_model -.->|"loads schema"| node_feature_schema
node_data -.->|"reads snapshots"| node_snapshots
node_data -.->|"reads cache"| node_grid
node_map_page -->|"loads grid data"| node_data
node_map_page -->|"renders map"| node_leaflet
node_leaflet -.->|"displays detections"| node_firms
node_twin_page -->|"loads grid data"| node_data
node_twin_page -->|"renders twin"| node_twin_renderer
node_twin_renderer -.->|"visualizes detections"| node_firms
node_performance -->|"loads pipeline"| node_model

click node_router "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/app.py"
click node_theme "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/theme.py"
click node_overview "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/overview.py"
click node_prediction "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/prediction.py"
click node_data "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/data_loader.py"
click node_model "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/model_loader.py"
click node_model_artifact "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/wildfire_model_pipeline.joblib"
click node_feature_schema "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/feature_schema.json"
click node_snapshots "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/assets/curated_snapshots.parquet"
click node_grid "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/assets/california_grid_static.parquet"
click node_map_page "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/interactive_map.py"
click node_leaflet "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/leaflet_map.py"
click node_twin_page "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/digital_twin.py"
click node_twin_renderer "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/twin_3d.py"
click node_performance "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/performance.py"
click node_methodology "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/methodology.py"
click node_about "https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/about.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_router,node_theme,node_overview,node_user toneBlue
class node_prediction,node_data,node_model,node_model_artifact,node_feature_schema,node_snapshots,node_grid toneAmber
class node_map_page,node_leaflet,node_twin_page,node_twin_renderer toneMint
class node_performance,node_methodology,node_about toneRose
class node_weather,node_firms toneIndigo
```

## Components

### Application

- [Page router](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/app.py): `app.py`
- [Shared design system](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/theme.py): `src/theme.py`
- [Overview](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/overview.py): `pages_impl/overview.py`

### Risk forecasting

- [Prediction workflows](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/prediction.py): `pages_impl/prediction.py`
- [Grid data access](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/data_loader.py): `src/data_loader.py`
- [Inference and schema](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/model_loader.py): `src/model_loader.py`
- [Trained pipeline](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/wildfire_model_pipeline.joblib): `wildfire_model_pipeline.joblib`
- [Feature schema](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/feature_schema.json): `feature_schema.json`
- [Curated snapshots](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/assets/curated_snapshots.parquet): `assets/curated_snapshots.parquet`
- [Static grid cache](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/assets/california_grid_static.parquet): `assets/california_grid_static.parquet`

### Geospatial views

- [Interactive map](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/interactive_map.py): `pages_impl/interactive_map.py`
- [Leaflet renderer](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/leaflet_map.py): `src/leaflet_map.py`
- [Digital twin page](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/digital_twin.py): `pages_impl/digital_twin.py`
- [2D/3D renderer](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/src/twin_3d.py): `src/twin_3d.py`

### Model and context

- [Performance evaluation](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/performance.py): `pages_impl/performance.py`
- [Methodology](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/methodology.py): `pages_impl/methodology.py`
- [About and governance](https://github.com/ahmedshaban0/californiawildfire-prediction-digitaltwin/blob/main/pages_impl/about.py): `pages_impl/about.py`

### Other components

- **App user**
- **Open-Meteo weather**
- **NASA FIRMS detections**

## Connections

- App user → Page router: navigates (evidence: `app.py`)
- Page router → Shared design system: applies (evidence: `app.py`)
- Page router → Overview: routes to (evidence: `app.py`)
- Page router → Prediction workflows: routes to (evidence: `app.py`)
- Page router → Interactive map: routes to (evidence: `app.py`)
- Page router → Digital twin page: routes to (evidence: `app.py`)
- Page router → Performance evaluation: routes to (evidence: `app.py`)
- Page router → Methodology: routes to (evidence: `app.py`)
- Page router → About and governance: routes to (evidence: `app.py`)
- Overview → Grid data access: loads grid data (evidence: `pages_impl/overview.py`)
- Overview → Inference and schema: loads inference (evidence: `pages_impl/overview.py`)
- Overview → 2D/3D renderer: renders view (evidence: `pages_impl/overview.py`)
- Prediction workflows → Grid data access: loads spatial data (evidence: `pages_impl/prediction.py`)
- Prediction workflows → Inference and schema: uses inference (evidence: `pages_impl/prediction.py`)
- Prediction workflows → Leaflet renderer: renders map (evidence: `pages_impl/prediction.py`)
- Prediction workflows → Open-Meteo weather: requests forecast (evidence: `README.md`)
- Inference and schema → Trained pipeline: loads pipeline
- Inference and schema → Feature schema: loads schema
- Grid data access → Curated snapshots: reads snapshots (evidence: `README.md`)
- Grid data access → Static grid cache: reads cache (evidence: `README.md`)
- Interactive map → Grid data access: loads grid data (evidence: `pages_impl/interactive_map.py`)
- Interactive map → Leaflet renderer: renders map (evidence: `pages_impl/interactive_map.py`)
- Leaflet renderer → NASA FIRMS detections: displays detections (evidence: `README.md`)
- Digital twin page → Grid data access: loads grid data (evidence: `pages_impl/digital_twin.py`)
- Digital twin page → 2D/3D renderer: renders twin (evidence: `pages_impl/digital_twin.py`)
- 2D/3D renderer → NASA FIRMS detections: visualizes detections (evidence: `README.md`)
- Performance evaluation → Inference and schema: loads pipeline (evidence: `pages_impl/performance.py`)
