Disagree to agree is an app that connects people with different, ideally opposite, political opinions to have a conversation with each other. The US Presidential Election in 2020 has reflected the increasingly polarized political climate in the US and the lack of meaningful discourse between people with different political beliefs. We recognize the need to heal this increasingly fractured society and improve mutual understanding through productive communication. Hence, we decided to take the usual agreeing to disagree a step further and develop an application that matches people with more opposing opinions than similar ones and help them to build consensus in ideas through discourse. At the end of the conversation, we hope that regardless of their political affiliations i.e. Republican, Democrat, etc., they would realize how they share more similarities than differences and be able to move from disagreement to agreement.

What it does

The app matches people with opposite political opinions to have a conversation with each other in a chat room. Prior to the matching process, new users have to first input their topics of interest (Economics, Immigration, etc.) and provide short answers to five political questions during registration. Disagree to agree will then calculate the sentiment polarity and objectivity scores for their answers before storing them into Google Realtime Database. Our self-developed matching algorithm matches users with at least 3 overlapping topics of interest and 3 short answers that have a polarity score difference of 0.75. The algorithm also makes sure that users will have similar sentiment objectivity scores so that they will have similar discussion styles (subjective/emotional vs objective/logical). This set of constraints ensures that real-time conversations would be productive since there will be sufficient points of conflict as well as areas where agreement can be achieved. This allows people with different political leaning to build consensus and find common ground. The matching will be done such that once a user clicks on the “Get Started” button, the app will try to match the user with another user from the queue on the Google Realtime Database. If no suitable matches is found, the user will join the queue in the database and will only leave the queue when a match is found.

The app also offers a few conversation prompts (Casual, Economics, Education, etc.) to help break the ice or kickstart the conversation. Users can choose the different categories by typing in eg. !education for an education prompt and the app will generate an education-related question for the users to discuss. After the entire conversation session, the users will reveal their political leaning (Republican, Democrat, etc.) to let each other know how despite the differences in their political stances, they actually share more similarities than they had previously thought.

How we built it

We used React.js for our front-end and Flask API for our back-end, Google Firebase to manage authentication and its Realtime Database to store user profiles, queue users to be matched, and keep track of messages. The real-time chat functionalities is created with the ChatSocketIO. Disagree to agree uses Google Cloud Natural Language to calculate sentiment polarity and TextBlob to calculate objectivity scores for matching users. The app is deployed via Google Cloud App Engine.

Challenges we ran into

It is the first time we used Firebase, so it took us a while to learn how to set up, push, and retrieve data from the database. It was especially challenging because of the lack of public documentation on how to utilize Firebase’s Realtime Database functions with Python. On top of that, it was our first time using a NoSQL database since most of us have only been using SQL databases like MySQL and PostgreSQL.

It is also the first time that we are using Google Cloud’s APIs. None of us has used Google Cloud Natural Language or Google Cloud App Engine. It was incredibly difficult to deploy the Flask Chat Application on Google Cloud App Engine because of several compatibility issues with the ChatSocketIO. The learning curve was incredibly steep because deployment was a completely new field for all of us. Debugging error that only surfaced after the deployment was also a nightmare because of the lack of error messages. Because of how tight for time we are, we did not set up the usual CI/CD workflow as well as the necessary test cases to ensure that our app would be easily debuggable during the deployment process.

Accomplishments that we're proud of

We were proud of what we have managed to build in such a short span of time in spite of the different time zones that we were operating in as well as the hectic academic schedule that we all shared. American politics was something that was extremely close to our hearts especially after seeing how our visa statuses could be threatened by some of the policies that were suggested. It was also especially tough to see how polarized political discussions have become. It was hence immensely satisfying for us to be able to help alleviate these issues with a web application. We were not only happy to make new friends at the hackathon but also be part of this incredible team that was very supportive of each other when it came to learning new technology.

What we learned

We learned how to set up, update, and retrieve data from the Firebase backend database. We also gained an understanding of how to use ChatSocket to send messages among different users in a single URL. On top of that, we managed to deploy our first (live chat) application ever and set it up in the Google Cloud App Engine.

What's next for Disagree to Agree

  • Add more moderation rules for the chat (report function, curse words’ filter, etc)
  • Add more questions for the chatbot
  • Use Google’s TensorFlow hub to optimize the matching algorithm
  • Create a forum for group discussions that involve enforced silence to facilitate reflection and examination of ideas

Built With

  • chatsocketio
  • css
  • flask
  • google-cloud-app-engine
  • google-cloud-natural-language-api
  • google-firebase-authentication-api
  • google-firebase-realtime-database
  • html
  • jquery
  • python
  • react.js
  • textblob
Share this project: