» Invite me!

Inspiration

It’s no surprise that current events have moved the majority of our lives online. As a group of high schoolers, the bustle of conversation with our classmates and friends that used to occur before school huddled together in a hallway or eating together in the cafeteria abruptly ended. Many of us have moved towards online chatting platforms to stay in touch with our friends, playing games, and maintaining at least some semblance of normalcy. Given the warping of our perception of time during lockdown periods, we each found ourselves slowly losing grip of our mental health as days keep appearing to be the same as the last.

Given the rise in the use of online chatting platforms, particularly Discord, our group decided to base our project around programming a Discord bot. As a platform that we and all of our peers have easy and unrestricted access to, we believed that a mood-tracking bot that checked in with us every day would help us pick up on trends about how we were feeling, enabling us to take more proactive action towards improving our mental health.

What it does

Pip is a Discord bot that aims to improve mental health through a multitude of functions. By combining IBM Watson’s tone analyzer and Google Cloud’s natural language processing sentiment, Pip can analyze messages and accurately determine the user's mood. Using the mood detected, Pip then responds accordingly, providing the user with support in the form of an uplifting message and the appropriate resources to help with how they are feeling. The user can also view their moods for the last 7 days in an easy-to-view graphic, which will help them identify things in their life that affect their mental well-being and make adjustments.

Alongside the mood tracking feature, Pip also offers a variety of other mental health services. Every 24 hours, Pip will send a message to give the user a mood boost and remind them to log their emotions. In case they feel down, Pip also has a motivation command that will automatically retrieve a motivational post from a never-ending list of options hand-curated by thousands of users. Finally, Pip can provide mental health resources on command if the user needs some more targeted resources.

Introduction Introduction

Check-In Check-In

Multilingual Support Multilingual Support

History History

How we built it

We built Pip using Python with the help of many APIs. The Discord.py Library was used to create the bot itself, while the tone recognition feature relies on the IBM Watson Tone Analyzer API and the Google Cloud API. Datetime was also a fundamental library used in conjunction with the Pillow library and Apache Cassandra driver to create graphics and store user information. Finally, the Reddit API was used to pull motivational posts from r/getmotivated.

Challenges we ran into

Having never used databases and artificial intelligence API libraries beforehand, we were comprehensive about implementing our seminal project idea. However, we were pleasantly surprised by how quickly we could successfully connect to and access Google Cloud’s APIs in Python. We thankfully had very similar success with DataStax Astra’s Cassandra Databases, as well as IBM Watson’s tone analyzer, thanks to the ample amount of available documentation and examples.

Accomplishments that we're proud of

We’re proud that despite not being familiar with many of the APIs and libraries beforehand, we managed to develop a fully working Discord bot with all of the features we initially planned in just 2 days. Although there are definitely some areas we can optimize and more features we wish to add, we’re very happy with our progress!

What we learned

As we constructed Pip over the last few days, we learned how to interact with a wide variety of libraries and APIs. For each of us, this was the first project we undertook that utilized databases and APIs, and yet, we were able to; thanks to the help of available documentation and (god-like) YouTube tutorials, we were able to envision the idea we had going into Mental Health Hacks. We learned to program both the front/back end of Pip while also learning to document all of our features in the code and our Github Repo.

What's next for CheckinWithMe

We have many ambitious plans in place for Pip Bot moving forward. In the future, we plan to implement:

Optimizations:

  • Replace long if-else trees with native switch-statements upon Python 3.10 release.

    # TODO Move to switch statements when Python 3.10 releases
    if tone_watson and tone_google:
    if tone_watson['tone_id'] in negative:
        if tone_google['score'] <= ranges["negative"]:
            return {'tone_id': tone_watson['tone_id']}
        else:
            # ML Libraries disagree on sentiment - will ask again for a more definitive statement
            return None
    else:
        if tone_google['score'] >= ranges["positive"]:
            return {'tone_id': tone_watson['tone_id']}
        else:
            # ML Libraries disagree on sentiment - will ask again for a more definitive statement
            return None
    elif tone_google:
    if tone_google['score'] >= ranges["strong_pos"]:
        return {'tone_id': positive[0]}
    elif tone_google['score'] <= ranges['negative']:
        # Google Sentiment Analysis believes the statement to be negative, but can't pinpoint the tone.
        # Will return separate -1 value for response
        return -1            
    elif tone_watson:
    return {'tone_id': tone_watson['tone_id']}
    else:
    return None
    
  • Move embeds from bot.py to a separate file.

Features:

  • Voice Recognition in >checkin
    • Analyses .audio files that users record and send to bot
  • Interactive Web UI to explore mood history in more depth
  • Streak-detection
    • Identifies streaks in good moods and compliments users
  • Thoughts/Gratitude Journal Support
    • Stores & Analyzes Journals, easily accessible on future Web UI
  • Chatbot feature
    • Allows users to casually converse with the bot using a conversational AI library, allowing users to have a more human-like interaction with Pip. With conversations, Pip will also have access to far more messages to analyze for a better, more accurate log of users’ moods.

Built With

Share this project:

Updates