Representing cubes as JSON
The REST API needs support for cubes. This ticket is primarily for discussing how to represent a cube in JSON.
A cube has the following properties:
- Dimensions (can sort of be compared to a variable in a cross tabulation). A dimension has a number of...
- Members. Members are also called categories. Categories are divided into...
- Levels. The members of a dimension are organized in a hierarchy of one or more levels. The top level always has only one member (think of this as a root).
A dimension could be Geography. A geographic dimension is very likely to have several levels. For example, Norway could be divided into these levels:
- Entire country
Each member at a given level is a child of one member on the level above it.
So, to represent this in JSON we would need the following:
- A description of dimensions. It has at least a code/id and a label.
- A description of the levels in a dimension. It has a code/id, label, and a pointer to its parent level.
- A description of the members. It has a code/id, label, and a pointer to the level it belongs to.
- A way to represent the measures/data.
This could be done in several ways. Each point above could be its own chunk in the JSON document, or everything could be described as a big tree with the measures/data points as leaves.
Things to consider
The data structure should be designed in such a way that:
- It is possible to represent dimensions, members, and levels as lists idenpendently from each other and independently from the data structure.
- It is possible to look up data points.
- It is possible to filter out dimensions (meaning, only one member from that dimension will be used).
- It is possible to filter out a number of members in a dimension.