Skip to content

godaralokesh29/GovInsight-Pro

Repository files navigation

๐Ÿ›๏ธ GovInsight Pro - AI-Powered Government Scheme Discovery Platform

Bridging Officials and Government Services through Intelligent Technology

๐Ÿงฉ Core Features

๐Ÿ” 1. Intelligent Scheme Discovery

โœ… Vector-powered search using:

  • ๐Ÿง  Semantic embeddings with Xenova/all-MiniLM-L6-v2 + multilingual transformers
  • ๐Ÿ“ Location-based filtering (state/district)
  • ๐Ÿ‘ค Profile-based personalization
  • ๐ŸŽฏ Real-time eligibility checking
{
  "query": "education scholarship scheme west bengal",
  "results": [
    {
      "name": "Swami Vivekananda Merit-cum-Means Scholarship (SVMCM)",
      "eligibility_score": 0.92,
      "benefits": "Financial assistance up to โ‚น60,000 per year for meritorious students pursuing higher education"
    }
  ]
}

๐Ÿค– 2. Universal Government AI Assistant

Powered by Google Gemini + Hugging Face Models with comprehensive knowledge:

  • ๐Ÿฅ Healthcare & Insurance (Ayushman Bharat, PMJJBY)
  • ๐ŸŽ“ Education & Scholarships (NSP, PM YASASVI)
  • ๐Ÿ’ผ Employment & Skills (MGNREGA, PMKVY)
  • ๐Ÿ’ฐ Financial Services (Jan Dhan, Mudra Loans)
  • ๐Ÿ“„ Digital Services (Aadhaar, PAN, Passport)
{
  "query": "West Bengal education scholarship schemes",
  "response": "Available schemes: Swami Vivekananda Merit-cum-Means Scholarship (up to โ‚น60,000/year), Kanyashree Prakalpa (โ‚น25,000 one-time grant), Aikyashree Minority Scholarship (โ‚น12,000โ€“โ‚น30,000 depending on level)"
}

๐Ÿ“ž 3. Multilingual IVR System (Twilio + Ngrok)

Press 1 for scheme information
Press 2 for eligibility check
Press 3 to speak with AI assistant

Supports keypad phones with:

  • ๐Ÿ”„ Twilio Voice API integration
  • ๐ŸŒ Ngrok tunneling for local development
  • ๐Ÿ—ฃ๏ธ Text-to-Speech with IndicTrans2 for Indian languages
  • ๐Ÿ“ž DTMF navigation for feature phones
  • ๐Ÿง  Hugging Face models for voice processing

๐Ÿ“„ 4. Document Intelligence & OCR

Smart form assistance using:

  • ๐Ÿ‘๏ธ Tesseract OCR for document scanning
  • ๐Ÿง  AI-powered field extraction
  • ๐Ÿ“ Step-by-step form filling guidance
  • ๐Ÿ”Š Audio instructions via TTS
{
  "extracted_fields": ["name", "aadhaar", "income"],
  "help_text": "Fill Aadhaar as 12-digit number without spaces",
  "audio_url": "/audio/form_help_hindi.mp3"
}

๐Ÿ‘ฅ 5. Community Engagement Platform

Role-based social features:

  • ๐Ÿ’ฌ Community posts and discussions
  • ๐Ÿท๏ธ Special badges for govt officials & NGOs
  • ๐Ÿ“Š AI sentiment analysis of community feedback
  • ๐Ÿšซ Hate speech detection and moderation
  • ๐Ÿ”” Real-time notification system

โš™๏ธ Tech Stack

Layer Technology Purpose
๐ŸŽจ Frontend React 19 + Vite + Tailwind CSS Modern responsive UI
๐Ÿ”ง Backend Node.js + Express + MongoDB RESTful API & data management
๐Ÿง  AI Services FastAPI + Python + Transformers ML/AI processing pipeline
๐Ÿ—„๏ธ Database MongoDB Atlas + Vector Search Semantic scheme discovery
๐Ÿ“ž Voice Twilio + Ngrok IVR calling system
๐ŸŒ Translation IndicTrans2 + Google Translate Multi-language support
๐Ÿค– ML Models Hugging Face + Custom Models NLP & Computer Vision
๐Ÿ” Auth JWT + bcrypt Secure authentication

๐Ÿ—๏ธ Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   React Frontend โ”‚โ”€โ”€โ”€โ”€โ”‚  Node.js Backend โ”‚โ”€โ”€โ”€โ”€โ”‚  FastAPI AI Hub โ”‚
โ”‚   (Port 3000)   โ”‚    โ”‚   (Port 5000)   โ”‚    โ”‚   (Port 8000)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                       โ”‚                       โ”‚
         โ”‚              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  MongoDB Atlas  โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚ (Vector Search) โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   Twilio IVR System     โ”‚
                    โ”‚   (Ngrok Tunneling)     โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

๐Ÿ“‹ Prerequisites

Node.js 18+, Python 3.9+, MongoDB Atlas account
Twilio account, Google API keys, Ngrok

๐Ÿ”ง Installation

1๏ธโƒฃ Backend Setup

cd backend
npm install
cp .env.example .env
# Configure: MONGODB_URI, JWT_SECRET, CORS_ORIGIN
npm run dev  # Runs on port 5000

2๏ธโƒฃ Frontend Setup

cd frontend
npm install
cp .env.example .env
# Configure: VITE_BACKEND_URL, VITE_GEMINI_API_KEY
npm run dev  # Runs on port 3000

3๏ธโƒฃ AI Services Setup

cd fastAPI
python -m venv myenv
source myenv/bin/activate  # Windows: myenv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Configure: GOOGLE_API_KEY, BACKEND_URL
python -m uvicorn app.main:app --reload  # Runs on port 8000

4๏ธโƒฃ IVR System Setup

# Install ngrok globally
npm install -g ngrok

# Expose FastAPI to internet
ngrok http 8000

# Configure Twilio webhook URL:
# https://your-ngrok-url.ngrok.io/ivr/voice

๐Ÿ“Š API Endpoints

๐Ÿ” Authentication

Method Endpoint Description
POST /api/v1/auth/register User registration
POST /api/v1/auth/login User login
GET /api/v1/auth/me Get current user

๐ŸŽฏ Schemes

Method Endpoint Description
GET /api/v1/schemes List all schemes
POST /api/v1/schemes/search Vector search schemes
GET /api/v1/schemes/eligible/me Get eligible schemes

๐Ÿค– AI Services

Method Endpoint Description
POST /chat AI assistant chat
POST /analyze-form OCR + form help
POST /detect-hatespeech Content moderation
POST /translate Text translation

๐Ÿ“ž IVR System

Method Endpoint Description
POST /ivr/voice Twilio voice webhook
POST /ivr/gather DTMF input processing
GET /ivr/tts/{text} Text-to-speech audio

๐Ÿง  AI/ML Components

๐Ÿ” Vector Search Engine

// Semantic scheme matching with state-of-the-art embeddings
const embedder = await pipeline("feature-extraction", "Xenova/all-MiniLM-L6-v2");
const queryEmbedding = await embedder(userQuery);
const results = await collection.aggregate([
  {
    $vectorSearch: {
      queryVector: queryEmbedding,
      path: "embedding",
      numCandidates: 200,
      limit: 5
    }
  }
]);

๐ŸŒ Advanced Translation Pipeline

# IndicTrans2 for Indian languages
from IndicTransToolkit import IndicProcessor
ip = IndicProcessor(inference=True)
input_sentences = ["Government scheme information"]
batch = ip.preprocess_batch(input_sentences, src_lang="eng_Latn", tgt_lang="hin_Deva")
translated = model(batch)
output = ip.postprocess_batch(translated, lang="hin_Deva")

๐Ÿง  Multi-Model AI Pipeline

# Hugging Face Transformers integration
from transformers import pipeline, AutoTokenizer, AutoModel

# Sentiment analysis for community posts
sentiment_analyzer = pipeline("sentiment-analysis", 
                            model="cardiffnlp/twitter-roberta-base-sentiment-latest")

# Multilingual embeddings
embedding_model = AutoModel.from_pretrained("sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2")

# Google Gemini for conversational AI
model = genai.GenerativeModel('gemini-1.5-flash')
response = model.generate_content(f"""
You are an Indian Government Services Assistant.
Query: {user_query}
Schemes: {relevant_schemes}
Respond directly with helpful information.
""")

๐Ÿ‘๏ธ Computer Vision & OCR

# Advanced document processing pipeline
import pytesseract
from PIL import Image
from transformers import pipeline

# OCR with preprocessing
ocr_result = pytesseract.image_to_string(preprocessed_image, lang='eng+hin+ben')

# Document classification
doc_classifier = pipeline("image-classification", 
                         model="microsoft/dit-base-finetuned-rvlcdip")

# Form field extraction with NER
ner_pipeline = pipeline("ner", 
                       model="dbmdz/bert-large-cased-finetuned-conll03-english")
fields = ner_pipeline(ocr_result)

๐Ÿ›ก๏ธ Content Moderation

# Custom hate speech detection model
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer

# Load pre-trained models
tfidf = pickle.load(open('vectorizer.pkl', 'rb'))
hate_model = pickle.load(open('model.pkl', 'rb'))

# Multi-language hate speech detection
transformed_text = transform_text(user_input)
vector_input = tfidf.transform([transformed_text])
is_hate_speech = hate_model.predict(vector_input)[0]

๐ŸŽญ User Roles & Permissions

Role Permissions UI Features
๐Ÿ‘ค Citizen View schemes, apply, community posts Standard interface
๐Ÿ›๏ธ Govt Official Manage schemes, approve applications Gold highlighting, admin badge
๐Ÿค NGO Create schemes, community engagement Green highlighting, NGO badge
โšก Admin Full system access, user management Red highlighting, admin badge

๐Ÿ“ฑ Multi-Platform Support

๐ŸŒ Web Application

  • Responsive design for desktop/mobile
  • Progressive Web App (PWA) ready
  • Offline scheme browsing capability

๐Ÿ“ž IVR System Flow

๐Ÿ“ž User calls Twilio number
    โ†“
๐ŸŽต Welcome message in preferred language
    โ†“
๐Ÿ”ข DTMF menu options
    โ†“ (Press 1)
๐Ÿ” Scheme information service
    โ†“ (Press 2)  
โœ… Eligibility checking
    โ†“ (Press 3)
๐Ÿค– AI assistant conversation

๐Ÿ“ฑ Mobile Features

  • Touch-friendly interface
  • Voice input support
  • Camera document scanning
  • Push notifications

๐Ÿ›ก๏ธ Security & Compliance

๐Ÿ” Authentication & Authorization

// JWT-based security
const token = jwt.sign({ userId, role }, JWT_SECRET, { expiresIn: '7d' });
// Role-based access control
const hasPermission = user.permissions.includes('manage_schemes');

๐Ÿšซ Content Moderation

# Hate speech detection
transformed_text = transform_text(user_input)
vector_input = tfidf.transform([transformed_text])
is_hate_speech = hate_model.predict(vector_input)[0]

๐Ÿ“Š Data Privacy

  • GDPR-compliant data handling
  • Encrypted sensitive information
  • Audit logs for all operations
  • User consent management

๐Ÿ“ˆ Real-World Impact

Traditional Process With GovInsight Pro Improvement
Manual scheme search AI-powered discovery 10x faster
Language barriers Multi-lingual support 100% accessible
Complex forms OCR + AI assistance 80% error reduction
Limited access IVR for feature phones Universal reach
Scattered information Unified platform Single source of truth

๐Ÿงช Sample Workflows

โœ… Scheme Discovery

POST /api/v1/schemes/search
{
  "query": "education scholarship odisha",
  "user_profile": {
    "state": "Odisha",
    "category": "student",
    "income": 150000
  }
}

๐Ÿค– AI Chat Assistance

POST /chat
{
  "message": "เคฎเฅเคเฅ‡ เค›เคพเคคเฅเคฐเคตเฅƒเคคเฅเคคเคฟ เคฏเฅ‹เคœเคจเคพ เคšเคพเคนเคฟเค",
  "language": "Hindi"
}

๐Ÿ“„ Document Analysis

POST /analyze-form
{
  "image_data": "base64_encoded_image",
  "language": "Bengali"
}

๐Ÿ”„ Development Workflow

๐Ÿงช Testing

# Backend tests
cd backend && npm test

# AI services tests
cd fastAPI && python test_services.py

# Frontend tests
cd frontend && npm run test

๐Ÿš€ Deployment

# Production build
npm run build

# Docker deployment
docker-compose up -d

# Environment setup
cp .env.production .env

๐Ÿ“Š Monitoring & Analytics

๐Ÿ“ˆ Key Metrics

  • Scheme discovery success rate
  • User engagement analytics
  • IVR call completion rates
  • AI response accuracy scores
  • Community sentiment trends

๐Ÿ” Logging

// Structured logging
logger.info('Scheme search', {
  userId,
  query,
  resultsCount,
  responseTime: Date.now() - startTime
});

๐Ÿ“Š Monitoring & Logging

Tool Purpose Example Metrics / Logs
Prometheus Metrics collection API latency, request count, DB query time
Grafana Dashboards & alerts API health, inference latency, IVR funnel
Loki Centralized logging Errors, OCR failures, Twilio webhook logs
Tempo Distributed tracing End-to-end request traces across services
Sentry Error monitoring Backend crashes, React errors

๐ŸŒŸ Future Roadmap

๐Ÿ”ฎ Phase 2 Features

  • ๐Ÿ”— Direct government API integrations
  • ๐Ÿ“ฑ Native mobile applications
  • ๐ŸŽ™๏ธ Advanced voice interactions
  • ๐Ÿค– Chatbot for WhatsApp/Telegram
  • ๐Ÿ“Š Advanced analytics dashboard

๐ŸŒ Expansion Plans

  • Support for all 22 official Indian languages
  • Integration with state government portals
  • Blockchain-based application tracking
  • AI-powered policy recommendation engine

๐Ÿค Contributing

๐Ÿ› ๏ธ Development Setup

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

๐Ÿ“ Code Standards

  • ESLint for JavaScript/React
  • Black formatter for Python
  • Conventional commits
  • 80%+ test coverage

๐Ÿ“„ License

MIT ยฉ 2025 GovInsight Pro Team
Built for Digital India Initiative


๐Ÿ™ Acknowledgments

  • Google Gemini for conversational AI
  • MongoDB Atlas for vector search capabilities
  • Twilio for voice communication infrastructure
  • Hugging Face for transformer models
  • Government of India for open data initiatives

๐Ÿš€ Making Government Services Accessible to Every Indian Citizen

About

The department of higher education under MoE like any other ministry have functional rules, regulations, policies, schemes, projects etc. The department while conducting day to day operations and dealing with institutions need to refer and analyze the data from multiple sources. For authorities and decisions makers, its critical to identify right

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors