Inspiration: Current political events taking place and analyzing the conversation people were having on Twitter, and if that is a reliable indicator of how people vote.

What it does: The web application continuously displays real-time sentiment analysis of political tweets of people with respect to their location. The backend pipeline is ingesting the twitter API and performing sentiment analysis on the tweets that filter it as political.

How I built it: The application pulls the real-time data with the Twitter APIs, filters the data on some keywords to identify if the tweets fall into the political category. This data is then further analyzed and sent to Google's inference API, which uses Natural Language Processing and performs the sentiment analysis to classify the tweets in four categories: Red+, Red-, Blue+, Blue-. This data is then pushed to the relational database called big query to perform analytics. The web application continuously queries the database to fetch the aggregated sentiment results for each state and displays it at the interval of every 3 seconds. The entire application is deployed using the Kubernetes engine of the Google Cloud Platform. The application when runs, displays the d3 Map of the United States, continuously fetching the real-time data, processing it and displaying the sentiments of the people of different states.

Challenges I ran into - Deploying the service on Kubernetes was one of the challenges we faced. Also, handling a lot of data from the live stream generated as a call to the twitter API was a challenge.

Accomplishments that I'm proud of: The application helps in identifying the real-time data and helps us to understand how people in different locations follow politics and have an opinion about different political parties.

What I learned: Learned technologies that made coding, integrating and collaborating a lot easier. With the help of the google cloud platform, where we had everything in one place, from databases to application deployments overcoming all the dependencies, it became a lot easier to build the application.

What's next for Political Hacks: We could scale our application to display the data where the statistics of individual cities are also shown along with the statistics of the state.

Share this project: