Social distancing is hard. It makes connecting with your loved ones more difficult, and oftentimes virtual alternatives to communication wont be able to capture key nonverbal cues that may indicate how someone is truly feeling. This places people at risk of suicide or self harm at an even higher risk, as their loved ones start to adapt to social distancing and e-communication. We wanted to find a creative solution to mitigate global suicide and challenges during these challenging times.

"When we recognize that someone is having [suicidal] thoughts and we reach out we are instantly planting a seed of hope that they are not invisible, that they're not alone."

- Misty Vaughan Allen

What it does

Our webapp allows individuals and mental health experts to check the average sentiment of the recent tweets of Twitter users within a specified locality quickly and accurately. They are then encouraged to reach out to users at high risk with the most negative sentiment analysis on recent tweets, so that they may provide them with relevant resources or local support.

Twitter is a great dataset to this end since ~23% of online adults use Twitter and over 500 million tweets are sent per day, meaning that it is an up-to-date and evolving sentiment dataset that can give valuable insight to an individual's state of mind.

How we built it

  • Collected 1,000,000 annotated Tweets (positive or negative) from
  • trained a Naive Bayes Multinomial network to learn to classify tweets as positive or negative.
  • created a Flask web application that included the model
  • used Google Maps API to fetch the latitude and longitude of users based on their address.
  • used the Twitter API to fetch 100 usernames from within the specified radius around the address.
  • used the Twitter API to fetch the 20 latest tweets from each username
  • ran sentiment analysis model on these 20 tweets, took the average sentiment per user, and displayed it graphically

Challenges we ran into

As outlined by the limitations of the current study, the predictive power for actual suicidal behaviour using Twitter is not yet known and the findings do not directly identify targets for intervention. This was our primary challenge as there is very little literary or scientific evidence supporting using sentiment analysis to identify suicidal behaviour. However, this group acknowledges that an absence of studies in a given scientific field does not indicate that a relationship or no relationship exists; only that there is a gap. This group decided to move forward with the project nonetheless as there is a significant social impact to be gained from such a tool, especially given present-day global circumstances.

Accomplishments that we're proud of

This was the first NLP model that we've ever trained! Thus, we are very proud to have learned about the process of building and training a Natural Language Processing machine learning model.

What we learned

We learned how to train and deploy a natural language processing model, source good databases, and modern web design techniques. We hope to implement these newly acquired skills in future projects and at future hackathons!

What's next for #suicideprevention

  • Allow for user sign-in and checking up on Private Twitter accounts, with an emphasis on following/followers

Built With

Share this project: