# satyam-ptl/co2-emission-prediction-using-ml architecture

> Architecture diagram of the GitHub repository satyam-ptl/co2-emission-prediction-using-ml, 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/satyam-ptl/co2-emission-prediction-using-ml
- Repository: https://github.com/satyam-ptl/co2-emission-prediction-using-ml

## Overview

This is a reproducible research package for forecasting monthly facility-level CO₂ emissions at Indian cement plants. The main workflow audits and prepares Climate TRACE data, selects features and models on a validation window, evaluates forecasts on hold-out and rolling-origin periods, then analyzes robustness and forecast errors. A companion stage checks results against an official cement production index and builds size-stratified conformal intervals; figures and manuscript materials present the results. Some pipeline internals are unsampled, so edges are limited to relationships shown in excerpts or README statements.

Main entry points: [`code/stage1_pipeline.py`](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py) (Forecast evaluation), [`results/tables`](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/tree/main/results/tables) (Result tables), [`data/modeling_dataset_step1.csv`](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/data/modeling_dataset_step1.csv) (Climate TRACE data), [`code/stage1b_external_and_intervals.py`](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1b_external_and_intervals.py) (External validity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Forecast analysis"]
  node_audit_features["Audit and features<br/>[stage1_pipeline.py]"]
  node_window_selection["Window selection<br/>[stage1_pipeline.py]"]
  node_model_comparison["Model comparison<br/>[stage1_pipeline.py]"]
  node_forecast_evaluation["Forecast evaluation<br/>[stage1_pipeline.py]"]
  node_robustness["Robustness analysis<br/>[stage1_pipeline.py]"]
  node_error_horizon["Error and horizons<br/>[stage1_pipeline.py]"]
  node_importance["Feature importance<br/>[stage1_pipeline.py]"]
  node_tables[("Result tables")]
  node_predictions["Forecast predictions"]
end

subgraph group_validation["External checks"]
  node_external_check["External validity"]
  node_conformal_intervals["Conformal intervals"]
end

subgraph group_presentation["Results presentation"]
  node_figures["Research figures<br/>[stage2_figures.py]"]
  node_figure_files["Figure outputs"]
  node_manuscript_spec["Manuscript content<br/>[build_spec.py]"]
  node_docx_renderer["Document renderer<br/>[render_docx.js]"]
  node_manuscript["Manuscript document"]
end

node_climate_data["Climate TRACE data"]
node_ici_data["Official cement index"]
node_analyst(("Researcher"))

node_analyst -->|"provides data"| node_climate_data
node_climate_data -->|"loads and prepares"| node_audit_features
node_audit_features -->|"builds windows"| node_window_selection
node_window_selection -->|"selects features"| node_model_comparison
node_model_comparison -->|"fits and predicts"| node_forecast_evaluation
node_forecast_evaluation -->|"writes forecasts"| node_predictions
node_forecast_evaluation -->|"writes metrics"| node_tables
node_forecast_evaluation -->|"tests performance"| node_robustness
node_forecast_evaluation -->|"analyzes errors"| node_error_horizon
node_forecast_evaluation -->|"measures importance"| node_importance
node_importance -->|"writes results"| node_tables
node_analyst -->|"provides index"| node_ici_data
node_climate_data -->|"compares emissions"| node_external_check
node_ici_data -->|"checks against index"| node_external_check
node_external_check -->|"writes comparison"| node_tables
node_climate_data -->|"supplies forecast data"| node_conformal_intervals
node_conformal_intervals -->|"writes intervals"| node_tables
node_climate_data -->|"loads observations"| node_figures
node_tables -->|"reads analysis results"| node_figures
node_figures -->|"saves figures"| node_figure_files
node_tables -->|"supplies manuscript results"| node_manuscript_spec
node_figure_files -.->|"embeds figures"| node_manuscript_spec
node_manuscript_spec -->|"provides document content"| node_docx_renderer
node_docx_renderer -->|"renders document"| node_manuscript

click node_climate_data "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/data/modeling_dataset_step1.csv"
click node_ici_data "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/data/T13_external_ICI_cement_PIB.csv"
click node_audit_features "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py"
click node_window_selection "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py"
click node_model_comparison "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py"
click node_forecast_evaluation "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py"
click node_robustness "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py"
click node_error_horizon "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py"
click node_importance "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py"
click node_external_check "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1b_external_and_intervals.py"
click node_conformal_intervals "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1b_external_and_intervals.py"
click node_tables "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/tree/main/results/tables"
click node_predictions "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/tree/main/results/preds"
click node_figures "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage2_figures.py"
click node_figure_files "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/tree/main/results/figures"
click node_manuscript_spec "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/build_spec.py"
click node_docx_renderer "https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/render_docx.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_audit_features,node_window_selection,node_model_comparison,node_forecast_evaluation,node_robustness,node_error_horizon,node_importance,node_tables,node_predictions toneBlue
class node_external_check,node_conformal_intervals toneAmber
class node_figures,node_figure_files,node_manuscript_spec,node_docx_renderer,node_manuscript toneMint
class node_climate_data,node_ici_data toneTeal
class node_analyst toneIndigo
```

## Components

### Forecast analysis

- [Audit and features](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py): `code/stage1_pipeline.py`
- [Window selection](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py): `code/stage1_pipeline.py`
- [Model comparison](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py): `code/stage1_pipeline.py`
- [Forecast evaluation](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py): `code/stage1_pipeline.py`
- [Robustness analysis](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py): `code/stage1_pipeline.py`
- [Error and horizons](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py): `code/stage1_pipeline.py`
- [Feature importance](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1_pipeline.py): `code/stage1_pipeline.py`
- [Result tables](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/tree/main/results/tables): `results/tables`
- [Forecast predictions](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/tree/main/results/preds): `results/preds`

### External checks

- [External validity](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1b_external_and_intervals.py): `code/stage1b_external_and_intervals.py`
- [Conformal intervals](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage1b_external_and_intervals.py): `code/stage1b_external_and_intervals.py`

### Results presentation

- [Research figures](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/stage2_figures.py): `code/stage2_figures.py`
- [Figure outputs](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/tree/main/results/figures): `results/figures`
- [Manuscript content](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/build_spec.py): `code/build_spec.py`
- [Document renderer](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/code/render_docx.js): `code/render_docx.js`
- **Manuscript document**

### Other components

- [Climate TRACE data](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/data/modeling_dataset_step1.csv): `data/modeling_dataset_step1.csv`
- [Official cement index](https://github.com/satyam-ptl/co2-emission-prediction-using-ml/blob/main/data/T13_external_ICI_cement_PIB.csv): `data/T13_external_ICI_cement_PIB.csv`
- **Researcher**

## Connections

- Researcher → Climate TRACE data: provides data (evidence: `README.md`)
- Climate TRACE data → Audit and features: loads and prepares (evidence: `README.md`)
- Audit and features → Window selection: builds windows (evidence: `code/stage1_pipeline.py`)
- Window selection → Model comparison: selects features (evidence: `code/stage1_pipeline.py`)
- Model comparison → Forecast evaluation: fits and predicts (evidence: `code/stage1_pipeline.py`)
- Forecast evaluation → Forecast predictions: writes forecasts (evidence: `code/stage1_pipeline.py`)
- Forecast evaluation → Result tables: writes metrics (evidence: `code/stage1_pipeline.py`)
- Forecast evaluation → Robustness analysis: tests performance (evidence: `code/stage1_pipeline.py`)
- Forecast evaluation → Error and horizons: analyzes errors (evidence: `code/stage1_pipeline.py`)
- Forecast evaluation → Feature importance: measures importance (evidence: `code/stage1_pipeline.py`)
- Feature importance → Result tables: writes results (evidence: `code/stage1_pipeline.py`)
- Researcher → Official cement index: provides index (evidence: `README.md`)
- Climate TRACE data → External validity: compares emissions (evidence: `code/stage1b_external_and_intervals.py`)
- Official cement index → External validity: checks against index (evidence: `README.md`)
- External validity → Result tables: writes comparison (evidence: `code/stage1b_external_and_intervals.py`)
- Climate TRACE data → Conformal intervals: supplies forecast data (evidence: `code/stage1b_external_and_intervals.py`)
- Conformal intervals → Result tables: writes intervals (evidence: `code/stage1b_external_and_intervals.py`)
- Climate TRACE data → Research figures: loads observations (evidence: `code/stage2_figures.py`)
- Result tables → Research figures: reads analysis results (evidence: `code/stage2_figures.py`)
- Research figures → Figure outputs: saves figures (evidence: `code/stage2_figures.py`)
- Result tables → Manuscript content: supplies manuscript results (evidence: `code/build_spec.py`)
- Figure outputs → Manuscript content: embeds figures (evidence: `README.md`)
- Manuscript content → Document renderer: provides document content (evidence: `README.md`)
- Document renderer → Manuscript document: renders document (evidence: `code/render_docx.js`)
