# siddharthshirode1-blip/ekbharat architecture

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

- Interactive diagram: https://gitdiagram.com/siddharthshirode1-blip/ekbharat
- Repository: https://github.com/siddharthshirode1-blip/ekbharat

## Overview

EkBhaarat is a governance intelligence and citizen-welfare web platform. Citizens and administrators use its web modules to explore schemes and public-spending data, view geographic and convergence analyses, and manage evidence-backed grievances; administrators also query datasets through a natural-language analytics flow. The Flask app serves the API and uses the local database layer, while the AI engine has separate query, validation, and connector components. The README describes several capabilities whose detailed handlers were not sampled, so those links are shown only where documented.

Main entry points: [`app.py`](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/app.py) (Flask API), [`complaints.html`](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/complaints.html) (Grievance tracker), [`ai_engine/query_engine.py`](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai_engine/query_engine.py) (Natural-language queries), [`ai.html`](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai.html) (AI studio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web capabilities"]
  node_ai_page["AI studio<br/>[ai.html]"]
  node_scheme_page["Scheme explorer<br/>[schemes.html]"]
  node_map_page["GIS heatmap<br/>[map.html]"]
  node_overlap_page["Scheme convergence<br/>[overlap.html]"]
  node_funds_page["DBT fund radar<br/>[beneficiaries.html]"]
  node_complaints_page["Grievance tracker<br/>[complaints.html]"]
  node_updates_page["Gazette updates<br/>[updates.html]"]
  node_data_page["Open data portal<br/>[data.html]"]
  node_auth_pages["Account access<br/>[login.html]"]
end

subgraph group_service["Application services"]
  node_api_entry["API entry<br/>[index.py]"]
  node_app["Flask API<br/>[app.py]"]
end

subgraph group_analytics["AI analytics"]
  node_query_engine["Natural-language queries<br/>[query_engine.py]"]
  node_sql_validator["Read-only SQL checks<br/>[sql_validator.py]"]
  node_db_connector["MySQL connector<br/>[db_connector.py]"]
end

subgraph group_data["Data platform"]
  node_database_layer["Database setup<br/>[database.py]"]
  node_sqlite[("Platform database<br/>[ekbharat.db]")]
  node_etl["Dataset ETL<br/>[etl_pipeline.py]"]
  node_processed_data["Clean datasets"]
end

node_citizen(("Citizen"))
node_admin(("Administrator"))

node_citizen -->|"explores schemes"| node_scheme_page
node_citizen -->|"views heatmap"| node_map_page
node_admin -->|"reviews convergence"| node_overlap_page
node_admin -->|"reviews DBT"| node_funds_page
node_citizen -->|"files grievances"| node_complaints_page
node_admin -->|"reviews proof"| node_complaints_page
node_citizen -->|"browses notices"| node_updates_page
node_citizen -->|"downloads datasets"| node_data_page
node_citizen -->|"signs in"| node_auth_pages
node_admin -->|"asks questions"| node_ai_page
node_ai_page -->|"submits query"| node_app
node_scheme_page -->|"requests scheme data"| node_app
node_map_page -->|"requests map data"| node_app
node_overlap_page -->|"requests overlap data"| node_app
node_funds_page -->|"requests fund data"| node_app
node_complaints_page -->|"manages tickets"| node_app
node_updates_page -->|"requests updates"| node_app
node_data_page -->|"requests downloads"| node_app
node_auth_pages -->|"authenticates"| node_app
node_api_entry -->|"imports app"| node_app
node_app -->|"uses database"| node_database_layer
node_database_layer -->|"initializes database"| node_sqlite
node_etl -->|"writes cleaned data"| node_processed_data
node_query_engine -->|"validates queries"| node_sql_validator
node_query_engine -->|"executes queries"| node_db_connector

click node_ai_page "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai.html"
click node_scheme_page "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/schemes.html"
click node_map_page "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/map.html"
click node_overlap_page "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/overlap.html"
click node_funds_page "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/beneficiaries.html"
click node_complaints_page "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/complaints.html"
click node_updates_page "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/updates.html"
click node_data_page "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/data.html"
click node_auth_pages "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/login.html"
click node_api_entry "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/api/index.py"
click node_app "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/app.py"
click node_database_layer "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/database.py"
click node_sqlite "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ekbharat.db"
click node_etl "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/scripts/etl_pipeline.py"
click node_processed_data "https://github.com/siddharthshirode1-blip/ekbharat/tree/main/data/processed"
click node_query_engine "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai_engine/query_engine.py"
click node_sql_validator "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai_engine/sql_validator.py"
click node_db_connector "https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai_engine/db_connector.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_ai_page,node_scheme_page,node_map_page,node_overlap_page,node_funds_page,node_complaints_page,node_updates_page,node_data_page,node_auth_pages toneBlue
class node_api_entry,node_app toneAmber
class node_query_engine,node_sql_validator,node_db_connector toneMint
class node_database_layer,node_sqlite,node_etl,node_processed_data toneRose
class node_citizen,node_admin toneIndigo
```

## Components

### Web capabilities

- [AI studio](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai.html): `ai.html`
- [Scheme explorer](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/schemes.html): `schemes.html`
- [GIS heatmap](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/map.html): `map.html`
- [Scheme convergence](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/overlap.html): `overlap.html`
- [DBT fund radar](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/beneficiaries.html): `beneficiaries.html`
- [Grievance tracker](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/complaints.html): `complaints.html`
- [Gazette updates](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/updates.html): `updates.html`
- [Open data portal](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/data.html): `data.html`
- [Account access](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/login.html): `login.html`

### Application services

- [API entry](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/api/index.py): `api/index.py`
- [Flask API](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/app.py): `app.py`

### AI analytics

- [Natural-language queries](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai_engine/query_engine.py): `ai_engine/query_engine.py`
- [Read-only SQL checks](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai_engine/sql_validator.py): `ai_engine/sql_validator.py`
- [MySQL connector](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ai_engine/db_connector.py): `ai_engine/db_connector.py`

### Data platform

- [Database setup](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/database.py): `database.py`
- [Platform database](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/ekbharat.db): `ekbharat.db`
- [Dataset ETL](https://github.com/siddharthshirode1-blip/ekbharat/blob/main/scripts/etl_pipeline.py): `scripts/etl_pipeline.py`
- [Clean datasets](https://github.com/siddharthshirode1-blip/ekbharat/tree/main/data/processed): `data/processed`

### Other components

- **Citizen**
- **Administrator**

## Connections

- Citizen → Scheme explorer: explores schemes (evidence: `README.md`)
- Citizen → GIS heatmap: views heatmap (evidence: `README.md`)
- Administrator → Scheme convergence: reviews convergence (evidence: `README.md`)
- Administrator → DBT fund radar: reviews DBT (evidence: `README.md`)
- Citizen → Grievance tracker: files grievances (evidence: `README.md`)
- Administrator → Grievance tracker: reviews proof (evidence: `README.md`)
- Citizen → Gazette updates: browses notices (evidence: `README.md`)
- Citizen → Open data portal: downloads datasets (evidence: `README.md`)
- Citizen → Account access: signs in (evidence: `README.md`)
- Administrator → AI studio: asks questions (evidence: `README.md`)
- AI studio → Flask API: submits query (evidence: `README.md`)
- Scheme explorer → Flask API: requests scheme data (evidence: `README.md`)
- GIS heatmap → Flask API: requests map data (evidence: `README.md`)
- Scheme convergence → Flask API: requests overlap data (evidence: `README.md`)
- DBT fund radar → Flask API: requests fund data (evidence: `README.md`)
- Grievance tracker → Flask API: manages tickets (evidence: `README.md`)
- Gazette updates → Flask API: requests updates (evidence: `README.md`)
- Open data portal → Flask API: requests downloads (evidence: `README.md`)
- Account access → Flask API: authenticates (evidence: `README.md`)
- API entry → Flask API: imports app (evidence: `api/index.py`)
- Flask API → Database setup: uses database (evidence: `app.py`)
- Database setup → Platform database: initializes database (evidence: `database.py`)
- Dataset ETL → Clean datasets: writes cleaned data (evidence: `scripts/etl_pipeline.py`)
- Natural-language queries → Read-only SQL checks: validates queries (evidence: `ai_engine/query_engine.py`)
- Natural-language queries → MySQL connector: executes queries (evidence: `ai_engine/query_engine.py`)
