# arkadipsom-code/india-climate-resilience-dashboard architecture

> Architecture diagram of the GitHub repository arkadipsom-code/india-climate-resilience-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arkadipsom-code/india-climate-resilience-dashboard
- Repository: https://github.com/arkadipsom-code/india-climate-resilience-dashboard

## Overview

#### Purpose and Entry Point
This is a Streamlit analytical dashboard for evaluating climate resilience across Indian metropolitan areas, forecasting selected climate trends through 2040, and recommending adaptation-capital allocations. The application entry point and UI composition layer is `app.py`.

#### Data Foundation
The system starts with a city-level historical input matrix in `data/city_data.csv`. This dataset supplies climate, population, water, and infrastructure variables used by both scoring and forecasting workflows. It is the principal boundary between source data and analytical logic.

#### Risk Scoring Pipeline
`modules/risk_engine.py` transforms raw city indicators into comparable 0–100 values through Min-Max standardization, then calculates heatwave, flood, water-stress, population-pressure, and infrastructure-readiness indexes. It combines these into the unified resilience score and maps each city to an operational resilience tier.

Key paths:
- `modules/risk_engine.py`
- `data/city_data.csv`

#### Forecasting Stage
`modules/forecast_engine.py` owns predictive simulation for temperature drift and extreme-weather-event frequency. It uses OLS linear regression to project city trends through 2040. Forecast outputs are a separate analytical input to dashboard reporting and future-oriented risk interpretation rather than a replacement for the base city dataset.

Key paths:
- `modules/forecast_engine.py`
- `data/city_data.csv`

#### Capital Allocation Engine
`modules/investment_engine.py` converts localized vulnerabilities into budget recommendations. It accepts a user-defined adaptation fund pool, up to ₹20,000 Crores according to the product specification, and prioritizes investments toward the highest-risk dimensions and cities.

Key paths:
- `modules/investment_engine.py`
- `modules/risk_engine.py`

#### Dashboard Orchestration and User Boundary
`app.py` orchestrates data loading, calls the risk, forecast, and investment engines, and presents interactive status alerts, visual distributions, maps, and configurable allocation views. Streamlit is the material runtime/UI framework; application dependencies are declared in `requirements.txt`.

Key paths:
- `app.py`
- `requirements.txt`

#### Primary Control Flow
1. Load city data from `data/city_data.csv`.
2. Compute normalized risk vectors, resilience scores, and vulnerability tiers in `modules/risk_engine.py`.
3. Generate long-range climate projections through `modules/forecast_engine.py`.
4. Apply budget and prioritization inputs in `modules/investment_engine.py`.
5. Render current risks, forecasts, and recommended allocations in `app.py`.

The core architectural boundary is between deterministic analytical engines under `modules/` and the Streamlit presentation/orchestration layer in `app.py`.

Main entry points: [`app.py`](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/app.py) (Dashboard orchestration), [`modules/risk_engine.py`](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/modules/risk_engine.py) (Risk scoring engine), [`modules/investment_engine.py`](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/modules/investment_engine.py) (Capital allocation engine), [`data/city_data.csv`](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/data/city_data.csv) (City historical matrix)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard"]
  node_streamlit{{"Streamlit runtime<br/>framework"}}
  node_app["Dashboard orchestration<br/>application entry point<br/>[app.py]"]
  node_fund_input(("Adaptation fund input<br/>user input"))
  node_dashboard_views["Risk, forecast &amp; allocation views<br/>interactive reporting"]
end

subgraph group_engines["Analytical Engines"]
  node_risk["Risk scoring engine<br/>risk analytics<br/>[risk_engine.py]"]
  node_forecast["Forecast engine<br/>predictive simulation<br/>[forecast_engine.py]"]
  node_investment["Capital allocation engine<br/>allocation analytics"]
end

subgraph group_data["Data Foundation"]
  node_city_data[("City historical matrix<br/>CSV dataset<br/>[city_data.csv]")]
end

node_requirements["Application dependencies<br/>dependency manifest<br/>[requirements.txt]"]

node_requirements -.->|"declares"| node_streamlit
node_streamlit -->|"runs"| node_app
node_city_data -->|"loads"| node_app
node_city_data -->|"city indicators"| node_risk
node_city_data -->|"historical trends"| node_forecast
node_app -->|"computes current risk"| node_risk
node_app -->|"generates projections"| node_forecast
node_risk -->|"scores and vulnerabilities"| node_investment
node_fund_input -->|"budget pool"| node_investment
node_app -->|"requests recommendations"| node_investment
node_risk -->|"current risks and tiers"| node_dashboard_views
node_forecast -->|"2040 projections"| node_dashboard_views
node_investment -->|"recommended allocations"| node_dashboard_views
node_app -->|"renders"| node_dashboard_views

click node_app "https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/app.py"
click node_risk "https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/modules/risk_engine.py"
click node_forecast "https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/modules/forecast_engine.py"
click node_investment "https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/modules/investment_engine.py"
click node_city_data "https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/data/city_data.csv"
click node_requirements "https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/requirements.txt"

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_streamlit,node_app,node_fund_input,node_dashboard_views toneBlue
class node_risk,node_forecast,node_investment toneAmber
class node_city_data toneMint
class node_requirements toneNeutral
```

## Components

### Dashboard

- **Streamlit runtime**: framework
- [Dashboard orchestration](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/app.py): application entry point · Loads data, invokes engines, and renders analytical views. · `app.py`
- **Adaptation fund input**: user input · Configurable pool up to ₹20,000 Crores.
- **Risk, forecast & allocation views**: interactive reporting · Alerts, distributions, maps, and allocation recommendations.

### Analytical Engines

Deterministic climate analysis and allocation logic.

- [Risk scoring engine](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/modules/risk_engine.py): risk analytics · Normalizes indicators, derives risk indexes, scores, and resilience tiers. · `modules/risk_engine.py`
- [Forecast engine](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/modules/forecast_engine.py): predictive simulation · Uses OLS regression to project temperature and extreme-event trends through 2040. · `modules/forecast_engine.py`
- [Capital allocation engine](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/modules/investment_engine.py): allocation analytics · Prioritizes city vulnerabilities within the user-defined adaptation fund. · `modules/investment_engine.py`

### Data Foundation

- [City historical matrix](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/data/city_data.csv): CSV dataset · Climate, population, water, and infrastructure inputs by city. · `data/city_data.csv`

### Other components

- [Application dependencies](https://github.com/arkadipsom-code/india-climate-resilience-dashboard/blob/main/requirements.txt): dependency manifest · `requirements.txt`

## Connections

- Application dependencies → Streamlit runtime: declares
- Streamlit runtime → Dashboard orchestration: runs
- City historical matrix → Dashboard orchestration: loads
- City historical matrix → Risk scoring engine: city indicators
- City historical matrix → Forecast engine: historical trends
- Dashboard orchestration → Risk scoring engine: computes current risk
- Dashboard orchestration → Forecast engine: generates projections
- Risk scoring engine → Capital allocation engine: scores and vulnerabilities
- Adaptation fund input → Capital allocation engine: budget pool
- Dashboard orchestration → Capital allocation engine: requests recommendations
- Risk scoring engine → Risk, forecast & allocation views: current risks and tiers
- Forecast engine → Risk, forecast & allocation views: 2040 projections
- Capital allocation engine → Risk, forecast & allocation views: recommended allocations
- Dashboard orchestration → Risk, forecast & allocation views: renders
