Skip to content

PatsyJaneJocelin/AI_Driven_CitizenGrievanceSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏛️ AI-Driven Citizen Grievance & Sentiment Analysis System

📌 Overview

This project is an AI-powered Natural Language Processing (NLP) system designed to automate the classification and prioritization of citizen complaints. The system analyzes raw text grievances, categorizes them into relevant government departments, and assigns urgency using sentiment analysis.


🚀 Features

  • 🔍 Department Classification (Multi-class NLP model)
  • 💬 Sentiment Analysis (Neutral / Negative / Critical)
  • Priority Scoring System
  • 🧠 Dual-Model Architecture
  • 🌐 FastAPI Deployment for Real-Time Predictions
  • 📊 EDA & Data Pipeline

🧠 System Architecture

Raw Complaint Text ↓ Text Preprocessing ↓ Department Model (SVM + TF-IDF) ↓ Sentiment Model (SVM + TF-IDF) ↓ Priority Mapping ↓ Final Output (JSON Response)


📊 Model Performance

Model Accuracy
Department Classification ~81%
Sentiment Analysis ~98%
  • Cross-validation used to ensure generalization
  • Macro F1-score optimized for balanced performance

🏗️ Tech Stack

  • Python
  • Scikit-learn
  • FastAPI
  • Pandas / NumPy
  • spaCy (Lemmatization)
  • Matplotlib / Seaborn (EDA)

📁 Project Structure

citizen-grievance-ai/
│
├── api/
│   └── main_gen.py
│
├── models/
│   ├── department_svm_model_gen.pkl
│   ├── tfidf_vectorizer_svm_gen.pkl
│   ├── sentiment_model_gen.pkl
│   ├── tfidf_vectorizer_sentiment_gen.pkl
│
├── src/
│   ├── models/
│   ├── preprocessing/
│   ├── eda/
│
├── data/
│   └── generated/

⚙️ Installation & Setup

1. Clone Repository

git clone https://github.com/PatsyJaneJocelin/AI_Driven_CitizenGrievanceSystem.git
cd citizen-grievance-ai

2. Create Virtual Environment

python -m venv venv
venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

🚀 Running the API

uvicorn api.main_gen:app --reload

🌐 API Documentation

Open in browser:

http://127.0.0.1:8000/docs

🧪 Example API Request

Input:

{
  "text": "Garbage not collected for 3 days, very bad situation"
}

Output:

{
  "department": "Municipal Services",
  "sentiment": "Negative",
  "priority": 3
}

🧠 Key Highlights

  • Built a dual-output NLP pipeline
  • Implemented task-specific feature engineering
  • Used cross-validation to prevent overfitting
  • Designed a real-world noisy dataset (50,000 samples)
  • Deployed using FastAPI for real-time inference

🔮 Future Improvements

  • Transformer-based models (BERT / RoBERTa)
  • Multilingual support enhancement
  • Frontend dashboard (React)
  • Cloud deployment (AWS / Render)

📌 Conclusion

This project demonstrates how AI can be leveraged to improve public sector efficiency by automating complaint categorization and prioritization, enabling faster and more transparent grievance redressal.

About

This project is an AI-powered Natural Language Processing (NLP) system designed to automate the classification and prioritization of citizen complaints. The system analyzes raw text grievances, categorizes them into relevant government departments, and assigns urgency using sentiment analysis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages