# namratanandi/electoral-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/namratanandi/electoral-analysis
- Repository: https://github.com/namratanandi/electoral-analysis

## Overview

This repository is an electoral-analysis notebook backed by constituency-level election data. Its documented workflow uses results from three elections to examine alliance and INC performance through vote-share trends, swing, correlations, and K-Means clustering, with seat and swing grades supplied as pre-labelled fields. The analysis aims to identify seat-strategy groups; the README also notes interactive Plotly charts. The notebook source was not excerpted, so the graph reflects documented capabilities rather than verified implementation calls.

Main entry points: [`INDIA_ALLIANCE_ANALYSIS_UP.ipynb`](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb) (Analysis notebook), [`UP_INC_ANALYSIS_2027_27.xlsx`](https://github.com/namratanandi/electoral-analysis/blob/main/UP_INC_ANALYSIS_2027_27.xlsx) (Election results workbook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Election data"]
  node_results[("Election results workbook")]
end

subgraph group_analysis["Electoral analysis"]
  node_notebook["Analysis notebook"]
  node_grades["Seat and swing grades"]
  node_trends["Vote-share trends"]
  node_swings["Swing analysis"]
  node_correlations["Correlation analysis"]
  node_clustering["K-Means clustering"]
end

subgraph group_outputs["Analysis outputs"]
  node_groups["Seat-strategy groups"]
  node_charts["Interactive charts"]
end

node_analyst(("Analyst"))

node_analyst -->|"runs analysis"| node_notebook
node_results -->|"provides results"| node_notebook
node_results -->|"provides labels"| node_grades
node_notebook -->|"examines trends"| node_trends
node_notebook -->|"examines swing"| node_swings
node_notebook -->|"analyzes correlations"| node_correlations
node_notebook -->|"clusters seats"| node_clustering
node_notebook -->|"identifies groups"| node_groups
node_notebook -->|"presents charts"| node_charts

click node_results "https://github.com/namratanandi/electoral-analysis/blob/main/UP_INC_ANALYSIS_2027_27.xlsx"
click node_notebook "https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb"
click node_grades "https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb"
click node_trends "https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb"
click node_swings "https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb"
click node_correlations "https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb"
click node_clustering "https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb"
click node_groups "https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb"
click node_charts "https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb"

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_results toneBlue
class node_notebook,node_grades,node_trends,node_swings,node_correlations,node_clustering toneAmber
class node_groups,node_charts toneMint
class node_analyst toneIndigo
```

## Components

### Election data

- [Election results workbook](https://github.com/namratanandi/electoral-analysis/blob/main/UP_INC_ANALYSIS_2027_27.xlsx): `UP_INC_ANALYSIS_2027_27.xlsx`

### Electoral analysis

- [Analysis notebook](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb): `INDIA_ALLIANCE_ANALYSIS_UP.ipynb`
- [Seat and swing grades](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb): `INDIA_ALLIANCE_ANALYSIS_UP.ipynb`
- [Vote-share trends](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb): `INDIA_ALLIANCE_ANALYSIS_UP.ipynb`
- [Swing analysis](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb): `INDIA_ALLIANCE_ANALYSIS_UP.ipynb`
- [Correlation analysis](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb): `INDIA_ALLIANCE_ANALYSIS_UP.ipynb`
- [K-Means clustering](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb): `INDIA_ALLIANCE_ANALYSIS_UP.ipynb`

### Analysis outputs

- [Seat-strategy groups](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb): `INDIA_ALLIANCE_ANALYSIS_UP.ipynb`
- [Interactive charts](https://github.com/namratanandi/electoral-analysis/blob/main/INDIA_ALLIANCE_ANALYSIS_UP.ipynb): `INDIA_ALLIANCE_ANALYSIS_UP.ipynb`

### Other components

- **Analyst**

## Connections

- Analyst → Analysis notebook: runs analysis (evidence: `README.md`)
- Election results workbook → Analysis notebook: provides results (evidence: `README.md`)
- Election results workbook → Seat and swing grades: provides labels (evidence: `README.md`)
- Analysis notebook → Vote-share trends: examines trends (evidence: `README.md`)
- Analysis notebook → Swing analysis: examines swing (evidence: `README.md`)
- Analysis notebook → Correlation analysis: analyzes correlations (evidence: `README.md`)
- Analysis notebook → K-Means clustering: clusters seats (evidence: `README.md`)
- Analysis notebook → Seat-strategy groups: identifies groups (evidence: `README.md`)
- Analysis notebook → Interactive charts: presents charts (evidence: `README.md`)
