# hectorpartido/climateai architecture

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

- Interactive diagram: https://gitdiagram.com/hectorpartido/climateai
- Repository: https://github.com/hectorpartido/climateai

## Overview

ClimateAI is a Streamlit dashboard and an offline climate-priority modeling pipeline. Users explore country priorities through six screens; the shared dashboard layer loads saved results and invokes prediction, while the separate analysis command regenerates indicators, country groups, fuzzy priorities, and reports. The README documents screen capabilities beyond the sampled excerpts. Edges below are limited to calls, imports, or workflows visible in the supplied source index/excerpts or explicitly documented in the README.

Main entry points: [`app/comun.py`](https://github.com/hectorpartido/climateai/blob/main/app/comun.py) (Shared dashboard), [`src/models/train.py`](https://github.com/hectorpartido/climateai/blob/main/src/models/train.py) (Analysis orchestrator), [`src/data/preprocess.py`](https://github.com/hectorpartido/climateai/blob/main/src/data/preprocess.py) (Indicator preparation), [`src/models/predict.py`](https://github.com/hectorpartido/climateai/blob/main/src/models/predict.py) (Priority prediction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_entry["Streamlit entry<br/>[streamlit_app.py]"]
  node_shared["Shared dashboard<br/>[comun.py]"]
  node_panorama["Country panorama<br/>[1_panorama.py]"]
  node_ranking["Country ranking<br/>[2_ranking.py]"]
  node_country["Country profile<br/>[3_ficha.py]"]
  node_groups_view["Country groups<br/>[4_grupos.py]"]
  node_simulator["Priority simulator<br/>[5_simulador.py]"]
  node_model_view["Data and model<br/>[6_datos_modelo.py]"]
end

subgraph group_analysis["Analysis pipeline"]
  node_preprocess["Indicator preparation<br/>[preprocess.py]"]
  node_expert["Expert validation<br/>[hoja_experto.py]"]
  node_trainer["Analysis orchestrator<br/>[train.py]"]
  node_clustering["Country clustering<br/>[clustering.py]"]
  node_reports[("Analysis reports")]
  node_config["Model configuration<br/>[config.py]"]
end

subgraph group_inference["Model inference"]
  node_fuzzy["Fuzzy calibration<br/>[fuzzy.py]"]
  node_artifacts[("Saved models")]
  node_prediction["Priority prediction<br/>[predict.py]"]
end

subgraph group_data["Climate data"]
  node_raw[("Source datasets")]
  node_processed[("Processed indicators")]
end

node_user(("Dashboard user"))

node_user -->|"opens dashboard"| node_entry
node_entry -->|"sets up"| node_shared
node_panorama -->|"uses shared data"| node_shared
node_ranking -->|"uses shared data"| node_shared
node_country -->|"uses shared data"| node_shared
node_groups_view -->|"uses shared data"| node_shared
node_simulator -->|"requests prediction"| node_shared
node_model_view -->|"uses shared data"| node_shared
node_shared -->|"calls prediction"| node_prediction
node_shared -->|"loads saved models"| node_artifacts
node_groups_view -->|"prepares group data"| node_preprocess
node_model_view -->|"runs analysis"| node_trainer
node_trainer -->|"generates indicators"| node_preprocess
node_preprocess -->|"reads source data"| node_raw
node_preprocess -->|"writes indicators"| node_processed
node_trainer -->|"trains groups"| node_clustering
node_trainer -->|"calibrates priorities"| node_fuzzy
node_trainer -->|"writes evaluations"| node_reports
node_trainer -->|"saves model files"| node_artifacts
node_prediction -->|"runs fuzzy inference"| node_fuzzy
node_prediction -->|"loads model artifacts"| node_artifacts
node_expert -->|"uses country indicators"| node_processed
node_clustering -->|"uses indicators"| node_processed
node_trainer -->|"uses paths and settings"| node_config

click node_entry "https://github.com/hectorpartido/climateai/blob/main/app/streamlit_app.py"
click node_shared "https://github.com/hectorpartido/climateai/blob/main/app/comun.py"
click node_panorama "https://github.com/hectorpartido/climateai/blob/main/app/paginas/1_panorama.py"
click node_ranking "https://github.com/hectorpartido/climateai/blob/main/app/paginas/2_ranking.py"
click node_country "https://github.com/hectorpartido/climateai/blob/main/app/paginas/3_ficha.py"
click node_groups_view "https://github.com/hectorpartido/climateai/blob/main/app/paginas/4_grupos.py"
click node_simulator "https://github.com/hectorpartido/climateai/blob/main/app/paginas/5_simulador.py"
click node_model_view "https://github.com/hectorpartido/climateai/blob/main/app/paginas/6_datos_modelo.py"
click node_raw "https://github.com/hectorpartido/climateai/tree/main/data/raw"
click node_processed "https://github.com/hectorpartido/climateai/tree/main/data/processed"
click node_preprocess "https://github.com/hectorpartido/climateai/blob/main/src/data/preprocess.py"
click node_expert "https://github.com/hectorpartido/climateai/blob/main/src/data/hoja_experto.py"
click node_trainer "https://github.com/hectorpartido/climateai/blob/main/src/models/train.py"
click node_clustering "https://github.com/hectorpartido/climateai/blob/main/src/models/clustering.py"
click node_fuzzy "https://github.com/hectorpartido/climateai/blob/main/src/models/fuzzy.py"
click node_artifacts "https://github.com/hectorpartido/climateai/tree/main/models"
click node_prediction "https://github.com/hectorpartido/climateai/blob/main/src/models/predict.py"
click node_reports "https://github.com/hectorpartido/climateai/tree/main/reports"
click node_config "https://github.com/hectorpartido/climateai/blob/main/src/config.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_entry,node_shared,node_panorama,node_ranking,node_country,node_groups_view,node_simulator,node_model_view,node_user toneBlue
class node_preprocess,node_expert,node_trainer,node_clustering,node_reports,node_config toneAmber
class node_fuzzy,node_artifacts,node_prediction toneMint
class node_raw,node_processed toneRose
```

## Components

### Dashboard

- [Streamlit entry](https://github.com/hectorpartido/climateai/blob/main/app/streamlit_app.py): `app/streamlit_app.py`
- [Shared dashboard](https://github.com/hectorpartido/climateai/blob/main/app/comun.py): `app/comun.py`
- [Country panorama](https://github.com/hectorpartido/climateai/blob/main/app/paginas/1_panorama.py): `app/paginas/1_panorama.py`
- [Country ranking](https://github.com/hectorpartido/climateai/blob/main/app/paginas/2_ranking.py): `app/paginas/2_ranking.py`
- [Country profile](https://github.com/hectorpartido/climateai/blob/main/app/paginas/3_ficha.py): `app/paginas/3_ficha.py`
- [Country groups](https://github.com/hectorpartido/climateai/blob/main/app/paginas/4_grupos.py): `app/paginas/4_grupos.py`
- [Priority simulator](https://github.com/hectorpartido/climateai/blob/main/app/paginas/5_simulador.py): `app/paginas/5_simulador.py`
- [Data and model](https://github.com/hectorpartido/climateai/blob/main/app/paginas/6_datos_modelo.py): `app/paginas/6_datos_modelo.py`

### Analysis pipeline

- [Indicator preparation](https://github.com/hectorpartido/climateai/blob/main/src/data/preprocess.py): `src/data/preprocess.py`
- [Expert validation](https://github.com/hectorpartido/climateai/blob/main/src/data/hoja_experto.py): `src/data/hoja_experto.py`
- [Analysis orchestrator](https://github.com/hectorpartido/climateai/blob/main/src/models/train.py): `src/models/train.py`
- [Country clustering](https://github.com/hectorpartido/climateai/blob/main/src/models/clustering.py): `src/models/clustering.py`
- [Analysis reports](https://github.com/hectorpartido/climateai/tree/main/reports): `reports`
- [Model configuration](https://github.com/hectorpartido/climateai/blob/main/src/config.py): `src/config.py`

### Model inference

- [Fuzzy calibration](https://github.com/hectorpartido/climateai/blob/main/src/models/fuzzy.py): `src/models/fuzzy.py`
- [Saved models](https://github.com/hectorpartido/climateai/tree/main/models): `models`
- [Priority prediction](https://github.com/hectorpartido/climateai/blob/main/src/models/predict.py): `src/models/predict.py`

### Climate data

- [Source datasets](https://github.com/hectorpartido/climateai/tree/main/data/raw): `data/raw`
- [Processed indicators](https://github.com/hectorpartido/climateai/tree/main/data/processed): `data/processed`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Streamlit entry: opens dashboard (evidence: `README.md`)
- Streamlit entry → Shared dashboard: sets up (evidence: `app/streamlit_app.py`)
- Country panorama → Shared dashboard: uses shared data (evidence: `app/paginas/1_panorama.py`)
- Country ranking → Shared dashboard: uses shared data (evidence: `app/paginas/2_ranking.py`)
- Country profile → Shared dashboard: uses shared data (evidence: `app/paginas/3_ficha.py`)
- Country groups → Shared dashboard: uses shared data (evidence: `app/paginas/4_grupos.py`)
- Priority simulator → Shared dashboard: requests prediction (evidence: `app/paginas/5_simulador.py`)
- Data and model → Shared dashboard: uses shared data (evidence: `app/paginas/6_datos_modelo.py`)
- Shared dashboard → Priority prediction: calls prediction (evidence: `app/comun.py`)
- Shared dashboard → Saved models: loads saved models (evidence: `app/comun.py`)
- Country groups → Indicator preparation: prepares group data (evidence: `app/paginas/4_grupos.py`)
- Data and model → Analysis orchestrator: runs analysis (evidence: `app/paginas/6_datos_modelo.py`)
- Analysis orchestrator → Indicator preparation: generates indicators (evidence: `src/models/train.py`)
- Indicator preparation → Source datasets: reads source data (evidence: `README.md`)
- Indicator preparation → Processed indicators: writes indicators (evidence: `src/data/preprocess.py`)
- Analysis orchestrator → Country clustering: trains groups (evidence: `src/models/train.py`)
- Analysis orchestrator → Fuzzy calibration: calibrates priorities (evidence: `src/models/train.py`)
- Analysis orchestrator → Analysis reports: writes evaluations (evidence: `src/models/train.py`)
- Analysis orchestrator → Saved models: saves model files (evidence: `src/models/train.py`)
- Priority prediction → Fuzzy calibration: runs fuzzy inference (evidence: `src/models/predict.py`)
- Priority prediction → Saved models: loads model artifacts (evidence: `src/models/predict.py`)
- Expert validation → Processed indicators: uses country indicators (evidence: `src/data/hoja_experto.py`)
- Country clustering → Processed indicators: uses indicators (evidence: `src/models/clustering.py`)
- Analysis orchestrator → Model configuration: uses paths and settings (evidence: `src/models/train.py`)
