Skip to content

Samarth305/GenAI-Rural_Intelligence_Platform

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌾 KhedutMitra : Rural Intelligence Platform

KhedutMitra is a sophisticated full-stack rural intelligence platform designed for farmer-centric risk monitoring, advisory delivery, and operational excellence. It empowers institutions with real-time data, predictive analytics, and automated communication tools to support rural communities effectively.


πŸš€ Tech Stack

Frontend

React Vite Tailwind CSS TanStack Query Zustand Leaflet

Backend

Node.js Express.js PostgreSQL JWT Twilio Telegram Azure Speech Groq


✨ Key Features

πŸ“Š Farmer Vulnerability Index (FVI)

Advanced risk scoring engine that computes vulnerability based on:

  • Climate Risk: Real-time and historical weather patterns.
  • Soil Suitability: Compatibility analysis for specific crops.
  • Financial Risk: Loan status, insurance coverage, and market factors.
  • Social Risk: Household and demographic indicators.

🌀️ Weather Intelligence

  • Real-time weather monitoring on district levels.
  • Intelligent caching strategy to prevent redundant API calls.
  • Weather-aware advisories generated for specific crop cycles.

πŸ—ΊοΈ Operational Dashboards

  • Dynamic Metrics: Live tracking of average vulnerability scores and unique district reaches.
  • Heatmaps: District-wise visualization of risk factors using Leaflet.
  • Actionable Insights: Categorized alerts (Critical, High, Medium, Low) for field teams.

πŸ’¬ WhatsApp Integration

  • Automated advisory delivery and farmer engagement via Twilio.
  • Assisted response flow for conversation tracking.
  • Bulk alert generation and status management.

πŸ€– AI-Powered Telegram Bot

  • Computer Vision: Crop disease detection from farmer-uploaded photos using Llama-3 Vision models via Groq.
  • Multilingual Support: Instant analysis and advice in Gujarati, Hindi, and English.
  • Automatic Logging: Detected issues are automatically logged into the central database for field officer follow-ups.

πŸŽ™οΈ Voice Assistant (TTS)

  • Rural Accessibility: Integrated Text-to-Speech (TTS) using Azure Speech Service to convert agricultural advisories into spoken audio.
  • Localized Voices: Support for natural-sounding neural voices in Gujarati, Hindi, and English.
  • Interactive Engagement: Hybrid interaction model combining text, images, and audio for maximum reach.

🌍 Multilingual & Localization

  • Native support for English, Gujarati, and Hindi.
  • Seamless UI localization across all modules (Dashboard, Profile, Alerts).

πŸ’Ž What Makes This Project Unique

  • Domain-Specific Modeling: Tailored farmer intelligence rather than generic CRM behavior.
  • Field-Ready Profiles: Combines agronomy and finance into a single, actionable entity.
  • Hybrid Advisory: Merges weather data, risk scoring, and automated alerting.
  • Institutional Focus: Dashboards designed for scale, supporting both field officers and superadmins.
  • Modular Architecture: Clean isolation of domains into controller/route/service layers.


πŸ“‚ Project Structure

GenAI-Rural_Intelligence_Platform/
β”œβ”€β”€ backend/                # Express.js Server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/         # App configuration
β”‚   β”‚   β”œβ”€β”€ db/             # Migrations, Seeds, and Setup
β”‚   β”‚   β”‚   β”œβ”€β”€ migrations/
β”‚   β”‚   β”‚   β”œβ”€β”€ migrate.js
β”‚   β”‚   β”‚   β”œβ”€β”€ seed.js
β”‚   β”‚   β”‚   └── setup.js
β”‚   β”‚   β”œβ”€β”€ middleware/     # Auth, Logging, Validation
β”‚   β”‚   β”œβ”€β”€ modules/        # Domain-driven modules
β”‚   β”‚   β”‚   β”œβ”€β”€ alerts/
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   β”œβ”€β”€ crops/
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”‚   β”œβ”€β”€ disease/
β”‚   β”‚   β”‚   β”œβ”€β”€ farmers/
β”‚   β”‚   β”‚   β”œβ”€β”€ institutions/
β”‚   β”‚   β”‚   β”œβ”€β”€ locations/
β”‚   β”‚   β”‚   β”œβ”€β”€ schemes/
β”‚   β”‚   β”‚   β”œβ”€β”€ translation/
β”‚   β”‚   β”‚   β”œβ”€β”€ users/
β”‚   β”‚   β”‚   β”œβ”€β”€ vulnerability/
β”‚   β”‚   β”‚   β”œβ”€β”€ weather/
β”‚   β”‚   β”‚   β”œβ”€β”€ whatsapp/
β”‚   β”‚   β”‚   └── function-docs/
β”‚   β”‚   └── utils/          # Shared Helpers
β”‚   └── server.js           # API Entry Point
β”œβ”€β”€ frontend/               # React Vite Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/            # TanStack Query Hooks
β”‚   β”‚   β”œβ”€β”€ components/     # UI Design System
β”‚   β”‚   β”œβ”€β”€ hooks/          # Custom React Hooks
β”‚   β”‚   β”œβ”€β”€ pages/          # Feature Views (Dashboard, Map, Farmers)
β”‚   β”‚   β”œβ”€β”€ router/         # App Routing
β”‚   β”‚   β”œβ”€β”€ store/          # Global State (Zustand)
β”‚   β”‚   └── utils/          # Frontend Helpers
β”‚   └── vite.config.js      # Build Configuration
└── README.md

πŸ› οΈ Getting Started

Prerequisites

  • Node.js v20 or higher
  • PostgreSQL (running locally or via cloud)

1. Backend Setup

  1. Go to the backend folder.
  2. Install dependencies: npm install
  3. Configure environment variables in .env (DATABASE_URL, JWT_SECRET, etc.).
  4. Initialize DB (schema + seed): npm run db:setup
  5. Start server: npm run dev

2. Frontend Setup

  1. Go to the frontend folder.
  2. Install dependencies: npm install
  3. Configure VITE_API_BASE_URL in .env.
  4. Start app: npm run dev

πŸ—„οΈ Database and Seed Notes

  • Migrations: Include base schema, WhatsApp sessions, farmer sequences, and extended profile fields.
  • Smart Seeding: The seed script populates farmers with complete agronomic and financial data, ensuring edit forms display realistic values immediately.

πŸ“– Function Documentation

  • Auto-Generated: Detailed per-function documentation is located in backend/src/modules/function-docs.
  • Index: See backend/src/modules/function-docs/README.md for a complete overview of controller/service logic.
  • Maintenance: To regenerate, rerun the documentation workflow assigned to backend modules.

πŸ›£οΈ API Domains

  • /api/auth - Authentication & Refresh Tokens
  • /api/users - User Management & RBAC
  • /api/institutions - Organization Management
  • /api/farmers - Profile CRUD & Life-cycle
  • /api/crops - Crop Catalog & Suitability
  • /api/vulnerability - FVI Calculation Engine
  • /api/schemes - Matching & Eligibility
  • /api/alerts - Operational Monitoring
  • /api/dashboard - Real-time Analytics
  • /api/disease - AI Disease Detection
  • /api/locations - District/Taluka Assets
  • /api/translate - Multilingual Logic
  • /api/whatsapp - Twilio Messaging & Voice Assistant
  • /api/telegram - GenAI Telegram Bot

πŸ”’ Security & Reliability

  • Stateful Sessions: JWT with integrated refresh flow for secure, long-lived sessions.
  • Input Validation: Strict Joi schemas for all inbound requests.
  • Error Handling: Centralized response normalization and logging.
  • Weather Reliability: Caching strategy with smart refresh to maintain advisory context.

βš™οΈ Maintenance Notes

  • Keep migrations forward-only and idempotent.
  • Ensure vulnerability weightages are updated in synchronization with institutional policies.

πŸ“„ License

This project is for internal institutional use. Contact the administrator for licensing policies.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 96.3%
  • PLpgSQL 3.4%
  • Other 0.3%