diff --git a/src/cr/cube/crunch_cube.py b/src/cr/cube/crunch_cube.py index 94defe494..516eab02d 100644 --- a/src/cr/cube/crunch_cube.py +++ b/src/cr/cube/crunch_cube.py @@ -512,29 +512,6 @@ def _adjust_axis(self, axis): return tuple(new_axis) - def _transform_table(self, table, include_transforms_for_dims): - table = self._transform( - table, - include_transforms_for_dims, - inflate=True, - ) - return table - - def _inflate_dim(self, array, axis): - # Explicitly check if axis is tuple (which could be the case for doing - # cell percentages across 3D cube, when the axis is set to (1, 2)). - # Python 3 doesn't support tuple to int conversion, and we have to - # check it manually. - if (axis and not isinstance(axis, tuple) and - axis > 0 and len(array.shape) == 1): - # If any of the dimensions has only one element, it's flattened - # from the resulting array (as a part of the MR pre-processing). - # This can lead to a potential inconsistency between dimensions - # and axes, and we need to restore one dimension in this case. - array = array[:, np.newaxis] - - return array - @lazyproperty def is_univariate_ca(self): '''Check if cube is a just the CA ("ca x cat" or "cat x ca" dims)''' @@ -568,19 +545,6 @@ def dim_types(self): def ndim(self): return len(self.dimensions) - @lazyproperty - def ind_selected(self): - return self._get_mr_slice() - - @lazyproperty - def ind_non_selected(self): - return self._get_mr_slice(selected=False) - - @lazyproperty - def valid_indices(self): - '''Valid indices of all dimensions (exclude missing).''' - return [dim.valid_indices(False) for dim in self.dimensions] - @property def valid_indices_with_selections(self): '''Get all valid indices (including MR selections).''' @@ -631,23 +595,6 @@ def is_double_mr(self): '''Check if cube has 2 MR dimensions.''' return True if isinstance(self.mr_dim_ind, tuple) else False - @lazyproperty - def double_mr_non_selected_inds(self): - '''Gets all combinations of non-selected slices for any double MR cube. - - For double MR cubes, we need combinations of (selected) with - (selected + non_selected) for all combinations of MR x MR, but we also - need other potential dimensions included - ''' - # This represents an index in between MR dimensions (at this point we - # know there are two). It's used subsequently, for creating the - # combined conditional slices, where we have to take 'selected' for - # one MR, and selected AND non-selected for the other. - inflect = self.mr_dim_ind[1] + 1 - ind_ns_0 = self.ind_selected[:inflect] + self.ind_non_selected[inflect:] - ind_ns_1 = self.ind_non_selected[:inflect] + self.ind_selected[inflect:] - return self.ind_non_selected, ind_ns_0, ind_ns_1 - # Static methods @staticmethod diff --git a/src/cr/cube/cube_slice.py b/src/cr/cube/cube_slice.py index 2267a9445..7e3e8f26e 100644 --- a/src/cr/cube/cube_slice.py +++ b/src/cr/cube/cube_slice.py @@ -60,8 +60,11 @@ def _update_args(self, kwargs): if self.ca_as_0th: axis = kwargs.get('axis', False) if axis is None: - # TODO: Write detailed explanation here in comments. - # Special case for CA slices (in multitables). + # Special case for CA slices (in multitables). In this case, + # we need to calculate a measurement across CA categories + # dimension (and not across items, because it's not + # allowed). The value for the axis parameter of None, would + # incur the items dimension, and we don't want that. kwargs['axis'] = 1 return kwargs @@ -118,7 +121,7 @@ def _update_result(self, result): def _call_cube_method(self, method, *args, **kwargs): kwargs = self._update_args(kwargs) result = getattr(self._cube, method)(*args, **kwargs) - if method in ('labels', 'inserted_hs_indices'): + if method == 'inserted_hs_indices': if not self.ca_as_0th: result = result[-2:] return result @@ -156,19 +159,32 @@ def mr_dim_ind(self): mr_dim_ind = self._cube.mr_dim_ind if self.ndim == 3: if isinstance(mr_dim_ind, int): + if mr_dim_ind == 0: + # If only the 0th dimension of a 3D is an MR, the sliced + # don't actuall have the MR... Thus return None. + return None return mr_dim_ind - 1 elif isinstance(mr_dim_ind, tuple): - return tuple(i - 1 for i in mr_dim_ind) + # If MR dimension index is a tuple, that means that the cube + # (only a 3D one if it reached this path) has 2 MR dimensions. + # If any of those is 0 ind dimension we don't need to include + # in the slice dimension (because the slice doesn't see the tab + # that it's on). If it's 1st and 2nd dimension, then subtract 1 + # from those, and present them as 0th and 1st dimension of the + # slice. This can happend e.g. in a CAT x MR x MR cube (which + # renders MR x MR slices). + mr_dim_ind = tuple(i - 1 for i in mr_dim_ind if i) + return mr_dim_ind if len(mr_dim_ind) > 1 else mr_dim_ind[0] return mr_dim_ind @property def ca_main_axis(self): '''For univariate CA, the main axis is the categorical axis''' - ca_ind = self.dim_types.index('categorical_array') - if ca_ind is not None: + try: + ca_ind = self.dim_types.index('categorical_array') return 1 - ca_ind - else: + except: return None def labels(self, hs_dims=None, prune=False): diff --git a/src/cr/cube/dimension.py b/src/cr/cube/dimension.py index 7e09f12a7..4f9a010f2 100644 --- a/src/cr/cube/dimension.py +++ b/src/cr/cube/dimension.py @@ -141,11 +141,6 @@ def _transform_anchor(self, subtotal): return subtotal.anchor element_ids = [el['id'] for el in self._elements] - if subtotal.anchor not in element_ids: - # In case of numeric value which is not a category ID, return - # default value 'bottom' - return 'bottom' - contiguous_anchors = [ i for (i, id_) in enumerate(element_ids) if id_ == subtotal.anchor diff --git a/tests/integration/fixtures/__init__.py b/tests/integration/fixtures/__init__.py index 0997de305..e7e376fc4 100644 --- a/tests/integration/fixtures/__init__.py +++ b/tests/integration/fixtures/__init__.py @@ -136,3 +136,5 @@ def _load(cube_file): FOOD_GROOPS_X_STARTTIME_X_NORDIC_COUNTRIES = _load( 'food-groops-x-starttime-x-nordic-countries.json', ) +MR_X_CAT_X_MR_PRUNE = _load('mr-x-cat-x-mr-prune.json') +HUFFPOST_ACTIONS_X_HOUSEHOLD = _load('huffpost-actions-x-household.json') diff --git a/tests/integration/fixtures/cubes/huffpost-actions-x-household.json b/tests/integration/fixtures/cubes/huffpost-actions-x-household.json new file mode 100644 index 000000000..d90641159 --- /dev/null +++ b/tests/integration/fixtures/cubes/huffpost-actions-x-household.json @@ -0,0 +1,1118 @@ +{ + "element": "shoji:view", + "self": "https://alpha.crunch.io/api/datasets/aa146404f1b742d3b84280b27a340990/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Faa146404f1b742d3b84280b27a340990%2Fvariables%2F000406%2F%22%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Faa146404f1b742d3b84280b27a340990%2Fvariables%2F000406%2F%22%7D%5D%7D,%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Faa146404f1b742d3b84280b27a340990%2Fvariables%2F000124%2F%22%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Faa146404f1b742d3b84280b27a340990%2Fvariables%2F000124%2F%22%7D%5D%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:null%7D", + "value": { + "query": { + "measures": { + "count": { + "function": "cube_count", + "args": [] + } + }, + "dimensions": [ + { + "each": "https://alpha.crunch.io/api/datasets/aa146404f1b742d3b84280b27a340990/variables/000406/" + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/aa146404f1b742d3b84280b27a340990/variables/000406/" + } + ] + }, + { + "each": "https://alpha.crunch.io/api/datasets/aa146404f1b742d3b84280b27a340990/variables/000124/" + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/aa146404f1b742d3b84280b27a340990/variables/000124/" + } + ] + } + ], + "weight": null + }, + "query_environment": { + "filter": [] + }, + "result": { + "dimensions": [ + { + "derived": true, + "references": { + "alias": "HP_03", + "description": "Which of these have you done this year? Select all that apply.", + "name": "Political actions", + "subreferences": [ + { + "alias": "HP_03_1", + "name": "Gone to a protest, political rally or demonstration" + }, + { + "alias": "HP_03_2", + "name": "Volunteered for a political candidate or advocacy organization" + }, + { + "alias": "HP_03_3", + "name": "Donated to a political candidate or advocacy organization" + }, + { + "alias": "HP_03_4", + "name": "Called or written your representative in Congress" + }, + { + "alias": "HP_03_5", + "name": "Signed a petition about a political issue" + }, + { + "alias": "HP_03_6", + "name": "Posted on social media to advocate for a political position or opinion" + }, + { + "alias": "HP_03_7", + "name": "Talked to your friends or family to advocate for a political position or opinion" + }, + { + "alias": "HP_03_8", + "name": "None of the above" + } + ] + }, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "HP_03_1", + "name": "Gone to a protest, political rally or demonstration" + }, + "id": "0001", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "HP_03_2", + "name": "Volunteered for a political candidate or advocacy organization" + }, + "id": "0002", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "HP_03_3", + "name": "Donated to a political candidate or advocacy organization" + }, + "id": "0003", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 4, + "value": { + "derived": false, + "references": { + "alias": "HP_03_4", + "name": "Called or written your representative in Congress" + }, + "id": "0004", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 5, + "value": { + "derived": false, + "references": { + "alias": "HP_03_5", + "name": "Signed a petition about a political issue" + }, + "id": "0005", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 6, + "value": { + "derived": false, + "references": { + "alias": "HP_03_6", + "name": "Posted on social media to advocate for a political position or opinion" + }, + "id": "0006", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 7, + "value": { + "derived": false, + "references": { + "alias": "HP_03_7", + "name": "Talked to your friends or family to advocate for a political position or opinion" + }, + "id": "0007", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 8, + "value": { + "derived": false, + "references": { + "alias": "HP_03_8", + "name": "None of the above" + }, + "id": "0008", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "references": { + "alias": "HP_03", + "subreferences": [ + { + "alias": "HP_03_1", + "name": "Gone to a protest, political rally or demonstration" + }, + { + "alias": "HP_03_2", + "name": "Volunteered for a political candidate or advocacy organization" + }, + { + "alias": "HP_03_3", + "name": "Donated to a political candidate or advocacy organization" + }, + { + "alias": "HP_03_4", + "name": "Called or written your representative in Congress" + }, + { + "alias": "HP_03_5", + "name": "Signed a petition about a political issue" + }, + { + "alias": "HP_03_6", + "name": "Posted on social media to advocate for a political position or opinion" + }, + { + "alias": "HP_03_7", + "name": "Talked to your friends or family to advocate for a political position or opinion" + }, + { + "alias": "HP_03_8", + "name": "None of the above" + } + ], + "description": "Which of these have you done this year? Select all that apply.", + "name": "Political actions" + }, + "derived": true, + "type": { + "ordinal": false, + "subvariables": [ + "0001", + "0002", + "0003", + "0004", + "0005", + "0006", + "0007", + "0008" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + { + "derived": true, + "references": { + "alias": "union_hhold", + "description": "Are you or is someone in your household a member of a labor union?", + "name": "Union Household", + "subreferences": [ + { + "alias": "union_hhold_1", + "name": "Yes, I am" + }, + { + "alias": "union_hhold_2", + "name": "Yes, household member is" + }, + { + "alias": "union_hhold_3", + "name": "No" + } + ] + }, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "union_hhold_1", + "name": "Yes, I am" + }, + "id": "0001", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "union_hhold_2", + "name": "Yes, household member is" + }, + "id": "0002", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "union_hhold_3", + "name": "No" + }, + "id": "0003", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "references": { + "alias": "union_hhold", + "subreferences": [ + { + "alias": "union_hhold_1", + "name": "Yes, I am" + }, + { + "alias": "union_hhold_2", + "name": "Yes, household member is" + }, + { + "alias": "union_hhold_3", + "name": "No" + } + ], + "description": "Are you or is someone in your household a member of a labor union?", + "name": "Union Household" + }, + "derived": true, + "type": { + "ordinal": false, + "subvariables": [ + "0001", + "0002", + "0003" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Not Selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + } + ], + "missing": 0, + "measures": { + "count": { + "data": [ + 11, + 98, + 0, + 10, + 99, + 0, + 89, + 20, + 0, + 66, + 825, + 0, + 74, + 817, + 0, + 759, + 132, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 12, + 49, + 0, + 6, + 55, + 0, + 44, + 17, + 0, + 65, + 874, + 0, + 78, + 861, + 0, + 804, + 135, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 19, + 145, + 0, + 14, + 150, + 0, + 133, + 31, + 0, + 58, + 778, + 0, + 70, + 766, + 0, + 715, + 121, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 32, + 266, + 0, + 31, + 267, + 0, + 241, + 57, + 0, + 45, + 657, + 0, + 53, + 649, + 0, + 607, + 95, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 33, + 364, + 0, + 38, + 359, + 0, + 329, + 68, + 0, + 44, + 559, + 0, + 46, + 557, + 0, + 519, + 84, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 26, + 262, + 0, + 30, + 258, + 0, + 235, + 53, + 0, + 51, + 661, + 0, + 54, + 658, + 0, + 613, + 99, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 40, + 412, + 0, + 44, + 408, + 0, + 374, + 78, + 0, + 37, + 511, + 0, + 40, + 508, + 0, + 474, + 74, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 18, + 326, + 0, + 20, + 324, + 0, + 307, + 37, + 0, + 59, + 597, + 0, + 64, + 592, + 0, + 541, + 115, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "n_missing": 0, + "metadata": { + "references": {}, + "derived": true, + "type": { + "integer": true, + "missing_rules": {}, + "missing_reasons": { + "No Data": -1 + }, + "class": "numeric" + } + } + } + }, + "element": "crunch:cube", + "counts": [ + 11, + 98, + 0, + 10, + 99, + 0, + 89, + 20, + 0, + 66, + 825, + 0, + 74, + 817, + 0, + 759, + 132, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 12, + 49, + 0, + 6, + 55, + 0, + 44, + 17, + 0, + 65, + 874, + 0, + 78, + 861, + 0, + 804, + 135, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 19, + 145, + 0, + 14, + 150, + 0, + 133, + 31, + 0, + 58, + 778, + 0, + 70, + 766, + 0, + 715, + 121, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 32, + 266, + 0, + 31, + 267, + 0, + 241, + 57, + 0, + 45, + 657, + 0, + 53, + 649, + 0, + 607, + 95, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 33, + 364, + 0, + 38, + 359, + 0, + 329, + 68, + 0, + 44, + 559, + 0, + 46, + 557, + 0, + 519, + 84, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 26, + 262, + 0, + 30, + 258, + 0, + 235, + 53, + 0, + 51, + 661, + 0, + 54, + 658, + 0, + 613, + 99, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 40, + 412, + 0, + 44, + 408, + 0, + 374, + 78, + 0, + 37, + 511, + 0, + 40, + 508, + 0, + 474, + 74, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 18, + 326, + 0, + 20, + 324, + 0, + 307, + 37, + 0, + 59, + 597, + 0, + 64, + 592, + 0, + 541, + 115, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "n": 1000 + } + } +} diff --git a/tests/integration/fixtures/cubes/mr-x-cat-x-mr-prune.json b/tests/integration/fixtures/cubes/mr-x-cat-x-mr-prune.json new file mode 100644 index 000000000..d3bfe8f7e --- /dev/null +++ b/tests/integration/fixtures/cubes/mr-x-cat-x-mr-prune.json @@ -0,0 +1,4666 @@ +{ + "element": "shoji:view", + "self": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22each%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2Fddc1b8a25c454689911d3d7a59c97aee%2Fvariables%2F0000dc%2F%22%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2Fddc1b8a25c454689911d3d7a59c97aee%2Fvariables%2F0000dc%2F%22%7D%5D%7D,%7B%22variable%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2Fddc1b8a25c454689911d3d7a59c97aee%2Fvariables%2F0000bd%2F%22%7D,%7B%22each%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2Fddc1b8a25c454689911d3d7a59c97aee%2Fvariables%2F0000dd%2F%22%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2Fddc1b8a25c454689911d3d7a59c97aee%2Fvariables%2F0000dd%2F%22%7D%5D%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:null%7D", + "value": { + "query": { + "measures": { + "count": { + "function": "cube_count", + "args": [] + } + }, + "dimensions": [ + { + "each": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/variables/0000dc/" + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/variables/0000dc/" + } + ] + }, + { + "variable": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/variables/0000bd/" + }, + { + "each": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/variables/0000dd/" + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://app.crunch.io/api/datasets/ddc1b8a25c454689911d3d7a59c97aee/variables/0000dd/" + } + ] + } + ], + "weight": null + }, + "query_environment": { + "filter": [] + }, + "result": { + "dimensions": [ + { + "derived": true, + "references": { + "subreferences": [ + { + "alias": "dk", + "name": "Denmark", + "description": "milstat_1" + }, + { + "alias": "fi", + "name": "Finland", + "description": "milstat_2" + }, + { + "alias": "is", + "name": "Iceland", + "description": "milstat_3" + }, + { + "alias": "no", + "name": "Norway", + "description": "milstat_4" + }, + { + "alias": "se", + "name": "Sweden", + "description": "milstat_5" + } + ], + "notes": "A multiple response variable", + "alias": "nordics", + "description": "Which of the following Nordic countries have you visited? (select all that apply)", + "name": "Nordic countries" + }, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "dk", + "name": "Denmark", + "description": "milstat_1" + }, + "id": "00c0", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "fi", + "name": "Finland", + "description": "milstat_2" + }, + "id": "00c1", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "is", + "name": "Iceland", + "description": "milstat_3" + }, + "id": "00c2", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 4, + "value": { + "derived": false, + "references": { + "alias": "no", + "name": "Norway", + "description": "milstat_4" + }, + "id": "00c3", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 5, + "value": { + "derived": false, + "references": { + "alias": "se", + "name": "Sweden", + "description": "milstat_5" + }, + "id": "00c4", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "references": { + "subreferences": [ + { + "alias": "dk", + "name": "Denmark", + "description": "milstat_1" + }, + { + "alias": "fi", + "name": "Finland", + "description": "milstat_2" + }, + { + "alias": "is", + "name": "Iceland", + "description": "milstat_3" + }, + { + "alias": "no", + "name": "Norway", + "description": "milstat_4" + }, + { + "alias": "se", + "name": "Sweden", + "description": "milstat_5" + } + ], + "notes": "A multiple response variable", + "description": "Which of the following Nordic countries have you visited? (select all that apply)", + "name": "Nordic countries", + "alias": "nordics" + }, + "derived": true, + "type": { + "ordinal": false, + "subvariables": [ + "00c0", + "00c1", + "00c2", + "00c3", + "00c4" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + { + "references": { + "alias": "offal", + "notes": "A categorical variable where one of the categories has no responses", + "name": "Offal", + "description": "Mike's favorite food" + }, + "derived": false, + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "missing": false, + "id": 1, + "name": "Liver" + }, + { + "numeric_value": 2, + "missing": false, + "id": 2, + "name": "Kidney" + }, + { + "numeric_value": 3, + "missing": false, + "id": 3, + "name": "Heart" + }, + { + "numeric_value": 4, + "missing": false, + "id": 4, + "name": "Pancreas" + }, + { + "numeric_value": 5, + "missing": false, + "id": 5, + "name": "Thymus" + }, + { + "numeric_value": 6, + "missing": false, + "id": 6, + "name": "Snout" + }, + { + "numeric_value": 7, + "missing": false, + "id": 7, + "name": "Lung" + }, + { + "numeric_value": 8, + "missing": false, + "id": 8, + "name": "Tongue" + }, + { + "numeric_value": 32766, + "missing": true, + "id": 32766, + "name": "Don't know" + }, + { + "numeric_value": 32767, + "missing": true, + "id": 32767, + "name": "Not asked" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + { + "derived": true, + "references": { + "subreferences": [ + { + "alias": "eurasia", + "name": "Eurasia", + "description": "union_hhold_1" + }, + { + "alias": "oceania", + "name": "Oceania", + "description": "union_hhold_2" + }, + { + "alias": "eastasia", + "name": "Eastasia", + "description": "union_hhold_3" + }, + { + "alias": "disputed", + "name": "Disputed" + } + ], + "notes": "A multiple response variable, where one item has no responses", + "alias": "1984_countries", + "description": "Which of the following countries from 1984 would you live in? (select all that apply)", + "name": "Countries from 1984" + }, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "eurasia", + "name": "Eurasia", + "description": "union_hhold_1" + }, + "id": "00c5", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "oceania", + "name": "Oceania", + "description": "union_hhold_2" + }, + "id": "00c6", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "eastasia", + "name": "Eastasia", + "description": "union_hhold_3" + }, + "id": "00c7", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + }, + { + "id": 4, + "value": { + "derived": false, + "references": { + "alias": "disputed", + "name": "Disputed" + }, + "id": "de5314cea98b44eb9c243a86e06d1476", + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "references": { + "subreferences": [ + { + "alias": "eurasia", + "name": "Eurasia", + "description": "union_hhold_1" + }, + { + "alias": "oceania", + "name": "Oceania", + "description": "union_hhold_2" + }, + { + "alias": "eastasia", + "name": "Eastasia", + "description": "union_hhold_3" + }, + { + "alias": "disputed", + "name": "Disputed" + } + ], + "notes": "A multiple response variable, where one item has no responses", + "description": "Which of the following countries from 1984 would you live in? (select all that apply)", + "name": "Countries from 1984", + "alias": "1984_countries" + }, + "derived": true, + "type": { + "ordinal": false, + "subvariables": [ + "00c5", + "00c6", + "00c7", + "de5314cea98b44eb9c243a86e06d1476" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + } + ], + "missing": 104, + "measures": { + "count": { + "data": [ + 9, + 11, + 0, + 7, + 13, + 0, + 5, + 15, + 0, + 0, + 20, + 0, + 0, + 7, + 0, + 5, + 2, + 0, + 2, + 5, + 0, + 0, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 67, + 467, + 0, + 49, + 485, + 0, + 428, + 106, + 0, + 0, + 534, + 0, + 10, + 153, + 0, + 14, + 149, + 0, + 139, + 24, + 0, + 0, + 163, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 144, + 0, + 10, + 139, + 0, + 134, + 15, + 0, + 0, + 149, + 0, + 42, + 303, + 0, + 17, + 328, + 0, + 287, + 58, + 0, + 0, + 345, + 0, + 4, + 184, + 0, + 12, + 176, + 0, + 172, + 16, + 0, + 0, + 188, + 0, + 2, + 115, + 0, + 7, + 110, + 0, + 108, + 9, + 0, + 0, + 117, + 0, + 1, + 30, + 0, + 1, + 30, + 0, + 29, + 2, + 0, + 0, + 31, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 3, + 98, + 0, + 17, + 84, + 0, + 81, + 20, + 0, + 0, + 101, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 43, + 0, + 9, + 44, + 0, + 35, + 18, + 0, + 0, + 53, + 0, + 3, + 14, + 0, + 5, + 12, + 0, + 9, + 8, + 0, + 0, + 17, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 14, + 0, + 2, + 13, + 0, + 12, + 3, + 0, + 0, + 15, + 0, + 4, + 16, + 0, + 1, + 19, + 0, + 15, + 5, + 0, + 0, + 20, + 0, + 0, + 13, + 0, + 1, + 12, + 0, + 12, + 1, + 0, + 0, + 13, + 0, + 1, + 13, + 0, + 0, + 14, + 0, + 13, + 1, + 0, + 0, + 14, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 7, + 0, + 0, + 8, + 0, + 7, + 1, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 66, + 435, + 0, + 47, + 454, + 0, + 398, + 103, + 0, + 0, + 501, + 0, + 7, + 146, + 0, + 14, + 139, + 0, + 132, + 21, + 0, + 0, + 153, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 131, + 0, + 9, + 126, + 0, + 122, + 13, + 0, + 0, + 135, + 0, + 38, + 289, + 0, + 17, + 310, + 0, + 273, + 54, + 0, + 0, + 327, + 0, + 4, + 172, + 0, + 11, + 165, + 0, + 161, + 15, + 0, + 0, + 176, + 0, + 1, + 102, + 0, + 7, + 96, + 0, + 95, + 8, + 0, + 0, + 103, + 0, + 1, + 27, + 0, + 1, + 27, + 0, + 26, + 2, + 0, + 0, + 28, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 93, + 0, + 17, + 78, + 0, + 76, + 19, + 0, + 0, + 95, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 6, + 42, + 0, + 3, + 45, + 0, + 40, + 8, + 0, + 0, + 48, + 0, + 2, + 11, + 0, + 2, + 11, + 0, + 9, + 4, + 0, + 0, + 13, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 0, + 3, + 7, + 0, + 7, + 3, + 0, + 0, + 10, + 0, + 13, + 85, + 0, + 3, + 95, + 0, + 82, + 16, + 0, + 0, + 98, + 0, + 1, + 17, + 0, + 1, + 17, + 0, + 16, + 2, + 0, + 0, + 18, + 0, + 0, + 6, + 0, + 0, + 6, + 0, + 6, + 0, + 0, + 0, + 6, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 0, + 2, + 3, + 0, + 3, + 2, + 0, + 0, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 70, + 436, + 0, + 53, + 453, + 0, + 393, + 113, + 0, + 0, + 506, + 0, + 8, + 149, + 0, + 17, + 140, + 0, + 132, + 25, + 0, + 0, + 157, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 135, + 0, + 8, + 132, + 0, + 127, + 13, + 0, + 0, + 140, + 0, + 29, + 220, + 0, + 15, + 234, + 0, + 206, + 43, + 0, + 0, + 249, + 0, + 3, + 168, + 0, + 11, + 160, + 0, + 157, + 14, + 0, + 0, + 171, + 0, + 2, + 109, + 0, + 7, + 104, + 0, + 102, + 9, + 0, + 0, + 111, + 0, + 1, + 28, + 0, + 1, + 28, + 0, + 27, + 2, + 0, + 0, + 29, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 3, + 95, + 0, + 15, + 83, + 0, + 80, + 18, + 0, + 0, + 98, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 27, + 176, + 0, + 22, + 181, + 0, + 160, + 43, + 0, + 0, + 203, + 0, + 7, + 48, + 0, + 6, + 49, + 0, + 42, + 13, + 0, + 0, + 55, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 49, + 0, + 2, + 47, + 0, + 47, + 2, + 0, + 0, + 49, + 0, + 23, + 151, + 0, + 9, + 165, + 0, + 143, + 31, + 0, + 0, + 174, + 0, + 1, + 82, + 0, + 6, + 77, + 0, + 76, + 7, + 0, + 0, + 83, + 0, + 0, + 37, + 0, + 2, + 35, + 0, + 35, + 2, + 0, + 0, + 37, + 0, + 1, + 14, + 0, + 0, + 15, + 0, + 14, + 1, + 0, + 0, + 15, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 20, + 0, + 3, + 18, + 0, + 17, + 4, + 0, + 0, + 21, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 49, + 302, + 0, + 34, + 317, + 0, + 273, + 78, + 0, + 0, + 351, + 0, + 3, + 112, + 0, + 13, + 102, + 0, + 99, + 16, + 0, + 0, + 115, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 96, + 0, + 9, + 92, + 0, + 87, + 14, + 0, + 0, + 101, + 0, + 19, + 154, + 0, + 9, + 164, + 0, + 145, + 28, + 0, + 0, + 173, + 0, + 3, + 103, + 0, + 6, + 100, + 0, + 97, + 9, + 0, + 0, + 106, + 0, + 2, + 78, + 0, + 5, + 75, + 0, + 73, + 7, + 0, + 0, + 80, + 0, + 0, + 16, + 0, + 1, + 15, + 0, + 15, + 1, + 0, + 0, + 16, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 80, + 0, + 14, + 68, + 0, + 66, + 16, + 0, + 0, + 82, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 33, + 243, + 0, + 23, + 253, + 0, + 225, + 51, + 0, + 0, + 276, + 0, + 1, + 91, + 0, + 3, + 89, + 0, + 88, + 4, + 0, + 0, + 92, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 79, + 0, + 3, + 80, + 0, + 76, + 7, + 0, + 0, + 83, + 0, + 7, + 91, + 0, + 7, + 91, + 0, + 84, + 14, + 0, + 0, + 98, + 0, + 2, + 86, + 0, + 4, + 84, + 0, + 82, + 6, + 0, + 0, + 88, + 0, + 1, + 70, + 0, + 5, + 66, + 0, + 65, + 6, + 0, + 0, + 71, + 0, + 0, + 12, + 0, + 1, + 11, + 0, + 11, + 1, + 0, + 0, + 12, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 74, + 0, + 12, + 63, + 0, + 62, + 13, + 0, + 0, + 75, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 43, + 235, + 0, + 33, + 245, + 0, + 208, + 70, + 0, + 0, + 278, + 0, + 9, + 69, + 0, + 16, + 62, + 0, + 53, + 25, + 0, + 0, + 78, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 66, + 0, + 8, + 59, + 0, + 58, + 9, + 0, + 0, + 67, + 0, + 35, + 214, + 0, + 11, + 238, + 0, + 204, + 45, + 0, + 0, + 249, + 0, + 2, + 99, + 0, + 8, + 93, + 0, + 91, + 10, + 0, + 0, + 101, + 0, + 1, + 45, + 0, + 2, + 44, + 0, + 43, + 3, + 0, + 0, + 46, + 0, + 1, + 18, + 0, + 0, + 19, + 0, + 18, + 1, + 0, + 0, + 19, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 26, + 0, + 5, + 23, + 0, + 21, + 7, + 0, + 0, + 28, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "n_missing": 104, + "metadata": { + "references": {}, + "derived": true, + "type": { + "integer": true, + "missing_rules": {}, + "missing_reasons": { + "No Data": -1 + }, + "class": "numeric" + } + } + } + }, + "element": "crunch:cube", + "counts": [ + 9, + 11, + 0, + 7, + 13, + 0, + 5, + 15, + 0, + 0, + 20, + 0, + 0, + 7, + 0, + 5, + 2, + 0, + 2, + 5, + 0, + 0, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 67, + 467, + 0, + 49, + 485, + 0, + 428, + 106, + 0, + 0, + 534, + 0, + 10, + 153, + 0, + 14, + 149, + 0, + 139, + 24, + 0, + 0, + 163, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 144, + 0, + 10, + 139, + 0, + 134, + 15, + 0, + 0, + 149, + 0, + 42, + 303, + 0, + 17, + 328, + 0, + 287, + 58, + 0, + 0, + 345, + 0, + 4, + 184, + 0, + 12, + 176, + 0, + 172, + 16, + 0, + 0, + 188, + 0, + 2, + 115, + 0, + 7, + 110, + 0, + 108, + 9, + 0, + 0, + 117, + 0, + 1, + 30, + 0, + 1, + 30, + 0, + 29, + 2, + 0, + 0, + 31, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 3, + 98, + 0, + 17, + 84, + 0, + 81, + 20, + 0, + 0, + 101, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 43, + 0, + 9, + 44, + 0, + 35, + 18, + 0, + 0, + 53, + 0, + 3, + 14, + 0, + 5, + 12, + 0, + 9, + 8, + 0, + 0, + 17, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 14, + 0, + 2, + 13, + 0, + 12, + 3, + 0, + 0, + 15, + 0, + 4, + 16, + 0, + 1, + 19, + 0, + 15, + 5, + 0, + 0, + 20, + 0, + 0, + 13, + 0, + 1, + 12, + 0, + 12, + 1, + 0, + 0, + 13, + 0, + 1, + 13, + 0, + 0, + 14, + 0, + 13, + 1, + 0, + 0, + 14, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 7, + 0, + 0, + 8, + 0, + 7, + 1, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 66, + 435, + 0, + 47, + 454, + 0, + 398, + 103, + 0, + 0, + 501, + 0, + 7, + 146, + 0, + 14, + 139, + 0, + 132, + 21, + 0, + 0, + 153, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 131, + 0, + 9, + 126, + 0, + 122, + 13, + 0, + 0, + 135, + 0, + 38, + 289, + 0, + 17, + 310, + 0, + 273, + 54, + 0, + 0, + 327, + 0, + 4, + 172, + 0, + 11, + 165, + 0, + 161, + 15, + 0, + 0, + 176, + 0, + 1, + 102, + 0, + 7, + 96, + 0, + 95, + 8, + 0, + 0, + 103, + 0, + 1, + 27, + 0, + 1, + 27, + 0, + 26, + 2, + 0, + 0, + 28, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 93, + 0, + 17, + 78, + 0, + 76, + 19, + 0, + 0, + 95, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 6, + 42, + 0, + 3, + 45, + 0, + 40, + 8, + 0, + 0, + 48, + 0, + 2, + 11, + 0, + 2, + 11, + 0, + 9, + 4, + 0, + 0, + 13, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 0, + 3, + 7, + 0, + 7, + 3, + 0, + 0, + 10, + 0, + 13, + 85, + 0, + 3, + 95, + 0, + 82, + 16, + 0, + 0, + 98, + 0, + 1, + 17, + 0, + 1, + 17, + 0, + 16, + 2, + 0, + 0, + 18, + 0, + 0, + 6, + 0, + 0, + 6, + 0, + 6, + 0, + 0, + 0, + 6, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 0, + 2, + 3, + 0, + 3, + 2, + 0, + 0, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 70, + 436, + 0, + 53, + 453, + 0, + 393, + 113, + 0, + 0, + 506, + 0, + 8, + 149, + 0, + 17, + 140, + 0, + 132, + 25, + 0, + 0, + 157, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 135, + 0, + 8, + 132, + 0, + 127, + 13, + 0, + 0, + 140, + 0, + 29, + 220, + 0, + 15, + 234, + 0, + 206, + 43, + 0, + 0, + 249, + 0, + 3, + 168, + 0, + 11, + 160, + 0, + 157, + 14, + 0, + 0, + 171, + 0, + 2, + 109, + 0, + 7, + 104, + 0, + 102, + 9, + 0, + 0, + 111, + 0, + 1, + 28, + 0, + 1, + 28, + 0, + 27, + 2, + 0, + 0, + 29, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 3, + 95, + 0, + 15, + 83, + 0, + 80, + 18, + 0, + 0, + 98, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 27, + 176, + 0, + 22, + 181, + 0, + 160, + 43, + 0, + 0, + 203, + 0, + 7, + 48, + 0, + 6, + 49, + 0, + 42, + 13, + 0, + 0, + 55, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 49, + 0, + 2, + 47, + 0, + 47, + 2, + 0, + 0, + 49, + 0, + 23, + 151, + 0, + 9, + 165, + 0, + 143, + 31, + 0, + 0, + 174, + 0, + 1, + 82, + 0, + 6, + 77, + 0, + 76, + 7, + 0, + 0, + 83, + 0, + 0, + 37, + 0, + 2, + 35, + 0, + 35, + 2, + 0, + 0, + 37, + 0, + 1, + 14, + 0, + 0, + 15, + 0, + 14, + 1, + 0, + 0, + 15, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 20, + 0, + 3, + 18, + 0, + 17, + 4, + 0, + 0, + 21, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 49, + 302, + 0, + 34, + 317, + 0, + 273, + 78, + 0, + 0, + 351, + 0, + 3, + 112, + 0, + 13, + 102, + 0, + 99, + 16, + 0, + 0, + 115, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 96, + 0, + 9, + 92, + 0, + 87, + 14, + 0, + 0, + 101, + 0, + 19, + 154, + 0, + 9, + 164, + 0, + 145, + 28, + 0, + 0, + 173, + 0, + 3, + 103, + 0, + 6, + 100, + 0, + 97, + 9, + 0, + 0, + 106, + 0, + 2, + 78, + 0, + 5, + 75, + 0, + 73, + 7, + 0, + 0, + 80, + 0, + 0, + 16, + 0, + 1, + 15, + 0, + 15, + 1, + 0, + 0, + 16, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 80, + 0, + 14, + 68, + 0, + 66, + 16, + 0, + 0, + 82, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 33, + 243, + 0, + 23, + 253, + 0, + 225, + 51, + 0, + 0, + 276, + 0, + 1, + 91, + 0, + 3, + 89, + 0, + 88, + 4, + 0, + 0, + 92, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 79, + 0, + 3, + 80, + 0, + 76, + 7, + 0, + 0, + 83, + 0, + 7, + 91, + 0, + 7, + 91, + 0, + 84, + 14, + 0, + 0, + 98, + 0, + 2, + 86, + 0, + 4, + 84, + 0, + 82, + 6, + 0, + 0, + 88, + 0, + 1, + 70, + 0, + 5, + 66, + 0, + 65, + 6, + 0, + 0, + 71, + 0, + 0, + 12, + 0, + 1, + 11, + 0, + 11, + 1, + 0, + 0, + 12, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 74, + 0, + 12, + 63, + 0, + 62, + 13, + 0, + 0, + 75, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 43, + 235, + 0, + 33, + 245, + 0, + 208, + 70, + 0, + 0, + 278, + 0, + 9, + 69, + 0, + 16, + 62, + 0, + 53, + 25, + 0, + 0, + 78, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 66, + 0, + 8, + 59, + 0, + 58, + 9, + 0, + 0, + 67, + 0, + 35, + 214, + 0, + 11, + 238, + 0, + 204, + 45, + 0, + 0, + 249, + 0, + 2, + 99, + 0, + 8, + 93, + 0, + 91, + 10, + 0, + 0, + 101, + 0, + 1, + 45, + 0, + 2, + 44, + 0, + 43, + 3, + 0, + 0, + 46, + 0, + 1, + 18, + 0, + 0, + 19, + 0, + 18, + 1, + 0, + 0, + 19, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 26, + 0, + 5, + 23, + 0, + 21, + 7, + 0, + 0, + 28, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "n": 1662 + } + } +} \ No newline at end of file diff --git a/tests/integration/test_crunch_cube.py b/tests/integration/test_crunch_cube.py index f5913424a..9386d8336 100644 --- a/tests/integration/test_crunch_cube.py +++ b/tests/integration/test_crunch_cube.py @@ -48,7 +48,10 @@ from .fixtures import LETTERS_X_PETS_HS from .fixtures import XYZ_SIMPLE_ALLTYPES from .fixtures import MR_X_CA_HS +from .fixtures import MR_X_CAT_HS from .fixtures import CA_X_MR_WEIGHTED_HS +from .fixtures import MR_X_CAT_X_MR_PRUNE +from .fixtures import HUFFPOST_ACTIONS_X_HOUSEHOLD class TestCrunchCube(TestCase): @@ -409,6 +412,18 @@ def test_labels_cat_x_datetime_exclude_missing(self): actual = cube.labels() self.assertEqual(actual, expected) + def test_is_simple_ca(self): + cube = CrunchCube(SIMPLE_CAT_ARRAY) + expected = True + actual = cube.is_univariate_ca + assert actual == expected + + def test_simpla_ca_main_axis(self): + cube = CrunchCube(SIMPLE_CAT_ARRAY) + expected = 1 + actual = cube.univariate_ca_main_axis + assert actual == expected + def test_labels_simple_cat_array_exclude_missing(self): cube = CrunchCube(SIMPLE_CAT_ARRAY) expected = [ @@ -643,9 +658,18 @@ def test_pvals(self): 0.4271118723152956 ] ]) + # Test without pruning actual = cube.pvals() np.testing.assert_almost_equal(actual, expected) + # Test with pruning + actual = cube.pvals(prune=True) + np.testing.assert_almost_equal(actual, expected) + + # Test with pruning and H&S + actual = cube.pvals(prune=True, hs_dims=[0, 1]) + np.testing.assert_almost_equal(actual, expected) + def test_pvals_stats(self): cube = CrunchCube(STATS_TEST) expected = np.array([ @@ -666,9 +690,18 @@ def test_pvals_stats(self): 0.0000013632752629 ] ]) + # Test without pruning actual = cube.pvals() np.testing.assert_almost_equal(actual, expected) + # Test with pruning + actual = cube.pvals(prune=True) + np.testing.assert_almost_equal(actual, expected) + + # Test with pruning and H&S + actual = cube.pvals(prune=True, hs_dims=[0, 1]) + np.testing.assert_almost_equal(actual, expected) + def test_mean_age_for_blame_x_gender(self): cube = CrunchCube(ECON_MEAN_AGE_BLAME_X_GENDER) expected = np.array([ @@ -1679,3 +1712,38 @@ def test_ca_x_mr_margin(self): axis=1, weighted=False, include_transforms_for_dims=[0, 1, 2] )[0] np.testing.assert_array_equal(actual, expected) + + def test_mr_x_cat_x_mr_pruning(self): + cube = CrunchCube(MR_X_CAT_X_MR_PRUNE) + expected = np.array([ + [False, False, False, True], + [False, False, False, True], + [True, True, True, True], + [False, False, False, True], + [False, False, False, True], + [False, False, False, True], + [True, True, True, True], + [True, True, True, True], + ]) + actual = cube.proportions(prune=True)[0].mask + np.testing.assert_array_equal(actual, expected) + + def test_mr_x_mr_prune_indices(self): + cube = CrunchCube(HUFFPOST_ACTIONS_X_HOUSEHOLD) + expected = [ + np.array([False, False, False, False, False, False, False, False]), + np.array([False, False, False]), + ] + actual = cube.prune_indices() + np.testing.assert_array_equal(actual[0], expected[0]) + np.testing.assert_array_equal(actual[1], expected[1]) + + def test_mr_x_cat_hs_prune_indices(self): + cube = CrunchCube(MR_X_CAT_HS) + expected = [ + np.array([False, False, False, False, False]), + np.array([False, False, False, True, False, False, True, False]), + ] + actual = cube.prune_indices(transforms=[0, 1]) + np.testing.assert_array_equal(actual[0], expected[0]) + np.testing.assert_array_equal(actual[1], expected[1]) diff --git a/tests/unit/test_cube_slice.py b/tests/unit/test_cube_slice.py index 08160d7e6..460aee3c0 100644 --- a/tests/unit/test_cube_slice.py +++ b/tests/unit/test_cube_slice.py @@ -18,6 +18,16 @@ def test_init(self): assert cs._cube == cube assert cs._index == index + def test_init_ca_as_0th(self): + '''Test creation of the 0th CA slice.''' + cube = Mock() + cube.dim_types = ['categorical_array', 'categorical'] + assert CubeSlice(cube, 0, ca_as_0th=True) + + cube.dim_types = ['categorical', 'categorical'] + with self.assertRaises(ValueError): + CubeSlice(cube, 0, ca_as_0th=True) + def test_ndim_invokes_ndim_from_cube(self): '''Test if ndim calls corresponding cube's method.''' cube = Mock(ndim=3) @@ -37,6 +47,7 @@ def test_table_name(self): cube.ndim = 2 cube.name = fake_title cs = CubeSlice(cube, 1) + assert cs.table_name is None assert cs.name == fake_title # Assert name for 3D @@ -123,6 +134,11 @@ def test_cube_slice_labels(self): cs = CubeSlice(cube, 1) assert cs.labels() == all_labels[-2:] + cube.ndim = 2 + cube.dim_types = ['categorical_array', Mock()] + cs = CubeSlice(cube, 1, ca_as_0th=True) + assert cs.labels() == all_labels[1:] + def test_prune_indices(self): '''Assert that correct prune indices are extracted from 3D cube.''' cube = Mock() @@ -184,3 +200,108 @@ def test_pruning_3d_labels(self): actual = CubeSlice(cube, 1).labels(prune=True) expected = [['fake_lbl_1'], ['fake_lbl_2', 'fake_lbl_3']] assert actual == expected + + def test_col_dim_ind(self): + '''Test column dimension index for normal slice vs CA as 0th.''' + cube = Mock() + cube.dim_types = ['categorical_array', Mock()] + cs = CubeSlice(cube, 0, ca_as_0th=False) + assert cs.col_dim_ind == 1 + + cs = CubeSlice(cube, 0, ca_as_0th=True) + assert cs.col_dim_ind == 0 + + def test_axis_for_ca_as_0th(self): + '''Test if the axis parameter is updated correctly for the CA as 0th.''' + cube = Mock() + cube.dim_types = ['categorical_array', Mock()] + cube.ndim = 2 + cube.margin.return_value = np.array([0, 1, 2]) + cs = CubeSlice(cube, 0, ca_as_0th=True) + cs.margin(axis=None) + cube.margin.assert_called_once_with(axis=1) + + def test_update_hs_dims(self): + '''Test if H&S dims are updated for 3D cubes.''' + cube = Mock() + cube.ndim = 3 + cs = CubeSlice(cube, 0) + expected = {'include_transforms_for_dims': [1, 2]} + actual = cs._update_args({'include_transforms_for_dims': [0, 1]}) + assert actual == expected + + def test_inserted_hs_indices(self): + '''Test H&S indices for different slices.''' + cube = Mock() + cube.ndim = 3 + cube.inserted_hs_indices.return_value = [1, 2, 3] + cs = CubeSlice(cube, 0) + assert cs.inserted_hs_indices() == [2, 3] + + cube.dim_types = ['categorical_array', Mock()] + cs = CubeSlice(cube, 0, ca_as_0th=True) + assert cs.inserted_hs_indices() == [1, 2, 3] + + def test_has_ca(self): + '''Test if slice has CA.''' + cube = Mock() + cube.ndim = 2 + cube.dim_types = ['categorical_array', Mock()] + + cs = CubeSlice(cube, 0) + assert cs.has_ca + + cube.ndim = 3 + cube.dim_types = ['categorical_array', Mock(), Mock()] + cs = CubeSlice(cube, 0) + assert not cs.has_ca + + def test_mr_dim_ind(self): + '''Test MR dimension index(indices).''' + cube = Mock() + cube.ndim = 2 + cube.mr_dim_ind = 0 + + cs = CubeSlice(cube, 0) + assert cs.mr_dim_ind == 0 + + cube.mr_dim_ind = 1 + cs = CubeSlice(cube, 0) + assert cs.mr_dim_ind == 1 + + cube.ndim = 3 + cube.mr_dim_ind = 1 + cs = CubeSlice(cube, 0) + assert cs.mr_dim_ind == 0 + cube.mr_dim_ind = 0 + cs = CubeSlice(cube, 0) + assert cs.mr_dim_ind is None + cube.mr_dim_ind = (1, 2) + assert cs.mr_dim_ind == (0, 1) + cube.mr_dim_ind = (0, 2) + assert cs.mr_dim_ind == 1 + + def test_ca_main_axis(self): + '''Test interpretation of the main axis for CA cube.''' + cube = Mock() + cube.dim_types = ['categorical_array', Mock()] + cs = CubeSlice(cube, 0) + assert cs.ca_main_axis == 1 + cube.dim_types = [Mock(), 'categorical_array'] + cs = CubeSlice(cube, 0) + assert cs.ca_main_axis == 0 + cube.dim_types = [Mock(), Mock()] + assert cs.ca_main_axis is None + + def test_has_mr(self): + '''Test if slice has MR dimension(s).''' + cube = Mock() + cube.dim_types = ['multiple_response', Mock()] + cs = CubeSlice(cube, 0) + assert cs.has_mr + cube.dim_types = [Mock(), 'multiple_response'] + cs = CubeSlice(cube, 0) + assert cs.has_mr + cube.dim_types = [Mock(), Mock()] + cs = CubeSlice(cube, 0) + assert not cs.has_mr diff --git a/tests/unit/test_dimension.py b/tests/unit/test_dimension.py index ee817b5c3..146c45d36 100644 --- a/tests/unit/test_dimension.py +++ b/tests/unit/test_dimension.py @@ -11,7 +11,7 @@ class TestDimension(TestCase): insertions_with_bad_data = [ { - u'anchor': 0, + u'anchor': 101, u'name': u'This is respondent ideology', }, { @@ -261,17 +261,17 @@ def test_hs_indices_with_empty_indices(self, mock_type): 'references': { 'view': { 'transform': {'insertions': [{ - "function": "subtotal", - "args": [ - 7, - 8, - 9, - 10, - 11 - ], - "anchor": "bottom", - "name": "test subtotal" - }]} + "function": "subtotal", + "args": [ + 7, + 8, + 9, + 10, + 11 + ], + "anchor": "bottom", + "name": "test subtotal" + }]} } } } @@ -280,6 +280,7 @@ def test_hs_indices_with_empty_indices(self, mock_type): actual = dim.hs_indices self.assertEqual(actual, expected) + # pylint: disable=protected-access, missing-docstring @patch('cr.cube.dimension.Dimension.elements') @patch('cr.cube.dimension.Dimension._get_type') def test_subtotals(self, mock_type, mock_elements): @@ -294,11 +295,13 @@ def test_subtotals(self, mock_type, mock_elements): } dim = Dimension(dim_data) actual = dim.subtotals - self.assertEqual(len(actual), 2) - self.assertEqual(type(actual[0]), Subtotal) - self.assertEqual(actual[0]._data, self.insertions_with_bad_data[1]) - self.assertEqual(type(actual[1]), Subtotal) - self.assertEqual(actual[1]._data, self.insertions_with_bad_data[2]) + assert len(actual) == 2 + assert isinstance(actual[0], Subtotal) + assert actual[0]._data == self.insertions_with_bad_data[1] + assert isinstance(actual[1], Subtotal) + assert actual[1]._data == self.insertions_with_bad_data[2] + assert actual[0].anchor == 'bottom' + assert actual[1].anchor == 5 @patch('cr.cube.dimension.Dimension._elements', [ {'id': 111}, {'id': 222}, {'id': 333}, {'id': 444}, {'id': 555}