It is a very political time and because of this, we thought it would be interesting to see what the global media portrays in the news about international relations. This is how NationRelations was born.

What it does

NationRelations displays the apparent relationships between a selected country and other countries for which data is available. The relationships are displayed via a gradient colors.

How we built it

We send REST requests to the EventRegistry News API to receive news headlines according to keywords (including aliases such as leader name and capital name). Using Google Cloud's Natural Language API, we analyzed the sentiment of headlines in a directed relationship between a pair of countries. We save those sentiment data points into a MySQL database. The sentiment values in the directed relationships are compiled into aggregate scores (consisting of the sentiment values of each headline analyzed) which are then used to display the relationships using a color legend on a map rendered through leaflet.js. The website is hosted on a Linux Apache server on Google's Compute Engine.

Challenges we ran into

Building a functional interface for the MySQL database was difficult since we ran into errors involving types and correct statements. Without properly saving to the database, there was no way we could keep track of our data and use it to compute aggregate scores. Even when we got a hold of those scores, we had to properly format the scores into JavaScript GeoJSON-formatted data to be rendered onto the map. The data also had to include country IDs and sentiment scores.

Accomplishments that we're proud of

We like the visuals for the website given the time we had. We had surprisingly few issues with git, and our team was very cohesive. Work was split up well, with each team member contributing input to the problems we had and each having a skill tat contributed to our overall success.

What we learned

Databases can be difficult to manage and import to set up correctly. We also became better versed with Google Cloud services, especially Compute Engine when one of us only had experience with App Engine. We also got more comfortable using Python.

What's next for NationRelations

Possibly implementing machine learning once our data set has grown to a sufficient size. That would include expanding to analyze more countries. We also would create more scripts to automate the update process for retrieving headlines, analyzing them, and displaying them. This would include thinking of a way to manage the rather large computing time it requires to analyze all the directed relationships we need to consider.

Share this project: