Skip to content

LEAF DSS Documentation

LEAF (Landscape Evaluation & Assessment Framework) Decision Support System is a geospatial planning platform built by IWMI for the Assam State Rural Livelihoods Mission (ASRLM). It evaluates the feasibility of agricultural and livestock interventions across Assam and plans village-level livelihood clusters.

Live: https://leaf-asrlm.in


What LEAF DSS Does

  • Geospatial visualization - Interactive Leaflet maps of block-level agriculture, water, infrastructure, livestock, and demographic indicators across Assam, with district-boundary and Protected-Area overlays.
  • Multi-criteria feasibility scoring - Weighted engine scoring each block against configurable variable ranges and weights to produce feasibility classes ("Very Low" to "Very High").
  • Cluster planning - Greedy seed-and-grow clustering (ALGO_VERSION 5) groups villages into livelihood clusters for six commodities (Dairy, Goatery, Piggery, Backyard Poultry, Duckery, Fishery). Field cadres edit assignments in the app; edits are protected from automatic regeneration.
  • AI recommendations - RAG pipeline combining block metrics with policy PDFs to generate citation-backed recommendations via OpenAI.

System Overview

┌─────────────────────────────────────────────────────────────┐
│                          Clients                              │
│   ┌──────────┐   ┌───────────┐   ┌───────────────┐           │
│   │ Browser  │   │ API Users │   │ Swagger /docs │           │
│   └────┬─────┘   └─────┬─────┘   └──────┬────────┘           │
└────────┼───────────────┼────────────────┼───────────────────┘
         │               │                │
┌────────▼───────────────▼────────────────▼───────────────────┐
│                 Flask Application (app:app)                   │
│                                                               │
│   blueprints/  (modules: pages, blocks, locations,            │
│   clusters, villages, feasibility, interventions, config,     │
│   export, levels, infrastructure, production_tool, …)         │
│                          │                                    │
│   ┌──────────────────────▼───────────────────────────────┐   │
│   │  Business logic: clustering · feasibility · rag_utils │   │
│   │                   google_sheets · db_backup           │   │
│   └───┬──────────────┬──────────────┬──────────────┬─────┘   │
│       │              │              │              │          │
│  ┌────▼─────┐  ┌─────▼──────┐  ┌────▼─────┐  ┌─────▼──────┐   │
│  │ Supabase │  │ CSV +      │  │ Google   │  │ Chroma +   │   │
│  │ Postgres │  │ Shapefiles │  │ Sheets   │  │ PDFs (RAG) │   │
│  │ (clusters│  │ (villages, │  │ overlay  │  │            │   │
│  │  + POIs) │  │  geodata)  │  │(block    │  │            │   │
│  └──────────┘  └────────────┘  │ values)  │  └────────────┘   │
│                                └──────────┘                   │
│   In-process scheduler thread: daily cluster sweep +          │
│   nightly Supabase Storage backup                             │
└───────────────────────────────────────────────────────────────┘

Coverage

LEAF DSS covers all 35 districts and 220 blocks of Assam. Village clustering reads from data/villages.csv (the planner's source of truth); block-level map and feasibility indicators come from a published Google Sheet overlay (block_values), falling back to the committed CSV.


Map Overlays

Layer Description Default
Feasibility Choropleth Blocks color-coded by feasibility score Always on
District Boundaries Dashed outlines of Assam's districts Always on
Protected Areas National parks, sanctuaries, conservation reserves Off (toggle)

Resource Path Description
Getting Started - Install, run, and make your first API call
API Reference /api Full endpoint documentation
Architecture - System design and module responsibilities
Deployment - Deploy to Render or run locally
Swagger UI /docs Interactive API explorer with try-it-out
Documentation Site /documentation/ This documentation, served from the Flask app

Technology Stack

Layer Technology
Backend Python 3.11, Flask (blueprints package), Flask-CORS, Gunicorn
Database Supabase Postgres (via DATABASE_URL, psycopg2, raw SQL); manual SQL migrations
Data & Geospatial Pandas, GeoPandas (Fiona/GDAL, Shapely, PyProj), CSV + Shapefiles, EPSG:4326
External data Google Sheets published-CSV overlay (block values, intervention config)
Background jobs In-process daemon scheduler thread (daily cluster sweep + nightly Supabase Storage backup), Postgres advisory locks
AI/RAG LangChain, ChromaDB, OpenAI (gpt-4o-mini)
API Docs Flasgger (Swagger/OpenAPI), MkDocs Material
Deployment Render (Gunicorn, standard plan), custom domain leaf-asrlm.in, GitHub auto-deploy

No authentication

There is no user authentication. Admin/destructive actions are gated only by a ?admin=1 query flag or X-Admin: 1 header. Do not expose write endpoints publicly without adding real auth.