Friday, December 2, 2016

Using GDELT 2 with PHP to Analyze the World!

Are you interested in political world events? Do you want to play with one of the world's largest databases? If you answered either of those questions with a yes, keep reading - this will interest you!

This article follows up on the promise to use GDELT with PHP.

I will show you a simple example of how to use GDELT through BigQuery with PHP, and how to visualize the results on a web page. Along the way, I will tell you some more about GDELT.

Vector illustration of abstract world map

GDELT

GDelt (the "Global Database of Events, Language and Tone") is the biggest Open Data database of political events in the world. It was developed by Kalev Leetaru (personal website), based on the work of Philip A. Schrodt and others in 2011. The data is available for download via zip files and, since 2014, is query-able via Google's BigQuery web interface and through its API, and with the GDELT Analysis Service.
The GDELT Project:

monitors the world's broadcast, print, and web news from nearly every corner of every country in over 100 languages and identifies the people, locations, organizations, counts, themes, sources, emotions, quotes, images and events driving our global society every second of every day, creating a free open platform for computing on the entire world.

Online Experimenting

All GDELT data has been made available through BigQuery. This "big data" database has a web interface that allows you to view the table structures, preview the data, and make queries while making use of the autosuggest feature.

In order to experiment with the GDELT dataset online, you need to have a Google account. Go to the BigQuery dashboard.

If you don't have a Google Cloud project yet, you will be prompted to create one. This is required. This project will be your working environment, so you may as well choose a proper name for it.

You can create your own queries via "Compose query". This one, for example:

SELECT EventCode, Actor1Name, Actor2Name, SOURCEURL, SqlDate
FROM [gdelt-bq:gdeltv2.events]
WHERE Year = 2016
LIMIT 20

Continue reading %Using GDELT 2 with PHP to Analyze the World!%


by Patrick van Bergen via SitePoint

No comments:

Post a Comment