Skip to content

ChileCube

Carlos Navarrete edited this page Apr 11, 2018 · 10 revisions

This is a global class, and connect with DataChile website data.

FYI: cube_id is considerated like cube.name. More information about cubes in https://datachile.io/about/api


ChileCube.get_cubes()

Get list of cubes availables in DataChile


ChileCube.get_cube(cube_id)

Get list of dimensions, measures and annotations availables in a cube.


ChileCube.get_drilldowns(cube_id) | List

Return a list with all Dimensions, Hierarchies and Levels that are found in the cube. Besides, drilldown property return a list with [ dimension, hierarchy, level ] that is used in .get().

[
    {
	"dimension": "Date",
	"hierarchy": "Date",
	"level": "Year",
	"drilldown": ["Date", "Date", "Year"]
    },
    ...
    {
	"dimension": "Tax Geography",
	"hierarchy": "Geography",
	"level": "Region",
	"drilldown": ["Tax Geography", "Geography", "Region"]
    }
]

ChileCube.get_comunas() | List

Return list of comunas availables in DataChile.

[
    {
        "comuna_id": 1,
        "comuna": "Concepción",
        "region_id": 1,
        "region": "Biobío"
    }
]

ChileCube.get_regiones() | List

Return list of regions availables in DataChile.


ChileCube.get_members(cube_id, dimension, level)

For an particular cube, get the members belonging to a certain level in a dimension.


ChileCube.get(cube_id, params={}, lang="en", df=False)

Return tidy data from cube.

By default, params are:

params={
    "drilldowns": [],
    "measures": [],
    "cuts": [
      {
        "drilldown": [],
        "values": []
      }
    ],
    "parents": False
}

* Always you must define at least one drilldown and one measure.

By default, data return like a dict, but you can set df=True for to return like a pandas DataFrame


ChileCube.get_measures(cube_id) | List

Get list of measures availables in a certain cube

[
  {
    "name": "Output",
    "caption": "Output",
    "annotations": {},
    "full_name": "[Measures].[Output]",
    "aggregator": "SUM"
  },
  ...
  {
    "name": "Investment",
    "caption": "Investment",
    "annotations": {},
    "full_name": "[Measures].[Investment]",
    "aggregator": "SUM"
  }
]