# stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources architecture

> Architecture diagram of the GitHub repository stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources
- Repository: https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources

## Overview

This prototype turns FIRMS-format thermal observations and facility records into contextualized, classified, persistence-scored, and risk-ranked events, then serves them through a GIS dashboard. The main runtime path is CSV ingestion and cleaning, proximity enrichment, spatial persistence analysis, ML inference, risk scoring, and API delivery. The dashboard also supports filtering, event inspection, and ad hoc prediction; OSM lookup is an optional integration. Pipeline ordering and module calls are supported by sampled source; some dashboard and API details rely on README documentation and partial excerpts.

Main entry points: [`src/pipeline.py`](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/pipeline.py) (Pipeline Runner), [`src/api.py`](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/api.py) (REST API), [`static/app.js`](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/static/app.js) (Dashboard Logic), [`src/ingestion.py`](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/ingestion.py) (Data Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_processing["Event Processing"]
  node_ingestion["Data Ingestion<br/>[ingestion.py]"]
  node_cleaning["Data Cleaning<br/>[cleaning.py]"]
  node_pipeline["Pipeline Runner<br/>[pipeline.py]"]
end

subgraph group_intelligence["Analysis Engines"]
  node_geospatial["Proximity Context<br/>[geospatial.py]"]
  node_persistence["Persistence Analysis<br/>[persistence.py]"]
  node_classifier["ML Classifier<br/>[ml_classifier.py]"]
  node_model_cache["Model Cache"]
  node_risk["Risk Scoring<br/>[risk_engine.py]"]
end

subgraph group_service["API Service"]
  node_api["REST API<br/>[api.py]"]
  node_event_state[("In-memory Results<br/>[api.py]")]
end

subgraph group_dashboard["GIS Dashboard"]
  node_frontend["Dashboard Logic<br/>[app.js]"]
  node_page["Dashboard Page<br/>[index.html]"]
  node_styles["Dashboard Styles<br/>[style.css]"]
end

node_operator(("User"))
node_runner["Demo Runner<br/>[run_demo.py]"]
node_hotspot_csv["Hotspot CSV"]
node_facility_csv["Facility CSV"]
node_training_csv["Training CSV"]
node_osm["OSM Overpass"]
node_browser(("Web Browser"))
node_map_tiles["Map Tile Providers"]

node_operator -->|"starts"| node_runner
node_runner -->|"runs"| node_pipeline
node_runner -->|"starts server"| node_api
node_pipeline -->|"loads data"| node_ingestion
node_hotspot_csv -->|"hotspot records"| node_ingestion
node_facility_csv -->|"facility records"| node_ingestion
node_ingestion -->|"cleans hotspots"| node_cleaning
node_pipeline -->|"enriches proximity"| node_geospatial
node_ingestion -->|"returns datasets"| node_pipeline
node_pipeline -->|"groups events"| node_persistence
node_pipeline -->|"classifies events"| node_classifier
node_training_csv -->|"training records"| node_classifier
node_classifier -->|"loads or saves"| node_model_cache
node_pipeline -->|"scores events"| node_risk
node_geospatial -.->|"optional lookup"| node_osm
node_api -->|"runs at startup"| node_pipeline
node_api -->|"stores results"| node_event_state
node_api -->|"reads results"| node_event_state
node_browser -->|"requests page"| node_page
node_page -->|"loads script"| node_frontend
node_page -->|"loads styles"| node_styles
node_frontend -->|"fetches events"| node_api
node_frontend -->|"fetches facilities"| node_api
node_frontend -->|"requests prediction"| node_api
node_frontend -->|"requests tiles"| node_map_tiles
node_api -->|"returns data"| node_browser

click node_runner "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/run_demo.py"
click node_hotspot_csv "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/data/demo_firms_hotspots.csv"
click node_facility_csv "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/data/demo_industrial_facilities.csv"
click node_training_csv "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/data/demo_ml_training_data.csv"
click node_ingestion "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/ingestion.py"
click node_cleaning "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/cleaning.py"
click node_pipeline "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/pipeline.py"
click node_geospatial "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/geospatial.py"
click node_persistence "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/persistence.py"
click node_classifier "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/ml_classifier.py"
click node_model_cache "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/data/baseline_random_forest.joblib"
click node_risk "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/risk_engine.py"
click node_api "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/api.py"
click node_event_state "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/api.py"
click node_frontend "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/static/app.js"
click node_page "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/static/index.html"
click node_styles "https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/static/style.css"

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_ingestion,node_cleaning,node_pipeline,node_operator,node_browser toneBlue
class node_geospatial,node_persistence,node_classifier,node_model_cache,node_risk toneAmber
class node_api,node_event_state toneMint
class node_frontend,node_page,node_styles toneRose
class node_runner,node_hotspot_csv,node_facility_csv,node_training_csv toneTeal
class node_osm,node_map_tiles toneIndigo
```

## Components

### Event Processing

- [Data Ingestion](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/ingestion.py): `src/ingestion.py`
- [Data Cleaning](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/cleaning.py): `src/cleaning.py`
- [Pipeline Runner](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/pipeline.py): `src/pipeline.py`

### Analysis Engines

- [Proximity Context](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/geospatial.py): `src/geospatial.py`
- [Persistence Analysis](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/persistence.py): `src/persistence.py`
- [ML Classifier](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/ml_classifier.py): `src/ml_classifier.py`
- [Model Cache](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/data/baseline_random_forest.joblib): `data/baseline_random_forest.joblib`
- [Risk Scoring](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/risk_engine.py): `src/risk_engine.py`

### API Service

- [REST API](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/api.py): `src/api.py`
- [In-memory Results](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/src/api.py): `src/api.py`

### GIS Dashboard

- [Dashboard Logic](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/static/app.js): `static/app.js`
- [Dashboard Page](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/static/index.html): `static/index.html`
- [Dashboard Styles](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/static/style.css): `static/style.css`

### Other components

- **User**
- [Demo Runner](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/run_demo.py): `run_demo.py`
- [Hotspot CSV](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/data/demo_firms_hotspots.csv): `data/demo_firms_hotspots.csv`
- [Facility CSV](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/data/demo_industrial_facilities.csv): `data/demo_industrial_facilities.csv`
- [Training CSV](https://github.com/stpanirudh/ai-based-detection-and-classification-of-industrial-fires-and-persistent-thermal-sources/blob/main/data/demo_ml_training_data.csv): `data/demo_ml_training_data.csv`
- **OSM Overpass**
- **Web Browser**
- **Map Tile Providers**

## Connections

- User → Demo Runner: starts
- Demo Runner → Pipeline Runner: runs
- Demo Runner → REST API: starts server
- Pipeline Runner → Data Ingestion: loads data
- Hotspot CSV → Data Ingestion: hotspot records
- Facility CSV → Data Ingestion: facility records
- Data Ingestion → Data Cleaning: cleans hotspots
- Pipeline Runner → Proximity Context: enriches proximity
- Data Ingestion → Pipeline Runner: returns datasets
- Pipeline Runner → Persistence Analysis: groups events
- Pipeline Runner → ML Classifier: classifies events
- Training CSV → ML Classifier: training records
- ML Classifier → Model Cache: loads or saves
- Pipeline Runner → Risk Scoring: scores events
- Proximity Context → OSM Overpass: optional lookup
- REST API → Pipeline Runner: runs at startup
- REST API → In-memory Results: stores results
- REST API → In-memory Results: reads results
- Web Browser → Dashboard Page: requests page
- Dashboard Page → Dashboard Logic: loads script
- Dashboard Page → Dashboard Styles: loads styles
- Dashboard Logic → REST API: fetches events
- Dashboard Logic → REST API: fetches facilities
- Dashboard Logic → REST API: requests prediction
- Dashboard Logic → Map Tile Providers: requests tiles
- REST API → Web Browser: returns data
