The light is finally at the end of the tunnel in the U.S. as we are getting closer and closer to new normalcy following the pandemic. However, another issue is rising. Covid-19 not only affected people by causing the virus to spread and kill over half a million people in the US. Mental health issues rose, and are predicted to rise after we approach new normalcy. According to the National Institute of Mental Health’s Dimensional Traumatic Stress Research Program, the percentage of people reporting they felt anxious or depressed spiked and remained at high levels since the start of the pandemic in March 2020. Some of the causes include substance misuse, anxiety and uncertainty, job losses, grief, and lack of social interaction. I am sure that all of us either experienced some of these ourselves or saw others experience some of the things we have mentioned, unfortunately. As we approach a new normal, we must have more resources available to people who are suffering from mental health issues following the pandemic. So, the project that we have been working on is Medity: a smart, mental health app that serves as a mindful reflection journal that provides users with motivational messages, and resources if they need them.

What it does

Users can log onto the app and will be directed to their calendar page where they can input their reflection for the day. Research done by Giada Dwe Stefano, Francesca Gino, Gary Pisano, and Bradley Staats done in call centers demonstrated that employees who spent 15 minutes at the end of the day reflecting about lessons learned performed 23% better after 10 days than those who did not reflect. Not only does it make people more productive, but studies also show that it helps people stay happier and more cognizant of what’s bothering them. Once they input their data, the app will store this information, and we have used Natural Language Processing to decipher the sentiment of these reflections.

Once it understands how positive or negative the message is, the app will do two things. First, based on how positive or negative the tweet is, it will send a notification to the user first thing in the morning when they wake up (users set the time), and they can wake up to a motivational quote in the morning. We have compiled an open-source database of quotes and will have the app pick from these based on how the user was feeling the night before.

For example, we had said that we were feeling anxious the night before because of an interview we had this morning. The program understood that it had a negative sentiment (but not seriously negative), so it gave me an uplifting quote to look at the positives and told me to go crush it today. But, had we said something more negative, the app would send me actionable resources for support. This is to help the user locate mental health resources in their nearby area if the app predicts that they need more help than just motivation.

Mental health hotlines will also be attached. Sometimes, it's easier to put this personal information into an inanimate object like a phone rather than sitting face to face with a human. Some people are shy or find it difficult to be vulnerable, so this can be one of the first ways they can recognize they need help. This could be helpful for the mental health telehealth industry that is growing. Of course, getting treatment from a professional is always the best option, but understanding that you need help in the first place is essential to the process. For people suffering from less urgent issues, the quotes and motivation can be encouraging.

How we built it

We have used an open-source tweet database that has hundreds of tweets and set sentiments of these tweets (positive or negative). Using this, we were able to train the model to understand the reflections that users input into the app. We first filtered non-relevant information using Regex from the inputted text (emojis, hashtags, multiple letters in a word used to emphasize a point, HTTPS in URLs, word/punctuation repetition. Then we used lemmatization (converting the words to their root form). We then got rid of stopwords (like “a”, “the” that do not contribute much to deciphering the actual sentiment. After all of these methods were complete, we used the methods to filter out the inputted text to what is shown on the screen. Now once these words are extracted, we are comparing these words to the tweets and we are figuring out how often they show up in the positive or negative tweets. For example, the word “love” shows up more frequently in the positive tweets, but the “nervous” word shows up more frequently in the negative sentiments. We used resources from AIOutsider to learn more about regex and the purpose of omitting certain information. Using this information, we can see if the phrases are leaning towards positive or negative sentiments. Finally, once the sentiments are clarified, we are using a LogisticRegression model to see whether the overall sentiment is positive or negative. We used a logistic regression model to train the model, and we needed to evaluate this model repeatedly (80% of the data was used to train). We realized that feeding in test data manually would take too long, so we implemented an MLOps pipeline to care of this. We were able to use iteration to feed in the tweet data that we did not use to train the model with and use this for test purposes instead. We simultaneously uploaded this test data into a separate file to review and monitor for accuracy using our logistic regression model. Automation here made it more feasible to test possible sentiments quickly.

We were interested in testing the model we had build against the BERT classifier so we are using our sentiment model ( and comparing how well the NLP is working compared to BERT. We were interested in the BERT classifier used in the stock sentiment analysis demo created by Iguazio so we wanted to take a similar approach for Medity.

Logistic regression is great for pinpointing whether something is positive or negative, true/false, but moving forward, we would probably lean towards another model to understand more about the tweet. Rather than just positive or negative, was the user anxious, excited, or worse like depressed. But for the hackathon, this model was successful in telling me to what degree the user was feeling positive or negative.

Challenges we ran into

This is the first time that we used natural language processing in a mobile app. Learning the syntax for regex was a learning curve, but it was interesting to see how to pick out the meaningful words in a phrase/sentence. In addition, working with expo and react-native to send out notifications picking out from the correct tweet categories took a lot of testing. We decided to use a LogisticRegression model because it was more simple to use than a Random Forest Classier for this task.

Accomplishments that we am proud of

We are happy that we were able to use our react-native skills and combine that with something we have never done before: natural language processing. In just a few weeks, we were able to understand the importance of regex and learn the significance of concepts like lemmatization. This is an interesting field that we never tapped into, but we are happy that we stepped out of our comfort zone to explore. In addition, we learned more about the mental health situation in the U.S. and we hope to continue to build this app to help people facing these issues.

What we learned

we learned how to use regex to simplify text and the concept of lemmatization and stopwords. By doing this, it was easier for me to focus on the important words and compare that to the list of tweets with positive and negative tweets. In addition, we learned how to use the Logistic Regression to see how positive or negative the sentiment is. Moving forward, we would like to explore other models to categorize the sentiments into other categories that would allow to app to pick out more relevant quotes. For example, instead of or focusing on just positive and negative sentiments, was the user nervous? Anxious? Depressed? This would be more helpful and is something we plan to focus on moving forward.

What's next for Medity

As we approach a new normal, there is an urgent need for mental health resources and to find remedies to help people adjust. Not everyone needs urgent help, but we believe that everyone needs to be mindful of their mental health during this time, so assistance should be available for anyone who needs it. With Medity, we are optimistic that we can use technology, NLP, and machine learning to reach a wider range of people quickly, as this pandemic nearly unfortunately touched every community in the world. We hope to integrate this technology into the growing industry of telehealth focusing on mental health. Thank you for taking the time to look at our project!

Share this project: