Mapping Depression through Tweets

What it does

Major depression is one of the most common mental health issues around the globe. Oftentimes, those who are depressed go to social media such as Twitter and Facebook to express their feelings. Oftentimes, these signs are left undetected or they are not handled properly. Our novel approach aims to solve this challenge by mapping tweets indicative of depression as well as crisis centers across the United States. This is a fast and efficient way of finding localized areas of high depression and providing crisis centers with information as to how prevalent depression is in their area.

How we built it

We first utilized the Twint tool for real-time scraping of Twitter data in the United States during the past two days. We then utilized NLTK tools to preprocess the text from the tweets and transform it into data that could be fed into a pre-trained Convolutional LSTM network. Once we filtered tweets were indicative of depression, we used the Twint tool to access a general location of the user and used ArcGIS geo-encoding API to extract longitude and latitude coordinates. Our web application, which relies on a Flask framework then took these coordinates and utilized the Google Maps API to create a heatmap. We were also able to extract locations of crisis centers from the Suicide Prevention Hotline website and plot those on our map. After creating this, we focused on making it real-time, so that the heatmap can be updated based on new tweets.

Challenges we ran into

The biggest challenge we ran into was perhaps taking the Twitter data and extracting the relevant information. We found that the Twitter API was restrictive in some senses and instead used the Twint tool which allowed for faster calls and was more flexible. Another challenge was connecting the backend machine learning algorithms to the Flask application.

Accomplishments that we're proud of

We were able to accomplish our goals for a working MVP.

What we learned

We learned to utilize the Twint API for real-time scraping of tweets and the levels of preprocessing necessary for proper analysis. We also learned how to work with the Google-Maps API in Flask as well as the ArcGIS API for geocoding, both of which were key for the project to be successful. Most importantly, we learned how to create a full end-to-end application as a team. There were a lot of moving parts all of which were dependent on each other.

What's next for Mapping Depression through Tweets

The team is looking to extract more data for better analysis as well as automatically determining high-risk areas through census and geographical data to contact crisis centers. We also are considering creating a mobile app version for this. Another potential avenue for this project would be to extract data from other types of social media such as Instagram or Facebook.