DEV Community

Cover image for CalmNest: Cultivating Mental Wellness for Everyone
Divye Joshi
Divye Joshi

Posted on

CalmNest: Cultivating Mental Wellness for Everyone

This blog is the final submission of Team 33 (Algorithmic Alchemists) for the Rebase <01> hackathon hosted by IIIT Kalyani.

Table of Contents

  1. What is CalmNest?
  2. Meet the CalmNest Team
  3. How to Use CalmNest?
  4. Why Mental Health?
  5. Our Toolkit and Tech Stack
  6. Behind the Scenes: The Lifecycle of a Chat Message
  7. Behind the Scenes: The DASS Survey and our Music Recommendation System
  8. A Challenge Faced and Conquered: CORS Issue
  9. Choosing the Right Resources: Intellectual Property Rights
  10. We value efficiency

Important Links

Demo Video Link
GitHub Repo Link

What is CalmNest?

CalmNest is an all-purpose mental health platform designed to improve mental well-being among people of all ages. It offers various features such as report generation, music recommendation, chatbot, journal entries, and a resource library. Additionally, it provides four different themes to cater to diverse user preferences.


Watch a short 3-minute demo video to get an introduction to our website!

Meet the CalmNest Team

Our team consists of individuals from different states and colleges. Let's introduce them briefly:

Team Lead

  • Divye Joshi (Devfolio : endy) (LinkedIn)
    • A machine learning enthusiast with expertise in various ML techniques. I am currently pursuing Computer Science Engineering at Jawaharlal Nehru University (JNU), completing the second year.

Team Member 1

  • Aditya Mishra (Devfolio: @aditya_jnu) (LinkedIn)
    • I'm currently dedicated to mastering web development. I am a 2nd-year student (ECE) at Jawaharlal Nehru University (JNU), School of Engineering.

Team Member 2

  • Mehak Mantri (Devfolio : MehakMantri) (LinkedIn)
    • Specializes in web development and enjoys exploring new technologies to enhance user experiences. Currently a second-year student at Kurukshetra University, Kurukshetra (KUK).

Team Member 3

  • Satyam Kumar (Devfolio: @sk73233) (LinkedIn)
    • I enjoy competitive programming and have a passion for web development. Currently a 4th-year student at Netaji Subhash Engineering College, Kolkata.

How to Use CalmNest?

You can start using CalmNest right away! Access the open-source GitHub repository here. The repository contains detailed step-by-step technical instructions in the README.md file to power up the Backend API and get the website running.

If you encounter any issues setting up the website, reach out to Divye on LinkedIn or through Discord (@endymiion).

Github Showcase

Why Mental Health?

Mental health is a critical aspect of overall well-being, aligning with Goal 3 of the 17 Sustainable Development Goals by the UN, which aims to ensure healthy lives and promote well-being for all at all ages (learn more). Addressing mental health issues is crucial, as evidenced by the article "Emotional problems in young people were rising rapidly even before the pandemic" published on The Conversation.

However, our aspirations extend beyond this singular objective. By harnessing the power of technology and community-driven initiatives, CalmNest also contributes to Goal 9: "Build resilient infrastructure, promote sustainable industrialization, and foster innovation," Goal 10: "Reduce inequality within and among countries," and Goal 17: "Strengthen the means of implementation and revitalize the global partnership for sustainable development."

A Survey Result

Our Toolkit and Tech Stack

Datasets

Models

Libraries and Frameworks

  • HTML: Markup language for structuring webpages.
  • CSS: Styling language for designing webpage layouts and appearances.
  • JavaScript: Programming language for adding interactivity and functionality to webpages.
  • ReactJS: JavaScript library for building user interfaces with modular and reusable components.
  • Vite: Build tool for bundling and optimizing frontend code, enhancing development workflow.
  • PyTorch: Open-source machine learning library for Python, providing support for deep learning tasks.
  • Hugging Face Transformers: Library providing state-of-the-art natural language processing models and tools.
  • Flask: Lightweight web framework for Python, enabling the development of web applications with simplicity and flexibility.

Behind the Scenes: The Lifecycle of a Chat Message

  • Whenever a chat message is sent to the chatbot, it gets converted to JSON format: {"query": "(message)"}. For example, "I am depressed" becomes {"query": "I am depressed"}.
  • The JSON file is sent to the API using a POST request, and the message is retrieved by the Python backend.
  • The message is then converted to a word embedding and compared with a vector database containing actual therapist conversations (dataset provided in our toolkit).
  • Using cosine similarity, we find the closest query that has been asked to a therapist.
  • For example, "I am depressed" might be most similar to a conversation like:
    • Human: "I am having depression."
    • Therapist: "I see, you should…"
  • Using the therapist's answer to that query, we generate a final prompt, feed it to the LLM, and get the final response from that LLM using a GET request through the ngrok public tunnel.

chat-diagram

Backend-Diagram

Behind the Scenes: DASS Survey and Our Music Recommendation System

  • The DASS 21-Questionnaire is an efficient survey used to assess levels of stress, depression, and anxiety (https://maic.qld.gov.au/wp-content/uploads/2016/07/DASS-21.pdf). We have implemented this survey in CalmNest.
  • Once we find these levels, we retrieve the anxiety-depression (A_D) score list (out of 10) and compare the scores to our music recommendation database (e.g., [7,0]).
  • Our database contains A_D scores and the genre of music that has improved mental health. We get the closest A_D score and recommend the same genre of music to the user who has completed the survey. This dataset is derived from the dataset mentioned in our toolkit.
  • The closest A_D score to the input score is calculated using Euclidean Distance.

music-table

music-backend-diagram

A Challenge Faced and Conquered: CORS Issue

  • We faced a challenge when using the fetch API to send POST requests to the API Server. The server was healthy, and Postman was working to connect to it, but the website was blocked due to the POST requests being sent as OPTIONS requests, resulting in a CORS error.
  • However, thanks to a Stack Overflow article, we could fix this issue by implementing the Flask-Cors library to allow preflight requests in our network: Stack Overflow article.

cors-error

cors-fix

Choosing the Right Resources: Intellectual Property Rights

  • Theme Music and Background: We have used free images from Freepik and music taken from YouTube (Non-Copyrighted Sounds).
  • Models and Datasets: We have checked the licenses of the models and datasets to ensure they align with our vision. If we ever commercialize this project, we will adhere to the terms under them.
  • Resource Library: When you use the resource library, you are directed towards the legal Google Books page of that book, instead of pirated illegal websites.

tinyllama-license

legal-gif

We value efficiency

  • LLAMA - 2 INFERENCE TIME IN GOOGLE COLAB (FREE) : 10-20 minutes.
  • TINY LLAMA INFERENCE TIME IN COLAB : ONLY 5-10 SECONDS!
    llmtime

  • GTE Small is very lightweight in size and powerful
    gte

Top comments (0)