Skip to content

mm6-devops/Sentiment-Analysis-Exam-Tool

Repository files navigation

Sentiment Analysis Tool In Exam Timing

MySQL Database Setup

This application uses MySQL as its primary database to store questions and student responses. Follow these steps to set up the database:

Prerequisites

  • Install MySQL Server (version 5.7 or higher)
  • Start the MySQL service
  • Install Python MySQL connector: pip install mysql-connector-python

Database Configuration

  1. 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
  2. Update the .env file 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_db
    

    Important: Replace your_actual_mysql_root_password with your real MySQL root password. The default value your_password will not work.

  3. Run the database setup script to create the database and tables:

    cd SentimentAnalysisExamTool
    python database/setup_db.py

Database Schema

The application creates two main tables:

  • questions: Stores exam-phase questions with options
  • student_responses: Stores student responses with sentiment analysis data

Troubleshooting Connection Issues

If you get "Failed to connect to the database" error:

  1. Verify MySQL service is running
  2. Check that your password in .env is correct (replace 'your_password' with your actual MySQL password)
  3. Run the diagnostic script: python database/diagnose_db.py
  4. Use the password update helper: python database/update_password.py
  5. Set up the database: python database/setup_db.py

Overview

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.

Purpose

  • 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.

Tech Stack

  • Python: Core language
  • CSS: Styling webpage
  • Streamlit: Web UI
  • MySQL: Question storage
  • JSON: Response storage with timestamps
  • NLP: VADER (via NLTK)
  • Visualization: Matplotlib

Directory Structure

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

Setup Instructions

1. Install MySQL

  • See docs/installation_guide.md for Windows CMD setup.

2. Install Dependencies

pip install -r requirements.txt

3. Setup NLTK

import nltk
nltk.download('vader_lexicon')

4. Configure Database

  • Run database/schema.sql in MySQL.
  • Update config/settings.py with your MySQL credentials (or use a .env file).

5. Run the App

streamlit run main.py

Admin Login

  • 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
                )

Usage

  • Student: Enter your ID (e.g., S12345), select a phase tab, answer questions, and submit.
  • Admin: Enter a student ID and view sentiment visualizations.

Features

  • Three Phases: Before, During, After Exam questionnaires.
  • Sentiment Analysis: Real-time analysis of responses.
  • Visualizations: chart types showing mood trends.

Contributors

Masoom Maurya, Pranav Mathade, Sujal Patil

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors