# paliiixray/sih-thermal-intel architecture

> Architecture diagram of the GitHub repository paliiixray/sih-thermal-intel, 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/paliiixray/sih-thermal-intel
- Repository: https://github.com/paliiixray/sih-thermal-intel

## Overview

FireSense turns satellite thermal detections into classified, contextualized, prioritized incidents, then supports analyst review, government command, responder operations, and public advisories. The legacy HTTP server and FastAPI backend are parallel runtime surfaces; README says the public deployment still uses the legacy handler while FastAPI runs separately. Sampled source shows the legacy pipeline’s enrichment sequence and FastAPI incident-service calls. Several dashboard and API capabilities are documented but their implementation was not sampled, so those links are documentation-backed.

Main entry points: [`app.py`](https://github.com/paliiixray/sih-thermal-intel/blob/main/app.py) (Legacy HTTP server), [`backend/pipeline.py`](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/pipeline.py) (Hotspot pipeline), [`backend/app/api/incidents.py`](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/api/incidents.py) (Incident API), [`backend/app/db/session.py`](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/db/session.py) (PostgreSQL/PostGIS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Detection and Enrichment"]
  node_firms["FIRMS client<br/>[firms_api.py]"]
  node_pipeline["Hotspot pipeline<br/>[pipeline.py]"]
  node_osm["OSM correlator<br/>[osm_correlator.py]"]
  node_persistence["Persistence baseline"]
  node_landcover["Land-cover resolver<br/>[landcover.py]"]
  node_legacy_classifier["Thermal classifier<br/>[classifier.py]"]
end

subgraph group_backend["Incident Intelligence"]
  node_incident_engine["Incident records<br/>[incident_engine.py]"]
  node_risk["Priority risk engine<br/>[engine.py]"]
  node_context["Geospatial context<br/>[context.py]"]
  node_ml_classifier["ML classification<br/>[classifier.py]"]
end

subgraph group_ops["Operations and Safety"]
  node_audit["Incident audit trail<br/>[incident_logger.py]"]
  node_state["Lifecycle state machine<br/>[state_machine.py]"]
  node_alerts["Simulated alerting<br/>[alerts.py]"]
end

subgraph group_ui["Operational Interfaces"]
  node_ntro["NTRO dossier<br/>[NTRO.jsx]"]
  node_government["Government command"]
  node_responders["Responder operations"]
  node_public["Public safety advisory<br/>[public.py]"]
  node_api_client["Frontend API client<br/>[api.js]"]
end

subgraph group_platform["API and Persistence"]
  node_legacy_server["Legacy HTTP server<br/>[app.py]"]
  node_incident_api["Incident API<br/>[incidents.py]"]
  node_fastapi["FastAPI entrypoint<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_database[("PostgreSQL/PostGIS<br/>[session.py]")]
end

node_satellite(("Satellite detections"))

node_satellite -.->|"provides detections"| node_firms
node_firms -->|"fetches hotspots"| node_pipeline
node_pipeline -->|"correlates context"| node_osm
node_pipeline -->|"calculates persistence"| node_persistence
node_pipeline -->|"resolves cover"| node_landcover
node_pipeline -->|"classifies hotspots"| node_legacy_classifier
node_legacy_server -->|"runs pipeline"| node_pipeline
node_legacy_server -->|"serves incidents"| node_incident_engine
node_incident_api -->|"gets context"| node_context
node_incident_api -->|"scores priority"| node_risk
node_incident_api -->|"classifies incidents"| node_ml_classifier
node_fastapi -->|"registers routes"| node_incident_api
node_fastapi -->|"registers routes"| node_auth
node_incident_api -->|"queries and updates"| node_database
node_context -->|"queries spatial data"| node_database
node_auth -->|"loads user"| node_database
node_legacy_server -->|"reads status log"| node_audit
node_legacy_server -.->|"validates transitions"| node_state
node_legacy_server -.->|"dispatches alerts"| node_alerts
node_ntro -->|"requests data"| node_api_client
node_api_client -.->|"calls API"| node_legacy_server
node_government -.->|"uses operations API"| node_legacy_server
node_responders -.->|"updates field status"| node_legacy_server
node_public -.->|"reads advisories"| node_database

click node_firms "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/firms_api.py"
click node_pipeline "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/pipeline.py"
click node_osm "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/osm_correlator.py"
click node_persistence "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/persistence_engine.py"
click node_landcover "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/landcover.py"
click node_legacy_classifier "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/classifier.py"
click node_legacy_server "https://github.com/paliiixray/sih-thermal-intel/blob/main/app.py"
click node_incident_engine "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/incident_engine.py"
click node_risk "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/services/risk/engine.py"
click node_context "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/services/geospatial/context.py"
click node_ml_classifier "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/services/ml/classifier.py"
click node_incident_api "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/api/incidents.py"
click node_fastapi "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/main.py"
click node_auth "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/core/auth.py"
click node_database "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/db/session.py"
click node_audit "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/incident_logger.py"
click node_state "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/state_machine.py"
click node_alerts "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/alerts.py"
click node_ntro "https://github.com/paliiixray/sih-thermal-intel/blob/main/frontend/pages/NTRO.jsx"
click node_government "https://github.com/paliiixray/sih-thermal-intel/blob/main/static/components/government/GovernmentCommand.jsx"
click node_responders "https://github.com/paliiixray/sih-thermal-intel/blob/main/static/components/responder/ResponderOperations.jsx"
click node_public "https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/api/public.py"
click node_api_client "https://github.com/paliiixray/sih-thermal-intel/blob/main/frontend/services/api.js"

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_firms,node_pipeline,node_osm,node_persistence,node_landcover,node_legacy_classifier toneBlue
class node_incident_engine,node_risk,node_context,node_ml_classifier toneAmber
class node_audit,node_state,node_alerts toneMint
class node_ntro,node_government,node_responders,node_public,node_api_client toneRose
class node_legacy_server,node_incident_api,node_fastapi,node_auth,node_database,node_satellite toneIndigo
```

## Components

### Detection and Enrichment

- [FIRMS client](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/firms_api.py): `backend/firms_api.py`
- [Hotspot pipeline](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/pipeline.py): `backend/pipeline.py`
- [OSM correlator](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/osm_correlator.py): `backend/osm_correlator.py`
- [Persistence baseline](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/persistence_engine.py): `backend/persistence_engine.py`
- [Land-cover resolver](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/landcover.py): `backend/landcover.py`
- [Thermal classifier](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/classifier.py): `backend/classifier.py`

### Incident Intelligence

- [Incident records](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/incident_engine.py): `backend/incident_engine.py`
- [Priority risk engine](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/services/risk/engine.py): `backend/app/services/risk/engine.py`
- [Geospatial context](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/services/geospatial/context.py): `backend/app/services/geospatial/context.py`
- [ML classification](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/services/ml/classifier.py): `backend/app/services/ml/classifier.py`

### Operations and Safety

- [Incident audit trail](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/incident_logger.py): `backend/incident_logger.py`
- [Lifecycle state machine](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/state_machine.py): `backend/state_machine.py`
- [Simulated alerting](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/alerts.py): `backend/alerts.py`

### Operational Interfaces

- [NTRO dossier](https://github.com/paliiixray/sih-thermal-intel/blob/main/frontend/pages/NTRO.jsx): `frontend/pages/NTRO.jsx`
- [Government command](https://github.com/paliiixray/sih-thermal-intel/blob/main/static/components/government/GovernmentCommand.jsx): `static/components/government/GovernmentCommand.jsx`
- [Responder operations](https://github.com/paliiixray/sih-thermal-intel/blob/main/static/components/responder/ResponderOperations.jsx): `static/components/responder/ResponderOperations.jsx`
- [Public safety advisory](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/api/public.py): `backend/app/api/public.py`
- [Frontend API client](https://github.com/paliiixray/sih-thermal-intel/blob/main/frontend/services/api.js): `frontend/services/api.js`

### API and Persistence

- [Legacy HTTP server](https://github.com/paliiixray/sih-thermal-intel/blob/main/app.py): `app.py`
- [Incident API](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/api/incidents.py): `backend/app/api/incidents.py`
- [FastAPI entrypoint](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/core/auth.py): `backend/app/core/auth.py`
- [PostgreSQL/PostGIS](https://github.com/paliiixray/sih-thermal-intel/blob/main/backend/app/db/session.py): `backend/app/db/session.py`

### Other components

- **Satellite detections**

## Connections

- Satellite detections → FIRMS client: provides detections
- FIRMS client → Hotspot pipeline: fetches hotspots (evidence: `backend/pipeline.py`)
- Hotspot pipeline → OSM correlator: correlates context (evidence: `backend/pipeline.py`)
- Hotspot pipeline → Persistence baseline: calculates persistence (evidence: `backend/pipeline.py`)
- Hotspot pipeline → Land-cover resolver: resolves cover (evidence: `backend/pipeline.py`)
- Hotspot pipeline → Thermal classifier: classifies hotspots (evidence: `backend/pipeline.py`)
- Legacy HTTP server → Hotspot pipeline: runs pipeline (evidence: `app.py`)
- Legacy HTTP server → Incident records: serves incidents (evidence: `app.py`)
- Incident API → Geospatial context: gets context (evidence: `backend/app/api/incidents.py`)
- Incident API → Priority risk engine: scores priority (evidence: `backend/app/api/incidents.py`)
- Incident API → ML classification: classifies incidents (evidence: `backend/app/api/incidents.py`)
- FastAPI entrypoint → Incident API: registers routes (evidence: `backend/app/main.py`)
- FastAPI entrypoint → Authentication: registers routes (evidence: `backend/app/main.py`)
- Incident API → PostgreSQL/PostGIS: queries and updates (evidence: `backend/app/api/incidents.py`)
- Geospatial context → PostgreSQL/PostGIS: queries spatial data (evidence: `backend/app/services/geospatial/context.py`)
- Authentication → PostgreSQL/PostGIS: loads user (evidence: `backend/app/core/auth.py`)
- Legacy HTTP server → Incident audit trail: reads status log (evidence: `app.py`)
- Legacy HTTP server → Lifecycle state machine: validates transitions (evidence: `app.py`)
- Legacy HTTP server → Simulated alerting: dispatches alerts (evidence: `app.py`)
- NTRO dossier → Frontend API client: requests data (evidence: `frontend/pages/NTRO.jsx`)
- Frontend API client → Legacy HTTP server: calls API
- Government command → Legacy HTTP server: uses operations API
- Responder operations → Legacy HTTP server: updates field status
- Public safety advisory → PostgreSQL/PostGIS: reads advisories (evidence: `backend/app/api/public.py`)
