Skip to content

Inkesk-Dozing/MindSpace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

52 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿง  MindSpace: Student Burnout Analytics

Made with Python License: Apache 2.0 Version Flask

MindSpace is a comprehensive data analytics platform designed to help educators and students understand mental health patterns, burnout risks, and sentiment trends. By analyzing study habits, sleep patterns, and subjective feedback, MindSpace provides actionable insights via an intuitive web dashboard.

๐ŸŽ“ Academic Project: MindSpace was developed as a minor project for analyzing student burnout in higher education settings using sentiment analysis and data visualization techniques.

๐Ÿ“‹ Table of Contents

๐Ÿš€ Features

MindSpace offers a comprehensive suite of features for student burnout analysis:

  • ๐Ÿ“ˆ Data-Driven Insights: Automatically calculates a "Burnout Score" based on study-to-sleep ratios and stress levels using a weighted algorithm that normalizes results to a 0-100 scale.

  • ๐Ÿ’ฌ Sentiment Analysis: Utilizes Natural Language Processing (NLTK VADER Sentiment Analyzer) to analyze text feedback and gauge student sentiment, providing compound scores ranging from -1 (very negative) to +1 (very positive).

  • โš ๏ธ Risk Classification: Categorizes students into 'Low', 'Medium', and 'High' risk tiers for proactive intervention:

    • ๐ŸŸข Low Risk: Burnout score โ‰ค 33
    • ๐ŸŸก Medium Risk: Burnout score 34-66
    • ๐Ÿ”ด High Risk: Burnout score > 66
  • ๐Ÿ“Š Interactive Dashboard: Visualizes data through 10 charts covering:

    • Burnout score histogram, risk pie chart, stress vs burnout bar chart
    • Correlation heatmap, scatter plots (sleep, study, and stress vs burnout)
    • Burnout boxplot by risk tier, sentiment distribution, sentiment vs burnout
    • Each chart includes a plain-English explanation of what the pattern means
  • ๐Ÿ” Searchable Data Table: Full dataset shown with no row limit. Live search by any column and a risk-level dropdown filter.

  • ๐Ÿค– Automatic Model Evaluation: A Random Forest classifier trains on every uploaded dataset automatically. The Evaluation tab shows accuracy, precision, recall, F1, ROC-AUC, per-class breakdown, and confusion matrix. No CLI steps needed.

  • ๐Ÿ”„ Dataset Comparison: Upload a second CSV from the Compare tab to get a side-by-side breakdown including a delta table, risk tier cards, 4 comparison charts, and an auto-generated written verdict.

  • โœ๏ธ Dynamic Dataset Management:

    • Upload custom CSV files with real-time processing
    • Edit data directly through the web interface
    • Automatic recalculation of all metrics upon data changes
  • ๐Ÿ”’ Robust Error Handling:

    • Division by zero protection in burnout calculations
    • Automatic data type conversion for numeric fields
    • Missing directory creation for visualizations
    • CSV format validation

๐Ÿ› ๏ธ Tech Stack

Layer Technology
Backend Python, Flask
Data Processing Pandas, NumPy
Machine Learning scikit-learn (Random Forest)
NLP NLTK (VADER Sentiment Analyzer)
Visualization Matplotlib, seaborn
Frontend HTML5, CSS3 (Vanilla), Jinja2
Fonts Outfit (Google Fonts)

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.7 or higher
  • pip (Python package installer)

Step 1: Clone the Repository

bash
git clone <repository-url>
cd MindSpace

Step 2: Create a Virtual Environment (Recommended)

bash
# On Windows
python -m venv venv
venv\Scripts\activate

# On macOS/Linux
python3 -m venv venv
source venv/bin/activate

Step 3: Install Dependencies

bash
pip install -r requirements.txt

This will install the following packages:

  • Flask - Lightweight web framework
  • pandas - Data manipulation and analysis
  • numpy - Numerical computing
  • nltk - Natural language processing
  • matplotlib - Data visualization
  • seaborn - Statistical chart styling
  • scikit-learn - Machine learning (Random Forest classifier and evaluation metrics)

Step 4: Download NLTK Data

The application automatically downloads the VADER lexicon on first run. If you encounter issues, you can manually download it:

python
import nltk
nltk.download('vader_lexicon')

โš™๏ธ Setup Guide

A walkthrough of getting MindSpace running end to end.

1. Clone and enter the project

git clone <repository-url>
cd mindspace

2. Create a virtual environment

# Windows
python -m venv venv
venv\Scripts\activate

# macOS / Linux
python3 -m venv venv
source venv/bin/activate

3. Install all dependencies

pip install -r requirements.txt

4. Run the app

python app.py

Then open http://127.0.0.1:5000 in your browser.

5. Upload your first dataset

  • From the Home page, click the upload area and select a .csv file
  • The app processes it immediately: burnout scores are calculated, 10 charts are generated, and a Random Forest model trains on the data
  • You are redirected to the Dashboard automatically

6. Explore the tabs

Tab What it does
Dashboard Full charts, searchable data table, key statistics
Evaluation Live model metrics for the uploaded dataset
Compare Upload a second CSV for a side-by-side breakdown
Edit Modify any row and regenerate everything

7 (Optional). Run scripts manually

If you want to train or evaluate the model outside the web app:

cd scripts
python train_model.py   # trains and saves to ../models/
python evaluate.py      # evaluates from ../models/ and saves confusion matrix

โšก Quick Start

  1. Run the application:
python app.py
  1. Access the dashboard: Open your browser and navigate to http://127.0.0.1:5000

  2. Upload your data:

    • Prepare a CSV file with the required columns (see Data Requirements)
    • Use the web interface to upload the file
    • View the generated analytics on the dashboard
  3. Edit data (optional):

    • Navigate to the Edit page
    • Modify any values directly
    • All calculations update automatically

๐Ÿ“Š Data Requirements

The application expects a CSV file with the following columns:

Column Name Type Description Example Value
student_id (optional) String Unique student identifier S001
student_name (optional) String Student full name Aanya Sharma
sleep_hours Float Average nightly sleep hours 7.5
study_hours Float Daily study hours 5
stress_level Integer Stress rating on a scale of 1-10 6
feedback String Qualitative text comments Feeling a bit overwhelmed.

Sample Data Format

csv
sleep_hours,study_hours,stress_level,feedback
8,4,7,"I feel overwhelmed with assignments"
6,6,9,"Too much pressure, can't sleep"
9,3,4,"Managing okay, but tired"
7,5,8,"Burning out, need help"
10,2,3,"Feeling good, balanced"
5,7,10,"Exhausted, high stress"

Sample Data Files

The repository includes sample datasets for testing:

  • data/sample_data.csv - Example dataset with 6 records
  • data/test_data.csv - Additional test data with diverse scenarios

๐Ÿ’ก Usage

Workflow

  1. Landing Page: Start at the index page where you can upload a CSV file
  2. Data Upload: Select and upload your CSV file containing student data
  3. Dashboard: View the analytics dashboard with:
    • Burnout score distribution histogram
    • Risk category pie chart
    • Summary statistics (average burnout, high-risk count)
    • Individual student records with calculated metrics
  4. Edit Data: Make changes to existing records and see real-time updates

Burnout Score Calculation

The burnout score is calculated using the formula:

Burnout Score = (study_hours / sleep_hours) * stress_level * 10
  • Clamped to a range of 0-100
  • Higher scores indicate greater burnout risk
  • Division by zero is handled gracefully (defaults to 0)

Risk Classification

Risk Level Score Range Action Recommended
๐ŸŸข Low 0-33 Monitor periodically
๐ŸŸก Medium 34-66 Consider intervention
๐Ÿ”ด High 67-100 Immediate attention required

Sentiment Analysis

The application uses VADER (Valence Aware Dictionary and sEntiment Reasoner) for sentiment analysis:

  • Compound Score: -1 (most negative) to +1 (most positive)
  • Positive: Compound score โ‰ฅ 0.05
  • Negative: Compound score โ‰ค -0.05
  • Neutral: Compound score between -0.05 and 0.05

๐ŸŽจ UI/UX Design

MindSpace features a modern, professional design:

  • Typography: Inter font family for clean, readable text
  • Color Scheme:
    • Primary: Blue gradient (#1e3a8a โ†’ #3b82f6)
    • Background: White with subtle transparency
    • Cards: White with soft shadows
  • Responsive Design: Works on desktop, tablet, and mobile devices
  • Interactive Elements: Hover effects, smooth transitions
  • Data Visualization: Clean charts with proper labeling

Dashboard Features

  • Statistics Cards: Display key metrics (Average Burnout, Total Students, High Risk Count)
  • Data Table: Sortable, scrollable table with all student records
  • Charts: Histogram for score distribution, Pie chart for risk categories
  • Navigation: Easy access to edit functionality

๐Ÿ“ Project Structure

mindspace/
โ”œโ”€โ”€ app.py                          # Flask routes, data processing, auto-training
โ”œโ”€โ”€ requirements.txt                # Project dependencies
โ”œโ”€โ”€ README.md                       # Project documentation
โ”œโ”€โ”€ LICENSE                         # Apache License 2.0
โ”œโ”€โ”€ SECURITY.md                     # Security policy
โ”œโ”€โ”€ CODE_OF_CONDUCT.md              # Community standards
โ”œโ”€โ”€ CONTRIBUTING.md                 # Contribution guidelines
โ”œโ”€โ”€ Code-Explanation.md             # Detailed code documentation
โ”œโ”€โ”€ scripts/                        # Standalone ML scripts
โ”‚   โ”œโ”€โ”€ train_model.py              # Manual training script
โ”‚   โ””โ”€โ”€ evaluate.py                 # Manual evaluation script
โ”œโ”€โ”€ models/                         # Saved model artifacts (auto-generated)
โ”‚   โ”œโ”€โ”€ model.pkl
โ”‚   โ””โ”€โ”€ eval_data.pkl
โ”œโ”€โ”€ data/                           # Dataset files
โ”‚   โ”œโ”€โ”€ sample_data.csv             # Sample dataset
โ”‚   โ””โ”€โ”€ updated_sample.csv          # Written after edits via web interface
โ”œโ”€โ”€ documents/                      # Project documentation
โ”‚   โ”œโ”€โ”€ synopsis.md
โ”‚   โ”œโ”€โ”€ Workload-Distribution.md
โ”‚   โ””โ”€โ”€ Research-Paper/
โ”œโ”€โ”€ templates/                      # HTML templates (all extend base.html)
โ”‚   โ”œโ”€โ”€ base.html                   # Shared sidebar layout and theme toggle
โ”‚   โ”œโ”€โ”€ index.html                  # Upload page
โ”‚   โ”œโ”€โ”€ dashboard.html              # Analytics dashboard with 10 charts
โ”‚   โ”œโ”€โ”€ evaluation.html             # Model metrics page
โ”‚   โ”œโ”€โ”€ compare.html                # Dataset comparison page
โ”‚   โ””โ”€โ”€ edit.html                   # Data editor
โ””โ”€โ”€ static/                         # Static assets
    โ”œโ”€โ”€ styles.css                  # Dark/light theme, all component styles
    โ””โ”€โ”€ plots/                      # Auto-generated chart images
        โ”œโ”€โ”€ score_hist.png
        โ”œโ”€โ”€ risk_pie.png
        โ”œโ”€โ”€ correlation_heatmap.png
        โ”œโ”€โ”€ confusion_matrix.png
        โ”œโ”€โ”€ cmp_burnout_hist.png    # Comparison charts (cmp_*.png)
        โ””โ”€โ”€ ...                     # (10 dashboard + 5 comparison charts total)

๐Ÿ‘ฅ Team

This project was developed by a team of 6 members:

Role Responsibilities
Backend Developer Flask routes, data processing, error handling
Frontend Templates Specialist HTML templates, Jinja2 integration
Styling & UI/UX Designer CSS styling, responsive design
Data & Testing Specialist Test data creation, end-to-end testing
Deployment & Integration Lead Dependencies, integration, deployment
Documentation & QA Documentation, code reviews, quality assurance

๐Ÿ”ฎ Future Enhancements

We have exciting plans for MindSpace's future:

  • User Authentication: Add login functionality for personalized dashboards
  • Export Options: Export analyzed data to PDF/Excel reports
  • API Development: RESTful API for programmatic access
  • Real-time Analytics: Live data streaming and processing
  • Enhanced Visualizations: Interactive charts with drill-down capabilities
  • Database Integration: Support for SQL databases (PostgreSQL, MySQL)
  • Multi-language Support: Localization for international users
  • Mobile Responsive Design: Improved mobile experience
  • Email Notifications: Automated alerts for high-risk students
  • LMS Integration: Connect with learning management systems
  • Advanced NLP: More nuanced sentiment analysis models
  • Machine Learning: Predictive burnout modeling (Random Forest, auto-trains on every upload)
  • Dataset Comparison: Side-by-side analysis of two cohorts
  • Model Evaluation Dashboard: Live accuracy, F1, confusion matrix in the web UI

๐Ÿ“š Research References

The MindSpace project is grounded in established research:

  1. Maslach, C., & Leiter, M. P. (2016). Understanding the burnout experience: recent research and its implications for psychiatry. World Psychiatry, 15(2), 103-111.

  2. Hutto, C. J., & Gilbert, E. E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Proceedings of the Eighth International Conference on Weblogs and Social Media (ICWSM-14).

  3. Grinberg, M. (2018). Flask Web Development: Developing Web Applications with Python. O'Reilly Media.

  4. McKinney, W. (2017). Python for Data Analysis. O'Reilly Media.

  5. Bird, S., Klein, E., & Loper, E. (2009). Natural Language Processing with Python. O'Reilly Media.

๐Ÿค Contributing

Contributions are welcome! Please read our Contributing Guidelines for details on:

  • Reporting bugs and suggesting features
  • Development workflow
  • Coding style guidelines
  • Testing procedures

๐Ÿ›ก๏ธ Security

For information on how to report security vulnerabilities, please see our Security Policy.

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

๐Ÿ“ง Contact

For questions, suggestions, or collaborations, please reach out:


Made with โค๏ธ for student well-being
๐Ÿง  MindSpace - Understanding Student Burnout

๐Ÿ“Š Evaluation Metrics

Metrics are computed automatically on each uploaded dataset. The values below reflect a run on the included sample_data.csv.

Metric Score
Accuracy ~95%
Precision ~96%
Recall ~95%
F1 Score ~95%
ROC-AUC computed per dataset

Why these metrics? F1-Score is the primary metric because class sizes can be uneven across datasets. Precision and Recall are both shown so you can see whether the model errs toward false alarms or missed cases. ROC-AUC reflects how well the model distinguishes between all three risk classes together.

The full per-class breakdown and confusion matrix are visible live in the app under the Evaluation tab after any upload.

Confusion Matrix

About

An Intelligent Multi-Modal Framework for predicting student burnout via temporal sentiment analysis and behavioral pattern tracking. A full-stack solution built with Python, Flask, and NLTK to provide data-driven wellness insights and proactive mental health assessments.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Contributors