Inspiration

Due to the COVID-19 pandemic, there has been a recent increase in mental health issues due to isolation and depression. This has been contributed directly due to a rise in unemployment leading to financial instability, food insecurity, inability to meet friends and family, and sedentary lifestyle due to lockdowns. As a result of these and many more factors, there has been a 40% rise in mental health issues since July 2020 alone.

https://www.cdc.gov/mmwr/volumes/69/wr/mm6932a1.htm

Center of disease control

Hence, we introduce … Moody, your personal mood tracker and angry nanny

What it does

Moody is a smart Mental Health Care App that can detect and warn people ahead of time about psychological changes in their behavior and recommend corrective actions on a day-to-day basis. Moody allows the user to make journal entries each day with memories such as pictures, attachments, etc.. Based on the detected results over time, Moody suggests activities to the user using a recommender system when they show signs of depression or anxiety in their journal text detected using sentiment analysis. In addition to being a smart personal diary, Moody acts as a log entry for psychiatrists and mental health experts to understand an individual's behavior based on their environment and daily activities, and possibly intervene whenever needed.

Moody, offers three primary services:

  • Suggests activities to the user based on their interests and through detecting past activities correlated with certain positive moods like happiness or excitement

  • Offers support groups, where people with similar interests and going through mental health issues talk about their journey and build a strong community even in these isolated times.

  • For users with chronic depression and suicidal thoughts Moody offers list of local mental health resources including doctor’s contact and government guidelines. The doctor/psychiatrist can also study the patient’s moods using journal entries that the user creates daily

How we built it

Architecture diagram

  • ML Engine: Sentiment analysis using input journal entry and journal-title. We use NLTK and tensor flow for sentiment analysis with Naïve Bayes classifier. The recommendation system is built using NLTK for recommending activities correlated with certain moods in the past.

  • Backend: Hosted as a Python web app on Gunicorn web server deployed on Heroku. We used Airtable as the database for the app which has 2 tables including user information and user data including embedded images and attachments.

  • Storage: Since Airtable has a limitation of uploading images only if they are hosted on a publicly accessible URL, we used S3 storage to store all images in a publicly accessible S3 bucket and used the URL to upload images to the Airtable.

  • Front-end: Mobile-based, developed on android studio using Kotlin framework. Frontend makes REST API calls to the app hosted on Heroku using a unique deployment link.

  • UI: User can add journal title, journal text, and image for any day and can view past journal entries, their mood on that day based on their experience and their activities of interests, join support groups or navigate resource groups, and view activity recommendations

Challenges we ran into

  • Airtable API currently can only post attachments hosted on publicly accessible URL, hence, to post base64 encoded image we uploaded the image to S3 and give the URL to the Airtable which on the background fetches the image from S3

  • Training the model using NLTK required training on multiple datasets and tokenizing words. It required several iterations to train the model to achieve the desired accuracy, which took some time. The initial LSTM model used Tensorflow tokenizing library and had backward compatibility issues with python2, so we had to switch to a model compatible with python2

  • It took us some time to understand posting large images as Base64 encoded string should be passed as multipart / form-data since it was causing some images to fail to work.

  • It was difficult to come up with a definite scale for different emotions. To make it more granular and capture a wide range of emotions, we decided on a 12-point scale after due deliberation and based on the plethora of available training data on Tweets.

Accomplishments that we are proud of

We are proud to develop and deploy a full-scale working mobile app with scalable backend and frontend to counter a relevant contemporary issue and do our part in social good through technology.

We incorporated Machine Learning to drive recommendations and analyze the mental health + emotions of the user. We synchronized and collaborate coherently even though it was a fully virtual hackathon. This makes us more confident in our ability to work in highly distributed software teams.

What we learned

  • Learned to use Airtable through UI and REST API. Learned how to attach images to Airtable through AWS S3 storage

  • Deploying app on Heroku and exporting AWS credentials to the hosted APP without coming to version control

  • Developing sentiment analyzer using NLTK and deploying the model on a production scale

  • Hosting web app on Gunicorn and converting flask application to Gunicorn app.

  • Collaborate virtually as a team effectively

What's next for Moody

  • Further improving the accuracy of the sentiment analyzer and recommender system by adding more features and training over more data sets

  • Give the users ability to send journal as logs to the mental health expert directly

  • Add support for attachments like audio, video, and camera.

  • Make APIs calls secure using encryption such as AES256 or SHA256

Contact

Pinak Sawhney - pinaksawhney5@gmail.com

Project Link: https://github.com/pinaksawhney/sigmoidHack2021

IF YOU THINK THAT YOU CAN HELP ME TO HELP OTHERS, PLEASE DO NOT HESITATE TO CONTACT ME.

Built With

Share this project:

Updates