GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Aditya-dxt/GramSetu: A full-stack geospatial decision-support platform for rural India that transforms real-world village infrastructure data into an interactive digital twin, enabling planners to identify underserved areas, analyze accessibility gaps, evaluate infrastructure health, and support data-driven rural development planning.

BranchesTags
Open more actions menu

Latest commit

 

History

66 Commits
66 Commits

Folders and files

NameName
Last commit message
Last commit date
backend
backend
 
 
frontend
frontend
 
 
scripts
scripts
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
GramSetu_Project_Documentation (1).pdf
GramSetu_Project_Documentation (1).pdf
 
 
PROGRESS.md
PROGRESS.md
 
 
README.md
README.md
 
 
bhitargaon_complete_village_profile.json
bhitargaon_complete_village_profile.json
 
 
docker-compose.yml
docker-compose.yml
 
 

Repository files navigation

GramSetu

🌾 GramSetu (ग्रामसेतु)

Evidence-Based Geospatial Digital Twin & AI Decision-Support Platform for Rural India

Deterministic, traceable rural development intelligence — every metric grounded in verified Census data, OpenStreetMap vectors, satellite observations, and PostGIS spatial queries.

FastAPI React TypeScript PostGIS PostgreSQL Docker Tailwind CSS License

🌟 Overview · 🏛️ Pilot Village (Bhitargaon) · 🏗️ Architecture · ✨ Core Modules · 📐 Database Schema · 🧮 Mathematical Engines · 📡 API Reference · 🚀 Quick Start · 🛡️ Data Provenance


🌟 What is GramSetu?

GramSetu ("Bridge to the Village") is an enterprise-grade geospatial digital twin and algorithmic decision-support platform designed to transform rural governance in India. Rather than relying on guesswork, political bias, or manual paper registers, GramSetu builds a high-fidelity digital replica of a Gram Panchayat by synthesizing:

  1. Official Census Data & Village Directories (demographics, land use, amenities, vulnerable populations).
  2. OpenStreetMap (OSM) & Survey of India Geometries (settlement boundaries, road networks, building footprints, waterways).
  3. Earth Observation & Remote Sensing (Sentinel-2 multispectral imagery, NDVI vegetation health, NDWI moisture indices, SAR radar flood risk).
  4. PostGIS Geodesic Spatial Analytics (K-Nearest Neighbor service buffers, walking-time catchments, cutoff risk zones).
  5. Deterministic Decision Engines (8-pillar Village Health Score, mathematical Priority Ranking, What-If scenario simulations, and central government scheme convergence).

Core Design Principles

Principle Technical Implementation
No Hallucinated Facts Every score and gap alert traces to a deterministic mathematical formula or PostGIS spatial query.
Strict Provenance Metadata Every data point carries an immutable provenance tag: source, source_status (REAL, OPEN_DATA, SATELLITE_DERIVED, MODEL_DERIVED, SYNTHETIC_DEMO), confidence, and observed_at.
Complete Bilingualism Full first-class UI support for Hindi (हिन्दी) and English, complete with Devanagari numerals and voice accessibility.
Role-Based Workflows 6 customized lenses tailored for Gram Pradhans, District Collectors, Field Workers, Citizens, NGOs, and State Planners.
Digital Personal Data Protection (DPDP) Compliance No private citizen names or personal sanitation flags are exposed. Planning is executed through cadastral parcels and ward aggregations.

🏛️ Pilot Village: Bhitargaon, Uttar Pradesh

GramSetu is demonstrated on Bhitargaon Gram Panchayat, a historically significant agrarian village in the Gangetic plains of Uttar Pradesh:

  • Location: Ghatampur Tehsil, Kanpur Nagar District, Uttar Pradesh (PIN: 209209, Census Village Code: 150654, LGD Code: 72102).
  • Coordinates: Centroid at 26.20930° N, 80.27350° E.
  • Demographics (Census of India 2011 Baseline):
    • Total Population: 5,303 (Males: 2,841 | Females: 2,462).
    • Total Households: 1,035.
    • Scheduled Caste (SC) Population: 1,478 (27.87%) | ST: 0.
    • Child Population (0–6 yrs): 697 (13.14%).
    • Literacy Rate: 81.39% (Male: 87.87% | Female: 74.04%).
  • Land Use & Agriculture:
    • Total Geographical Area: 554.20 Hectares (5.542 km²).
    • Net Sown Area: 394.47 Ha (71.18%) | Irrigated Area: 200.47 Ha (50.82% of net sown).
    • Forest Cover: 1.01 Ha | Non-agricultural Built-up: 45.73 Ha.
    • Principal Crops: Jowar, Wheat (गेहूं), Mustard (सरसों).
  • Archaeological Heritage:
    • Home to the Ancient Brick Temple of the Gupta Period (dated late 5th to early 6th century CE), a centrally protected monument under the Archaeological Survey of India (ASI Monument ID: N-UP-L153). Features the oldest surviving vaulted terracotta arches and high shikhara in northern India.
  • Wards / Habitations (Majras):
    1. वार्ड 1 — मंदिर मोहल्ला व प्राचीन बस्ती (Core habitation surrounding the Gupta temple).
    2. वार्ड 2 — बाजार चौराहा व ब्लॉक मुख्यालय परिसर (Commercial market and administrative center).
    3. वार्ड 3 — पासी खेड़ा व रविदास नगर (Predominantly Scheduled Caste residential cluster).
    4. वार्ड 4 — चतुरी पुरवा (Agrarian settlement and tubewell tract).
    5. वार्ड 5 — बेरी खेड़ा व कुंआ खेड़ा (Peripheral hamlet vulnerable to monsoon road cutoffs).

🏗️ System Architecture

GramSetu is structured into three clean decoupled tiers: a PostGIS Spatial Database, an Asynchronous FastAPI Microservice, and a React 18 + Vite Geospatial Frontend.

flowchart TD
    subgraph INGEST["1. Data Ingestion & Remote Sensing"]
        CENSUS["Census 2011 / LGD Portals"]
        OSM["OpenStreetMap Overpass API"]
        S2["Copernicus Sentinel-2 & SAR"]
        CONFIG["Village YAML Configs"]
    end

    subgraph STORAGE["2. Spatial Database (PostGIS 3.4 + PG 16)"]
        DB[("PostgreSQL Database")]
        T_VIL["villages / wards"]
        T_BLD["buildings (Cadastral & Footprints)"]
        T_RD["roads (MDR & PMGSY Networks)"]
        T_AST["assets (Health, Schools, Water, Power)"]
        T_RSK["risk_zones (Flood & Drought Polygons)"]
        DB --- T_VIL & T_BLD & T_RD & T_AST & T_RSK
    end

    subgraph ENGINES["3. Backend Analytics & Scoring (FastAPI)"]
        API["FastAPI REST Interface (/api/...)"]
        ACC["PostGIS Geodesic KNN Accessibility Engine"]
        HLT["8-Pillar Health Score Calculator"]
        PRI["Deterministic Priority Engine"]
        SIM["What-If Counterfactual Simulator"]
        AI["Grounded RAG Assistant (PostGIS Bound)"]
        API --- ACC & HLT & PRI & SIM & AI
    end

    subgraph UI["4. Frontend Digital Twin (React + Vite + Leaflet)"]
        MAP["Digital Twin Geospatial Canvas"]
        DASH["Panchayat Executive Dashboard"]
        SAT["Spectral Remote Sensing Viewer"]
        PRJ["Project Ranking & Scheme Convergence"]
        ROLES["6-Tier Role Management Lenses"]
        REP["Gram Sabha Resolution Generator"]
    end

    INGEST -->|"seed_village.py / Ingestion Pipeline"| STORAGE
    STORAGE -->|"Spatial SQL (ST_DWithin, ST_Distance)"| ENGINES
    ENGINES -->|"REST JSON & GeoJSON FeatureCollections"| UI
Loading

✨ Core Modules & Features

1. 🗺️ Digital Twin Geospatial Canvas

  • Vector Layers with Micro-Toggles: 10+ independent vector layers:
    • Village Cadastral Boundary (56-point OSM polygon).
    • 5 Ward Delimitation Polygons with vulnerability color gradients.
    • Exact Building Footprints (Gupta Temple ASI site, Community Health Centre, schools).
    • Road Networks (UP PWD Major District Roads, PMGSY paved roads, and earthen tracks).
    • Critical Public Assets (CHC hospital, schools, 33/11kV substation, water tanks, banks, CSC).
    • Dynamic Accessibility Buffers (500m water walkability, 1,500m primary health catchments).
    • Environmental Risk Zones (Pandu river monsoon waterlogging, groundwater depletion zones).
  • Interactive Asset Placement (Drawing Mode): Planners can click directly on the map to place hypothetical new tube wells, health clinics, or roads and test coverage changes.
  • Feature Inspector: Clicking any element renders its attributes, capacity, distance to emergency services, and strict provenance badge.

2. 📊 Village Executive Overview & Krishi-Mausam Panel

  • Live KPI Deck: Real-time counters for population, households, female sex ratio, statutory budget envelope (XV-FC + SFC + MGNREGA), budget utilization percentage, open citizen grievances, and identified infrastructure gaps.
  • Agrometeorological Advisory (कृषि मौसम सेवा): Live weather parameters (temperature, humidity, rainfall probability, wind speed) paired with localized agricultural advisories for Rabi/Kharif crops (wheat, mustard, legumes).
  • Ward Disparity Matrix: Side-by-side comparative grid benchmarking all 5 wards across paved road coverage, tap water connections, and health access travel times.

3. 🏥 Village Health Score Engine (8-Pillar Scoring)

  • Deterministic index scoring the village from 0 to 100 across 8 weighted sectors: $$\text{Health Score} = \sum_{i=1}^{8} w_i \times \text{SubScore}_i$$ where each $\text{SubScore}_i = \min\left(100, 100 \times \frac{\text{Coverage Achieved}}{\text{Target Benchmark}}\right)$.
  • Bhitargaon Live Sector Breakdown (Composite Score: 73.4 / 100):
    • 🛣️ Roads & Connectivity (20% weight): 68.4 / 100 (Paved road length vs unpaved earthen tracks).
    • 💧 Drinking Water (15% weight): 78.5 / 100 (JJM Functional Household Tap Connection coverage).
    • 🏥 Healthcare (15% weight): 72.0 / 100 (Population within 15-minute CHC catchment).
    • 🎓 Education (15% weight): 84.5 / 100 (Inter Colleges and Model Primary School proximity).
    • ⚡ Electricity (10% weight): 70.8 / 100 (17 hrs/day reliable supply from local 33/11kV substation).
    • 🚽 Sanitation (10% weight): 75.2 / 100 (ODF-Plus status & pucca drainage coverage).
    • 🌐 Digital Connectivity (10% weight): 68.0 / 100 (BharatNet 100 Mbps fiber & 4G signals).
    • ♻️ Solid & Liquid Waste (5% weight): 62.0 / 100 (SBM 3D Resource Recovery Centre status).
  • Interactive Weight Sliders: Planners can dynamically adjust sector weights to prioritize local emergencies (e.g., increasing Water weight during drought).

4. 🔬 Accessibility Engine & Gap Analysis

  • PostGIS Geodesic KNN: Runs spatial proximity queries across every building and habitation against infrastructure facilities using ST_DWithin and ST_Distance.
  • Automatic Deficit Detection: Generates prioritized gap alerts when populations fall outside national planning norms:
    • Critical Road Cutoff: Beri Khera (Ward 5) missing 2.1 km all-weather paved road.
    • Water Deficit: Chaturi Purwa (Ward 4) missing 1.2 km last-mile JJM distribution pipe.
    • Healthcare Isolation: Pasi Khera (Ward 3) requiring an Ayushman Arogya Mandir sub-center.
    • Sanitation Deficit: Beri Khera requiring community soak-pit drainage.

5. 🎯 Deterministic Priority Engine

Ranks capital improvement interventions without subjective human bias using an objective, verifiable formula: $$\text{Priority Score} = \frac{\text{Impact} \times \text{Severity} \times \text{Urgency} \times \text{Vulnerability} \times \text{Coverage}}{\text{Estimated Cost (₹ Lakhs)}}$$

  • Intervention Alignment: Every project is mapped directly to funding schemes:
    • PMGSY-III / CMGSY (60:40 Central:State road funding).
    • Jal Jeevan Mission — Har Ghar Jal (50:50 piped water grant).
    • PM-ABHIM / 15th FC Tied Health Grant (Healthcare infrastructure).
    • Swachh Bharat Mission (Gramin) Phase-2 (SLWM & RRC waste funding).

6. 🔮 What-If Counterfactual Simulator & Budget Optimizer

  • Interactive Scenario Testing: Planners can simulate adding infrastructure (e.g., 2.1 km paved road in Ward 5) to see the expected score delta, newly served households, and projected health score increase in real time.
  • Scenario Comparison: Side-by-side comparison of baseline metrics vs simulated post-intervention outcomes.
  • Budget Optimizer: Knapsack-inspired optimization engine that maximizes health score improvement within a fixed budgetary constraint (e.g., ₹50 Lakhs).

7. 🛰️ Remote Sensing & Multi-Spectral Satellite AI

GramSetu integrates authentic, multi-temporal Earth Observation telemetry covering Bhitargaon (26.2098° N, 80.2755° E) directly from orbit:

  • True Color Optical (10m Resolution): High-resolution cloud-free ortho-mosaic of the village landscape acquired in February 2026 via ESRI World Imagery Wayback (Release ID 63116).
  • NDVI (Normalized Difference Vegetation Index): $$\text{NDVI} = \frac{\text{B08} - \text{B04}}{\text{B08} + \text{B04}}$$ Computed from Copernicus Sentinel-2C L2A Near-Infrared (Band 8, 842nm) and Red (Band 4, 665nm). Visualized via the official Copernicus Land Monitoring Service (CLMS) 5-tier agricultural palette (warm stone-tan for abadi/roads, vibrant emerald for wheat and mustard fields, deep forest green for dense canopies). Live Mean NDVI: 0.64.
  • NDWI (Normalized Difference Water Index) & Wetland Delineation: $$\text{NDWI} = \frac{\text{B03} - \text{B08}}{\text{B03} + \text{B08}}, \quad \text{MNDWI} = \frac{\text{B03} - \text{B11}}{\text{B03} + \text{B11}}$$ Combines Sentinel-2 Green (Band 3, 560nm), NIR (Band 8), and SWIR (Band 11, 1610nm) to isolate surface water from leaf moisture. Village ponds, the historic Gupta Temple Kund, and the rejuvenated Amrit Sarovar (14.2 Ha) glow in high-contrast azure blue (#0284C7) with pale cyan boundary contours.
  • Sentinel-1 C-Band SAR Radar (5.405 GHz): $$\sigma^0_{\text{dB}} = 20\log_{10}(\text{DN}) - 83.0$$ Day/night, cloud-penetrating synthetic aperture radar backscatter from Copernicus Sentinel-1A (S1A_IW_GRDH_1SDV_20260225T124627, Orbit 63376). Despeckled with spatial Gaussian filtering and calibrated:
    • Water Surfaces: Specular reflection away from antenna $\rightarrow$ deep dark black ($\sigma^0 < -20\text{ dB}$).
    • Agricultural Soils & Crops: Microwave backscatter texture indicating surface roughness and dielectric moisture ($\sigma^0 \approx -15\text{ dB}$).
    • Brick Houses & Temple Monument: High-intensity corner reflectors ($\sigma^0 > -5\text{ dB}$).
  • Bi-Temporal 4-Year Change Detection (2022 vs 2026):
    • Baseline: January 12, 2022 satellite ortho-mosaic (ESRI Wayback WB_2022_R00, ID 52304).
    • Current: February 26, 2026 satellite ortho-mosaic (ESRI Wayback WB_2026_R02, ID 63116).
    • Spectral Difference Heatmap: Euclidean multi-band differencing ($\Delta E = 7.89%$ measured pixel change) mapping new built-up construction (+9.2%), pond deepening under Amrit Sarovar, and road paving.
    • Interactive Viewing Modes: Pointer-events swipe split slider, astronomical/GIS blink comparator (850ms interval), and auto-play sweep.
  • Computer Vision (AI CV) Validation Panel: Quantitative validation benchmarks against Survey of India ground-truth vectors:
    • Building Extraction: IoU 0.78 | F1-Score 0.84
    • Road Network Delineation: IoU 0.74 | F1-Score 0.81
    • Waterbody Boundary Delineation: IoU 0.88 | F1-Score 0.92
    • Bi-Temporal Change Detection: IoU 0.71 | F1-Score 0.77

8. 🤖 Grounded AI Rural Planning Assistant

  • A conversational intelligence assistant designed specifically for rural development planners.
  • Strict Grounding: Bound to the village's verified database and PostGIS queries; answers questions on demographics, budgets, project rankings, and scheme rules without fabricating facts.

9. 📋 Executive Export & Presentation Mode

  • Gram Sabha Resolution Modal: Formats all detected gaps, community statistics, and approved projects into an official Gram Sabha resolution draft ready for printing.
  • Kiosk Presentation Mode: Full-screen high-contrast presentation view designed for district review meetings (DISHA) and panchayat samiti halls.

👥 Multi-Stakeholder Role Workflows

GramSetu adapts its interface, metrics, and permissions according to 6 defined user personas:

Role Target User Dedicated View & Capabilities
Panchayat Planner Gram Pradhan, Panchayat Secretary Full access: Digital Twin, Health Score sliders, Simulation, Budget optimizer, and Gram Sabha exports.
District Official District Magistrate, CDO, DPRO Multi-village comparative benchmarking, block-level expenditure audits, and DISHA review metrics.
Field Worker ASHA, Anganwadi, Rozgar Sahayak Offline-friendly survey interface: household verification, handpump functionality logs, immunization tracking.
Citizen Portal Village Residents, Youth Clubs Radical public transparency: village budget utilization, active tenders, grievance submission, and water test reports.
NGO / CSR Partner Development Foundations, Donors High-impact unserved gap identification, school sanitation sponsorships, and ROI measurement.
State Planner Directorate of Panchayati Raj, UP Policy simulation, state-wide scheme saturation dashboards, and 15th FC fund release tracking.

📐 Database Schema & Spatial Models

GramSetu leverages PostgreSQL 16 with PostGIS 3.4 extensions. The relational spatial model is structured as follows:

erDiagram
    villages {
        uuid id PK
        string slug UK
        string name
        string state
        string state_code
        string district
        string lcode
        float area_sq_km
        geometry centroid "Point(4326)"
        geometry boundary "Polygon(4326)"
        jsonb population "Sourced[int]"
        jsonb households "Sourced[int]"
        int ward_count
    }

    wards {
        uuid id PK
        uuid village_id FK
        int ward_number
        string name
        int population
        int households
        float vulnerability_index
        geometry boundary "Polygon(4326)"
    }

    buildings {
        uuid id PK
        uuid village_id FK
        uuid ward_id FK
        string building_type
        string parcel_number
        bool has_piped_water
        bool has_electricity
        bool has_toilet
        geometry geom "Polygon(4326)"
        string source_status
    }

    roads {
        uuid id PK
        uuid village_id FK
        string name
        string highway_type
        string surface_type
        float length_km
        float width_m
        geometry geom "LineString(4326)"
    }

    assets {
        uuid id PK
        uuid village_id FK
        string name
        string asset_type
        string sector
        string capacity
        int serving_population
        geometry geom "Point(4326)"
        jsonb provenance
    }

    risk_zones {
        uuid id PK
        uuid village_id FK
        string name
        string risk_type
        string severity
        int affected_population
        int monsoon_cutoff_days
        geometry geom "Polygon(4326)"
    }

    villages ||--o{ wards : "contains"
    villages ||--o{ buildings : "contains"
    villages ||--o{ roads : "contains"
    villages ||--o{ assets : "contains"
    villages ||--o{ risk_zones : "contains"
    wards ||--o{ buildings : "groups"
Loading

🧮 Mathematical Formulations & Scoring Engines

1. Village Health Score Formula

The Village Health Score evaluates infrastructure saturation against national mission benchmarks:

$$\text{VHS} = \sum_{k \in \text{Sectors}} w_k \cdot S_k$$

$$\text{Subject to: } \sum_{k} w_k = 1.0, \quad w_k \ge 0$$

$$S_k = \min\left(100, ; 100 \times \frac{C_k}{T_k}\right)$$

Where:

  • $w_k$ = Sector weight assigned to sector $k$.
  • $C_k$ = Measured coverage in the village.
  • $T_k$ = Statutory target benchmark (e.g., 100% tap connections, 24 hours electricity, 1,000m primary school radius).

2. Capital Priority Ranking Formula

The Priority Score ranks candidate interventions to maximize social return on capital:

$$\text{Priority Score} = \frac{I \times S \times U \times V \times C_{\text{share}}}{E_{\text{cost}}}$$

Where:

  • $I$ = Impact Population (Count of directly benefited residents).
  • $S$ = Severity Score ($1 - 10$, reflecting risk to human life and health).
  • $U$ = Urgency Score ($1 - 10$, reflecting seasonal cutoff risk).
  • $V$ = Vulnerability Multiplier ($1.0 - 2.0$, higher for high-SC/ST or BPL habitations).
  • $C_{\text{share}}$ = Coverage Share (% of unserved gap resolved).
  • $E_{\text{cost}}$ = Estimated Project Budget in ₹ Lakhs.

3. Geodesic Haversine Distance & Accessibility Catchments

Walking distances between household clusters and critical public amenities are computed across the WGS84 ellipsoid ($R = 6,371\text{ km}$):

$$a = \sin^2\left(\frac{\Delta \phi}{2}\right) + \cos(\phi_1)\cos(\phi_2)\sin^2\left(\frac{\Delta \lambda}{2}\right)$$

$$d = 2R \cdot \text{atan2}\left(\sqrt{a}, \sqrt{1-a}\right)$$

A habitation is classified as served if $d \le D_{\text{norm}}$ (e.g., $D_{\text{water}} \le 500\text{m}$, $D_{\text{primary_school}} \le 1,000\text{m}$, $D_{\text{primary_health}} \le 1,500\text{m}$).

4. 0/1 Knapsack Budget Optimization

Given a statutory grant ceiling $B$ (e.g., ₹50 Lakhs under 15th FC / State Finance Commission), the budget optimizer selects an optimal subset of interventions $\mathcal{I}$ that maximizes the composite health score gain:

$$\max \sum_{j \in \mathcal{I}} x_j \cdot \Delta \text{VHS}_j \quad \text{subject to} \quad \sum_{j \in \mathcal{I}} x_j \cdot c_j \le B, \quad x_j \in {0, 1}$$

Where $c_j$ is the estimated project cost and $\Delta \text{VHS}_j$ is the marginal health score delta projected by the counterfactual simulation engine.

5. Multi-Temporal Remote Sensing Spectral Difference

Physical bi-temporal land changes between 2022 and 2026 are measured via Euclidean distance across normalized red, green, and blue reflectance vectors:

$$\Delta E(x, y) = \sqrt{\left(R_{26} - R_{22}\right)^2 + \left(G_{26} - G_{22}\right)^2 + \left(B_{26} - B_{22}\right)^2}$$

Significant changes are thresholded at $\Delta E > 20$ DN to separate seasonal fallow variations from permanent civil works (paved roads, building construction, and Amrit Sarovar excavation).


📡 REST API Reference

The FastAPI backend exposes interactive OpenAPI docs at http://localhost:8000/api/docs.

1. Village Core Endpoints

GET /api/villages
List all configured villages with demographic summaries and provenance records.

GET /api/villages/{slug}
Retrieve full details, boundary polygon, and centroid for a target village.

GET /api/villages/{slug}/layers
Returns the GeoJSON layer manifest with feature counts for all map layers.

GET /api/villages/{slug}/layers/{layer_name}
Fetch a complete GeoJSON FeatureCollection for a specific layer:
`buildings` | `roads` | `wards` | `assets` | `risk_zones`

2. Health Score Endpoints

GET /api/villages/{slug}/health-score
Returns the 8-pillar composite score, historical trajectory, and sub-score details.

POST /api/villages/{slug}/health-score/recompute
Accepts custom sector weights in the request body and recalculates scores in real-time.

3. Spatial Accessibility Endpoints

GET /api/villages/{slug}/accessibility/summary
Aggregated building counts categorized as GOOD, MODERATE, or POOR across all services.

GET /api/villages/{slug}/accessibility/{service}
Returns building-level GeoJSON features with individual distance attributes.
Available services: `healthcare` | `education` | `water` | `roads`

🚀 Quick Start Guide

Prerequisites

  • Docker Desktop (version ≥ 24.x) & Docker Compose (version ≥ 2.x).
  • Optional (for local development without Docker): Node.js v18+, Python 3.10+, PostgreSQL 16 with PostGIS.

1. Clone the Repository

git clone https://github.com/Aditya-dxt/GramSetu.git
cd GramSetu

2. Environment Configuration

Copy the sample environment file:

cp .env.example .env

Default development environment variables (.env):

POSTGRES_USER=gramsetu
POSTGRES_PASSWORD=gramsetu_dev_password
POSTGRES_DB=gramsetu_db
POSTGRES_PORT=5432

DATABASE_URL=postgresql+psycopg://gramsetu:gramsetu_dev_password@db:5432/gramsetu_db
ENVIRONMENT=development
PROJECT_NAME="GramSetu - Village Infrastructure Digital Twin"
API_V1_STR=/api
CORS_ORIGINS=["http://localhost:5173","http://localhost:3000","http://127.0.0.1:5173"]

VITE_API_URL=http://localhost:8000
FRONTEND_PORT=5173
BACKEND_PORT=8000

3. Start the Complete Stack with Docker

Launch the PostGIS database, FastAPI backend, and React frontend in the background:

docker compose up -d --build

4. Seed the Database with Real Bhitargaon Data

Populate PostGIS with the authentic Bhitargaon demographic, ward, and spatial dataset:

docker compose exec backend python scripts/seed_village.py --config config/villages/bhitargaon.yaml

5. Open the Application

  • Frontend Web Application: http://localhost:5173
  • Backend API Documentation (Swagger): http://localhost:8000/api/docs
  • Live Village API (Bhitargaon): http://localhost:8000/api/villages/bhitargaon-kanpur

6. Clean Shutdown

To stop and remove containers when finished:

docker compose down

🛡️ Data Provenance & Privacy Discipline

In accordance with Section 16 of the GramSetu Technical Specification and India's Digital Personal Data Protection (DPDP) Act 2023:

flowchart LR
    A["Raw Data Ingestion"] --> B{Provenance Tagging}
    B -->|"Census / Official Registry"| C["REAL\nHigh Confidence"]
    B -->|"OpenStreetMap / Open Data"| D["OPEN_DATA\nHigh Confidence"]
    B -->|"Copernicus / Sentinel-2"| E["SATELLITE_DERIVED\nMedium/High"]
    B -->|"PostGIS Spatial Algorithm"| F["MODEL_DERIVED\nDeterministic"]
    B -->|"Procedural Fallback"| G["SYNTHETIC_DEMO\nExplicitly Flagged"]
Loading
  1. Explicit Provenance Badging: Every UI card and API response carries a ProvenanceBadge displaying source authority, verification status, and observation date.
  2. Confidentiality by Design: Individual census schedules and personal household records are protected under Section 15 of the Census Act, 1948. GramSetu aggregates all private metrics at the ward and cadastral parcel level, ensuring individual privacy is never breached while granting planners total spatial clarity.

Authentic Ground-Truth Data Matrix

Layer / Feature Ground-Truth Authority Resolution / Accuracy Date of Record Verification Method
Village Demographics & Wards Office of the Registrar General & Census Commissioner, India Village Code: 150654 Census 2011 Baseline Primary Census Abstract (PCA) cross-referenced with LGD
Land Use & Cropland Area Directorate of Economics & Statistics, Ministry of Agriculture 554.20 Ha (394.47 Ha Net Sown) 2021–2022 Annual Survey District Statistical Handbook, Kanpur Nagar
Administrative Boundary & Roads OpenStreetMap (OSM) & UP PWD / PMGSY Network 56-vertex Polygon, LineStrings Feb 2026 Overpass Sync ST_Contains and ST_DWithin spatial topology checks
Gupta Brick Temple Footprint Archaeological Survey of India (ASI) Monument ID: N-UP-L153 Protected Heritage Site Centrally protected monument spatial buffer (26.2093°N, 80.2735°E)
High-Res True Color Ortho ESRI World Imagery Wayback Archive 0.5m Ortho Imagery Feb 26, 2026 (Release 63116) Tile WMTS coordinates z=15, x=23690, y=13910
Historical 2022 Baseline ESRI World Imagery Wayback Archive 0.5m Ortho Imagery Jan 12, 2022 (Release 52304) Bi-temporal spatial overlay alignment
NDVI Crop Health & Canopy European Space Agency / Copernicus Sentinel-2C L2A 10m Ground Resolution Feb 26, 2026 (S2C_44RMP) Multi-spectral Band 8 (NIR) & Band 4 (Red) COG range read
NDWI Water Bodies & Amrit Sarovar European Space Agency / Copernicus Sentinel-2C L2A 10m Ground Resolution Feb 26, 2026 (S2C_44RMP) Band 3 (Green), Band 8 (NIR), and Band 11 (SWIR MNDWI)
SAR Microwave Radar Backscatter European Space Agency / Copernicus Sentinel-1A IW GRD 10m Spatial Resolution (5.405 GHz) Feb 25, 2026 (S1A_IW_GRDH) VV + VH dual-pol radar backscatter decibel calibration
15th FC Grants & Rural Schemes Ministry of Panchayati Raj / eGramSwaraj Portal Statutory Grant Envelope FY 2025–26 Allocation Tied / Untied budget entitlement guidelines

📁 Repository File Tree

GramSetu/
├── docker-compose.yml              # Multi-container orchestration (DB + Backend + Frontend)
├── .env.example                    # Sample environment variables
├── README.md                       # Comprehensive project master documentation
├── PROGRESS.md                     # Phase development tracker
├── bhitargaon_complete_village_profile.json # Master JSON export of Bhitargaon data
│
├── scripts/                        # Remote sensing & pipeline automation scripts
│   └── fetch_sentinel_data.py      # Automated Copernicus Sentinel-2 L2A & Sentinel-1 SAR pipeline
│
├── backend/                        # FastAPI Python Backend
│   ├── Dockerfile                  # Container definition for Python 3.11 service
│   ├── requirements.txt            # Python dependencies (FastAPI, GeoAlchemy2, Shapely, etc.)
│   ├── alembic.ini                 # Database migration configuration
│   ├── app/
│   │   ├── main.py                 # FastAPI application lifecycle and middleware
│   │   ├── core/                   # Logging and configuration settings
│   │   ├── database/               # SQLAlchemy engine, session, and PostGIS base models
│   │   ├── models/                 # ORM models (Village, Ward, Building, Road, Asset, Risk)
│   │   ├── schemas/                # Pydantic v2 validation models & provenance types
│   │   ├── services/               # Geospatial service layer (KNN accessibility, GeoJSON)
│   │   └── api/routes/             # REST controllers (village, geojson, accessibility)
│   ├── config/villages/            # YAML village configurations
│   │   ├── bhitargaon.yaml         # Authentic Bhitargaon PostGIS configuration
│   │   └── demo_village.yaml       # Benchmark demo village configuration
│   └── scripts/
│       └── seed_village.py         # Idempotent YAML-to-PostGIS database seeder
│
└── frontend/                       # React 18 + Vite Frontend
    ├── Dockerfile                  # Node.js alpine development container
    ├── package.json                # Frontend dependencies
    ├── vite.config.ts              # Vite build and proxy settings
    ├── tailwind.config.js          # Extended theme (clay, mustard, paddy, jal palettes)
    ├── tsconfig.json               # TypeScript compiler paths & strict configuration
    ├── index.html                  # HTML entry point with Google Fonts (Plus Jakarta Sans, Outfit)
    ├── public/
    │   ├── apna-gaon-logo.png      # Official GramSetu brand emblem asset
    │   └── satellite/              # Authentic Earth observation rasters for Bhitargaon
    │       ├── bhitargaon_2022_baseline.jpg # Real ESRI Wayback Jan 2022 baseline mosaic
    │       ├── bhitargaon_2026_current.jpg  # Real ESRI Wayback Feb 2026 current mosaic
    │       ├── bhitargaon_truecolor.jpg     # High-resolution true color optical layer
    │       ├── bhitargaon_ndvi.jpg          # Calibrated Copernicus Sentinel-2 NDVI raster
    │       ├── bhitargaon_ndwi.jpg          # Calibrated Sentinel-2 NDWI waterbodies raster
    │       ├── bhitargaon_sar.jpg           # Calibrated Copernicus Sentinel-1 C-Band SAR radar
    │       ├── bhitargaon_builtup.jpg       # Cadastral built-up classification mask
    │       └── bhitargaon_change.jpg        # Bi-temporal Euclidean spectral change heatmap
    └── src/
        ├── App.tsx                 # Root component: tab management & active role routing
        ├── index.css               # Global styling, utility classes, and custom scrollbars
        ├── types/index.ts          # Complete TypeScript domain contracts
        ├── data/
        │   ├── bhitargaonVillageData.ts # Authentic Bhitargaon VillageData digital twin instance
        │   ├── villagesData.ts     # Master VILLAGES_DATABASE export
        │   ├── schemesData.ts      # Centrally sponsored government scheme registry
        │   ├── aiScenarios.ts      # Interactive planning scenarios & Chaupal assistant queries
        │   └── translations.ts     # Full bilingual Hindi/English dictionary
        ├── utils/
        │   ├── basemaps.ts         # Carto Positron, OSM, and Satellite basemap configurations
        │   ├── encodingRepair.ts   # UTF-8 encoding repair & text normalization
        │   ├── gisCalculations.ts  # Geodesic haversine distance & service buffer calculations
        │   ├── localization.ts     # Localization formatting & Devanagari numerals
        │   ├── simulationFeatures.ts # Spatial impact helpers for What-If scenarios
        │   ├── speechHelper.ts     # Web Speech synthesis helper for audio briefings
        │   ├── wardPartition.ts    # Voronoi spatial ward partitioning & polygon helpers
        │   └── whatIfEngine.ts     # Counterfactual simulation & delta projection engine
        └── components/
            ├── Navbar.tsx          # Top header: village selector, role switcher, audio briefing
            ├── FormattedText.tsx   # Number & bilingual text formatter
            ├── LanguageSelector.tsx# Hindi and English language toggle
            ├── ProvenanceBadge.tsx # Verification badge displaying source metadata
            ├── common/             # Reusable UI containers (PageHeader, SectionCard)
            ├── layout/Sidebar.tsx  # Responsive navigation sidebar with role indicators
            ├── Dashboard/          # Executive KPI deck, Krishi-Mausam, HealthScoreCard, GapAnalysis
            ├── map/                # DigitalTwinMap and VillageMap Leaflet vector visualizers
            ├── Simulation/         # WhatIfSimulator, WardSimulatorMap, BudgetOptimizer
            ├── Priority/           # PriorityEngineView with deterministic project cards
            ├── SatelliteAI/        # Multi-spectral SatelliteViewer with split-slider & CV panel
            ├── AIAssistant/        # GroundedChat rural planning assistant (RAG-bound)
            ├── Roles/              # Dedicated views for District, Field Worker, and Citizens
            └── Reports/            # Gram Sabha resolution and kiosk presentation modes

Built for Hackathons & Rural Innovation · Powered by OpenStreetMap & Copernicus Sentinel · Spatial Analytics by PostGIS

Made with ❤️ for Gram Panchayats across India

About

A full-stack geospatial decision-support platform for rural India that transforms real-world village infrastructure data into an interactive digital twin, enabling planners to identify underserved areas, analyze accessibility gaps, evaluate infrastructure health, and support data-driven rural development planning.

Topics

digital-twindockerfastapiopenstreetmappostgresqlpythonreactrest-apirural-developmentspatial-analysis

Resources

Readme
Activity

Stars

1 star

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.