Traces of natural disasters in World news
This version of the NewsTraces project uses the Guardian Open Platform. We're using the Guardian because the Open Platform has an easy to use API. Enter a search and select the time period you�re interested in. Relevant stories are displayed chronologically showing the pattern of the search term�s history with salient events showing up as peaks.
By default the search is under the 'World' section. You can select an alternative section or 'All' sections from the dropdown. Clicking on the individual news blocks will link through to the relevant Guardian article.
Searches with large numbers of results such as 'Obama' or 'Blair' will take a long time to load, so we suggest you refine the search in a number of ways. Either pick a more specific search term such as 'Obama healthcare', limit the time period by changing the 'starting' and 'ending' dates, or pick the specific section you're in, e.g. 'Politics'.
How it was Built //
The project was adapted from the initial BBC version, and uses the Guardian Open Platform API. See the getting started guide here:
To make it simpler and more readable the source code is a pared down from the online version. The main Actionscript file is called news_traces_01_guardian_sc.as
Get the code here:
Getting the data
Data is retrieved by querying the Open Platform API. The best way to find out how it works is to experiment with the explorer API:
The query string is constructed in function queryAPI, where parameters including the search term, the news section, and the begin and end dates are specified. Multiple requests are needed to get the result pages for each search term. Callback function completeHandler manages the download process, first getting the total results per search term when the _loadState is RESULT_METADATA, and each page for the search terms when its RESULT_CONTENT.
Results, in JSON format, are processed and added to the visualisation timeline in function parseJson.
To maximise screen estate the visualisation layout adapts to the pixel resolution available. The layout function first finds the largest bounding size available with a lower threshold of _minBounds. Chorological bars are drawn composed of blocks of individual news items. By default each bar represents 3 month. Change this by setting _monthsPerBar in init.
The colours for the search terms can be set at the top of the script in _boxCols.