Skip to content

How Where Does My Money Go uses the slicer API

Friedrich Lindenberg edited this page Jun 6, 2015 · 1 revision

To highlight the use of the Cubes slicer API, let's look at the UK Country Regional Analysis dataset. This is a high-level survey of the UK budget, and the original Where Does My Money Go? page was based on this data.

The first call we'll make will aggregate the complete dataset and give us a total sum:

GET /api/slicer/cube/ukgov-finances-cra/aggregate

This is not very useful, however, as it includes UK spending over several years. So let's refine our query to include only 2010 figures:

GET /api/slicer/cube/ukgov-finances-cra/aggregate?cut=time.year:2010

Much better! Now we may want to know how these funds are distributed geographically, so let's drill down by the NUTS names of each region of the UK:

GET /api/slicer/cube/ukgov-finances-cra/aggregate?cut=time.year:2010&drilldown=region

Given an SVG file with the right region names, this could easily be used to drive a CSS-based choropleth map, with a bit of JavaScript glue on the client side.

Another set of dimensions of the CRA dataset is the Classification of Functions of Government (COFOG), which classifies government activity by its functional purpose. Like many taxonomies, COFOG has several levels, which we have modelled as three dimensions: cofog1, cofog2 and cofog3.

In order to generate a Bubble Tree diagram, we want to break down the full CRA dataset by each of these dimensions:

GET /api/slicer/cube/ukgov-finances-cra/aggregate?cut=time.year:2010&drilldown=cofog1|cofog2|cofog3

(Warning: this generates quite a lot of data. You may want to paginate the results to view it in your browser.)

As you can see, the aggregator API can be used to flexibly query the data to generate views such as visualisations, maps or pivot tables.