{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Getting Started with GDELT + Google Cloud Datalab: Simple Timelines\n", "---\n", "\n", "Some simple examples for getting started using GDELT in Google Cloud Datalab." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Creating Event Timelines (1979-Present)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%%sql --module ukraineconflicttimeline\n", "\n", "#NOTE: string(MonthYear) converts the date to a string so the timeline below will treat as categorical labels \n", "SELECT string(MonthYear) MonthYear, INTEGER(norm*100000)/1000 Intensity\n", "FROM (\n", "SELECT ActionGeo_CountryCode, QuadClass, MonthYear, COUNT(1) AS c, RATIO_TO_REPORT(c) OVER(PARTITION BY MonthYear ORDER BY c DESC) norm FROM [gdelt-bq:full.events]\n", "GROUP BY ActionGeo_CountryCode, QuadClass, MonthYear\n", ")\n", "WHERE ActionGeo_CountryCode='UP' and QuadClass=4\n", "ORDER BY ActionGeo_CountryCode, QuadClass, MonthYear;" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "