# 1rishipathak/pyroscan architecture

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

- Interactive diagram: https://gitdiagram.com/1rishipathak/pyroscan
- Repository: https://github.com/1rishipathak/pyroscan

## Overview

PyroScan maps seasonal Sentinel-2 burn scars to reveal farmland burns missed by official fire counts, then adds contextual evidence and publishes results through a dashboard. The graph includes the documented training, analysis, official-source, emissions, hotspot, news, and INSAT capabilities. Some pipeline scripts and the API were not sampled, so only documented or indexed relationships are shown; optional or uncertain wiring is omitted.

Main entry points: [`pyroscan/config.py`](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/config.py) (Study configuration), [`scripts/08_web_assets.py`](https://github.com/1rishipathak/pyroscan/blob/main/scripts/08_web_assets.py) (Dashboard data generation), [`scripts/05_infer.py`](https://github.com/1rishipathak/pyroscan/blob/main/scripts/05_infer.py) (Season inference), [`pyroscan/s2.py`](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/s2.py) (Scene access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_burn["Burn analysis"]
  node_config["Study configuration<br/>[config.py]"]
  node_scene_access["Scene access<br/>[s2.py]"]
  node_timeline["Clear-look timeline<br/>[timeline.py]"]
  node_indices["Burn indices and labels<br/>[indices.py]"]
  node_training["U-Net training<br/>[04_train.py]"]
  node_model["U-Net model<br/>[model.py]"]
  node_inference["Season inference<br/>[05_infer.py]"]
end

subgraph group_context["Fire context"]
  node_official_sources["Official count ingestion<br/>[sources.py]"]
  node_tinyfish["TinyFish client<br/>[tinyfish_client.py]"]
  node_news["Enforcement news<br/>[news.py]"]
  node_firms["FIRMS detections<br/>[firms.py]"]
  node_insat["INSAT fire analysis<br/>[mosdac.py]"]
end

subgraph group_publish["Results and dashboard"]
  node_emissions["Smoke estimates<br/>[emissions.py]"]
  node_geo["Punjab geography<br/>[geo.py]"]
  node_hotspots["Village hotspots<br/>[08b_hotspots.py]"]
  node_assets["Dashboard data generation<br/>[08_web_assets.py]"]
  node_dashboard["Interactive dashboard<br/>[app.js]"]
  node_api["HTTP API<br/>[main.py]"]
  node_timelapse["Season timelapse<br/>[11_timelapse.py]"]
end

subgraph group_external["External data"]
  node_s2[("Sentinel-2 scenes")]
  node_official["Official bulletins"]
  node_tinyfish_service{{"TinyFish APIs"}}
  node_insat_service[("INSAT-3DR scans")]
end

node_researcher(("Analyst"))

node_scene_access -->|"uses settings"| node_config
node_timeline -->|"uses settings"| node_config
node_timeline -->|"loads scenes"| node_scene_access
node_training -->|"uses settings"| node_config
node_training -->|"trains"| node_model
node_inference -->|"uses settings"| node_config
node_inference -->|"uses burn indices"| node_indices
node_inference -->|"walks scenes"| node_timeline
node_inference -->|"runs model"| node_model
node_official_sources -->|"uses settings"| node_config
node_official_sources -->|"fetches bulletins"| node_tinyfish
node_tinyfish -->|"queries"| node_tinyfish_service
node_news -->|"uses settings"| node_config
node_news -->|"searches and reads"| node_tinyfish
node_insat -->|"reads fire scans"| node_insat_service
node_assets -->|"uses settings"| node_config
node_assets -->|"calculates emissions"| node_emissions
node_assets -->|"uses scene data"| node_scene_access
node_assets -->|"uses geography"| node_geo
node_assets -->|"publishes dashboard data"| node_dashboard
node_hotspots -->|"uses settings"| node_config
node_researcher -->|"views results"| node_dashboard
node_researcher -.->|"requests data"| node_api
node_timelapse -->|"uses settings"| node_config
node_s2 -->|"provides imagery"| node_scene_access
node_official -->|"provides bulletins"| node_official_sources

click node_config "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/config.py"
click node_scene_access "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/s2.py"
click node_timeline "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/timeline.py"
click node_indices "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/indices.py"
click node_training "https://github.com/1rishipathak/pyroscan/blob/main/scripts/04_train.py"
click node_model "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/model.py"
click node_inference "https://github.com/1rishipathak/pyroscan/blob/main/scripts/05_infer.py"
click node_official_sources "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/sources.py"
click node_tinyfish "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/tinyfish_client.py"
click node_news "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/news.py"
click node_firms "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/firms.py"
click node_insat "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/mosdac.py"
click node_emissions "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/emissions.py"
click node_geo "https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/geo.py"
click node_hotspots "https://github.com/1rishipathak/pyroscan/blob/main/scripts/08b_hotspots.py"
click node_assets "https://github.com/1rishipathak/pyroscan/blob/main/scripts/08_web_assets.py"
click node_dashboard "https://github.com/1rishipathak/pyroscan/blob/main/web/app.js"
click node_api "https://github.com/1rishipathak/pyroscan/blob/main/api/main.py"
click node_timelapse "https://github.com/1rishipathak/pyroscan/blob/main/scripts/11_timelapse.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_config,node_scene_access,node_timeline,node_indices,node_training,node_model,node_inference toneBlue
class node_official_sources,node_tinyfish,node_news,node_firms,node_insat toneAmber
class node_emissions,node_geo,node_hotspots,node_assets,node_dashboard,node_api,node_timelapse toneMint
class node_s2,node_official,node_tinyfish_service,node_insat_service toneRose
class node_researcher toneIndigo
```

## Components

### Burn analysis

- [Study configuration](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/config.py): `pyroscan/config.py`
- [Scene access](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/s2.py): `pyroscan/s2.py`
- [Clear-look timeline](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/timeline.py): `pyroscan/timeline.py`
- [Burn indices and labels](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/indices.py): `pyroscan/indices.py`
- [U-Net training](https://github.com/1rishipathak/pyroscan/blob/main/scripts/04_train.py): `scripts/04_train.py`
- [U-Net model](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/model.py): `pyroscan/model.py`
- [Season inference](https://github.com/1rishipathak/pyroscan/blob/main/scripts/05_infer.py): `scripts/05_infer.py`

### Fire context

- [Official count ingestion](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/sources.py): `pyroscan/sources.py`
- [TinyFish client](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/tinyfish_client.py): `pyroscan/tinyfish_client.py`
- [Enforcement news](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/news.py): `pyroscan/news.py`
- [FIRMS detections](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/firms.py): `pyroscan/firms.py`
- [INSAT fire analysis](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/mosdac.py): `pyroscan/mosdac.py`

### Results and dashboard

- [Smoke estimates](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/emissions.py): `pyroscan/emissions.py`
- [Punjab geography](https://github.com/1rishipathak/pyroscan/blob/main/pyroscan/geo.py): `pyroscan/geo.py`
- [Village hotspots](https://github.com/1rishipathak/pyroscan/blob/main/scripts/08b_hotspots.py): `scripts/08b_hotspots.py`
- [Dashboard data generation](https://github.com/1rishipathak/pyroscan/blob/main/scripts/08_web_assets.py): `scripts/08_web_assets.py`
- [Interactive dashboard](https://github.com/1rishipathak/pyroscan/blob/main/web/app.js): `web/app.js`
- [HTTP API](https://github.com/1rishipathak/pyroscan/blob/main/api/main.py): `api/main.py`
- [Season timelapse](https://github.com/1rishipathak/pyroscan/blob/main/scripts/11_timelapse.py): `scripts/11_timelapse.py`

### External data

- **Sentinel-2 scenes**
- **Official bulletins**
- **TinyFish APIs**
- **INSAT-3DR scans**

### Other components

- **Analyst**

## Connections

- Scene access → Study configuration: uses settings (evidence: `pyroscan/s2.py`)
- Clear-look timeline → Study configuration: uses settings (evidence: `pyroscan/timeline.py`)
- Clear-look timeline → Scene access: loads scenes (evidence: `pyroscan/timeline.py`)
- U-Net training → Study configuration: uses settings (evidence: `scripts/04_train.py`)
- U-Net training → U-Net model: trains (evidence: `scripts/04_train.py`)
- Season inference → Study configuration: uses settings (evidence: `scripts/05_infer.py`)
- Season inference → Burn indices and labels: uses burn indices (evidence: `scripts/05_infer.py`)
- Season inference → Clear-look timeline: walks scenes (evidence: `scripts/05_infer.py`)
- Season inference → U-Net model: runs model (evidence: `scripts/05_infer.py`)
- Official count ingestion → Study configuration: uses settings (evidence: `pyroscan/sources.py`)
- Official count ingestion → TinyFish client: fetches bulletins (evidence: `pyroscan/sources.py`)
- TinyFish client → TinyFish APIs: queries (evidence: `pyroscan/tinyfish_client.py`)
- Enforcement news → Study configuration: uses settings (evidence: `pyroscan/news.py`)
- Enforcement news → TinyFish client: searches and reads (evidence: `pyroscan/news.py`)
- INSAT fire analysis → INSAT-3DR scans: reads fire scans (evidence: `README.md`)
- Dashboard data generation → Study configuration: uses settings (evidence: `scripts/08_web_assets.py`)
- Dashboard data generation → Smoke estimates: calculates emissions (evidence: `scripts/08_web_assets.py`)
- Dashboard data generation → Scene access: uses scene data (evidence: `scripts/08_web_assets.py`)
- Dashboard data generation → Punjab geography: uses geography (evidence: `scripts/08_web_assets.py`)
- Dashboard data generation → Interactive dashboard: publishes dashboard data (evidence: `README.md`)
- Village hotspots → Study configuration: uses settings (evidence: `scripts/08b_hotspots.py`)
- Analyst → Interactive dashboard: views results (evidence: `README.md`)
- Analyst → HTTP API: requests data
- Season timelapse → Study configuration: uses settings (evidence: `scripts/11_timelapse.py`)
- Sentinel-2 scenes → Scene access: provides imagery (evidence: `pyroscan/s2.py`)
- Official bulletins → Official count ingestion: provides bulletins (evidence: `pyroscan/sources.py`)
