# Project export: MoodTunes

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 10.0
- Tagline: Unlock the healing potential of music with MoodTunes. Elevate your mental well-being through personalized anxiety relief and relaxation music recommendations.
- Devpost: https://devpost.com/software/moodtunes-x9y1gr
- GitHub: https://github.com/singhaditya8499/MoodTunes
- Demo: https://mood-tunes.streamlit.app/
- Team: 2 GitHub contributor(s) — singh-aditya8499 (11 commits), Aditya Singh (2 commits)

## Devpost submission (written by the team)

### Inspiration

MoodTunes was inspired by a deep understanding of the profound impact music has on emotions and mental well-being. We recognized the need to create a tool that could harness the therapeutic power of music to alleviate anxiety and promote relaxation. We were driven by the idea of making music a key component of mental health and wellness.

### What it does

MoodTunes is an app designed to help individuals manage their anxiety levels through personalized music recommendations. Users input their anxiety levels using the Hamilton Anxiety Rating Scale, and the app utilizes advanced algorithms, including LSTM and NLP, to curate custom playlists that aim to alleviate stress and promote relaxation. It provides a unique blend of music and mental well-being, enhancing the user's overall mood and mental health. Made use of CockroachDB in order to store all user data.

### How we built it

MoodTunes was crafted using Django for the backend, LSTM and NLP for anxiety prediction, Streamlit for the user interface, and Python for seamless integration. To store data, we decided to use CockroachDB. We also utilized web automation and data scraping techniques to curate an extensive music library. This combination of technologies enabled us to offer accurate anxiety assessments and personalized music recommendations via a user-friendly app.

### Challenges we ran into

Developing algorithms that accurately assessed anxiety levels and recommended suitable music was an ongoing challenge. Additionally, we faced difficulties related to training the transformer model, which impacted our ability to achieve the desired level of accuracy in assessing anxiety levels and making music recommendations. Overcoming these challenges required innovative solutions and continuous efforts to refine the app.

### Accomplishments we're proud of

Successfully launching an app that harnesses the therapeutic power of music to support mental well-being. Creating a vast music library and a robust algorithm that delivers personalized music recommendations.

### What we learned

During the development of MoodTunes, we learned about the complexities of music psychology and intricate algorithm development. We also gained insights into user engagement and the importance of continually refining and improving the user experience.

### What's next

Expand the app's music library to provide an even wider range of music choices for users. Continue refining and enhancing the algorithm to improve the accuracy of anxiety assessments and music recommendations. Explore partnerships with mental health professionals and institutions to integrate MoodTunes into therapy and wellness programs.

## README (from the GitHub repository)

# MoodTunes

## Inspiration
MoodTunes was inspired by a deep understanding of the profound impact music has on emotions and mental well-being. We recognized the need to create a tool that could harness the therapeutic power of music to alleviate anxiety and promote relaxation. We were driven by the idea of making music a key component of mental health and wellness.

## What it does
MoodTunes is an app designed to help individuals manage their anxiety levels through personalized music recommendations. Users input their anxiety levels using the Hamilton Anxiety Rating Scale, and the app utilizes advanced algorithms, including LSTM and NLP, to curate custom playlists that aim to alleviate stress and promote relaxation. It provides a unique blend of music and mental well-being, enhancing the user's overall mood and mental health.

## How we built it
MoodTunes was crafted using Django for the backend, LSTM and NLP for anxiety prediction, Streamlit for the user interface, and Python for seamless integration. We also utilized web automation and data scraping techniques to curate an extensive music library. This combination of technologies enabled us to offer accurate anxiety assessments and personalized music recommendations via a user-friendly app.

Belo is the flow diagram of our work.

<img src="data/moodtunes1.png">

### Repository structure

1. `data` folder contains all the dataset that was gathered from websites.
2. `ham_a_app` and `ham_a_project` is the django component for python backend.
3. `src` folder contains code for data preprocessing, classification.
4. `UI` has the code for all the streamlit components.

## Challenges we ran into
Developing algorithms that accurately assessed anxiety levels and recommended suitable music was an ongoing challenge. Additionally, we faced difficulties related to training the transformer model, which impacted our ability to achieve the desired level of accuracy in assessing anxiety levels and making music recommendations. Overcoming these challenges required innovative solutions and continuous efforts to refine the app.

## Accomplishments that we're proud of
Successfully launching an app that harnesses the therapeutic power of music to support mental well-being. Creating a vast music library and a robust algorithm that delivers personalized music recommendations.

## What we learned
During the development of MoodTunes, we learned about the complexities of music psychology and intricate algorithm development. We also gained insights into user engagement and the importance of continually refining and improving the user experience.

## What's next for MoodTunes
Expand the app's music library to provide an even wider range of music choices for users.
Continue refining and enhancing the algorithm to improve the accuracy of anxiety assessments and music recommendations.
Explore partnerships with mental health professionals and institutions to integrate MoodTunes into therapy and wellness programs.


## Detected evidence (automated analysis)

Indexed codebase: 24 recognized source files, 32 KB.
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- Python (language) — detected in the code
- Django (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (56 of 56)

```
.DS_Store
data/cleaned-data-with-features_date.csv
data/cleaned-data-with-features_date.pkl
data/cleaned-data-with-features.csv
data/cleaned-data-with-features.pkl
data/dataPickle.pkl
data/moody_lyrics_small_dataset.csv
data/moody_lyrics.csv
data/moody_mood_numeric.csv
data/partial_data.csv
data/partialData.csv
data/processedData1.csv
data/uncleaned-data-with-features.csv
db.sqlite3
ham_a_app/__init__.py
ham_a_app/admin.py
ham_a_app/apps.py
ham_a_app/migrations/__init__.py
ham_a_app/models.py
ham_a_app/static/ham_a_app/styles.css
ham_a_app/templates/ham_a_app/questionnaire.html
ham_a_app/templates/ham_a_app/result.html
ham_a_app/tests.py
ham_a_app/urls.py
ham_a_app/views.py
ham_a_project/__init__.py
ham_a_project/asgi.py
ham_a_project/settings.py
ham_a_project/urls.py
ham_a_project/wsgi.py
manage.py
package.json
README.md
src/.DS_Store
src/data_preprocessing/.ipynb_checkpoints/Data extraction-checkpoint.ipynb
src/data_preprocessing/.ipynb_checkpoints/general_moody_lyrics_preprocessing-checkpoint.ipynb
src/data_preprocessing/.ipynb_checkpoints/Get_data_from_spotify-checkpoint.ipynb
src/data_preprocessing/.ipynb_checkpoints/preprocessing_lyrics-checkpoint.ipynb
src/data_preprocessing/Data extraction.ipynb
src/data_preprocessing/general_moody_lyrics_preprocessing.ipynb
src/data_preprocessing/Get_data_from_spotify.ipynb
src/data_preprocessing/preprocessing_lyrics.ipynb
src/logs/xlnet_1024_bs_8_adamw_data_80_lr_2e05_20
src/songs_classification/.ipynb_checkpoints/basic_classification-checkpoint.ipynb
src/songs_classification/.ipynb_checkpoints/LSTM_classification-checkpoint.ipynb
src/songs_classification/.ipynb_checkpoints/Untitled-checkpoint.ipynb
src/songs_classification/basic_classification.ipynb
src/songs_classification/LSTM_classification.ipynb
src/songs_classification/transformer_classfication.py
src/songs_classification/Untitled.ipynb
templates/index.html
UI/data/taylor_swift_data_regression_result.pkl
UI/pages/Graph_of_change.py
UI/pages/Songs_Recommend.py
UI/pages/Stress_Score.py
UI/Start.py
```

### Dependencies

- package.json: nouislider@^15.7.1

### Recent commits (newest first)

- Added flow diagram image
- fix: Image not visible on github repo
- Add flow diagram of the work
- Added README
- Removed DB access points
- Merge pull request #1 from singhaditya8499/master
- update the path to access pkl file
- update data fetch link
- added data file to UI
- add code for UI streamlit
- added ham_project
- Merge branch 'mainline' of https://github.com/singhaditya8499/MoodTunes into mainline
- Inital commit
- Initial commit

## Key source files (fetched from GitHub, selected and truncated for size)

### package.json

```
{
  "dependencies": {
    "nouislider": "^15.7.1"
  }
}

```

### manage.py

```python
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ham_a_project.settings')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()

```

### ham_a_app/models.py

```python
from django.db import models

# Create your models here.

```

### ham_a_app/tests.py

```python
from django.test import TestCase

# Create your tests here.

```

### ham_a_app/admin.py

```python
from django.contrib import admin

# Register your models here.

```

### ham_a_app/urls.py

```python
from django.urls import path
from . import views

urlpatterns = [
    path('', views.ham_a_questionnaire, name='questionnaire'),
]

```

### ham_a_app/apps.py

```python
from django.apps import AppConfig


class HamAAppConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'ham_a_app'

```

### templates/index.html

```html
<!DOCTYPE html>
<html>
<head>
    <title>Welcome to My App</title>
</head>
<body>
    <h1>Welcome to My App</h1>
    <p>This is the home page.</p>
    <p><a href="{% url 'questionnaire' %}">Take the HAM-A Questionnaire</a></p>
</body>
</html>

```

### ham_a_project/asgi.py

```python
"""
ASGI config for ham_a_project project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ham_a_project.settings')

application = get_asgi_application()

```

### ham_a_project/wsgi.py

```python
"""
WSGI config for ham_a_project project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ham_a_project.settings')

application = get_wsgi_application()

```

[11 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]