Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Complaint Management System

A full-stack complaint management system built with Streamlit, Supabase, and AI for sentiment analysis and automatic categorization.

🚀 Features

  • Submit Complaints: Students can submit complaints with automatic AI categorization
  • Sentiment Analysis: AI detects if complaints are Positive, Negative, or Neutral
  • Admin Panel: Admins can view, filter, and update complaint statuses
  • Real-time Database: All data stored in Supabase (PostgreSQL)
  • Smart Categorization: Complaints automatically sorted into Academic, Hostel, Canteen, or General

🛠️ Tech Stack

Component Technology
Frontend Streamlit
Backend Python
Database Supabase (PostgreSQL)
AI/NLP TextBlob

📋 Prerequisites

  • Python 3.8 or higher
  • Supabase account (free tier works)
  • Internet connection

⚙️ Setup Instructions

1. Create Supabase Database

  1. Go to https://supabase.com and sign in
  2. Create a new project
  3. Open SQL Editor and run this SQL code:
CREATE TABLE complaints (
  id SERIAL PRIMARY KEY,
  student_name TEXT NOT NULL,
  complaint TEXT NOT NULL,
  category TEXT,
  sentiment TEXT,
  status TEXT DEFAULT 'Pending',
  created_at TIMESTAMP DEFAULT NOW()
);
  1. Go to Project Settings → API and copy:
    • Project URL
    • anon key

2. Install Dependencies

Open PowerShell in the project directory and run:

# Create virtual environment
python -m venv venv

# Activate virtual environment
venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Download TextBlob corpora
python -m textblob.download_corpora

3. Configure Supabase Connection

Open supabase_utils.py and replace the placeholders:

SUPABASE_URL = "https://YOUR_PROJECT_URL.supabase.co"
SUPABASE_KEY = "YOUR_SUPABASE_ANON_KEY"

4. Run the Application

streamlit run app.py

The app will open in your browser at http://localhost:8501

📖 Usage

For Students (Submit Complaint)

  1. Select "Submit Complaint" from the sidebar
  2. Enter your name
  3. Describe your complaint
  4. Click "Submit Complaint"
  5. AI will automatically categorize and analyze sentiment

For Everyone (View Complaints)

  1. Select "View Complaints" from the sidebar
  2. Use filters to view specific categories, sentiments, or statuses
  3. View all complaint details in the table

For Admins (Admin Panel)

  1. Select "Admin Panel" from the sidebar
  2. Enter admin password (default: admin123)
  3. Click on any complaint to expand details
  4. Update status (Pending → In Progress → Resolved)
  5. Click "Save" to update

🔐 Security Notes

Important: Change the default admin password in app.py:

elif admin_password != "admin123":  # Change this password!

For production deployment, use environment variables:

import os
SUPABASE_URL = os.getenv("SUPABASE_URL")
SUPABASE_KEY = os.getenv("SUPABASE_KEY")
ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD")

🌍 Deployment

Deploy to Streamlit Cloud

  1. Push your code to GitHub
  2. Go to https://share.streamlit.io/
  3. Connect your GitHub repository
  4. Set secrets in Streamlit Cloud:
    • SUPABASE_URL
    • SUPABASE_KEY
    • ADMIN_PASSWORD

Deploy to Render

  1. Create a new Web Service on Render.com
  2. Connect your repository
  3. Set environment variables
  4. Deploy!

🎯 AI Features Explained

Sentiment Analysis (TextBlob)

  • Analyzes the emotional tone of complaints
  • Classifies as: Positive, Negative, or Neutral
  • Uses polarity score from -1 (negative) to +1 (positive)

Automatic Categorization

Complaints are categorized based on keywords:

  • Academic: exam, marks, paper
  • Hostel: hostel, room, water
  • Canteen: food, canteen, mess
  • General: everything else

🔧 Project Structure

complaint-management-system/
│
├── app.py                # Main Streamlit application
├── ai_utils.py           # AI/NLP processing (sentiment + categorization)
├── supabase_utils.py     # Database connection and queries
├── requirements.txt      # Python dependencies
└── README.md            # This file

🚀 Future Enhancements

  • Add user authentication with Supabase Auth
  • Add data visualization charts (Plotly)
  • Export complaints to Excel
  • Email notifications for status updates
  • Advanced NLP with transformers
  • Multi-language support
  • File attachment support

📝 License

This project is open source and available for educational purposes.

🤝 Contributing

Feel free to fork, improve, and submit pull requests!

📧 Support

For issues or questions, please create an issue in the repository.


Built with ❤️ using Streamlit, Supabase, and AI

About

A beginner-friendly Complaint Management System with AI-powered categorization and sentiment analysis using Flask, SQLite, TextBlob, and Bootstrap.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages