Project Samarth is a prototype intelligent Q&A chat system designed to help users query real government data in natural language.
This project demonstrates how government datasets (like those on data.gov.in) can be integrated into a conversational AI system for better policy analysis and public transparency.
This system currently focuses on government schemes and programs — allowing users to ask questions such as:
- “Tell me about PM-KISAN.”
- “What is Digital India?”
- “Which schemes are related to the Ministry of Health?”
SamarthChat/ │ ├── backend/ │ ├── app.py # Flask API server │ ├── build_db.py # Database setup and population │ ├── sql_templates.py # SQL query templates │ ├── gov_data.db # SQLite database (auto-generated) │ ├── frontend/ │ ├── index.html # Chat interface (no framework) │ ├── style.css # Stylesheet │ ├── README.md └── .gitignore
yaml Copy code
- Python 3.8+
- Pip installed
cd backend
pip install flask flask-cors pandas
Build the SQLite database
bash
Copy code
python build_db.py
Run the Flask server
bash
Copy code
python app.py
Server will start at:
cpp
Copy code
http://127.0.0.1:5000
2️⃣ Frontend Setup
No build step required.
Simply open the file frontend/index.html in your browser.
If you want to serve it from a local server:
bash
Copy code
cd frontend
python -m http.server 8080
Then visit:
👉 http://127.0.0.1:8080
💬 Example Queries
Try asking:
“Tell me about PMAY.”
“Schemes under Ministry of Agriculture.”
“Startup India details.”
“When was Digital India launched?”
🧩 How It Works
The user enters a question in plain English.
The Flask backend receives the query and performs fuzzy SQL lookups on gov_data.db.
The matching schemes and descriptions are returned to the frontend.
The chat interface renders results as conversational replies.
🔒 Future Enhancements
🔗 Real-time dataset ingestion via data.gov.in API
📊 Integration of agriculture + climate datasets for insight-based answers
🧠 Use of LLM / semantic search models to understand complex queries
☁️ Deployment-ready backend (Docker + Cloud Run / AWS Lambda)
🧾 Example Datasets to Ingest (Recommended)
When extending the system to use live data.gov.in sources, start with:
Agriculture Production Data (Ministry of Agriculture & Farmers Welfare)
→ https://data.gov.in/catalog/agriculture-production
Rainfall and Weather Data (IMD)
→ https://data.gov.in/catalog/rainfall-india
Crop-wise Area and Yield Statistics
→ https://data.gov.in/catalog/crop-production-statistics
Soil and Irrigation Data
→ https://data.gov.in/catalog/soil-irrigation-statistics
🧰 Tech Stack
Component Technology
Backend Python, Flask, SQLite
Frontend HTML, CSS, JavaScript
Data Structured SQLite DB (sample data)
Deployment Localhost / Docker-ready
🧠 Author
Piyush Krushnarao Ninawe
AI-ML & Web Developer | HarIT Tech Solution
📍 Nagpur, Maharashtra
🔗 LinkedIn
🪄 Quick Demo Flow
1️⃣ Run the backend → python backend/app.py
2️⃣ Open → frontend/index.html
3️⃣ Type: “Tell me about PM-KISAN.”
4️⃣ Instantly get government scheme details, with the ministry and year.