# shaanbarca/sez-renewable-energy-dashboard architecture

> Architecture diagram of the GitHub repository shaanbarca/sez-renewable-energy-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shaanbarca/sez-renewable-energy-dashboard
- Repository: https://github.com/shaanbarca/sez-renewable-energy-dashboard

## Overview

The SEZ Renewable Energy Dashboard combines a geospatial data pipeline, renewable-energy competitiveness modeling, a FastAPI service, and a React dashboard. Analysts explore sites on a map, adjust assumptions, and inspect scorecards, detailed site analyses, and energy visualizations. The README establishes the main pipeline-to-API-to-frontend architecture and product capabilities; source-index references and excerpts support selected internal links. Some feature implementations were not sampled, so their internal connections are omitted.

Main entry points: [`src/api/main.py`](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/api/main.py) (FastAPI application), [`src/dash/logic/scorecard.py`](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/dash/logic/scorecard.py) (Live scorecard), [`frontend/src/App.tsx`](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/App.tsx) (Dashboard application), [`frontend/src/store/dashboard.ts`](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/store/dashboard.ts) (Dashboard state and recomputation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Data pipeline"]
  node_pipeline_runner["Pipeline orchestration<br/>[run_pipeline.py]"]
  node_site_resource["Site resources and buildability"]
  node_pipeline_facts["Site and grid fact builders"]
  node_processed_data[("Processed tables")]
end

subgraph group_model["Analytical model"]
  node_core_model["Competitiveness model<br/>[basic_model.py]"]
  node_scorecard_logic["Live scorecard<br/>[scorecard.py]"]
  node_site_context["Per-site context<br/>[site_context.py]"]
  node_assumptions["Model assumptions<br/>[assumptions.py]"]
end

subgraph group_backend["API backend"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_scorecard_api["Scorecard endpoint<br/>[scorecard.py]"]
  node_layers_api["Map and site endpoints<br/>[layers.py]"]
  node_map_layers["Geospatial layer preparation<br/>[map_layers.py]"]
end

subgraph group_state["Frontend state"]
  node_dashboard_state["Dashboard state and recomputation<br/>[dashboard.ts]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_experience["Dashboard experience"]
  node_frontend_app["Dashboard application<br/>[App.tsx]"]
  node_interactive_map["Interactive map<br/>[MapView.tsx]"]
  node_analysis_panels["Assumptions and site analysis"]
  node_charts_tables["Charts and scorecard views"]
end

node_analyst(("Analyst"))
node_inputs["Geospatial and source data"]

node_analyst -->|"explores"| node_frontend_app
node_inputs -->|"supplies data"| node_pipeline_runner
node_pipeline_runner -->|"runs builder"| node_site_resource
node_pipeline_runner -->|"runs builders"| node_pipeline_facts
node_site_resource -.->|"writes results"| node_processed_data
node_pipeline_facts -->|"writes tables"| node_processed_data
node_processed_data -->|"loads at startup"| node_api_app
node_api_app -->|"mounts routes"| node_scorecard_api
node_api_app -->|"mounts routes"| node_layers_api
node_api_app -->|"uses layers"| node_map_layers
node_scorecard_api -->|"recomputes scorecard"| node_scorecard_logic
node_scorecard_logic -->|"assembles site context"| node_site_context
node_scorecard_logic -->|"uses model logic"| node_core_model
node_site_context -->|"computes grid context"| node_core_model
node_scorecard_logic -->|"uses assumptions"| node_assumptions
node_frontend_app -->|"initializes state"| node_dashboard_state
node_frontend_app -->|"renders map"| node_interactive_map
node_frontend_app -->|"renders panels"| node_analysis_panels
node_dashboard_state -->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_api_app
node_layers_api -.->|"serves map layers"| node_map_layers
node_interactive_map -->|"reads map state"| node_dashboard_state
node_dashboard_state -.->|"supplies scorecard data"| node_charts_tables

click node_pipeline_runner "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/run_pipeline.py"
click node_site_resource "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/pipeline/build_fct_site_resource.py"
click node_pipeline_facts "https://github.com/shaanbarca/sez-renewable-energy-dashboard/tree/main/src/pipeline"
click node_core_model "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/model/basic_model.py"
click node_scorecard_logic "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/dash/logic/scorecard.py"
click node_site_context "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/dash/logic/site_context.py"
click node_assumptions "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/assumptions.py"
click node_api_app "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/api/main.py"
click node_scorecard_api "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/api/routes/scorecard.py"
click node_layers_api "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/api/routes/layers.py"
click node_map_layers "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/dash/map_layers.py"
click node_frontend_app "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/App.tsx"
click node_dashboard_state "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/store/dashboard.ts"
click node_api_client "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/lib/api.ts"
click node_interactive_map "https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/components/map/MapView.tsx"
click node_analysis_panels "https://github.com/shaanbarca/sez-renewable-energy-dashboard/tree/main/frontend/src/components/panels"
click node_charts_tables "https://github.com/shaanbarca/sez-renewable-energy-dashboard/tree/main/frontend/src/components/charts"

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_pipeline_runner,node_site_resource,node_pipeline_facts,node_processed_data toneBlue
class node_core_model,node_scorecard_logic,node_site_context,node_assumptions toneAmber
class node_api_app,node_scorecard_api,node_layers_api,node_map_layers toneMint
class node_dashboard_state,node_api_client toneRose
class node_frontend_app,node_interactive_map,node_analysis_panels,node_charts_tables,node_analyst,node_inputs toneIndigo
```

## Components

### Data pipeline

- [Pipeline orchestration](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/run_pipeline.py): `run_pipeline.py`
- [Site resources and buildability](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/pipeline/build_fct_site_resource.py): `src/pipeline/build_fct_site_resource.py`
- [Site and grid fact builders](https://github.com/shaanbarca/sez-renewable-energy-dashboard/tree/main/src/pipeline): `src/pipeline`
- **Processed tables**

### Analytical model

- [Competitiveness model](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/model/basic_model.py): `src/model/basic_model.py`
- [Live scorecard](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/dash/logic/scorecard.py): `src/dash/logic/scorecard.py`
- [Per-site context](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/dash/logic/site_context.py): `src/dash/logic/site_context.py`
- [Model assumptions](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/assumptions.py): `src/assumptions.py`

### API backend

- [FastAPI application](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/api/main.py): `src/api/main.py`
- [Scorecard endpoint](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/api/routes/scorecard.py): `src/api/routes/scorecard.py`
- [Map and site endpoints](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/api/routes/layers.py): `src/api/routes/layers.py`
- [Geospatial layer preparation](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/src/dash/map_layers.py): `src/dash/map_layers.py`

### Frontend state

- [Dashboard state and recomputation](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/store/dashboard.ts): `frontend/src/store/dashboard.ts`
- [API client](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Dashboard experience

- [Dashboard application](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Interactive map](https://github.com/shaanbarca/sez-renewable-energy-dashboard/blob/main/frontend/src/components/map/MapView.tsx): `frontend/src/components/map/MapView.tsx`
- [Assumptions and site analysis](https://github.com/shaanbarca/sez-renewable-energy-dashboard/tree/main/frontend/src/components/panels): `frontend/src/components/panels`
- [Charts and scorecard views](https://github.com/shaanbarca/sez-renewable-energy-dashboard/tree/main/frontend/src/components/charts): `frontend/src/components/charts`

### Other components

- **Analyst**
- **Geospatial and source data**

## Connections

- Analyst → Dashboard application: explores (evidence: `README.md`)
- Geospatial and source data → Pipeline orchestration: supplies data (evidence: `README.md`)
- Pipeline orchestration → Site resources and buildability: runs builder (evidence: `run_pipeline.py`)
- Pipeline orchestration → Site and grid fact builders: runs builders (evidence: `run_pipeline.py`)
- Site resources and buildability → Processed tables: writes results
- Site and grid fact builders → Processed tables: writes tables (evidence: `README.md`)
- Processed tables → FastAPI application: loads at startup (evidence: `README.md`)
- FastAPI application → Scorecard endpoint: mounts routes (evidence: `src/api/main.py`)
- FastAPI application → Map and site endpoints: mounts routes (evidence: `src/api/main.py`)
- FastAPI application → Geospatial layer preparation: uses layers (evidence: `src/api/main.py`)
- Scorecard endpoint → Live scorecard: recomputes scorecard (evidence: `src/api/routes/scorecard.py`)
- Live scorecard → Per-site context: assembles site context (evidence: `src/dash/logic/scorecard.py`)
- Live scorecard → Competitiveness model: uses model logic (evidence: `src/dash/logic/scorecard.py`)
- Per-site context → Competitiveness model: computes grid context (evidence: `src/dash/logic/site_context.py`)
- Live scorecard → Model assumptions: uses assumptions (evidence: `src/dash/logic/scorecard.py`)
- Dashboard application → Dashboard state and recomputation: initializes state (evidence: `frontend/src/App.tsx`)
- Dashboard application → Interactive map: renders map (evidence: `frontend/src/App.tsx`)
- Dashboard application → Assumptions and site analysis: renders panels (evidence: `frontend/src/App.tsx`)
- Dashboard state and recomputation → API client: requests data (evidence: `frontend/src/store/dashboard.ts`)
- API client → FastAPI application: calls API (evidence: `README.md`)
- Map and site endpoints → Geospatial layer preparation: serves map layers (evidence: `src/api/routes/layers.py`)
- Interactive map → Dashboard state and recomputation: reads map state (evidence: `frontend/src/components/map/MapView.tsx`)
- Dashboard state and recomputation → Charts and scorecard views: supplies scorecard data
