This application uses MySQL as its primary database to store questions and student responses. Follow these steps to set up the database:
- Install MySQL Server (version 5.7 or higher)
- Start the MySQL service
- Install Python MySQL connector:
pip install mysql-connector-python
-
Find your MySQL root password:
- If you just installed MySQL, the default password might be blank or you set it during installation
- If you forgot your root password, you may need to reset it
-
Update the
.envfile in the project root with your MySQL credentials:DB_USER=root DB_PASSWORD=your_actual_mysql_root_password DB_HOST=localhost DB_NAME=sentiment_exam_dbImportant: Replace
your_actual_mysql_root_passwordwith your real MySQL root password. The default valueyour_passwordwill not work. -
Run the database setup script to create the database and tables:
cd SentimentAnalysisExamTool python database/setup_db.py
The application creates two main tables:
questions: Stores exam-phase questions with optionsstudent_responses: Stores student responses with sentiment analysis data
If you get "Failed to connect to the database" error:
- Verify MySQL service is running
- Check that your password in
.envis correct (replace 'your_password' with your actual MySQL password) - Run the diagnostic script:
python database/diagnose_db.py - Use the password update helper:
python database/update_password.py - Set up the database:
python database/setup_db.py
This project is a final-year tool to analyze students' sentiments (Happy, Stressed, Nervous, Depressed, Neutral) before, during, and after exams. It uses Python, Streamlit for the UI, MySQL for question storage, JSON for response storage, and VADER for NLP-based sentiment analysis. Visualizations are generated using Matplotlib.
- Student Experience: Answer diplomatic questions in three phases (Before, During, After Exam).
- Analysis: Sentiment analysis on responses to track mood changes.
- Visualization: Graphs (line, bar, pie, area, scatter) for admin to view sentiment trends.
- Python: Core language
- CSS: Styling webpage
- Streamlit: Web UI
- MySQL: Question storage
- JSON: Response storage with timestamps
- NLP: VADER (via NLTK)
- Visualization: Matplotlib
app/
├── __init__.py
├── ui.py
├── utils.py
assets/
├── home_page.jpg
backend/
├── __init__.py
├── data_processor.py
├── mysql_handler.py
├── sentiment.py
config/
├── __init__.py
├── settings.py
data/
├── reviews/
│ ├── before_exam/
│ ├── after_exam/
│ ├── during_exam/
├── visualization/
database/
├── __init__.py
├── db_config.py
├── schema.sql
doc/
├── Project Synopsis/
│ ├── Sentiment Analysis Tool in Exam Timing_Synopsis.pdf
├── Project Report/
│ ├── Sentiment Analysis Tool in Exam Timing_Project_Report.pdf
├── Installation Guide/
│ ├── installation_guide.md
├── Project Explanation/
pages/
├── about.py
├── admin.py
├── student.py
├── home.py
├── project_details.py
visualization/
├── __init__.py
├── charts.py
README.md # Project documentation
requirements.txt # Dependencies list
- See
docs/installation_guide.mdfor Windows CMD setup.
pip install -r requirements.txtimport nltk
nltk.download('vader_lexicon')- Run
database/schema.sqlin MySQL. - Update
config/settings.pywith your MySQL credentials (or use a.envfile).
streamlit run main.py- main.py: Add on you password in main.py for authentication in below code base
# You can replace this with a more secure password system
ADMIN_PASSWORD = (
"admin123" # This should be stored securely in production
)- Student: Enter your ID (e.g., S12345), select a phase tab, answer questions, and submit.
- Admin: Enter a student ID and view sentiment visualizations.
- Three Phases: Before, During, After Exam questionnaires.
- Sentiment Analysis: Real-time analysis of responses.
- Visualizations: chart types showing mood trends.
Masoom Maurya, Pranav Mathade, Sujal Patil