A full-stack complaint management system built with Streamlit, Supabase, and AI for sentiment analysis and automatic categorization.
- 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
| Component | Technology |
|---|---|
| Frontend | Streamlit |
| Backend | Python |
| Database | Supabase (PostgreSQL) |
| AI/NLP | TextBlob |
- Python 3.8 or higher
- Supabase account (free tier works)
- Internet connection
- Go to https://supabase.com and sign in
- Create a new project
- 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()
);- Go to Project Settings → API and copy:
- Project URL
- anon key
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_corporaOpen supabase_utils.py and replace the placeholders:
SUPABASE_URL = "https://YOUR_PROJECT_URL.supabase.co"
SUPABASE_KEY = "YOUR_SUPABASE_ANON_KEY"streamlit run app.pyThe app will open in your browser at http://localhost:8501
- Select "Submit Complaint" from the sidebar
- Enter your name
- Describe your complaint
- Click "Submit Complaint"
- AI will automatically categorize and analyze sentiment
- Select "View Complaints" from the sidebar
- Use filters to view specific categories, sentiments, or statuses
- View all complaint details in the table
- Select "Admin Panel" from the sidebar
- Enter admin password (default:
admin123) - Click on any complaint to expand details
- Update status (Pending → In Progress → Resolved)
- Click "Save" to update
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")- Push your code to GitHub
- Go to https://share.streamlit.io/
- Connect your GitHub repository
- Set secrets in Streamlit Cloud:
SUPABASE_URLSUPABASE_KEYADMIN_PASSWORD
- Create a new Web Service on Render.com
- Connect your repository
- Set environment variables
- Deploy!
- Analyzes the emotional tone of complaints
- Classifies as: Positive, Negative, or Neutral
- Uses polarity score from -1 (negative) to +1 (positive)
Complaints are categorized based on keywords:
- Academic: exam, marks, paper
- Hostel: hostel, room, water
- Canteen: food, canteen, mess
- General: everything else
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
- 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
This project is open source and available for educational purposes.
Feel free to fork, improve, and submit pull requests!
For issues or questions, please create an issue in the repository.
Built with ❤️ using Streamlit, Supabase, and AI