From d7fdbc71e5b052125cdeff7b57949eb6b43e62e7 Mon Sep 17 00:00:00 2001 From: ernestoarbitrio Date: Thu, 5 Nov 2020 11:28:46 +0100 Subject: [PATCH] fixtures: grooming json fixtures --- tests/fixtures/ca-subvar-x-ca-cat-x-mr.json | 1204 ++++--- tests/fixtures/ca-x-cat-hs.json | 998 +++--- tests/fixtures/ca-x-mr-hs.json | 1991 ++++++------ .../ca-x-mr-sig-testing-subtotals.json | 2600 ++++++++------- tests/fixtures/ca-x-mr.json | 1913 ++++++----- tests/fixtures/ca-x-single-cat.json | 527 ++- .../fixtures/cat-hs-x-mr-augmented-wgtd.json | 2855 ++++++++--------- tests/fixtures/cat-hs-x-mr-wgtd.json | 835 +++-- tests/fixtures/cat-hs-x-mr.json | 1208 ++++--- tests/fixtures/cat-subvar-x-mr-augmented.json | 1763 +++++----- tests/fixtures/cat-x-cat-german-weighted.json | 433 ++- tests/fixtures/cat-x-cat-hs-2rows-1col.json | 703 ++-- tests/fixtures/cat-x-cat-hs-total-bottom.json | 725 ++--- .../econ-blame-x-ideology-row-and-col-hs.json | 742 +++-- 14 files changed, 9084 insertions(+), 9413 deletions(-) diff --git a/tests/fixtures/ca-subvar-x-ca-cat-x-mr.json b/tests/fixtures/ca-subvar-x-ca-cat-x-mr.json index 076e3e549..e72e61be7 100644 --- a/tests/fixtures/ca-subvar-x-ca-cat-x-mr.json +++ b/tests/fixtures/ca-subvar-x-ca-cat-x-mr.json @@ -1,624 +1,612 @@ { - "element": "shoji:view", - "self": "/api/datasets/123/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22each%22:%22/api/datasets/123%2Fvariables%2F00000f%2F%22%7D,%7B%22variable%22:%22/api/datasets/123%2Fvariables%2F00000f%2F%22%7D,%7B%22each%22:%22/api/datasets/123%2Fvariables%2F000010%2F%22%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22/api/datasets/123%2Fvariables%2F000010%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:%22/api/datasets/123%2Fvariables%2F00000d%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [ - - ] - } + "query": { + "measures": { + "count": { + "function": "cube_count", + "args": [ + ] + } + }, + "dimensions": [ + { + "each": "/api/datasets/123/variables/00000f/" + }, + { + "variable": "/api/datasets/123/variables/00000f/" + }, + { + "each": "/api/datasets/123/variables/000010/" + }, + { + "function": "as_selected", + "args": [ + { + "variable": "/api/datasets/123/variables/000010/" + } + ] + } + ], + "weight": "/api/datasets/123/variables/00000d/" + }, + "result": { + "dimensions": [ + { + "derived": true, + "references": { + "subreferences": [ + { + "alias": "a_cat", + "name": "cat", + "description": "a_cat" + }, + { + "alias": "a_dog", + "name": "dog", + "description": "a_dog" + }, + { + "alias": "a_wombat", + "name": "wombat", + "description": "a_wombat" }, - "dimensions": [ + { + "uniform_basis": null, + "description": null, + "name": "tarantula", + "format": null, + "subreferences": null, + "notes": null, + "api_derivation": null, + "dichotomous": false, + "discarded": null, + "alias": "tarantula", + "view": null + } + ], + "view": { + "show_counts": false, + "transforms": { + "insertions": [ { - "each": "/api/datasets/123/variables/00000f/" + "function": "subtotal", + "args": [ + 2 + ], + "anchor": 2, + "name": "selected, again" + } + ] + }, + "include_missing": false, + "column_width": null + }, + "name": "pets_array", + "alias": "pets_array" + }, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "a_cat", + "name": "cat", + "description": "a_cat" }, - { - "variable": "/api/datasets/123/variables/00000f/" + "id": "0004" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "a_dog", + "name": "dog", + "description": "a_dog" }, - { - "each": "/api/datasets/123/variables/000010/" + "id": "0005" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "a_wombat", + "name": "wombat", + "description": "a_wombat" }, + "id": "0006" + }, + "missing": false + }, + { + "id": 4, + "value": { + "derived": false, + "references": { + "uniform_basis": null, + "description": null, + "name": "tarantula", + "format": null, + "subreferences": null, + "notes": null, + "api_derivation": null, + "dichotomous": false, + "discarded": null, + "alias": "tarantula", + "view": null + }, + "id": "f624a951fedf4eeb86774ea84142c043" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "references": { + "subreferences": [ + { + "alias": "a_cat", + "name": "cat", + "description": "a_cat" + }, + { + "alias": "a_dog", + "name": "dog", + "description": "a_dog" + }, + { + "alias": "a_wombat", + "name": "wombat", + "description": "a_wombat" + }, + { + "uniform_basis": null, + "description": null, + "format": null, + "subreferences": null, + "notes": null, + "api_derivation": null, + "dichotomous": false, + "discarded": null, + "alias": "tarantula", + "view": null, + "name": "tarantula" + } + ], + "alias": "pets_array", + "name": "pets_array", + "view": { + "show_counts": false, + "transforms": { + "insertions": [ { - "function": "as_selected", - "args": [ - { - "variable": "/api/datasets/123/variables/000010/" - } - ] + "function": "subtotal", + "args": [ + 2 + ], + "anchor": 2, + "name": "selected, again" } - ], - "weight": "/api/datasets/123/variables/00000d/" + ] + }, + "include_missing": false, + "column_width": null + } }, - "query_environment": { - "filter": [ - - ] + "derived": false, + "type": { + "ordinal": false, + "subvariables": [ + "0004", + "0005", + "0006", + "f624a951fedf4eeb86774ea84142c043" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "missing": false, + "id": 1, + "name": "not selected" + }, + { + "numeric_value": 2, + "missing": false, + "id": 2, + "name": "selected" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + { + "derived": true, + "references": { + "alias": "languages", + "subreferences": [ + { + "alias": "Python", + "name": "Python", + "description": "Python" + }, + { + "alias": "R", + "name": "R", + "description": "R" + }, + { + "alias": "JavaScript", + "name": "JavaScript", + "description": "JavaScript" + } + ], + "is_dichotomous": false, + "description": "Languages", + "name": "languages" }, - "result": { - "dimensions": [ - { - "derived": true, - "references": { - "subreferences": [ - { - "alias": "a_cat", - "name": "cat", - "description": "a_cat" - }, - { - "alias": "a_dog", - "name": "dog", - "description": "a_dog" - }, - { - "alias": "a_wombat", - "name": "wombat", - "description": "a_wombat" - }, - { - "uniform_basis": null, - "description": null, - "name": "tarantula", - "format": null, - "subreferences": null, - "notes": null, - "api_derivation": null, - "dichotomous": false, - "discarded": null, - "alias": "tarantula", - "view": null - } - ], - "view": { - "show_counts": false, - "transforms": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 2 - ], - "anchor": 2, - "name": "selected, again" - } - ] - }, - "include_missing": false, - "column_width": null - }, - "name": "pets_array", - "alias": "pets_array" - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "a_cat", - "name": "cat", - "description": "a_cat" - }, - "id": "0004" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "a_dog", - "name": "dog", - "description": "a_dog" - }, - "id": "0005" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "a_wombat", - "name": "wombat", - "description": "a_wombat" - }, - "id": "0006" - }, - "missing": false - }, - { - "id": 4, - "value": { - "derived": false, - "references": { - "uniform_basis": null, - "description": null, - "name": "tarantula", - "format": null, - "subreferences": null, - "notes": null, - "api_derivation": null, - "dichotomous": false, - "discarded": null, - "alias": "tarantula", - "view": null - }, - "id": "f624a951fedf4eeb86774ea84142c043" - }, - "missing": false - } - ], - "class": "enum" - } + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "Python", + "name": "Python", + "description": "Python" }, - { - "references": { - "subreferences": [ - { - "alias": "a_cat", - "name": "cat", - "description": "a_cat" - }, - { - "alias": "a_dog", - "name": "dog", - "description": "a_dog" - }, - { - "alias": "a_wombat", - "name": "wombat", - "description": "a_wombat" - }, - { - "uniform_basis": null, - "description": null, - "format": null, - "subreferences": null, - "notes": null, - "api_derivation": null, - "dichotomous": false, - "discarded": null, - "alias": "tarantula", - "view": null, - "name": "tarantula" - } - ], - "alias": "pets_array", - "name": "pets_array", - "view": { - "show_counts": false, - "transforms": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 2 - ], - "anchor": 2, - "name": "selected, again" - } - ] - }, - "include_missing": false, - "column_width": null - } - }, - "derived": false, - "type": { - "ordinal": false, - "subvariables": [ - "0004", - "0005", - "0006", - "f624a951fedf4eeb86774ea84142c043" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "missing": false, - "id": 1, - "name": "not selected" - }, - { - "numeric_value": 2, - "missing": false, - "id": 2, - "name": "selected" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } + "id": "0007" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "R", + "name": "R", + "description": "R" }, - { - "derived": true, - "references": { - "alias": "languages", - "subreferences": [ - { - "alias": "Python", - "name": "Python", - "description": "Python" - }, - { - "alias": "R", - "name": "R", - "description": "R" - }, - { - "alias": "JavaScript", - "name": "JavaScript", - "description": "JavaScript" - } - ], - "is_dichotomous": false, - "description": "Languages", - "name": "languages" - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "Python", - "name": "Python", - "description": "Python" - }, - "id": "0007" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "R", - "name": "R", - "description": "R" - }, - "id": "0008" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "JavaScript", - "name": "JavaScript", - "description": "JavaScript" - }, - "id": "0009" - }, - "missing": false - } - ], - "class": "enum" - } + "id": "0008" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "JavaScript", + "name": "JavaScript", + "description": "JavaScript" }, - { - "references": { - "alias": "languages", - "is_dichotomous": false, - "description": "Languages", - "name": "languages", - "subreferences": [ - { - "alias": "Python", - "name": "Python", - "description": "Python" - }, - { - "alias": "R", - "name": "R", - "description": "R" - }, - { - "alias": "JavaScript", - "name": "JavaScript", - "description": "JavaScript" - } - ] - }, - "derived": true, - "type": { - "ordinal": false, - "subvariables": [ - "0007", - "0008", - "0009" - ], - "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": 11, - "measures": { - "count": { - "data": [ - 48.3060552084168, - 66.9213862845193, - 0, - 4, - 111.227441492936, - 0, - 67.2009605786221, - 48.026480914314, - 0, - 45.5622240626441, - 43.0189195835338, - 0, - 88.581143646178, - 0, - 0, - 46.0586810267601, - 42.5224626194179, - 0, - 37.7333933396404, - 16.2484218226594, - 0, - 33.1195045629724, - 20.8623105993273, - 0, - 22.0856203922224, - 31.8961947700774, - 0, - 0, - 107.343646011268, - 0, - 44.5990866109926, - 62.7445594002749, - 0, - 65.1772181069687, - 42.1664279042988, - 0, - 99.2814207226147, - 4, - 0, - 46.2762920148788, - 57.0051287077359, - 0, - 47.3984636199024, - 55.8829571027123, - 0, - 32.3202518880865, - 14.845081679445, - 0, - 34.825269583279, - 12.3400639842526, - 0, - 22.7695802707335, - 24.3957532967981, - 0, - 38.467089744086, - 37.7917070370835, - 0, - 34.9176266266032, - 41.3411701545663, - 0, - 0, - 76.2587967811695, - 0, - 40.2191314923054, - 68.5784068160317, - 0, - 43.7410619590204, - 65.0564763493167, - 0, - 104.797538308337, - 4, - 0, - 52.9154513743098, - 19.8186138375973, - 0, - 47.0419596235268, - 25.6921055883804, - 0, - 30.5477236892674, - 42.1863415226398, - 0, - 0, - 4, - 0, - 4, - 0, - 0, - 0, - 4, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 131.601672610701, - 122.188727690713, - 0, - 121.70064820915, - 132.089752092263, - 0, - 135.345261997604, - 118.445138303809, - 0 - ], - "n_missing": 11, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": false, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } - } + "id": "0009" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "references": { + "alias": "languages", + "is_dichotomous": false, + "description": "Languages", + "name": "languages", + "subreferences": [ + { + "alias": "Python", + "name": "Python", + "description": "Python" + }, + { + "alias": "R", + "name": "R", + "description": "R" + }, + { + "alias": "JavaScript", + "name": "JavaScript", + "description": "JavaScript" + } + ] + }, + "derived": true, + "type": { + "ordinal": false, + "subvariables": [ + "0007", + "0008", + "0009" + ], + "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": 11, + "measures": { + "count": { + "data": [ + 48.3060552084168, + 66.9213862845193, + 0, + 4, + 111.227441492936, + 0, + 67.2009605786221, + 48.026480914314, + 0, + 45.5622240626441, + 43.0189195835338, + 0, + 88.581143646178, + 0, + 0, + 46.0586810267601, + 42.5224626194179, + 0, + 37.7333933396404, + 16.2484218226594, + 0, + 33.1195045629724, + 20.8623105993273, + 0, + 22.0856203922224, + 31.8961947700774, + 0, + 0, + 107.343646011268, + 0, + 44.5990866109926, + 62.7445594002749, + 0, + 65.1772181069687, + 42.1664279042988, + 0, + 99.2814207226147, + 4, + 0, + 46.2762920148788, + 57.0051287077359, + 0, + 47.3984636199024, + 55.8829571027123, + 0, + 32.3202518880865, + 14.845081679445, + 0, + 34.825269583279, + 12.3400639842526, + 0, + 22.7695802707335, + 24.3957532967981, + 0, + 38.467089744086, + 37.7917070370835, + 0, + 34.9176266266032, + 41.3411701545663, + 0, + 0, + 76.2587967811695, + 0, + 40.2191314923054, + 68.5784068160317, + 0, + 43.7410619590204, + 65.0564763493167, + 0, + 104.797538308337, + 4, + 0, + 52.9154513743098, + 19.8186138375973, + 0, + 47.0419596235268, + 25.6921055883804, + 0, + 30.5477236892674, + 42.1863415226398, + 0, + 0, + 4, + 0, + 4, + 0, + 0, + 0, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 131.601672610701, + 122.188727690713, + 0, + 121.70064820915, + 132.089752092263, + 0, + 135.345261997604, + 118.445138303809, + 0 + ], + "n_missing": 11, + "metadata": { + "references": { + }, + "derived": true, + "type": { + "integer": false, + "missing_rules": { + }, + "missing_reasons": { + "No Data": -1 }, - "element": "crunch:cube", - "counts": [ - 21, - 26, - 0, - 2, - 45, - 0, - 24, - 23, - 0, - 18, - 16, - 0, - 34, - 0, - 0, - 18, - 16, - 0, - 12, - 9, - 0, - 13, - 8, - 0, - 9, - 12, - 0, - 0, - 40, - 0, - 18, - 22, - 0, - 21, - 19, - 0, - 40, - 2, - 0, - 19, - 23, - 0, - 21, - 21, - 0, - 11, - 9, - 0, - 12, - 8, - 0, - 9, - 11, - 0, - 16, - 16, - 0, - 13, - 19, - 0, - 0, - 32, - 0, - 18, - 22, - 0, - 18, - 22, - 0, - 38, - 2, - 0, - 17, - 13, - 0, - 18, - 12, - 0, - 13, - 17, - 0, - 0, - 2, - 0, - 2, - 0, - 0, - 0, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 51, - 49, - 0, - 47, - 53, - 0, - 51, - 49, - 0 - ], - "n": 102 + "class": "numeric" + } } - } + } + }, + "element": "crunch:cube", + "counts": [ + 21, + 26, + 0, + 2, + 45, + 0, + 24, + 23, + 0, + 18, + 16, + 0, + 34, + 0, + 0, + 18, + 16, + 0, + 12, + 9, + 0, + 13, + 8, + 0, + 9, + 12, + 0, + 0, + 40, + 0, + 18, + 22, + 0, + 21, + 19, + 0, + 40, + 2, + 0, + 19, + 23, + 0, + 21, + 21, + 0, + 11, + 9, + 0, + 12, + 8, + 0, + 9, + 11, + 0, + 16, + 16, + 0, + 13, + 19, + 0, + 0, + 32, + 0, + 18, + 22, + 0, + 18, + 22, + 0, + 38, + 2, + 0, + 17, + 13, + 0, + 18, + 12, + 0, + 13, + 17, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 51, + 49, + 0, + 47, + 53, + 0, + 51, + 49, + 0 + ], + "n": 102 + } } diff --git a/tests/fixtures/ca-x-cat-hs.json b/tests/fixtures/ca-x-cat-hs.json index a754e37a9..72ada820f 100644 --- a/tests/fixtures/ca-x-cat-hs.json +++ b/tests/fixtures/ca-x-cat-hs.json @@ -1,520 +1,500 @@ { - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/ee87b889a43c4465bb8f5bcb239a723a/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Fee87b889a43c4465bb8f5bcb239a723a%2Fvariables%2F00000c%2F%22%7D,%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Fee87b889a43c4465bb8f5bcb239a723a%2Fvariables%2F00000c%2F%22%7D,%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Fee87b889a43c4465bb8f5bcb239a723a%2Fvariables%2F000000%2F%22%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": [ - - ] + "query": { + "dimensions": [ + { + "each": "https://alpha.crunch.io/api/datasets/ee87b889a43c4465bb8f5bcb239a723a/variables/00000c/" + }, + { + "variable": "https://alpha.crunch.io/api/datasets/ee87b889a43c4465bb8f5bcb239a723a/variables/00000c/" + }, + { + "variable": "https://alpha.crunch.io/api/datasets/ee87b889a43c4465bb8f5bcb239a723a/variables/000000/" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + } + }, + "result": { + "counts": [ + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 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, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": true, + "references": { + "alias": "categorical_array", + "description": null, + "is_dichotomous": false, + "name": "categorical_array", + "subreferences": [ + { + "alias": "ca_subvar_1", + "description": null, + "name": "ca_subvar_1" + }, + { + "alias": "ca_subvar_2", + "description": null, + "name": "ca_subvar_2" + }, + { + "alias": "ca_subvar_3", + "description": null, + "name": "ca_subvar_3" + } + ], + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "transform": { + "insertions": [] + } + } + }, + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "0007", + "references": { + "alias": "ca_subvar_1", + "description": null, + "name": "ca_subvar_1" } + } }, - "dimensions": [ - { - "each": "https://alpha.crunch.io/api/datasets/ee87b889a43c4465bb8f5bcb239a723a/variables/00000c/" - }, - { - "variable": "https://alpha.crunch.io/api/datasets/ee87b889a43c4465bb8f5bcb239a723a/variables/00000c/" - }, - { - "variable": "https://alpha.crunch.io/api/datasets/ee87b889a43c4465bb8f5bcb239a723a/variables/000000/" + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "0008", + "references": { + "alias": "ca_subvar_2", + "description": null, + "name": "ca_subvar_2" } - ], - "weight": null - }, - "query_environment": { - "filter": [ - - ] + } + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "0009", + "references": { + "alias": "ca_subvar_3", + "description": null, + "name": "ca_subvar_3" + } + } + } + ], + "subtype": { + "class": "variable" + } + } + }, + { + "derived": false, + "references": { + "alias": "categorical_array", + "description": null, + "is_dichotomous": false, + "name": "categorical_array", + "subreferences": [ + { + "alias": "ca_subvar_1", + "description": null, + "name": "ca_subvar_1" + }, + { + "alias": "ca_subvar_2", + "description": null, + "name": "ca_subvar_2" + }, + { + "alias": "ca_subvar_3", + "description": null, + "name": "ca_subvar_3" + } + ], + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "transform": { + "insertions": [] + } + } }, - "result": { - "dimensions": [ - { - "derived": true, - "references": { - "description": null, - "subreferences": [ - { - "alias": "ca_subvar_1", - "name": "ca_subvar_1", - "description": null - }, - { - "alias": "ca_subvar_2", - "name": "ca_subvar_2", - "description": null - }, - { - "alias": "ca_subvar_3", - "name": "ca_subvar_3", - "description": null - } - ], - "name": "categorical_array", - "alias": "categorical_array", - "is_dichotomous": false, - "view": { - "show_counts": false, - "transform": { - "insertions": [ - - ] - }, - "include_missing": false, - "column_width": null - } - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "ca_subvar_1", - "name": "ca_subvar_1", - "description": null - }, - "id": "0007" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "ca_subvar_2", - "name": "ca_subvar_2", - "description": null - }, - "id": "0008" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "ca_subvar_3", - "name": "ca_subvar_3", - "description": null - }, - "id": "0009" - }, - "missing": false - } - ], - "class": "enum" - } - }, + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "a", + "numeric_value": null + }, + { + "id": 2, + "missing": false, + "name": "b", + "numeric_value": null + }, + { + "id": 3, + "missing": false, + "name": "c", + "numeric_value": null + }, + { + "id": 4, + "missing": false, + "name": "d", + "numeric_value": null + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "0007", + "0008", + "0009" + ] + } + }, + { + "derived": false, + "references": { + "alias": "x", + "description": "Numeric variable with value labels", + "name": "x", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ { - "references": { - "description": null, - "subreferences": [ - { - "alias": "ca_subvar_1", - "name": "ca_subvar_1", - "description": null - }, - { - "alias": "ca_subvar_2", - "name": "ca_subvar_2", - "description": null - }, - { - "alias": "ca_subvar_3", - "name": "ca_subvar_3", - "description": null - } - ], - "name": "categorical_array", - "alias": "categorical_array", - "is_dichotomous": false, - "view": { - "show_counts": false, - "transform": { - "insertions": [ - - ] - }, - "include_missing": false, - "column_width": null - } - }, - "derived": false, - "type": { - "ordinal": false, - "subvariables": [ - "0007", - "0008", - "0009" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": null, - "id": 1, - "name": "a", - "missing": false - }, - { - "numeric_value": null, - "id": 2, - "name": "b", - "missing": false - }, - { - "numeric_value": null, - "id": 3, - "name": "c", - "missing": false - }, - { - "numeric_value": null, - "id": 4, - "name": "d", - "missing": false - }, - { - "numeric_value": null, - "id": -1, - "name": "No Data", - "missing": true - } - ] - } + "anchor": 3, + "args": [ + 3, + 2, + 1 + ], + "function": "subtotal", + "name": "colors" }, { - "references": { - "alias": "x", - "view": { - "show_counts": false, - "show_numeric_values": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 3, - 2, - 1 - ], - "name": "colors", - "anchor": 3 - }, - { - "function": "subtotal", - "args": [ - 9, - 4 - ], - "name": "numbers", - "anchor": 9 - } - ] - }, - "include_missing": false, - "column_width": null - }, - "description": "Numeric variable with value labels", - "name": "x" - }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "id": 1, - "name": "red", - "missing": false - }, - { - "numeric_value": 2, - "id": 2, - "name": "green", - "missing": false - }, - { - "numeric_value": 3, - "id": 3, - "name": "blue", - "missing": false - }, - { - "numeric_value": 4, - "id": 4, - "name": "4", - "missing": false - }, - { - "numeric_value": 8, - "id": 8, - "name": "8", - "missing": true - }, - { - "numeric_value": 9, - "id": 9, - "name": "9", - "missing": false - }, - { - "numeric_value": null, - "id": -1, - "name": "No Data", - "missing": true - } - ] - } - } - ], - "missing": 1, - "measures": { - "count": { - "data": [ - 1, - 1, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 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, - 1, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "n_missing": 1, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": true, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } + "anchor": 9, + "args": [ + 9, + 4 + ], + "function": "subtotal", + "name": "numbers" } + ] + } + } + }, + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "red", + "numeric_value": 1 }, - "element": "crunch:cube", - "counts": [ - 1, - 1, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 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, - 1, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "n": 6 + { + "id": 2, + "missing": false, + "name": "green", + "numeric_value": 2 + }, + { + "id": 3, + "missing": false, + "name": "blue", + "numeric_value": 3 + }, + { + "id": 4, + "missing": false, + "name": "4", + "numeric_value": 4 + }, + { + "id": 8, + "missing": true, + "name": "8", + "numeric_value": 8 + }, + { + "id": 9, + "missing": false, + "name": "9", + "numeric_value": 9 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false } - } -} + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 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, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": true, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 1 + } + }, + "missing": 1, + "n": 6 + } +} \ No newline at end of file diff --git a/tests/fixtures/ca-x-mr-hs.json b/tests/fixtures/ca-x-mr-hs.json index 70d28e4da..1ed50a1d1 100644 --- a/tests/fixtures/ca-x-mr-hs.json +++ b/tests/fixtures/ca-x-mr-hs.json @@ -1,1018 +1,1003 @@ { - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000d8%2F%22%7D,%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000d8%2F%22%7D,%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000dd%2F%22%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%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:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000d0%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [ - - ] - } + "query": { + "dimensions": [ + { + "each": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d8/" + }, + { + "variable": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d8/" + }, + { + "each": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dd/" + }, + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dd/" + } + ], + "function": "as_selected" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d0/" + }, + "result": { + "counts": [ + 34, + 21, + 257, + 29, + 23, + 260, + 251, + 6, + 55, + 0, + 0, + 312, + 39, + 36, + 340, + 43, + 35, + 337, + 335, + 11, + 69, + 0, + 0, + 415, + 26, + 23, + 222, + 26, + 20, + 225, + 223, + 7, + 41, + 0, + 0, + 271, + 37, + 26, + 427, + 33, + 28, + 429, + 424, + 6, + 60, + 0, + 0, + 490, + 6, + 18, + 129, + 7, + 17, + 129, + 140, + 1, + 12, + 0, + 0, + 153, + 1, + 4, + 16, + 3, + 3, + 15, + 16, + 2, + 3, + 0, + 0, + 21, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 15, + 16, + 141, + 19, + 14, + 139, + 139, + 5, + 28, + 0, + 0, + 172, + 36, + 35, + 288, + 31, + 35, + 293, + 294, + 8, + 57, + 0, + 0, + 359, + 23, + 25, + 234, + 30, + 23, + 229, + 233, + 7, + 42, + 0, + 0, + 282, + 62, + 32, + 573, + 50, + 34, + 583, + 560, + 10, + 97, + 0, + 0, + 667, + 6, + 18, + 135, + 7, + 17, + 135, + 146, + 1, + 12, + 0, + 0, + 159, + 1, + 2, + 20, + 4, + 3, + 16, + 17, + 2, + 4, + 0, + 0, + 23, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 143, + 128, + 1391, + 141, + 126, + 1395, + 1389, + 33, + 240, + 0, + 0, + 1662 + ], + "dimensions": [ + { + "derived": true, + "references": { + "alias": "abolitionists", + "description": "Do you have a favorable or an unfavorable opinion of the following abolitionists?", + "name": "Abolitionists", + "notes": "A categorical array variable, where one item has no responses", + "subreferences": [ + { + "alias": "douglass", + "description": "fav_ppdem", + "name": "Frederick Douglass" + }, + { + "alias": "brown", + "description": "fav_pprep", + "name": "John Brown" }, - "dimensions": [ + { + "alias": "truth", + "name": "Sojourner Truth" + } + ], + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "transform": { + "insertions": [ { - "each": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d8/" + "anchor": 2, + "args": [ + 0, + 2 + ], + "function": "subtotal", + "name": "favorable" }, { - "variable": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d8/" - }, + "anchor": 4, + "args": [ + 3, + 4 + ], + "function": "subtotal", + "name": "unfavorable" + } + ] + } + } + }, + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "0061", + "references": { + "alias": "douglass", + "description": "fav_ppdem", + "name": "Frederick Douglass" + } + } + }, + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "0062", + "references": { + "alias": "brown", + "description": "fav_pprep", + "name": "John Brown" + } + } + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "fb4492a07d5142f9a9a49de9c07ce8a1", + "references": { + "alias": "truth", + "name": "Sojourner Truth" + } + } + } + ], + "subtype": { + "class": "variable" + } + } + }, + { + "derived": false, + "references": { + "alias": "abolitionists", + "description": "Do you have a favorable or an unfavorable opinion of the following abolitionists?", + "name": "Abolitionists", + "notes": "A categorical array variable, where one item has no responses", + "subreferences": [ + { + "alias": "douglass", + "description": "fav_ppdem", + "name": "Frederick Douglass" + }, + { + "alias": "brown", + "description": "fav_pprep", + "name": "John Brown" + }, + { + "alias": "truth", + "name": "Sojourner Truth" + } + ], + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "transform": { + "insertions": [ { - "each": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dd/" + "anchor": 2, + "args": [ + 0, + 2 + ], + "function": "subtotal", + "name": "favorable" }, { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dd/" - } - ] + "anchor": 4, + "args": [ + 3, + 4 + ], + "function": "subtotal", + "name": "unfavorable" } - ], - "weight": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d0/" + ] + } + } }, - "query_environment": { - "filter": [ - - ] + "type": { + "categories": [ + { + "id": 0, + "missing": false, + "name": "Very favorable", + "numeric_value": 0, + "selected": false + }, + { + "id": 2, + "missing": false, + "name": "Somewhat favorable", + "numeric_value": 2, + "selected": false + }, + { + "id": 3, + "missing": false, + "name": "Somewhat unfavorable", + "numeric_value": 3, + "selected": false + }, + { + "id": 4, + "missing": false, + "name": "Very unfavorable", + "numeric_value": 4, + "selected": false + }, + { + "id": 5, + "missing": false, + "name": "Don't know", + "numeric_value": 5, + "selected": false + }, + { + "id": 32766, + "missing": true, + "name": "skipped", + "numeric_value": 32766, + "selected": false + }, + { + "id": 32767, + "missing": true, + "name": "not asked", + "numeric_value": 32767, + "selected": false + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null, + "selected": false + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "0061", + "0062", + "fb4492a07d5142f9a9a49de9c07ce8a1" + ] + } + }, + { + "derived": true, + "references": { + "alias": "1984_countries", + "description": "Which of the following countries from 1984 would you live in? (select all that apply)", + "name": "Countries from 1984", + "notes": "A multiple response variable, where one item has no responses", + "subreferences": [ + { + "alias": "eurasia", + "description": "union_hhold_1", + "name": "Eurasia" + }, + { + "alias": "oceania", + "description": "union_hhold_2", + "name": "Oceania" + }, + { + "alias": "eastasia", + "description": "union_hhold_3", + "name": "Eastasia" + }, + { + "alias": "disputed", + "name": "Disputed" + } + ], + "uniform_basis": false }, - "result": { - "dimensions": [ - { - "derived": true, - "references": { - "description": "Do you have a favorable or an unfavorable opinion of the following abolitionists?", - "subreferences": [ - { - "alias": "douglass", - "name": "Frederick Douglass", - "description": "fav_ppdem" - }, - { - "alias": "brown", - "name": "John Brown", - "description": "fav_pprep" - }, - { - "alias": "truth", - "name": "Sojourner Truth" - } - ], - "notes": "A categorical array variable, where one item has no responses", - "name": "Abolitionists", - "alias": "abolitionists", - "view": { - "show_counts": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 0, - 2 - ], - "name": "favorable", - "anchor": 2 - }, - { - "function": "subtotal", - "args": [ - 3, - 4 - ], - "name": "unfavorable", - "anchor": 4 - } - ] - }, - "include_missing": false, - "column_width": null - } - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "douglass", - "name": "Frederick Douglass", - "description": "fav_ppdem" - }, - "id": "0061" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "brown", - "name": "John Brown", - "description": "fav_pprep" - }, - "id": "0062" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "truth", - "name": "Sojourner Truth" - }, - "id": "fb4492a07d5142f9a9a49de9c07ce8a1" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "derived": false, - "references": { - "description": "Do you have a favorable or an unfavorable opinion of the following abolitionists?", - "subreferences": [ - { - "alias": "douglass", - "name": "Frederick Douglass", - "description": "fav_ppdem" - }, - { - "alias": "brown", - "name": "John Brown", - "description": "fav_pprep" - }, - { - "alias": "truth", - "name": "Sojourner Truth" - } - ], - "notes": "A categorical array variable, where one item has no responses", - "name": "Abolitionists", - "alias": "abolitionists", - "view": { - "show_counts": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 0, - 2 - ], - "name": "favorable", - "anchor": 2 - }, - { - "function": "subtotal", - "args": [ - 3, - 4 - ], - "name": "unfavorable", - "anchor": 4 - } - ] - }, - "include_missing": false, - "column_width": null - } - }, - "type": { - "ordinal": false, - "subvariables": [ - "0061", - "0062", - "fb4492a07d5142f9a9a49de9c07ce8a1" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 0, - "selected": false, - "id": 0, - "name": "Very favorable", - "missing": false - }, - { - "numeric_value": 2, - "selected": false, - "id": 2, - "name": "Somewhat favorable", - "missing": false - }, - { - "numeric_value": 3, - "selected": false, - "id": 3, - "name": "Somewhat unfavorable", - "missing": false - }, - { - "numeric_value": 4, - "selected": false, - "id": 4, - "name": "Very unfavorable", - "missing": false - }, - { - "numeric_value": 5, - "selected": false, - "id": 5, - "name": "Don't know", - "missing": false - }, - { - "numeric_value": 32766, - "selected": false, - "id": 32766, - "name": "skipped", - "missing": true - }, - { - "numeric_value": 32767, - "selected": false, - "id": 32767, - "name": "not asked", - "missing": true - }, - { - "numeric_value": null, - "selected": false, - "id": -1, - "name": "No Data", - "missing": true - } - ] - } - }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": "Which of the following countries from 1984 would you live in? (select all that apply)", - "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", - "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" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "oceania", - "name": "Oceania", - "description": "union_hhold_2" - }, - "id": "00c6" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "eastasia", - "name": "Eastasia", - "description": "union_hhold_3" - }, - "id": "00c7" - }, - "missing": false - }, - { - "id": 4, - "value": { - "derived": false, - "references": { - "alias": "disputed", - "name": "Disputed" - }, - "id": "11b45a85e5ac4011bd3cf884b8a2476f" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "references": { - "uniform_basis": false, - "description": "Which of the following countries from 1984 would you live in? (select all that apply)", - "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", - "name": "Countries from 1984" - }, - "derived": true, - "type": { - "ordinal": false, - "subvariables": [ - "00c5", - "00c6", - "00c7", - "11b45a85e5ac4011bd3cf884b8a2476f" - ], - "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" - } - ] - } + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00c5", + "references": { + "alias": "eurasia", + "description": "union_hhold_1", + "name": "Eurasia" + } + } + }, + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00c6", + "references": { + "alias": "oceania", + "description": "union_hhold_2", + "name": "Oceania" } - ], - "missing": 10, - "measures": { - "count": { - "data": [ - 22.2609925032701, - 16.9844835303167, - 222.310511064138, - 21.4670764652966, - 18.7623471388787, - 221.32656349355, - 219.182324478491, - 3.19926616430062, - 39.1743964549334, - 0, - 0, - 261.555987097725, - 34.4602057043984, - 38.9081180709724, - 318.459577115524, - 44.0133766327096, - 40.2937863255125, - 307.520737932672, - 314.365248914328, - 11.0374449013001, - 66.4252070752666, - 0, - 0, - 391.827900890895, - 25.5630888770301, - 35.7209072453127, - 202.837216191128, - 25.335068002585, - 30.4374108415629, - 208.348733469323, - 217.584012509558, - 8.94596533741205, - 37.5912344665001, - 0, - 0, - 264.121212313471, - 32.4017181382625, - 31.0352661360065, - 438.013129815619, - 33.841067995359, - 33.331393844497, - 434.277652250033, - 438.909164860856, - 5.0196677412525, - 57.5212814877798, - 0, - 0, - 501.450114089889, - 4.99112939798944, - 28.002444742699, - 179.351243978733, - 8.54509709144171, - 26.3461434771868, - 177.453577550793, - 198.80859162999, - 1.65630126551221, - 11.8799252239189, - 0, - 0, - 212.344818119421, - 0.752560977946403, - 6.91918433229187, - 23.0282221783644, - 3.60847290734546, - 5.74004220502229, - 21.351452376235, - 23.6917151822036, - 3.82636054837688, - 3.18189175802228, - 0, - 0, - 30.6999674886027, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 15.1064515178025, - 14.8964289544671, - 140.995495924001, - 21.0230096950105, - 12.9669188119134, - 137.008447889347, - 135.917515423371, - 3.7245122738576, - 31.3563486990416, - 0, - 0, - 170.998376396271, - 32.5604100093203, - 41.4234601652912, - 329.92570090253, - 34.3230034411795, - 41.2112974042019, - 328.37527023176, - 338.33312724915, - 9.33037214070239, - 56.2460716872887, - 0, - 0, - 403.909571077141, - 25.1241675577809, - 28.2218351521075, - 215.050092465812, - 29.5531524247545, - 26.870502142431, - 211.972440608514, - 217.765472615634, - 8.59861013012241, - 42.0320124299436, - 0, - 0, - 268.3960951757, - 41.5686964119083, - 41.9334112591193, - 486.723309333154, - 40.0469902636259, - 43.5846394210477, - 486.593787319508, - 492.635593733922, - 6.88919293488811, - 70.7006303353718, - 0, - 0, - 570.225417004182, - 5.23117131012065, - 28.002444742699, - 187.651851514459, - 8.22537078190222, - 26.3461434771868, - 186.31395330819, - 207.428925475256, - 1.65630126551221, - 11.8002408265107, - 0, - 0, - 220.885467567279, - 0.838798791964368, - 3.09282378391499, - 23.6534502035512, - 3.63863248826485, - 3.93162257587936, - 20.0148177152864, - 20.460423078094, - 3.48601721307167, - 3.63863248826485, - 0, - 0, - 27.5850727794306, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 120.429695598897, - 157.570404057599, - 1383.9999003435, - 136.810159094737, - 154.91112383266, - 1370.2787170726, - 1412.54105757542, - 33.6850059581544, - 215.773936466421, - 0, - 0, - 1661.99999999999 - ], - "n_missing": 10, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": false, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } + } + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00c7", + "references": { + "alias": "eastasia", + "description": "union_hhold_3", + "name": "Eastasia" } + } }, - "element": "crunch:cube", - "counts": [ - 34, - 21, - 257, - 29, - 23, - 260, - 251, - 6, - 55, - 0, - 0, - 312, - 39, - 36, - 340, - 43, - 35, - 337, - 335, - 11, - 69, - 0, - 0, - 415, - 26, - 23, - 222, - 26, - 20, - 225, - 223, - 7, - 41, - 0, - 0, - 271, - 37, - 26, - 427, - 33, - 28, - 429, - 424, - 6, - 60, - 0, - 0, - 490, - 6, - 18, - 129, - 7, - 17, - 129, - 140, - 1, - 12, - 0, - 0, - 153, - 1, - 4, - 16, - 3, - 3, - 15, - 16, - 2, - 3, - 0, - 0, - 21, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 15, - 16, - 141, - 19, - 14, - 139, - 139, - 5, - 28, - 0, - 0, - 172, - 36, - 35, - 288, - 31, - 35, - 293, - 294, - 8, - 57, - 0, - 0, - 359, - 23, - 25, - 234, - 30, - 23, - 229, - 233, - 7, - 42, - 0, - 0, - 282, - 62, - 32, - 573, - 50, - 34, - 583, - 560, - 10, - 97, - 0, - 0, - 667, - 6, - 18, - 135, - 7, - 17, - 135, - 146, - 1, - 12, - 0, - 0, - 159, - 1, - 2, - 20, - 4, - 3, - 16, - 17, - 2, - 4, - 0, - 0, - 23, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 143, - 128, - 1391, - 141, - 126, - 1395, - 1389, - 33, - 240, - 0, - 0, - 1662 - ], - "n": 1662 + { + "id": 4, + "missing": false, + "value": { + "derived": false, + "id": "11b45a85e5ac4011bd3cf884b8a2476f", + "references": { + "alias": "disputed", + "name": "Disputed" + } + } + } + ], + "subtype": { + "class": "variable" + } } - } -} + }, + { + "derived": true, + "references": { + "alias": "1984_countries", + "description": "Which of the following countries from 1984 would you live in? (select all that apply)", + "name": "Countries from 1984", + "notes": "A multiple response variable, where one item has no responses", + "subreferences": [ + { + "alias": "eurasia", + "description": "union_hhold_1", + "name": "Eurasia" + }, + { + "alias": "oceania", + "description": "union_hhold_2", + "name": "Oceania" + }, + { + "alias": "eastasia", + "description": "union_hhold_3", + "name": "Eastasia" + }, + { + "alias": "disputed", + "name": "Disputed" + } + ], + "uniform_basis": false + }, + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true + }, + { + "id": 0, + "missing": false, + "name": "Not Selected", + "numeric_value": 0 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00c5", + "00c6", + "00c7", + "11b45a85e5ac4011bd3cf884b8a2476f" + ] + } + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 22.2609925032701, + 16.9844835303167, + 222.310511064138, + 21.4670764652966, + 18.7623471388787, + 221.32656349355, + 219.182324478491, + 3.19926616430062, + 39.1743964549334, + 0, + 0, + 261.555987097725, + 34.4602057043984, + 38.9081180709724, + 318.459577115524, + 44.0133766327096, + 40.2937863255125, + 307.520737932672, + 314.365248914328, + 11.0374449013001, + 66.4252070752666, + 0, + 0, + 391.827900890895, + 25.5630888770301, + 35.7209072453127, + 202.837216191128, + 25.335068002585, + 30.4374108415629, + 208.348733469323, + 217.584012509558, + 8.94596533741205, + 37.5912344665001, + 0, + 0, + 264.121212313471, + 32.4017181382625, + 31.0352661360065, + 438.013129815619, + 33.841067995359, + 33.331393844497, + 434.277652250033, + 438.909164860856, + 5.0196677412525, + 57.5212814877798, + 0, + 0, + 501.450114089889, + 4.99112939798944, + 28.002444742699, + 179.351243978733, + 8.54509709144171, + 26.3461434771868, + 177.453577550793, + 198.80859162999, + 1.65630126551221, + 11.8799252239189, + 0, + 0, + 212.344818119421, + 0.752560977946403, + 6.91918433229187, + 23.0282221783644, + 3.60847290734546, + 5.74004220502229, + 21.351452376235, + 23.6917151822036, + 3.82636054837688, + 3.18189175802228, + 0, + 0, + 30.6999674886027, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 15.1064515178025, + 14.8964289544671, + 140.995495924001, + 21.0230096950105, + 12.9669188119134, + 137.008447889347, + 135.917515423371, + 3.7245122738576, + 31.3563486990416, + 0, + 0, + 170.998376396271, + 32.5604100093203, + 41.4234601652912, + 329.92570090253, + 34.3230034411795, + 41.2112974042019, + 328.37527023176, + 338.33312724915, + 9.33037214070239, + 56.2460716872887, + 0, + 0, + 403.909571077141, + 25.1241675577809, + 28.2218351521075, + 215.050092465812, + 29.5531524247545, + 26.870502142431, + 211.972440608514, + 217.765472615634, + 8.59861013012241, + 42.0320124299436, + 0, + 0, + 268.3960951757, + 41.5686964119083, + 41.9334112591193, + 486.723309333154, + 40.0469902636259, + 43.5846394210477, + 486.593787319508, + 492.635593733922, + 6.88919293488811, + 70.7006303353718, + 0, + 0, + 570.225417004182, + 5.23117131012065, + 28.002444742699, + 187.651851514459, + 8.22537078190222, + 26.3461434771868, + 186.31395330819, + 207.428925475256, + 1.65630126551221, + 11.8002408265107, + 0, + 0, + 220.885467567279, + 0.838798791964368, + 3.09282378391499, + 23.6534502035512, + 3.63863248826485, + 3.93162257587936, + 20.0148177152864, + 20.460423078094, + 3.48601721307167, + 3.63863248826485, + 0, + 0, + 27.5850727794306, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 120.429695598897, + 157.570404057599, + 1383.9999003435, + 136.810159094737, + 154.91112383266, + 1370.2787170726, + 1412.54105757542, + 33.6850059581544, + 215.773936466421, + 0, + 0, + 1661.99999999999 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 10 + } + }, + "missing": 10, + "n": 1662 + } +} \ No newline at end of file diff --git a/tests/fixtures/ca-x-mr-sig-testing-subtotals.json b/tests/fixtures/ca-x-mr-sig-testing-subtotals.json index aced8f38f..d00761fb0 100644 --- a/tests/fixtures/ca-x-mr-sig-testing-subtotals.json +++ b/tests/fixtures/ca-x-mr-sig-testing-subtotals.json @@ -1,1319 +1,1309 @@ { - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [ - - ] + "meta": { + "display_settings": { + "countsOrPercents": { + "value": "percent" + }, + "currentTab": { + "value": 0 + }, + "decimalPlaces": { + "value": 1 + }, + "percentageDirection": { + "value": "rowPct" + }, + "populationMagnitude": { + "value": 3 + }, + "showEmpty": { + "value": false + }, + "showNotes": { + "value": false + }, + "showSignif": { + "value": true + }, + "uiView": { + "value": "app.datasets.analyze" + }, + "vizType": { + "value": "table" + } + }, + "filters": [], + "name": "Bolshevik facial hair row %, sig testing", + "subtitle": "row %, sig testing", + "table_title": "", + "title": "Bolshevik facial hair", + "weight": "weight" + }, + "value": { + "query": { + "dimensions": [ + { + "each": 1 + }, + { + "variable": "0000d1" + }, + { + "each": 3 + }, + { + "args": [ + { + "variable": "0000dc" + } + ], + "function": "as_selected" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": "http://127.0.0.1:8080/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d0/" + }, + "query_environment": { + "filter": [] + }, + "result": { + "counts": [ + 2, + 0, + 11, + 2, + 1, + 10, + 2, + 1, + 10, + 6, + 1, + 6, + 3, + 1, + 9, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 11, + 103, + 727, + 66, + 98, + 677, + 87, + 91, + 663, + 327, + 55, + 459, + 411, + 62, + 368, + 14, + 21, + 77, + 12, + 25, + 75, + 8, + 25, + 79, + 26, + 23, + 63, + 63, + 12, + 37, + 6, + 55, + 365, + 38, + 49, + 339, + 72, + 47, + 307, + 198, + 24, + 204, + 168, + 41, + 217, + 0, + 43, + 227, + 25, + 38, + 207, + 31, + 38, + 201, + 80, + 31, + 159, + 150, + 22, + 98, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 20, + 94, + 13, + 20, + 89, + 13, + 18, + 91, + 37, + 17, + 68, + 61, + 11, + 50, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 13, + 47, + 10, + 14, + 44, + 3, + 15, + 50, + 19, + 10, + 39, + 36, + 7, + 25, + 7, + 103, + 675, + 50, + 98, + 637, + 80, + 94, + 611, + 301, + 57, + 427, + 396, + 59, + 330, + 9, + 60, + 418, + 50, + 55, + 382, + 88, + 50, + 349, + 226, + 31, + 230, + 180, + 50, + 257, + 1, + 26, + 173, + 20, + 24, + 156, + 16, + 25, + 159, + 54, + 19, + 127, + 122, + 11, + 67, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 6, + 11, + 1, + 6, + 12, + 1, + 5, + 13, + 5, + 4, + 10, + 10, + 3, + 6, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 13, + 44, + 9, + 15, + 43, + 10, + 14, + 43, + 18, + 12, + 37, + 32, + 11, + 24, + 15, + 113, + 766, + 61, + 110, + 723, + 87, + 106, + 701, + 337, + 68, + 489, + 450, + 64, + 380, + 6, + 57, + 374, + 51, + 49, + 337, + 79, + 48, + 310, + 198, + 28, + 211, + 165, + 44, + 228, + 0, + 33, + 212, + 21, + 31, + 193, + 23, + 29, + 193, + 79, + 22, + 144, + 138, + 16, + 91, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 5, + 28, + 4, + 5, + 27, + 4, + 5, + 27, + 12, + 5, + 19, + 15, + 4, + 17, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 7, + 6, + 37, + 6, + 10, + 34, + 7, + 8, + 35, + 12, + 9, + 29, + 27, + 4, + 19, + 13, + 117, + 743, + 64, + 110, + 699, + 75, + 107, + 691, + 334, + 65, + 474, + 442, + 68, + 363, + 10, + 61, + 381, + 43, + 54, + 355, + 84, + 52, + 316, + 198, + 32, + 222, + 177, + 49, + 226, + 0, + 33, + 218, + 26, + 32, + 193, + 30, + 30, + 191, + 81, + 23, + 147, + 134, + 13, + 104, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": true, + "references": { + "alias": "bolshevik_hair", + "description": "In your opinion, each of these famous Bolshevik's facial hair is...", + "is_dichotomous": false, + "name": "Bolshevik facial hair", + "notes": "A categorical array variable where the missing categories are interspersed throughout the non-missing categories", + "subreferences": [ + { + "alias": "stalin", + "description": "cabatt_1", + "name": "იოსებ სტალინი (Stalin)" + }, + { + "alias": "trotsky", + "description": "cabatt_6", + "name": "Лев Троцкий (Trotsky)" + }, + { + "alias": "kalinin", + "description": "cabatt_3", + "name": "Михаи́л Ива́нович Кали́нин (Kalinin)" + }, + { + "alias": "lenin", + "description": "cabatt_7", + "name": "Владимир Ленин (Lenin)" + } + ] + }, + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "0007", + "references": { + "alias": "stalin", + "description": "cabatt_1", + "name": "იოსებ სტალინი (Stalin)" + } } - }, - "dimensions": [ - { - "each": 1 - }, - { - "variable": "0000d1" - }, - { - "each": 3 - }, - { - "function": "as_selected", - "args": [ - { - "variable": "0000dc" - } - ] + }, + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "0008", + "references": { + "alias": "trotsky", + "description": "cabatt_6", + "name": "Лев Троцкий (Trotsky)" + } } + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "0009", + "references": { + "alias": "kalinin", + "description": "cabatt_3", + "name": "Михаи́л Ива́нович Кали́нин (Kalinin)" + } + } + }, + { + "id": 4, + "missing": false, + "value": { + "derived": false, + "id": "000a", + "references": { + "alias": "lenin", + "description": "cabatt_7", + "name": "Владимир Ленин (Lenin)" + } + } + } ], - "weight": "http://127.0.0.1:8080/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d0/" + "subtype": { + "class": "variable" + } + } }, - "query_environment": { - "filter": [ - + { + "derived": false, + "references": { + "alias": "bolshevik_hair", + "description": "In your opinion, each of these famous Bolshevik's facial hair is...", + "is_dichotomous": false, + "name": "Bolshevik facial hair", + "notes": "A categorical array variable where the missing categories are interspersed throughout the non-missing categories", + "subreferences": [ + { + "alias": "stalin", + "description": "cabatt_1", + "name": "იოსებ სტალინი (Stalin)" + }, + { + "alias": "trotsky", + "description": "cabatt_6", + "name": "Лев Троцкий (Trotsky)" + }, + { + "alias": "kalinin", + "description": "cabatt_3", + "name": "Михаи́л Ива́нович Кали́нин (Kalinin)" + }, + { + "alias": "lenin", + "description": "cabatt_7", + "name": "Владимир Ленин (Lenin)" + } ] + }, + "type": { + "categories": [ + { + "id": 32766, + "missing": true, + "name": "skipped", + "numeric_value": 32766, + "selected": false + }, + { + "id": 32767, + "missing": true, + "name": "not asked", + "numeric_value": 32767, + "selected": false + }, + { + "id": 1, + "missing": false, + "name": "Too much", + "numeric_value": 1, + "selected": false + }, + { + "id": 5, + "missing": false, + "name": "Too little", + "numeric_value": 5, + "selected": false + }, + { + "id": 0, + "missing": false, + "name": "The right amount", + "numeric_value": 0, + "selected": false + }, + { + "id": 4, + "missing": false, + "name": "Not sure", + "numeric_value": 4, + "selected": false + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null, + "selected": false + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "0007", + "0008", + "0009", + "000a" + ] + } }, - "result": { - "dimensions": [ - { - "derived": true, - "references": { - "description": "In your opinion, each of these famous Bolshevik's facial hair is...", - "subreferences": [ - { - "alias": "stalin", - "name": "იოსებ სტალინი (Stalin)", - "description": "cabatt_1" - }, - { - "alias": "trotsky", - "name": "Лев Троцкий (Trotsky)", - "description": "cabatt_6" - }, - { - "alias": "kalinin", - "name": "Михаи́л Ива́нович Кали́нин (Kalinin)", - "description": "cabatt_3" - }, - { - "alias": "lenin", - "name": "Владимир Ленин (Lenin)", - "description": "cabatt_7" - } - ], - "notes": "A categorical array variable where the missing categories are interspersed throughout the non-missing categories", - "alias": "bolshevik_hair", - "is_dichotomous": false, - "name": "Bolshevik facial hair" - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "stalin", - "name": "იოსებ სტალინი (Stalin)", - "description": "cabatt_1" - }, - "id": "0007" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "trotsky", - "name": "Лев Троцкий (Trotsky)", - "description": "cabatt_6" - }, - "id": "0008" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "kalinin", - "name": "Михаи́л Ива́нович Кали́нин (Kalinin)", - "description": "cabatt_3" - }, - "id": "0009" - }, - "missing": false - }, - { - "id": 4, - "value": { - "derived": false, - "references": { - "alias": "lenin", - "name": "Владимир Ленин (Lenin)", - "description": "cabatt_7" - }, - "id": "000a" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "references": { - "description": "In your opinion, each of these famous Bolshevik's facial hair is...", - "subreferences": [ - { - "alias": "stalin", - "name": "იოსებ სტალინი (Stalin)", - "description": "cabatt_1" - }, - { - "alias": "trotsky", - "name": "Лев Троцкий (Trotsky)", - "description": "cabatt_6" - }, - { - "alias": "kalinin", - "name": "Михаи́л Ива́нович Кали́нин (Kalinin)", - "description": "cabatt_3" - }, - { - "alias": "lenin", - "name": "Владимир Ленин (Lenin)", - "description": "cabatt_7" - } - ], - "notes": "A categorical array variable where the missing categories are interspersed throughout the non-missing categories", - "alias": "bolshevik_hair", - "is_dichotomous": false, - "name": "Bolshevik facial hair" - }, - "derived": false, - "type": { - "ordinal": false, - "subvariables": [ - "0007", - "0008", - "0009", - "000a" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 32766, - "selected": false, - "id": 32766, - "missing": true, - "name": "skipped" - }, - { - "numeric_value": 32767, - "selected": false, - "id": 32767, - "missing": true, - "name": "not asked" - }, - { - "numeric_value": 1, - "selected": false, - "id": 1, - "missing": false, - "name": "Too much" - }, - { - "numeric_value": 5, - "selected": false, - "id": 5, - "missing": false, - "name": "Too little" - }, - { - "numeric_value": 0, - "selected": false, - "id": 0, - "missing": false, - "name": "The right amount" - }, - { - "numeric_value": 4, - "selected": false, - "id": 4, - "missing": false, - "name": "Not sure" - }, - { - "numeric_value": null, - "selected": false, - "id": -1, - "missing": true, - "name": "No Data" - } - ] - } - }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": "Which of the following Nordic countries have you visited? (select all that apply)", - "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", - "is_dichotomous": true, - "name": "Nordic countries" - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "dk", - "name": "Denmark", - "description": "milstat_1" - }, - "id": "00c0" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "fi", - "name": "Finland", - "description": "milstat_2" - }, - "id": "00c1" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "is", - "name": "Iceland", - "description": "milstat_3" - }, - "id": "00c2" - }, - "missing": false - }, - { - "id": 4, - "value": { - "derived": false, - "references": { - "alias": "no", - "name": "Norway", - "description": "milstat_4" - }, - "id": "00c3" - }, - "missing": false - }, - { - "id": 5, - "value": { - "derived": false, - "references": { - "alias": "se", - "name": "Sweden", - "description": "milstat_5" - }, - "id": "00c4" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "references": { - "uniform_basis": false, - "description": "Which of the following Nordic countries have you visited? (select all that apply)", - "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", - "is_dichotomous": true, - "name": "Nordic countries" - }, - "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" - } - ] - } - } + { + "derived": true, + "references": { + "alias": "nordics", + "description": "Which of the following Nordic countries have you visited? (select all that apply)", + "is_dichotomous": true, + "name": "Nordic countries", + "notes": "A multiple response variable", + "subreferences": [ + { + "alias": "dk", + "description": "milstat_1", + "name": "Denmark" + }, + { + "alias": "fi", + "description": "milstat_2", + "name": "Finland" + }, + { + "alias": "is", + "description": "milstat_3", + "name": "Iceland" + }, + { + "alias": "no", + "description": "milstat_4", + "name": "Norway" + }, + { + "alias": "se", + "description": "milstat_5", + "name": "Sweden" + } ], - "missing": 2, - "measures": { - "count": { - "data": [ - 1.65979771819165, - 0, - 13.9270274647004, - 2.96344574716368, - 0.869333895168885, - 11.7540455405595, - 3.55285297013774, - 0.869333895168885, - 11.1646383175855, - 6.52277188778838, - 0.869333895168885, - 8.19471939993482, - 4.36193975760226, - 0.869333895168885, - 10.3555515301209, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 13.4450929625256, - 98.5136182913165, - 637.357265730664, - 61.2754570548901, - 90.3575943414785, - 597.682925588138, - 81.7170906635991, - 82.0862071309613, - 585.512679189947, - 289.002137768091, - 55.1505605139189, - 405.163278702498, - 365.242891723743, - 60.982614017616, - 323.090471243148, - 17.0666209331443, - 21.0952779612099, - 85.3109693192459, - 7.59343081445309, - 28.8228628784548, - 87.0565745206922, - 9.53802171286541, - 26.9336335934349, - 87.0012129072998, - 26.8695623224513, - 25.1096490359858, - 71.4936568551631, - 71.1192039225491, - 14.5780813304951, - 37.775582960556, - 8.43877713273272, - 53.1035917252477, - 375.381200046677, - 40.7358749480332, - 46.7999714087435, - 349.387722547881, - 77.1299416653173, - 43.3108120359689, - 316.482815203371, - 201.418329955483, - 22.5362168813994, - 212.969022067774, - 170.468212429121, - 39.0055389037504, - 227.449817571786, - 0, - 57.3600521744947, - 279.340708539851, - 29.4866043931536, - 51.9314858612711, - 255.28267045992, - 38.8808865828423, - 50.3200348073874, - 247.499839324115, - 96.5965694508612, - 41.195851006618, - 198.908340256866, - 191.981840681226, - 30.8315816067175, - 113.887338426401, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 9.92029297553869, - 19.7400483331064, - 100.386558093686, - 15.4068400875812, - 18.3569639068771, - 96.2830954078732, - 16.962754226054, - 18.0623538012876, - 95.0217913749899, - 38.2076107233431, - 16.4928838085727, - 75.3464048704157, - 62.3208239731381, - 11.2735952280151, - 56.4524802011783, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 9.87508327949836, - 14.3192353964892, - 59.1464514515102, - 11.2675056435235, - 14.8125191759469, - 57.2607453080274, - 4.14769665520673, - 15.8715784694538, - 63.3214950028372, - 29.5291244255024, - 11.3995424297982, - 42.4121032721972, - 40.1703043219586, - 6.0243791126203, - 37.1460866929189, - 8.26652216766441, - 92.1124289304242, - 583.886280923837, - 44.7633542317244, - 89.2159585232686, - 550.285919266933, - 72.9724640027403, - 80.8641530548241, - 530.428614964361, - 262.725838840513, - 50.8439220326181, - 370.695471148794, - 344.509723255133, - 53.429683427805, - 286.325825338988, - 11.6790564287239, - 65.9042793868665, - 430.612851224218, - 48.452820418072, - 61.5098859751909, - 398.233480646545, - 97.9831080092136, - 51.6630334093814, - 358.550045621213, - 230.195652788106, - 35.9405577337742, - 242.059976517927, - 189.120896455771, - 61.0321581081886, - 258.043132475847, - 0.869333895168885, - 37.9965481053825, - 217.285029407888, - 22.1642925767926, - 34.8859208038335, - 199.100698027813, - 18.7527707015473, - 37.0589027279744, - 200.339237978918, - 59.7511446072099, - 30.1847053283278, - 166.215061472902, - 167.052340508241, - 14.507333877119, - 74.5912370230791, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 2.42933078007588, - 5.73235617508201, - 15.6761902934751, - 1.49850936604462, - 5.73235617508201, - 16.6070117075063, - 1.17914212726958, - 4.55321404781243, - 18.105521073551, - 6.30300052058957, - 3.66832493590669, - 13.8665517921367, - 12.4278944546533, - 3.2431733664449, - 8.16680942753475, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8.39573480666894, - 15.4952298170233, - 52.2126508237706, - 9.63714424049469, - 13.5299057251883, - 52.9365654817798, - 9.44718715255943, - 16.423348084818, - 50.2330802100854, - 20.2725788355165, - 15.5173619618845, - 40.3136746500617, - 38.2927497189588, - 11.7829715350995, - 26.0278941934044, - 19.8790071809217, - 101.463116569833, - 690.602976143096, - 56.2163206284992, - 101.079268064969, - 654.649511200382, - 83.0535948165, - 92.0948878952942, - 636.796617182056, - 305.193372894763, - 61.7735922552134, - 444.978134743874, - 409.640858024675, - 58.4146893501378, - 343.889552519038, - 9.90621597892775, - 55.0278610296194, - 373.394659352381, - 47.5206499389839, - 49.7954153803178, - 341.012671041626, - 87.6132785569048, - 44.5474174001837, - 306.168040403839, - 195.2019421789, - 28.533287182771, - 214.593506999257, - 161.147898277143, - 46.105052664534, - 231.075785419251, - 0, - 52.3539765607115, - 259.430694488416, - 27.1821887836713, - 48.6443030395595, - 235.958179225897, - 29.5255909415281, - 45.9011540348131, - 236.357926072787, - 93.4384769549071, - 35.3690449973153, - 182.977149096906, - 181.664688038812, - 26.7212628375317, - 103.398720172784, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 2.48602468962541, - 4.19192804715235, - 29.2975988261611, - 3.35752276599355, - 4.40276191314031, - 28.215266883805, - 2.48488123654107, - 4.74684536925195, - 28.7438249571458, - 9.79314957086999, - 4.39606372450688, - 21.786338267562, - 19.7467025646989, - 2.88369251029536, - 13.3451564879445, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 9.7803012222566, - 6.15339934156018, - 44.0999854612128, - 3.90892821413032, - 9.76028796541731, - 46.364469845482, - 10.0914706410191, - 7.70574241452484, - 42.2364729694857, - 15.859766758229, - 9.20425178056946, - 34.9696674862312, - 29.7415054659447, - 3.60688862385713, - 26.6852919352278, - 16.4479903421807, - 104.780079711006, - 665.300707451108, - 56.4011671534055, - 98.8446927148957, - 631.282917635994, - 69.5019838118314, - 90.4826917485473, - 626.544101943917, - 302.819307729484, - 57.2636975473541, - 426.445772227457, - 393.969196389827, - 65.6359015405782, - 326.923679573891, - 11.8959724925315, - 68.1512334899437, - 387.58261153286, - 46.4212628337103, - 59.4260278916545, - 361.78252678997, - 94.5383231761747, - 56.9508276865298, - 316.14066665263, - 199.684866385115, - 39.1206672034273, - 228.824283926792, - 179.84721102297, - 58.1884131325316, - 229.594193359833, - 0, - 46.7958995626063, - 265.036267829797, - 31.965931990454, - 46.3474779000091, - 233.51875750194, - 34.2021347291957, - 43.6339142440675, - 233.99611841914, - 92.252280940977, - 34.8769310772332, - 184.702955374193, - 179.869473070801, - 15.9522539464857, - 116.010440375116, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "n_missing": 2, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": false, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } + "uniform_basis": false + }, + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00c0", + "references": { + "alias": "dk", + "description": "milstat_1", + "name": "Denmark" + } + } + }, + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00c1", + "references": { + "alias": "fi", + "description": "milstat_2", + "name": "Finland" + } + } + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00c2", + "references": { + "alias": "is", + "description": "milstat_3", + "name": "Iceland" + } + } + }, + { + "id": 4, + "missing": false, + "value": { + "derived": false, + "id": "00c3", + "references": { + "alias": "no", + "description": "milstat_4", + "name": "Norway" + } + } + }, + { + "id": 5, + "missing": false, + "value": { + "derived": false, + "id": "00c4", + "references": { + "alias": "se", + "description": "milstat_5", + "name": "Sweden" + } } - }, - "element": "crunch:cube", - "counts": [ - 2, - 0, - 11, - 2, - 1, - 10, - 2, - 1, - 10, - 6, - 1, - 6, - 3, - 1, - 9, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 11, - 103, - 727, - 66, - 98, - 677, - 87, - 91, - 663, - 327, - 55, - 459, - 411, - 62, - 368, - 14, - 21, - 77, - 12, - 25, - 75, - 8, - 25, - 79, - 26, - 23, - 63, - 63, - 12, - 37, - 6, - 55, - 365, - 38, - 49, - 339, - 72, - 47, - 307, - 198, - 24, - 204, - 168, - 41, - 217, - 0, - 43, - 227, - 25, - 38, - 207, - 31, - 38, - 201, - 80, - 31, - 159, - 150, - 22, - 98, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8, - 20, - 94, - 13, - 20, - 89, - 13, - 18, - 91, - 37, - 17, - 68, - 61, - 11, - 50, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8, - 13, - 47, - 10, - 14, - 44, - 3, - 15, - 50, - 19, - 10, - 39, - 36, - 7, - 25, - 7, - 103, - 675, - 50, - 98, - 637, - 80, - 94, - 611, - 301, - 57, - 427, - 396, - 59, - 330, - 9, - 60, - 418, - 50, - 55, - 382, - 88, - 50, - 349, - 226, - 31, - 230, - 180, - 50, - 257, - 1, - 26, - 173, - 20, - 24, - 156, - 16, - 25, - 159, - 54, - 19, - 127, - 122, - 11, - 67, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 2, - 6, - 11, - 1, - 6, - 12, - 1, - 5, - 13, - 5, - 4, - 10, - 10, - 3, - 6, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 10, - 13, - 44, - 9, - 15, - 43, - 10, - 14, - 43, - 18, - 12, - 37, - 32, - 11, - 24, - 15, - 113, - 766, - 61, - 110, - 723, - 87, - 106, - 701, - 337, - 68, - 489, - 450, - 64, - 380, - 6, - 57, - 374, - 51, - 49, - 337, - 79, - 48, - 310, - 198, - 28, - 211, - 165, - 44, - 228, - 0, - 33, - 212, - 21, - 31, - 193, - 23, - 29, - 193, - 79, - 22, - 144, - 138, - 16, - 91, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 3, - 5, - 28, - 4, - 5, - 27, - 4, - 5, - 27, - 12, - 5, - 19, - 15, - 4, - 17, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 7, - 6, - 37, - 6, - 10, - 34, - 7, - 8, - 35, - 12, - 9, - 29, - 27, - 4, - 19, - 13, - 117, - 743, - 64, - 110, - 699, - 75, - 107, - 691, - 334, - 65, - 474, - 442, - 68, - 363, - 10, - 61, - 381, - 43, - 54, - 355, - 84, - 52, - 316, - 198, - 32, - 222, - 177, - 49, - 226, - 0, - 33, - 218, - 26, - 32, - 193, - 30, - 30, - 191, - 81, - 23, - 147, - 134, - 13, - 104, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 + } ], - "n": 1662 + "subtype": { + "class": "variable" + } + } + }, + { + "derived": true, + "references": { + "alias": "nordics", + "description": "Which of the following Nordic countries have you visited? (select all that apply)", + "is_dichotomous": true, + "name": "Nordic countries", + "notes": "A multiple response variable", + "subreferences": [ + { + "alias": "dk", + "description": "milstat_1", + "name": "Denmark" + }, + { + "alias": "fi", + "description": "milstat_2", + "name": "Finland" + }, + { + "alias": "is", + "description": "milstat_3", + "name": "Iceland" + }, + { + "alias": "no", + "description": "milstat_4", + "name": "Norway" + }, + { + "alias": "se", + "description": "milstat_5", + "name": "Sweden" + } + ], + "uniform_basis": false + }, + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true + }, + { + "id": 0, + "missing": false, + "name": "Other", + "numeric_value": 0 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00c0", + "00c1", + "00c2", + "00c3", + "00c4" + ] + } } - }, - "meta": { - "subtitle": "row %, sig testing", - "name": "Bolshevik facial hair row %, sig testing", - "weight": "weight", - "title": "Bolshevik facial hair", - "filters": [ - - ], - "table_title": "", - "display_settings": { - "percentageDirection": { - "value": "rowPct" - }, - "showEmpty": { - "value": false - }, - "vizType": { - "value": "table" - }, - "countsOrPercents": { - "value": "percent" - }, - "decimalPlaces": { - "value": 1 - }, - "populationMagnitude": { - "value": 3 - }, - "showSignif": { - "value": true - }, - "currentTab": { - "value": 0 - }, - "uiView": { - "value": "app.datasets.analyze" - }, - "showNotes": { - "value": false + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 1.65979771819165, + 0, + 13.9270274647004, + 2.96344574716368, + 0.869333895168885, + 11.7540455405595, + 3.55285297013774, + 0.869333895168885, + 11.1646383175855, + 6.52277188778838, + 0.869333895168885, + 8.19471939993482, + 4.36193975760226, + 0.869333895168885, + 10.3555515301209, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 13.4450929625256, + 98.5136182913165, + 637.357265730664, + 61.2754570548901, + 90.3575943414785, + 597.682925588138, + 81.7170906635991, + 82.0862071309613, + 585.512679189947, + 289.002137768091, + 55.1505605139189, + 405.163278702498, + 365.242891723743, + 60.982614017616, + 323.090471243148, + 17.0666209331443, + 21.0952779612099, + 85.3109693192459, + 7.59343081445309, + 28.8228628784548, + 87.0565745206922, + 9.53802171286541, + 26.9336335934349, + 87.0012129072998, + 26.8695623224513, + 25.1096490359858, + 71.4936568551631, + 71.1192039225491, + 14.5780813304951, + 37.775582960556, + 8.43877713273272, + 53.1035917252477, + 375.381200046677, + 40.7358749480332, + 46.7999714087435, + 349.387722547881, + 77.1299416653173, + 43.3108120359689, + 316.482815203371, + 201.418329955483, + 22.5362168813994, + 212.969022067774, + 170.468212429121, + 39.0055389037504, + 227.449817571786, + 0, + 57.3600521744947, + 279.340708539851, + 29.4866043931536, + 51.9314858612711, + 255.28267045992, + 38.8808865828423, + 50.3200348073874, + 247.499839324115, + 96.5965694508612, + 41.195851006618, + 198.908340256866, + 191.981840681226, + 30.8315816067175, + 113.887338426401, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 9.92029297553869, + 19.7400483331064, + 100.386558093686, + 15.4068400875812, + 18.3569639068771, + 96.2830954078732, + 16.962754226054, + 18.0623538012876, + 95.0217913749899, + 38.2076107233431, + 16.4928838085727, + 75.3464048704157, + 62.3208239731381, + 11.2735952280151, + 56.4524802011783, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 9.87508327949836, + 14.3192353964892, + 59.1464514515102, + 11.2675056435235, + 14.8125191759469, + 57.2607453080274, + 4.14769665520673, + 15.8715784694538, + 63.3214950028372, + 29.5291244255024, + 11.3995424297982, + 42.4121032721972, + 40.1703043219586, + 6.0243791126203, + 37.1460866929189, + 8.26652216766441, + 92.1124289304242, + 583.886280923837, + 44.7633542317244, + 89.2159585232686, + 550.285919266933, + 72.9724640027403, + 80.8641530548241, + 530.428614964361, + 262.725838840513, + 50.8439220326181, + 370.695471148794, + 344.509723255133, + 53.429683427805, + 286.325825338988, + 11.6790564287239, + 65.9042793868665, + 430.612851224218, + 48.452820418072, + 61.5098859751909, + 398.233480646545, + 97.9831080092136, + 51.6630334093814, + 358.550045621213, + 230.195652788106, + 35.9405577337742, + 242.059976517927, + 189.120896455771, + 61.0321581081886, + 258.043132475847, + 0.869333895168885, + 37.9965481053825, + 217.285029407888, + 22.1642925767926, + 34.8859208038335, + 199.100698027813, + 18.7527707015473, + 37.0589027279744, + 200.339237978918, + 59.7511446072099, + 30.1847053283278, + 166.215061472902, + 167.052340508241, + 14.507333877119, + 74.5912370230791, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2.42933078007588, + 5.73235617508201, + 15.6761902934751, + 1.49850936604462, + 5.73235617508201, + 16.6070117075063, + 1.17914212726958, + 4.55321404781243, + 18.105521073551, + 6.30300052058957, + 3.66832493590669, + 13.8665517921367, + 12.4278944546533, + 3.2431733664449, + 8.16680942753475, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8.39573480666894, + 15.4952298170233, + 52.2126508237706, + 9.63714424049469, + 13.5299057251883, + 52.9365654817798, + 9.44718715255943, + 16.423348084818, + 50.2330802100854, + 20.2725788355165, + 15.5173619618845, + 40.3136746500617, + 38.2927497189588, + 11.7829715350995, + 26.0278941934044, + 19.8790071809217, + 101.463116569833, + 690.602976143096, + 56.2163206284992, + 101.079268064969, + 654.649511200382, + 83.0535948165, + 92.0948878952942, + 636.796617182056, + 305.193372894763, + 61.7735922552134, + 444.978134743874, + 409.640858024675, + 58.4146893501378, + 343.889552519038, + 9.90621597892775, + 55.0278610296194, + 373.394659352381, + 47.5206499389839, + 49.7954153803178, + 341.012671041626, + 87.6132785569048, + 44.5474174001837, + 306.168040403839, + 195.2019421789, + 28.533287182771, + 214.593506999257, + 161.147898277143, + 46.105052664534, + 231.075785419251, + 0, + 52.3539765607115, + 259.430694488416, + 27.1821887836713, + 48.6443030395595, + 235.958179225897, + 29.5255909415281, + 45.9011540348131, + 236.357926072787, + 93.4384769549071, + 35.3690449973153, + 182.977149096906, + 181.664688038812, + 26.7212628375317, + 103.398720172784, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2.48602468962541, + 4.19192804715235, + 29.2975988261611, + 3.35752276599355, + 4.40276191314031, + 28.215266883805, + 2.48488123654107, + 4.74684536925195, + 28.7438249571458, + 9.79314957086999, + 4.39606372450688, + 21.786338267562, + 19.7467025646989, + 2.88369251029536, + 13.3451564879445, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 9.7803012222566, + 6.15339934156018, + 44.0999854612128, + 3.90892821413032, + 9.76028796541731, + 46.364469845482, + 10.0914706410191, + 7.70574241452484, + 42.2364729694857, + 15.859766758229, + 9.20425178056946, + 34.9696674862312, + 29.7415054659447, + 3.60688862385713, + 26.6852919352278, + 16.4479903421807, + 104.780079711006, + 665.300707451108, + 56.4011671534055, + 98.8446927148957, + 631.282917635994, + 69.5019838118314, + 90.4826917485473, + 626.544101943917, + 302.819307729484, + 57.2636975473541, + 426.445772227457, + 393.969196389827, + 65.6359015405782, + 326.923679573891, + 11.8959724925315, + 68.1512334899437, + 387.58261153286, + 46.4212628337103, + 59.4260278916545, + 361.78252678997, + 94.5383231761747, + 56.9508276865298, + 316.14066665263, + 199.684866385115, + 39.1206672034273, + 228.824283926792, + 179.84721102297, + 58.1884131325316, + 229.594193359833, + 0, + 46.7958995626063, + 265.036267829797, + 31.965931990454, + 46.3474779000091, + 233.51875750194, + 34.2021347291957, + 43.6339142440675, + 233.99611841914, + 92.252280940977, + 34.8769310772332, + 184.702955374193, + 179.869473070801, + 15.9522539464857, + 116.010440375116, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} } + }, + "n_missing": 2 } + }, + "missing": 2, + "n": 1662 } -} + } +} \ No newline at end of file diff --git a/tests/fixtures/ca-x-mr.json b/tests/fixtures/ca-x-mr.json index b374deef0..19481fae8 100644 --- a/tests/fixtures/ca-x-mr.json +++ b/tests/fixtures/ca-x-mr.json @@ -1,974 +1,959 @@ { - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000d8%2F%22%7D,%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000d8%2F%22%7D,%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000dd%2F%22%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%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:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000d0%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [ - - ] + "query": { + "dimensions": [ + { + "each": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d8/" + }, + { + "variable": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d8/" + }, + { + "each": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dd/" + }, + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dd/" + } + ], + "function": "as_selected" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d0/" + }, + "result": { + "counts": [ + 34, + 21, + 257, + 29, + 23, + 260, + 251, + 6, + 55, + 0, + 0, + 312, + 39, + 36, + 340, + 43, + 35, + 337, + 335, + 11, + 69, + 0, + 0, + 415, + 26, + 23, + 222, + 26, + 20, + 225, + 223, + 7, + 41, + 0, + 0, + 271, + 37, + 26, + 427, + 33, + 28, + 429, + 424, + 6, + 60, + 0, + 0, + 490, + 6, + 18, + 129, + 7, + 17, + 129, + 140, + 1, + 12, + 0, + 0, + 153, + 1, + 4, + 16, + 3, + 3, + 15, + 16, + 2, + 3, + 0, + 0, + 21, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 15, + 16, + 141, + 19, + 14, + 139, + 139, + 5, + 28, + 0, + 0, + 172, + 36, + 35, + 288, + 31, + 35, + 293, + 294, + 8, + 57, + 0, + 0, + 359, + 23, + 25, + 234, + 30, + 23, + 229, + 233, + 7, + 42, + 0, + 0, + 282, + 62, + 32, + 573, + 50, + 34, + 583, + 560, + 10, + 97, + 0, + 0, + 667, + 6, + 18, + 135, + 7, + 17, + 135, + 146, + 1, + 12, + 0, + 0, + 159, + 1, + 2, + 20, + 4, + 3, + 16, + 17, + 2, + 4, + 0, + 0, + 23, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 143, + 128, + 1391, + 141, + 126, + 1395, + 1389, + 33, + 240, + 0, + 0, + 1662 + ], + "dimensions": [ + { + "derived": true, + "references": { + "alias": "abolitionists", + "description": "Do you have a favorable or an unfavorable opinion of the following abolitionists?", + "name": "Abolitionists", + "notes": "A categorical array variable, where one item has no responses", + "subreferences": [ + { + "alias": "douglass", + "description": "fav_ppdem", + "name": "Frederick Douglass" + }, + { + "alias": "brown", + "description": "fav_pprep", + "name": "John Brown" + }, + { + "alias": "truth", + "name": "Sojourner Truth" + } + ], + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false + } + }, + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "0061", + "references": { + "alias": "douglass", + "description": "fav_ppdem", + "name": "Frederick Douglass" + } + } + }, + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "0062", + "references": { + "alias": "brown", + "description": "fav_pprep", + "name": "John Brown" } + } }, - "dimensions": [ - { - "each": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d8/" - }, - { - "variable": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d8/" - }, - { - "each": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dd/" - }, - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dd/" - } - ] + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "fb4492a07d5142f9a9a49de9c07ce8a1", + "references": { + "alias": "truth", + "name": "Sojourner Truth" } - ], - "weight": "https://alpha.crunch.io/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d0/" + } + } + ], + "subtype": { + "class": "variable" + } + } + }, + { + "derived": false, + "references": { + "alias": "abolitionists", + "description": "Do you have a favorable or an unfavorable opinion of the following abolitionists?", + "name": "Abolitionists", + "notes": "A categorical array variable, where one item has no responses", + "subreferences": [ + { + "alias": "douglass", + "description": "fav_ppdem", + "name": "Frederick Douglass" + }, + { + "alias": "brown", + "description": "fav_pprep", + "name": "John Brown" + }, + { + "alias": "truth", + "name": "Sojourner Truth" + } + ], + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false + } }, - "query_environment": { - "filter": [ - - ] + "type": { + "categories": [ + { + "id": 0, + "missing": false, + "name": "Very favorable", + "numeric_value": 0, + "selected": false + }, + { + "id": 2, + "missing": false, + "name": "Somewhat favorable", + "numeric_value": 2, + "selected": false + }, + { + "id": 3, + "missing": false, + "name": "Somewhat unfavorable", + "numeric_value": 3, + "selected": false + }, + { + "id": 4, + "missing": false, + "name": "Very unfavorable", + "numeric_value": 4, + "selected": false + }, + { + "id": 5, + "missing": false, + "name": "Don't know", + "numeric_value": 5, + "selected": false + }, + { + "id": 32766, + "missing": true, + "name": "skipped", + "numeric_value": 32766, + "selected": false + }, + { + "id": 32767, + "missing": true, + "name": "not asked", + "numeric_value": 32767, + "selected": false + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null, + "selected": false + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "0061", + "0062", + "fb4492a07d5142f9a9a49de9c07ce8a1" + ] + } + }, + { + "derived": true, + "references": { + "alias": "1984_countries", + "description": "Which of the following countries from 1984 would you live in? (select all that apply)", + "name": "Countries from 1984", + "notes": "A multiple response variable, where one item has no responses", + "subreferences": [ + { + "alias": "eurasia", + "description": "union_hhold_1", + "name": "Eurasia" + }, + { + "alias": "oceania", + "description": "union_hhold_2", + "name": "Oceania" + }, + { + "alias": "eastasia", + "description": "union_hhold_3", + "name": "Eastasia" + }, + { + "alias": "disputed", + "name": "Disputed" + } + ], + "uniform_basis": false }, - "result": { - "dimensions": [ - { - "derived": true, - "references": { - "description": "Do you have a favorable or an unfavorable opinion of the following abolitionists?", - "subreferences": [ - { - "alias": "douglass", - "name": "Frederick Douglass", - "description": "fav_ppdem" - }, - { - "alias": "brown", - "name": "John Brown", - "description": "fav_pprep" - }, - { - "alias": "truth", - "name": "Sojourner Truth" - } - ], - "notes": "A categorical array variable, where one item has no responses", - "name": "Abolitionists", - "alias": "abolitionists", - "view": { - "show_counts": false, - "include_missing": false, - "column_width": null - } - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "douglass", - "name": "Frederick Douglass", - "description": "fav_ppdem" - }, - "id": "0061" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "brown", - "name": "John Brown", - "description": "fav_pprep" - }, - "id": "0062" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "truth", - "name": "Sojourner Truth" - }, - "id": "fb4492a07d5142f9a9a49de9c07ce8a1" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "derived": false, - "references": { - "description": "Do you have a favorable or an unfavorable opinion of the following abolitionists?", - "subreferences": [ - { - "alias": "douglass", - "name": "Frederick Douglass", - "description": "fav_ppdem" - }, - { - "alias": "brown", - "name": "John Brown", - "description": "fav_pprep" - }, - { - "alias": "truth", - "name": "Sojourner Truth" - } - ], - "notes": "A categorical array variable, where one item has no responses", - "name": "Abolitionists", - "alias": "abolitionists", - "view": { - "show_counts": false, - "include_missing": false, - "column_width": null - } - }, - "type": { - "ordinal": false, - "subvariables": [ - "0061", - "0062", - "fb4492a07d5142f9a9a49de9c07ce8a1" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 0, - "selected": false, - "id": 0, - "name": "Very favorable", - "missing": false - }, - { - "numeric_value": 2, - "selected": false, - "id": 2, - "name": "Somewhat favorable", - "missing": false - }, - { - "numeric_value": 3, - "selected": false, - "id": 3, - "name": "Somewhat unfavorable", - "missing": false - }, - { - "numeric_value": 4, - "selected": false, - "id": 4, - "name": "Very unfavorable", - "missing": false - }, - { - "numeric_value": 5, - "selected": false, - "id": 5, - "name": "Don't know", - "missing": false - }, - { - "numeric_value": 32766, - "selected": false, - "id": 32766, - "name": "skipped", - "missing": true - }, - { - "numeric_value": 32767, - "selected": false, - "id": 32767, - "name": "not asked", - "missing": true - }, - { - "numeric_value": null, - "selected": false, - "id": -1, - "name": "No Data", - "missing": true - } - ] - } - }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": "Which of the following countries from 1984 would you live in? (select all that apply)", - "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", - "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" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "oceania", - "name": "Oceania", - "description": "union_hhold_2" - }, - "id": "00c6" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "eastasia", - "name": "Eastasia", - "description": "union_hhold_3" - }, - "id": "00c7" - }, - "missing": false - }, - { - "id": 4, - "value": { - "derived": false, - "references": { - "alias": "disputed", - "name": "Disputed" - }, - "id": "11b45a85e5ac4011bd3cf884b8a2476f" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "references": { - "uniform_basis": false, - "description": "Which of the following countries from 1984 would you live in? (select all that apply)", - "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", - "name": "Countries from 1984" - }, - "derived": true, - "type": { - "ordinal": false, - "subvariables": [ - "00c5", - "00c6", - "00c7", - "11b45a85e5ac4011bd3cf884b8a2476f" - ], - "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" - } - ] - } + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00c5", + "references": { + "alias": "eurasia", + "description": "union_hhold_1", + "name": "Eurasia" + } + } + }, + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00c6", + "references": { + "alias": "oceania", + "description": "union_hhold_2", + "name": "Oceania" + } + } + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00c7", + "references": { + "alias": "eastasia", + "description": "union_hhold_3", + "name": "Eastasia" } - ], - "missing": 10, - "measures": { - "count": { - "data": [ - 22.2609925032701, - 16.9844835303167, - 222.310511064138, - 21.4670764652966, - 18.7623471388787, - 221.32656349355, - 219.182324478491, - 3.19926616430062, - 39.1743964549334, - 0, - 0, - 261.555987097725, - 34.4602057043984, - 38.9081180709724, - 318.459577115524, - 44.0133766327096, - 40.2937863255125, - 307.520737932672, - 314.365248914328, - 11.0374449013001, - 66.4252070752666, - 0, - 0, - 391.827900890895, - 25.5630888770301, - 35.7209072453127, - 202.837216191128, - 25.335068002585, - 30.4374108415629, - 208.348733469323, - 217.584012509558, - 8.94596533741205, - 37.5912344665001, - 0, - 0, - 264.121212313471, - 32.4017181382625, - 31.0352661360065, - 438.013129815619, - 33.841067995359, - 33.331393844497, - 434.277652250033, - 438.909164860856, - 5.0196677412525, - 57.5212814877798, - 0, - 0, - 501.450114089889, - 4.99112939798944, - 28.002444742699, - 179.351243978733, - 8.54509709144171, - 26.3461434771868, - 177.453577550793, - 198.80859162999, - 1.65630126551221, - 11.8799252239189, - 0, - 0, - 212.344818119421, - 0.752560977946403, - 6.91918433229187, - 23.0282221783644, - 3.60847290734546, - 5.74004220502229, - 21.351452376235, - 23.6917151822036, - 3.82636054837688, - 3.18189175802228, - 0, - 0, - 30.6999674886027, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 15.1064515178025, - 14.8964289544671, - 140.995495924001, - 21.0230096950105, - 12.9669188119134, - 137.008447889347, - 135.917515423371, - 3.7245122738576, - 31.3563486990416, - 0, - 0, - 170.998376396271, - 32.5604100093203, - 41.4234601652912, - 329.92570090253, - 34.3230034411795, - 41.2112974042019, - 328.37527023176, - 338.33312724915, - 9.33037214070239, - 56.2460716872887, - 0, - 0, - 403.909571077141, - 25.1241675577809, - 28.2218351521075, - 215.050092465812, - 29.5531524247545, - 26.870502142431, - 211.972440608514, - 217.765472615634, - 8.59861013012241, - 42.0320124299436, - 0, - 0, - 268.3960951757, - 41.5686964119083, - 41.9334112591193, - 486.723309333154, - 40.0469902636259, - 43.5846394210477, - 486.593787319508, - 492.635593733922, - 6.88919293488811, - 70.7006303353718, - 0, - 0, - 570.225417004182, - 5.23117131012065, - 28.002444742699, - 187.651851514459, - 8.22537078190222, - 26.3461434771868, - 186.31395330819, - 207.428925475256, - 1.65630126551221, - 11.8002408265107, - 0, - 0, - 220.885467567279, - 0.838798791964368, - 3.09282378391499, - 23.6534502035512, - 3.63863248826485, - 3.93162257587936, - 20.0148177152864, - 20.460423078094, - 3.48601721307167, - 3.63863248826485, - 0, - 0, - 27.5850727794306, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 120.429695598897, - 157.570404057599, - 1383.9999003435, - 136.810159094737, - 154.91112383266, - 1370.2787170726, - 1412.54105757542, - 33.6850059581544, - 215.773936466421, - 0, - 0, - 1661.99999999999 - ], - "n_missing": 10, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": false, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } + } + }, + { + "id": 4, + "missing": false, + "value": { + "derived": false, + "id": "11b45a85e5ac4011bd3cf884b8a2476f", + "references": { + "alias": "disputed", + "name": "Disputed" } + } + } + ], + "subtype": { + "class": "variable" + } + } + }, + { + "derived": true, + "references": { + "alias": "1984_countries", + "description": "Which of the following countries from 1984 would you live in? (select all that apply)", + "name": "Countries from 1984", + "notes": "A multiple response variable, where one item has no responses", + "subreferences": [ + { + "alias": "eurasia", + "description": "union_hhold_1", + "name": "Eurasia" + }, + { + "alias": "oceania", + "description": "union_hhold_2", + "name": "Oceania" + }, + { + "alias": "eastasia", + "description": "union_hhold_3", + "name": "Eastasia" + }, + { + "alias": "disputed", + "name": "Disputed" + } + ], + "uniform_basis": false + }, + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true + }, + { + "id": 0, + "missing": false, + "name": "Not Selected", + "numeric_value": 0 }, - "element": "crunch:cube", - "counts": [ - 34, - 21, - 257, - 29, - 23, - 260, - 251, - 6, - 55, - 0, - 0, - 312, - 39, - 36, - 340, - 43, - 35, - 337, - 335, - 11, - 69, - 0, - 0, - 415, - 26, - 23, - 222, - 26, - 20, - 225, - 223, - 7, - 41, - 0, - 0, - 271, - 37, - 26, - 427, - 33, - 28, - 429, - 424, - 6, - 60, - 0, - 0, - 490, - 6, - 18, - 129, - 7, - 17, - 129, - 140, - 1, - 12, - 0, - 0, - 153, - 1, - 4, - 16, - 3, - 3, - 15, - 16, - 2, - 3, - 0, - 0, - 21, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 15, - 16, - 141, - 19, - 14, - 139, - 139, - 5, - 28, - 0, - 0, - 172, - 36, - 35, - 288, - 31, - 35, - 293, - 294, - 8, - 57, - 0, - 0, - 359, - 23, - 25, - 234, - 30, - 23, - 229, - 233, - 7, - 42, - 0, - 0, - 282, - 62, - 32, - 573, - 50, - 34, - 583, - 560, - 10, - 97, - 0, - 0, - 667, - 6, - 18, - 135, - 7, - 17, - 135, - 146, - 1, - 12, - 0, - 0, - 159, - 1, - 2, - 20, - 4, - 3, - 16, - 17, - 2, - 4, - 0, - 0, - 23, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 143, - 128, - 1391, - 141, - 126, - 1395, - 1389, - 33, - 240, - 0, - 0, - 1662 - ], - "n": 1662 + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00c5", + "00c6", + "00c7", + "11b45a85e5ac4011bd3cf884b8a2476f" + ] } - } -} + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 22.2609925032701, + 16.9844835303167, + 222.310511064138, + 21.4670764652966, + 18.7623471388787, + 221.32656349355, + 219.182324478491, + 3.19926616430062, + 39.1743964549334, + 0, + 0, + 261.555987097725, + 34.4602057043984, + 38.9081180709724, + 318.459577115524, + 44.0133766327096, + 40.2937863255125, + 307.520737932672, + 314.365248914328, + 11.0374449013001, + 66.4252070752666, + 0, + 0, + 391.827900890895, + 25.5630888770301, + 35.7209072453127, + 202.837216191128, + 25.335068002585, + 30.4374108415629, + 208.348733469323, + 217.584012509558, + 8.94596533741205, + 37.5912344665001, + 0, + 0, + 264.121212313471, + 32.4017181382625, + 31.0352661360065, + 438.013129815619, + 33.841067995359, + 33.331393844497, + 434.277652250033, + 438.909164860856, + 5.0196677412525, + 57.5212814877798, + 0, + 0, + 501.450114089889, + 4.99112939798944, + 28.002444742699, + 179.351243978733, + 8.54509709144171, + 26.3461434771868, + 177.453577550793, + 198.80859162999, + 1.65630126551221, + 11.8799252239189, + 0, + 0, + 212.344818119421, + 0.752560977946403, + 6.91918433229187, + 23.0282221783644, + 3.60847290734546, + 5.74004220502229, + 21.351452376235, + 23.6917151822036, + 3.82636054837688, + 3.18189175802228, + 0, + 0, + 30.6999674886027, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 15.1064515178025, + 14.8964289544671, + 140.995495924001, + 21.0230096950105, + 12.9669188119134, + 137.008447889347, + 135.917515423371, + 3.7245122738576, + 31.3563486990416, + 0, + 0, + 170.998376396271, + 32.5604100093203, + 41.4234601652912, + 329.92570090253, + 34.3230034411795, + 41.2112974042019, + 328.37527023176, + 338.33312724915, + 9.33037214070239, + 56.2460716872887, + 0, + 0, + 403.909571077141, + 25.1241675577809, + 28.2218351521075, + 215.050092465812, + 29.5531524247545, + 26.870502142431, + 211.972440608514, + 217.765472615634, + 8.59861013012241, + 42.0320124299436, + 0, + 0, + 268.3960951757, + 41.5686964119083, + 41.9334112591193, + 486.723309333154, + 40.0469902636259, + 43.5846394210477, + 486.593787319508, + 492.635593733922, + 6.88919293488811, + 70.7006303353718, + 0, + 0, + 570.225417004182, + 5.23117131012065, + 28.002444742699, + 187.651851514459, + 8.22537078190222, + 26.3461434771868, + 186.31395330819, + 207.428925475256, + 1.65630126551221, + 11.8002408265107, + 0, + 0, + 220.885467567279, + 0.838798791964368, + 3.09282378391499, + 23.6534502035512, + 3.63863248826485, + 3.93162257587936, + 20.0148177152864, + 20.460423078094, + 3.48601721307167, + 3.63863248826485, + 0, + 0, + 27.5850727794306, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 120.429695598897, + 157.570404057599, + 1383.9999003435, + 136.810159094737, + 154.91112383266, + 1370.2787170726, + 1412.54105757542, + 33.6850059581544, + 215.773936466421, + 0, + 0, + 1661.99999999999 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 10 + } + }, + "missing": 10, + "n": 1662 + } +} \ No newline at end of file diff --git a/tests/fixtures/ca-x-single-cat.json b/tests/fixtures/ca-x-single-cat.json index aba97c19b..5418ad24b 100644 --- a/tests/fixtures/ca-x-single-cat.json +++ b/tests/fixtures/ca-x-single-cat.json @@ -1,279 +1,264 @@ { - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/0063c146f72945b7a54dbe7edb35e15c/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F0063c146f72945b7a54dbe7edb35e15c%2Fvariables%2F00000b%2F%22%7D,%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F0063c146f72945b7a54dbe7edb35e15c%2Fvariables%2F00000b%2F%22%7D,%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F0063c146f72945b7a54dbe7edb35e15c%2Fvariables%2F3dc48bd3ebb74966ab55de5f69e47561%2F%22%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": [ - - ] + "query": { + "dimensions": [ + { + "each": "https://alpha.crunch.io/api/datasets/0063c146f72945b7a54dbe7edb35e15c/variables/00000b/" + }, + { + "variable": "https://alpha.crunch.io/api/datasets/0063c146f72945b7a54dbe7edb35e15c/variables/00000b/" + }, + { + "variable": "https://alpha.crunch.io/api/datasets/0063c146f72945b7a54dbe7edb35e15c/variables/3dc48bd3ebb74966ab55de5f69e47561/" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": null + }, + "result": { + "counts": [ + 13, + 32, + 0, + 12, + 22, + 0, + 8, + 13, + 0, + 16, + 24, + 0, + 12, + 28, + 0, + 5, + 15, + 0, + 11, + 21, + 0, + 12, + 26, + 0, + 10, + 20, + 0 + ], + "dimensions": [ + { + "derived": true, + "references": { + "alias": "pets_array", + "description": "Pets Array", + "is_dichotomous": false, + "name": "pets_array", + "subreferences": [ + { + "alias": "a_cat", + "description": "a_cat", + "name": "cat" + }, + { + "alias": "a_dog", + "description": "a_dog", + "name": "dog" + }, + { + "alias": "a_wombat", + "description": "a_wombat", + "name": "wombat" + } + ] + }, + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "0003", + "references": { + "alias": "a_cat", + "description": "a_cat", + "name": "cat" + } + } + }, + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "0004", + "references": { + "alias": "a_dog", + "description": "a_dog", + "name": "dog" } + } }, - "dimensions": [ - { - "each": "https://alpha.crunch.io/api/datasets/0063c146f72945b7a54dbe7edb35e15c/variables/00000b/" - }, - { - "variable": "https://alpha.crunch.io/api/datasets/0063c146f72945b7a54dbe7edb35e15c/variables/00000b/" - }, - { - "variable": "https://alpha.crunch.io/api/datasets/0063c146f72945b7a54dbe7edb35e15c/variables/3dc48bd3ebb74966ab55de5f69e47561/" + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "0005", + "references": { + "alias": "a_wombat", + "description": "a_wombat", + "name": "wombat" } - ], - "weight": null + } + } + ], + "subtype": { + "class": "variable" + } + } + }, + { + "derived": false, + "references": { + "alias": "pets_array", + "description": "Pets Array", + "is_dichotomous": false, + "name": "pets_array", + "subreferences": [ + { + "alias": "a_cat", + "description": "a_cat", + "name": "cat" + }, + { + "alias": "a_dog", + "description": "a_dog", + "name": "dog" + }, + { + "alias": "a_wombat", + "description": "a_wombat", + "name": "wombat" + } + ] }, - "query_environment": { - "filter": [ - - ] + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "not selected", + "numeric_value": 1 + }, + { + "id": 2, + "missing": false, + "name": "selected", + "numeric_value": 2 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "0003", + "0004", + "0005" + ] + } + }, + { + "derived": true, + "references": { + "alias": "Fruit Single CAT", + "description": "Fruits", + "name": "Fruit Single CAT" }, - "result": { - "dimensions": [ - { - "derived": true, - "references": { - "alias": "pets_array", - "subreferences": [ - { - "alias": "a_cat", - "name": "cat", - "description": "a_cat" - }, - { - "alias": "a_dog", - "name": "dog", - "description": "a_dog" - }, - { - "alias": "a_wombat", - "name": "wombat", - "description": "a_wombat" - } - ], - "is_dichotomous": false, - "description": "Pets Array", - "name": "pets_array" - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "a_cat", - "name": "cat", - "description": "a_cat" - }, - "id": "0003" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "a_dog", - "name": "dog", - "description": "a_dog" - }, - "id": "0004" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "a_wombat", - "name": "wombat", - "description": "a_wombat" - }, - "id": "0005" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "derived": false, - "references": { - "alias": "pets_array", - "is_dichotomous": false, - "description": "Pets Array", - "name": "pets_array", - "subreferences": [ - { - "alias": "a_cat", - "name": "cat", - "description": "a_cat" - }, - { - "alias": "a_dog", - "name": "dog", - "description": "a_dog" - }, - { - "alias": "a_wombat", - "name": "wombat", - "description": "a_wombat" - } - ] - }, - "type": { - "ordinal": false, - "subvariables": [ - "0003", - "0004", - "0005" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "missing": false, - "id": 1, - "name": "not selected" - }, - { - "numeric_value": 2, - "missing": false, - "id": 2, - "name": "selected" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - }, - { - "derived": true, - "references": { - "alias": "Fruit Single CAT", - "name": "Fruit Single CAT", - "description": "Fruits" - }, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": null, - "missing": false, - "id": 1, - "name": "rambutan" - }, - { - "numeric_value": null, - "missing": true, - "id": 2, - "name": "satsuma" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - } - ], - "missing": 70, - "measures": { - "count": { - "data": [ - 13, - 32, - 0, - 12, - 22, - 0, - 8, - 13, - 0, - 16, - 24, - 0, - 12, - 28, - 0, - 5, - 15, - 0, - 11, - 21, - 0, - 12, - 26, - 0, - 10, - 20, - 0 - ], - "n_missing": 70, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": true, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "rambutan", + "numeric_value": null + }, + { + "id": 2, + "missing": true, + "name": "satsuma", + "numeric_value": null }, - "element": "crunch:cube", - "counts": [ - 13, - 32, - 0, - 12, - 22, - 0, - 8, - 13, - 0, - 16, - 24, - 0, - 12, - 28, - 0, - 5, - 15, - 0, - 11, - 21, - 0, - 12, - 26, - 0, - 10, - 20, - 0 - ], - "n": 100 + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false } - } -} + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 13, + 32, + 0, + 12, + 22, + 0, + 8, + 13, + 0, + 16, + 24, + 0, + 12, + 28, + 0, + 5, + 15, + 0, + 11, + 21, + 0, + 12, + 26, + 0, + 10, + 20, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": true, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 70 + } + }, + "missing": 70, + "n": 100 + } +} \ No newline at end of file diff --git a/tests/fixtures/cat-hs-x-mr-augmented-wgtd.json b/tests/fixtures/cat-hs-x-mr-augmented-wgtd.json index a4aab5859..8839281eb 100644 --- a/tests/fixtures/cat-hs-x-mr-augmented-wgtd.json +++ b/tests/fixtures/cat-hs-x-mr-augmented-wgtd.json @@ -1,1497 +1,1456 @@ { - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F0yADwLRARYg8QMoiERXLx3000107%2F%22%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%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:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F0yADwLRARYg8QMoiERXLx300011d%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [] - } + "query": { + "dimensions": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx3000107/" }, - "dimensions": [ - { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx3000107/" - }, - { - "function": "dimension", - "args": [ - { - "function": "as_selected", - "args": [ + { + "args": [ + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + }, + { + "value": "subvariables" + } + ], + "function": "dimension" + }, + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + }, + { + "args": [ + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + }, + { + "value": "subvariables" + } + ], + "function": "dimension" + }, + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" + }, + "result": { + "counts": [ + 711, + 0, + 0, + 489, + 222, + 0, + 142, + 569, + 0, + 0, + 694, + 0, + 75, + 619, + 0, + 220, + 474, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 489, + 75, + 0, + 564, + 0, + 0, + 111, + 453, + 0, + 222, + 619, + 0, + 0, + 841, + 0, + 251, + 590, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 142, + 220, + 0, + 111, + 251, + 0, + 362, + 0, + 0, + 569, + 474, + 0, + 453, + 590, + 0, + 0, + 1043, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1744, + 0, + 0, + 1289, + 455, + 0, + 372, + 1372, + 0, + 0, + 2169, + 0, + 196, + 1973, + 0, + 914, + 1255, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1289, + 196, + 0, + 1485, + 0, + 0, + 306, + 1179, + 0, + 455, + 1973, + 0, + 0, + 2428, + 0, + 980, + 1448, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 372, + 914, + 0, + 306, + 980, + 0, + 1286, + 0, + 0, + 1372, + 1255, + 0, + 1179, + 1448, + 0, + 0, + 2627, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1375, + 0, + 0, + 1098, + 277, + 0, + 242, + 1133, + 0, + 0, + 2212, + 0, + 193, + 2019, + 0, + 1245, + 967, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1098, + 193, + 0, + 1291, + 0, + 0, + 217, + 1074, + 0, + 277, + 2019, + 0, + 0, + 2296, + 0, + 1270, + 1026, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 242, + 1245, + 0, + 217, + 1270, + 0, + 1487, + 0, + 0, + 1133, + 967, + 0, + 1074, + 1026, + 0, + 0, + 2100, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1220, + 0, + 0, + 1001, + 219, + 0, + 123, + 1097, + 0, + 0, + 1864, + 0, + 144, + 1720, + 0, + 1185, + 679, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1001, + 144, + 0, + 1145, + 0, + 0, + 120, + 1025, + 0, + 219, + 1720, + 0, + 0, + 1939, + 0, + 1188, + 751, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 123, + 1185, + 0, + 120, + 1188, + 0, + 1308, + 0, + 0, + 1097, + 679, + 0, + 1025, + 751, + 0, + 0, + 1776, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 24, + 0, + 0, + 14, + 10, + 0, + 10, + 14, + 0, + 0, + 30, + 0, + 2, + 28, + 0, + 12, + 18, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 14, + 2, + 0, + 16, + 0, + 0, + 7, + 9, + 0, + 10, + 28, + 0, + 0, + 38, + 0, + 15, + 23, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 12, + 0, + 7, + 15, + 0, + 22, + 0, + 0, + 14, + 18, + 0, + 9, + 23, + 0, + 0, + 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": false, + "references": { + "alias": "F_AGECAT", + "description": "Age category", + "name": "F_AGECAT", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ + { + "anchor": "top", + "args": [ + 1, + 2 + ], + "function": "subtotal", + "name": "18–49" + }, + { + "anchor": "top", + "args": [ + 3, + 4 + ], + "function": "subtotal", + "name": "≥50" + }, + { + "anchor": 2, + "args": [ + 3, + 2 + ], + "function": "subtotal", + "name": "test12" + }, { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + "anchor": "bottom", + "args": [ + 4, + 99 + ], + "function": "subtotal", + "name": "test" } ] - }, - { - "value": "subvariables" } - ] + } }, - { - "function": "as_selected", - "args": [ + "type": { + "categories": [ { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" - } - ] - }, - { - "function": "dimension", - "args": [ + "id": 1, + "missing": false, + "name": "18-29", + "numeric_value": 1 + }, { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" - } - ] + "id": 2, + "missing": false, + "name": "30-49", + "numeric_value": 2 }, { - "value": "subvariables" - } - ] - }, - { - "function": "as_selected", - "args": [ + "id": 3, + "missing": false, + "name": "50-64", + "numeric_value": 3 + }, + { + "id": 4, + "missing": false, + "name": "65+", + "numeric_value": 4 + }, { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + "id": 99, + "missing": false, + "name": "Refused", + "numeric_value": 99 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null } - ] + ], + "class": "categorical", + "ordinal": false } - ], - "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" - }, - "query_environment": { - "filter": [] - }, - "result": { - "dimensions": [ - { - "references": { - "alias": "F_AGECAT", - "description": "Age category", - "name": "F_AGECAT", - "view": { - "show_counts": false, - "show_numeric_values": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 1, - 2 - ], - "name": "18–49", - "anchor": "top" - }, - { - "function": "subtotal", - "args": [ - 3, - 4 - ], - "name": "≥50", - "anchor": "top" - }, - { - "function": "subtotal", - "args": [ - 3, - 2 - ], - "name": "test12", - "anchor": 2 - }, - { - "function": "subtotal", - "args": [ - 4, - 99 - ], - "name": "test", - "anchor": "bottom" - } - ] - }, - "include_missing": false, - "column_width": null + }, + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 } }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "missing": false, - "id": 1, - "name": "18-29" - }, - { - "numeric_value": 2, - "missing": false, - "id": 2, - "name": "30-49" - }, - { - "numeric_value": 3, - "missing": false, - "id": 3, - "name": "50-64" - }, - { - "numeric_value": 4, - "missing": false, - "id": 4, - "name": "65+" - }, - { - "numeric_value": 99, - "missing": false, - "id": 99, - "name": "Refused" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - { - "references": { - "uniform_basis": false, - "description": null, - "name": "Trust", - "format": { - "summary": { - "digits": 0 + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00000", + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + } } }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00002", + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + } } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null - } - }, - "derived": true, - "type": { - "subtype": { - "class": "variable" }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - "id": "00000" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - "id": "00002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - }, - "id": "00001" - }, - "missing": false + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00001", + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } } - ], - "class": "enum" + } + ], + "subtype": { + "class": "variable" } - }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": null, - "format": { - "summary": { - "digits": 0 - } + } + }, + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 + } + }, + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" }, - "name": "Trust" - }, - "type": { - "ordinal": false, - "subvariables": [ - "00000", - "00002", - "00001" - ], - "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" - } - ] + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - { - "references": { - "uniform_basis": false, - "description": null, - "name": "Trust", - "format": { - "summary": { - "digits": 0 - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null + { + "id": 0, + "missing": false, + "name": "Other", + "numeric_value": 0 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ] + } + }, + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 } }, - "derived": true, - "type": { - "subtype": { - "class": "variable" + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - "id": "00000" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - "id": "00002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - }, - "id": "00001" - }, - "missing": false - } - ], - "class": "enum" + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": null, - "format": { - "summary": { - "digits": 0 + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00000", + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + } } }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00002", + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + } } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null }, - "name": "Trust" - }, - "type": { - "ordinal": false, - "subvariables": [ - "00000", - "00002", - "00001" - ], - "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" + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00001", + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } } - ] - } - } - ], - "missing": 0, - "measures": { - "count": { - "data": [ - 1002.5234324131684, - 0, - 0, - 645.5602359951876, - 356.9631964179815, - 0, - 240.67289101199108, - 761.8505414011779, - 0, - 0, - 1247.7916049952876, - 0, - 120.39056204551068, - 1127.401042949778, - 0, - 415.7664839603485, - 832.0251210349411, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 645.5602359951876, - 120.39056204551068, - 0, - 765.9507980406985, - 0, - 0, - 185.25535349052006, - 580.6954445501777, - 0, - 356.9631964179815, - 1127.401042949778, - 0, - 0, - 1484.3642393677555, - 0, - 471.1840214818194, - 1013.1802178859404, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 240.67289101199108, - 415.7664839603485, - 0, - 185.25535349052006, - 471.1840214818194, - 0, - 656.4393749723399, - 0, - 0, - 761.8505414011779, - 832.0251210349411, - 0, - 580.6954445501777, - 1013.1802178859404, - 0, - 0, - 1593.8756624361115, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1520.2348209127326, - 0, - 0, - 1088.6831051455192, - 431.55171576721705, - 0, - 416.88658440033595, - 1103.3482365123994, - 0, - 0, - 2573.2276224677926, - 0, - 202.40947405155643, - 2370.8181484162387, - 0, - 1178.5575392459032, - 1394.6700832218874, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1088.6831051455192, - 202.40947405155643, - 0, - 1291.0925791970749, - 0, - 0, - 337.8370954349569, - 953.2554837621217, - 0, - 431.55171576721705, - 2370.8181484162387, - 0, - 0, - 2802.3698641834494, - 0, - 1257.6070282112817, - 1544.7628359721687, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 416.88658440033595, - 1178.5575392459032, - 0, - 337.8370954349569, - 1257.6070282112817, - 0, - 1595.4441236462358, - 0, - 0, - 1103.3482365123994, - 1394.6700832218874, - 0, - 953.2554837621217, - 1544.7628359721687, - 0, - 0, - 2498.0183197342967, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 908.6566750086301, - 0, - 0, - 699.1064519467798, - 209.55022306184983, - 0, - 261.88391990858304, - 646.7727551000474, - 0, - 0, - 2254.626234708468, - 0, - 142.65793991683756, - 2111.9682947916294, - 0, - 1341.9120476404512, - 912.7141870680143, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 699.1064519467798, - 142.65793991683756, - 0, - 841.7643918636179, - 0, - 0, - 214.58026555613168, - 627.1841263074863, - 0, - 209.55022306184983, - 2111.9682947916294, - 0, - 0, - 2321.5185178534775, - 0, - 1389.2157019929016, - 932.3028158605755, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 261.88391990858304, - 1341.9120476404512, - 0, - 214.58026555613168, - 1389.2157019929016, - 0, - 1603.7959675490333, - 0, - 0, - 646.7727551000474, - 912.7141870680143, - 0, - 627.1841263074863, - 932.3028158605755, - 0, - 0, - 1559.4869421680564, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 746.8900823558639, - 0, - 0, - 604.9871915620402, - 141.90289079382256, - 0, - 124.00836666649133, - 622.8817156893717, - 0, - 0, - 1753.2632224112933, - 0, - 116.3952893029048, - 1636.8679331083893, - 0, - 1131.8620227754368, - 621.4011996358547, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 604.9871915620402, - 116.3952893029048, - 0, - 721.3824808649454, - 0, - 0, - 118.44696552131786, - 602.9355153436267, - 0, - 141.90289079382256, - 1636.8679331083893, - 0, - 0, - 1778.770823902211, - 0, - 1137.4234239206107, - 641.3473999815998, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 124.00836666649133, - 1131.8620227754368, - 0, - 118.44696552131786, - 1137.4234239206107, - 0, - 1255.8703894419277, - 0, - 0, - 622.8817156893717, - 621.4011996358547, - 0, - 602.9355153436267, - 641.3473999815998, - 0, - 0, - 1244.2829153252233, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 9.83166357273626, - 0, - 0, - 8.05036409050453, - 1.781299482231725, - 0, - 4.30851759454994, - 5.5231459781863155, - 0, - 0, - 25.955125403512575, - 0, - 0.18103843545111914, - 25.774086968061457, - 0, - 17.90643840416656, - 8.048686999346012, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8.05036409050453, - 0.18103843545111914, - 0, - 8.23140252595565, - 0, - 0, - 3.5901487259238825, - 4.641253800031767, - 0, - 1.781299482231725, - 25.774086968061457, - 0, - 0, - 27.555386450293184, - 0, - 18.62480727279262, - 8.93057917750056, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 4.30851759454994, - 17.90643840416656, - 0, - 3.5901487259238825, - 18.62480727279262, - 0, - 22.2149559987165, - 0, - 0, - 5.5231459781863155, - 8.048686999346012, - 0, - 4.641253800031767, - 8.93057917750056, - 0, - 0, - 13.571832977532326, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 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": 0, - "metadata": { - "references": {}, - "derived": true, - "type": { - "integer": false, - "missing_rules": {}, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" } + ], + "subtype": { + "class": "variable" } } }, - "n": 12043, - "filter_stats": { - "filtered_complete": { - "unweighted": { - "selected": 12043, - "other": 0, - "missing": 0 + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 + } }, - "weighted": { - "selected": 12043.000484249482, - "other": 0, - "missing": 0 + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - "filtered": { - "unweighted": { - "selected": 12043, - "other": 0, - "missing": 0 - }, - "weighted": { - "selected": 12043.000484249482, - "other": 0, - "missing": 0 - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true + }, + { + "id": 0, + "missing": false, + "name": "Other", + "numeric_value": 0 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ] } - }, - "unfiltered": { - "unweighted_n": 12043, - "weighted_n": 12043.000484249482 - }, - "filtered": { - "unweighted_n": 12043, - "weighted_n": 12043.000484249482 - }, - "counts": [ - 711, - 0, - 0, - 489, - 222, - 0, - 142, - 569, - 0, - 0, - 694, - 0, - 75, - 619, - 0, - 220, - 474, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 489, - 75, - 0, - 564, - 0, - 0, - 111, - 453, - 0, - 222, - 619, - 0, - 0, - 841, - 0, - 251, - 590, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 142, - 220, - 0, - 111, - 251, - 0, - 362, - 0, - 0, - 569, - 474, - 0, - 453, - 590, - 0, - 0, - 1043, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1744, - 0, - 0, - 1289, - 455, - 0, - 372, - 1372, - 0, - 0, - 2169, - 0, - 196, - 1973, - 0, - 914, - 1255, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1289, - 196, - 0, - 1485, - 0, - 0, - 306, - 1179, - 0, - 455, - 1973, - 0, - 0, - 2428, - 0, - 980, - 1448, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 372, - 914, - 0, - 306, - 980, - 0, - 1286, - 0, - 0, - 1372, - 1255, - 0, - 1179, - 1448, - 0, - 0, - 2627, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1375, - 0, - 0, - 1098, - 277, - 0, - 242, - 1133, - 0, - 0, - 2212, - 0, - 193, - 2019, - 0, - 1245, - 967, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1098, - 193, - 0, - 1291, - 0, - 0, - 217, - 1074, - 0, - 277, - 2019, - 0, - 0, - 2296, - 0, - 1270, - 1026, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 242, - 1245, - 0, - 217, - 1270, - 0, - 1487, - 0, - 0, - 1133, - 967, - 0, - 1074, - 1026, - 0, - 0, - 2100, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1220, - 0, - 0, - 1001, - 219, - 0, - 123, - 1097, - 0, - 0, - 1864, - 0, - 144, - 1720, - 0, - 1185, - 679, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1001, - 144, - 0, - 1145, - 0, - 0, - 120, - 1025, - 0, - 219, - 1720, - 0, - 0, - 1939, - 0, - 1188, - 751, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 123, - 1185, - 0, - 120, - 1188, - 0, - 1308, - 0, - 0, - 1097, - 679, - 0, - 1025, - 751, - 0, - 0, - 1776, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 24, - 0, - 0, - 14, - 10, - 0, - 10, - 14, - 0, - 0, - 30, - 0, - 2, - 28, - 0, - 12, - 18, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 14, - 2, - 0, - 16, - 0, - 0, - 7, - 9, - 0, - 10, - 28, - 0, - 0, - 38, - 0, - 15, - 23, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 10, - 12, - 0, - 7, - 15, - 0, - 22, - 0, - 0, - 14, - 18, - 0, - 9, - 23, - 0, - 0, - 32, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "element": "crunch:cube" - } + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 1002.5234324131684, + 0, + 0, + 645.5602359951876, + 356.9631964179815, + 0, + 240.67289101199108, + 761.8505414011779, + 0, + 0, + 1247.7916049952876, + 0, + 120.39056204551068, + 1127.401042949778, + 0, + 415.7664839603485, + 832.0251210349411, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 645.5602359951876, + 120.39056204551068, + 0, + 765.9507980406985, + 0, + 0, + 185.25535349052006, + 580.6954445501777, + 0, + 356.9631964179815, + 1127.401042949778, + 0, + 0, + 1484.3642393677555, + 0, + 471.1840214818194, + 1013.1802178859404, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 240.67289101199108, + 415.7664839603485, + 0, + 185.25535349052006, + 471.1840214818194, + 0, + 656.4393749723399, + 0, + 0, + 761.8505414011779, + 832.0251210349411, + 0, + 580.6954445501777, + 1013.1802178859404, + 0, + 0, + 1593.8756624361115, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1520.2348209127326, + 0, + 0, + 1088.6831051455192, + 431.55171576721705, + 0, + 416.88658440033595, + 1103.3482365123994, + 0, + 0, + 2573.2276224677926, + 0, + 202.40947405155643, + 2370.8181484162387, + 0, + 1178.5575392459032, + 1394.6700832218874, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1088.6831051455192, + 202.40947405155643, + 0, + 1291.0925791970749, + 0, + 0, + 337.8370954349569, + 953.2554837621217, + 0, + 431.55171576721705, + 2370.8181484162387, + 0, + 0, + 2802.3698641834494, + 0, + 1257.6070282112817, + 1544.7628359721687, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 416.88658440033595, + 1178.5575392459032, + 0, + 337.8370954349569, + 1257.6070282112817, + 0, + 1595.4441236462358, + 0, + 0, + 1103.3482365123994, + 1394.6700832218874, + 0, + 953.2554837621217, + 1544.7628359721687, + 0, + 0, + 2498.0183197342967, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 908.6566750086301, + 0, + 0, + 699.1064519467798, + 209.55022306184983, + 0, + 261.88391990858304, + 646.7727551000474, + 0, + 0, + 2254.626234708468, + 0, + 142.65793991683756, + 2111.9682947916294, + 0, + 1341.9120476404512, + 912.7141870680143, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 699.1064519467798, + 142.65793991683756, + 0, + 841.7643918636179, + 0, + 0, + 214.58026555613168, + 627.1841263074863, + 0, + 209.55022306184983, + 2111.9682947916294, + 0, + 0, + 2321.5185178534775, + 0, + 1389.2157019929016, + 932.3028158605755, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 261.88391990858304, + 1341.9120476404512, + 0, + 214.58026555613168, + 1389.2157019929016, + 0, + 1603.7959675490333, + 0, + 0, + 646.7727551000474, + 912.7141870680143, + 0, + 627.1841263074863, + 932.3028158605755, + 0, + 0, + 1559.4869421680564, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 746.8900823558639, + 0, + 0, + 604.9871915620402, + 141.90289079382256, + 0, + 124.00836666649133, + 622.8817156893717, + 0, + 0, + 1753.2632224112933, + 0, + 116.3952893029048, + 1636.8679331083893, + 0, + 1131.8620227754368, + 621.4011996358547, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 604.9871915620402, + 116.3952893029048, + 0, + 721.3824808649454, + 0, + 0, + 118.44696552131786, + 602.9355153436267, + 0, + 141.90289079382256, + 1636.8679331083893, + 0, + 0, + 1778.770823902211, + 0, + 1137.4234239206107, + 641.3473999815998, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 124.00836666649133, + 1131.8620227754368, + 0, + 118.44696552131786, + 1137.4234239206107, + 0, + 1255.8703894419277, + 0, + 0, + 622.8817156893717, + 621.4011996358547, + 0, + 602.9355153436267, + 641.3473999815998, + 0, + 0, + 1244.2829153252233, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 9.83166357273626, + 0, + 0, + 8.05036409050453, + 1.781299482231725, + 0, + 4.30851759454994, + 5.5231459781863155, + 0, + 0, + 25.955125403512575, + 0, + 0.18103843545111914, + 25.774086968061457, + 0, + 17.90643840416656, + 8.048686999346012, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8.05036409050453, + 0.18103843545111914, + 0, + 8.23140252595565, + 0, + 0, + 3.5901487259238825, + 4.641253800031767, + 0, + 1.781299482231725, + 25.774086968061457, + 0, + 0, + 27.555386450293184, + 0, + 18.62480727279262, + 8.93057917750056, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4.30851759454994, + 17.90643840416656, + 0, + 3.5901487259238825, + 18.62480727279262, + 0, + 22.2149559987165, + 0, + 0, + 5.5231459781863155, + 8.048686999346012, + 0, + 4.641253800031767, + 8.93057917750056, + 0, + 0, + 13.571832977532326, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 0 + } + }, + "missing": 0, + "n": 12043 } } \ No newline at end of file diff --git a/tests/fixtures/cat-hs-x-mr-wgtd.json b/tests/fixtures/cat-hs-x-mr-wgtd.json index a1420adc7..9692e479e 100644 --- a/tests/fixtures/cat-hs-x-mr-wgtd.json +++ b/tests/fixtures/cat-hs-x-mr-wgtd.json @@ -1,467 +1,426 @@ { - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F0yADwLRARYg8QMoiERXLx3000107%2F%22%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%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:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F0yADwLRARYg8QMoiERXLx300011d%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [] - } + "query": { + "dimensions": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx3000107/" }, - "dimensions": [ - { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx3000107/" - }, - { - "function": "dimension", - "args": [ - { - "function": "as_selected", - "args": [ + { + "args": [ + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + }, + { + "value": "subvariables" + } + ], + "function": "dimension" + }, + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" + }, + "result": { + "counts": [ + 711, + 694, + 0, + 564, + 841, + 0, + 362, + 1043, + 0, + 1744, + 2169, + 0, + 1485, + 2428, + 0, + 1286, + 2627, + 0, + 1375, + 2212, + 0, + 1291, + 2296, + 0, + 1487, + 2100, + 0, + 1220, + 1864, + 0, + 1145, + 1939, + 0, + 1308, + 1776, + 0, + 24, + 30, + 0, + 16, + 38, + 0, + 22, + 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": false, + "references": { + "alias": "F_AGECAT", + "description": "Age category", + "name": "F_AGECAT", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ + { + "anchor": "top", + "args": [ + 1, + 2 + ], + "function": "subtotal", + "name": "18–49" + }, + { + "anchor": "top", + "args": [ + 3, + 4 + ], + "function": "subtotal", + "name": "≥50" + }, { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + "anchor": 2, + "args": [ + 3, + 2 + ], + "function": "subtotal", + "name": "test12" + }, + { + "anchor": "bottom", + "args": [ + 4, + 99 + ], + "function": "subtotal", + "name": "test" } ] - }, - { - "value": "subvariables" } - ] + } }, - { - "function": "as_selected", - "args": [ + "type": { + "categories": [ { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" - } - ] - } - ], - "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" - }, - "query_environment": { - "filter": [] - }, - "result": { - "dimensions": [ - { - "derived": false, - "references": { - "alias": "F_AGECAT", - "view": { - "show_counts": false, - "column_width": null, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 1, - 2 - ], - "name": "18–49", - "anchor": "top" - }, - { - "function": "subtotal", - "args": [ - 3, - 4 - ], - "name": "≥50", - "anchor": "top" - }, - { - "function": "subtotal", - "args": [ - 3, - 2 - ], - "name": "test12", - "anchor": 2 - }, - { - "function": "subtotal", - "args": [ - 4, - 99 - ], - "name": "test", - "anchor": "bottom" - } - ] - }, - "include_missing": false, - "show_numeric_values": false + "_id": 0, + "id": 1, + "missing": false, + "name": "18-29", + "numeric_value": 1 }, - "description": "Age category", - "name": "F_AGECAT" - }, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "_id": 0, - "id": 1, - "name": "18-29", - "missing": false - }, - { - "numeric_value": 2, - "_id": 1, - "id": 2, - "name": "30-49", - "missing": false - }, - { - "numeric_value": 3, - "_id": 2, - "id": 3, - "name": "50-64", - "missing": false - }, - { - "numeric_value": 4, - "_id": 3, - "id": 4, - "name": "65+", - "missing": false - }, - { - "numeric_value": 99, - "_id": 4, - "id": 99, - "name": "Refused", - "missing": false - }, - { - "numeric_value": null, - "_id": -1, - "id": -1, - "name": "No Data", - "missing": true - } - ] - } - }, - { - "references": { - "uniform_basis": false, - "description": null, - "format": { - "summary": { - "digits": 0 - } + { + "_id": 1, + "id": 2, + "missing": false, + "name": "30-49", + "numeric_value": 2 }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null + { + "_id": 2, + "id": 3, + "missing": false, + "name": "50-64", + "numeric_value": 3 + }, + { + "_id": 3, + "id": 4, + "missing": false, + "name": "65+", + "numeric_value": 4 + }, + { + "_id": 4, + "id": 99, + "missing": false, + "name": "Refused", + "numeric_value": 99 }, - "name": "Trust" + { + "_id": -1, + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false + } + }, + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 + } }, - "derived": true, - "type": { - "subtype": { - "class": "variable" + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - "id": "00000" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - "id": "00002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - }, - "id": "00001" - }, - "missing": false - } - ], - "class": "enum" + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": null, - "name": "Trust", - "format": { - "summary": { - "digits": 0 + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00000", + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + } } }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00002", + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + } } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null - } - }, - "type": { - "ordinal": false, - "subvariables": [ - "00000", - "00002", - "00001" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "selected": true, - "id": 1, - "name": "Selected", - "missing": false - }, - { - "numeric_value": 0, - "id": 0, - "name": "Other", - "missing": false - }, - { - "numeric_value": null, - "id": -1, - "name": "No Data", - "missing": true + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00001", + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } } - ] - } - } - ], - "missing": 0, - "measures": { - "count": { - "data": [ - 1002.5234324131684, - 1247.7916049952876, - 0, - 765.9507980406985, - 1484.3642393677555, - 0, - 656.4393749723399, - 1593.8756624361115, - 0, - 1520.2348209127326, - 2573.2276224677926, - 0, - 1291.0925791970749, - 2802.3698641834494, - 0, - 1595.4441236462358, - 2498.0183197342967, - 0, - 908.6566750086301, - 2254.626234708468, - 0, - 841.7643918636179, - 2321.5185178534775, - 0, - 1603.7959675490333, - 1559.4869421680564, - 0, - 746.8900823558639, - 1753.2632224112933, - 0, - 721.3824808649454, - 1778.770823902211, - 0, - 1255.8703894419277, - 1244.2829153252233, - 0, - 9.83166357273626, - 25.955125403512575, - 0, - 8.23140252595565, - 27.555386450293184, - 0, - 22.2149559987165, - 13.571832977532326, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "n_missing": 0, - "metadata": { - "references": {}, - "derived": true, - "type": { - "integer": false, - "missing_rules": {}, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" } + ], + "subtype": { + "class": "variable" } } }, - "n": 12043, - "filter_stats": { - "filtered_complete": { - "unweighted": { - "selected": 12043, - "other": 0, - "missing": 0 + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 + } }, - "weighted": { - "selected": 12043.000484249482, - "other": 0, - "missing": 0 + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - "filtered": { - "unweighted": { - "selected": 12043, - "other": 0, - "missing": 0 - }, - "weighted": { - "selected": 12043.000484249482, - "other": 0, - "missing": 0 - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true + }, + { + "id": 0, + "missing": false, + "name": "Other", + "numeric_value": 0 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ] } - }, - "unfiltered": { - "unweighted_n": 12043, - "weighted_n": 12043.000484249482 - }, - "filtered": { - "unweighted_n": 12043, - "weighted_n": 12043.000484249482 - }, - "counts": [ - 711, - 694, - 0, - 564, - 841, - 0, - 362, - 1043, - 0, - 1744, - 2169, - 0, - 1485, - 2428, - 0, - 1286, - 2627, - 0, - 1375, - 2212, - 0, - 1291, - 2296, - 0, - 1487, - 2100, - 0, - 1220, - 1864, - 0, - 1145, - 1939, - 0, - 1308, - 1776, - 0, - 24, - 30, - 0, - 16, - 38, - 0, - 22, - 32, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "element": "crunch:cube" - } + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 1002.5234324131684, + 1247.7916049952876, + 0, + 765.9507980406985, + 1484.3642393677555, + 0, + 656.4393749723399, + 1593.8756624361115, + 0, + 1520.2348209127326, + 2573.2276224677926, + 0, + 1291.0925791970749, + 2802.3698641834494, + 0, + 1595.4441236462358, + 2498.0183197342967, + 0, + 908.6566750086301, + 2254.626234708468, + 0, + 841.7643918636179, + 2321.5185178534775, + 0, + 1603.7959675490333, + 1559.4869421680564, + 0, + 746.8900823558639, + 1753.2632224112933, + 0, + 721.3824808649454, + 1778.770823902211, + 0, + 1255.8703894419277, + 1244.2829153252233, + 0, + 9.83166357273626, + 25.955125403512575, + 0, + 8.23140252595565, + 27.555386450293184, + 0, + 22.2149559987165, + 13.571832977532326, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 0 + } + }, + "missing": 0, + "n": 12043 } } \ No newline at end of file diff --git a/tests/fixtures/cat-hs-x-mr.json b/tests/fixtures/cat-hs-x-mr.json index ecde45190..f1fcb4a79 100644 --- a/tests/fixtures/cat-hs-x-mr.json +++ b/tests/fixtures/cat-hs-x-mr.json @@ -1,620 +1,610 @@ { - "element": "shoji:view", - "self": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/cube/?filter=%7B%22filter%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Ffilters%2F2bf229efacc74b4e81a3e5a94657af7e%2F%22%7D&query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F000026%2F%22%7D,%7B%22each%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000dc%2F%22%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000dc%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:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F230d454e1b5942a99f870fdb0a31c8ca%2Fvariables%2F0000d0%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [ - - ] - } - }, - "dimensions": [ + "query": { + "dimensions": [ + { + "variable": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/000026/" + }, + { + "each": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dc/" + }, + { + "args": [ + { + "variable": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dc/" + } + ], + "function": "as_selected" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d0/" + }, + "query_environment": { + "filter": [ + "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/filters/2bf229efacc74b4e81a3e5a94657af7e/" + ] + }, + "result": { + "counts": [ + 8, + 7, + 40, + 7, + 8, + 40, + 4, + 9, + 42, + 13, + 7, + 35, + 27, + 5, + 23, + 7, + 17, + 102, + 16, + 18, + 92, + 21, + 16, + 89, + 36, + 14, + 76, + 58, + 11, + 57, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 6, + 51, + 253, + 26, + 49, + 235, + 39, + 42, + 229, + 130, + 29, + 151, + 134, + 33, + 143, + 5, + 64, + 332, + 27, + 59, + 315, + 54, + 57, + 290, + 190, + 31, + 180, + 166, + 42, + 193, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 0, + 0, + 4, + 0, + 0, + 4, + 2, + 0, + 2, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": false, + "references": { + "alias": "pasta", + "description": "The geometry of pasta", + "name": "Shapes of pasta", + "notes": "A categorical variable", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ { - "variable": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/000026/" + "anchor": 2, + "args": [ + 1, + 2 + ], + "function": "subtotal", + "name": "long pasta" }, { - "each": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dc/" - }, - { - "function": "as_selected", - "args": [ - { - "variable": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000dc/" - } - ] + "anchor": 6, + "args": [ + 0, + 4, + 5, + 6 + ], + "function": "subtotal", + "name": "short pasta" } - ], - "weight": "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/variables/0000d0/" + ] + } + } }, - "query_environment": { - "filter": [ - "/api/datasets/230d454e1b5942a99f870fdb0a31c8ca/filters/2bf229efacc74b4e81a3e5a94657af7e/" - ] + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Bucatini", + "numeric_value": 1 + }, + { + "id": 2, + "missing": false, + "name": "Chitarra", + "numeric_value": 2 + }, + { + "id": 0, + "missing": false, + "name": "Boccoli", + "numeric_value": 0 + }, + { + "id": 4, + "missing": false, + "name": "Orecchiette", + "numeric_value": 4 + }, + { + "id": 5, + "missing": false, + "name": "Quadrefiore", + "numeric_value": 5 + }, + { + "id": 6, + "missing": false, + "name": "Fileja", + "numeric_value": 6 + }, + { + "id": 32766, + "missing": true, + "name": "Skipped", + "numeric_value": 32766 + }, + { + "id": 32767, + "missing": true, + "name": "Not asked", + "numeric_value": 32767 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false + } + }, + { + "derived": true, + "references": { + "alias": "nordics", + "description": "Which of the following Nordic countries have you visited? (select all that apply)", + "is_dichotomous": true, + "name": "Nordic countries", + "notes": "A multiple response variable", + "subreferences": [ + { + "alias": "dk", + "description": "milstat_1", + "name": "Denmark" + }, + { + "alias": "fi", + "description": "milstat_2", + "name": "Finland" + }, + { + "alias": "is", + "description": "milstat_3", + "name": "Iceland" + }, + { + "alias": "no", + "description": "milstat_4", + "name": "Norway" + }, + { + "alias": "se", + "description": "milstat_5", + "name": "Sweden" + } + ], + "uniform_basis": false }, - "result": { - "dimensions": [ - { - "references": { - "alias": "pasta", - "notes": "A categorical variable", - "view": { - "show_counts": false, - "column_width": null, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 1, - 2 - ], - "name": "long pasta", - "anchor": 2 - }, - { - "function": "subtotal", - "args": [ - 0, - 4, - 5, - 6 - ], - "name": "short pasta", - "anchor": 6 - } - ] - }, - "include_missing": false, - "show_numeric_values": false - }, - "description": "The geometry of pasta", - "name": "Shapes of pasta" - }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "missing": false, - "id": 1, - "name": "Bucatini" - }, - { - "numeric_value": 2, - "missing": false, - "id": 2, - "name": "Chitarra" - }, - { - "numeric_value": 0, - "missing": false, - "id": 0, - "name": "Boccoli" - }, - { - "numeric_value": 4, - "missing": false, - "id": 4, - "name": "Orecchiette" - }, - { - "numeric_value": 5, - "missing": false, - "id": 5, - "name": "Quadrefiore" - }, - { - "numeric_value": 6, - "missing": false, - "id": 6, - "name": "Fileja" - }, - { - "numeric_value": 32766, - "missing": true, - "id": 32766, - "name": "Skipped" - }, - { - "numeric_value": 32767, - "missing": true, - "id": 32767, - "name": "Not asked" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": "Which of the following Nordic countries have you visited? (select all that apply)", - "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", - "is_dichotomous": true, - "name": "Nordic countries" - }, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "dk", - "name": "Denmark", - "description": "milstat_1" - }, - "id": "00c0" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "fi", - "name": "Finland", - "description": "milstat_2" - }, - "id": "00c1" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "is", - "name": "Iceland", - "description": "milstat_3" - }, - "id": "00c2" - }, - "missing": false - }, - { - "id": 4, - "value": { - "derived": false, - "references": { - "alias": "no", - "name": "Norway", - "description": "milstat_4" - }, - "id": "00c3" - }, - "missing": false - }, - { - "id": 5, - "value": { - "derived": false, - "references": { - "alias": "se", - "name": "Sweden", - "description": "milstat_5" - }, - "id": "00c4" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "references": { - "uniform_basis": false, - "description": "Which of the following Nordic countries have you visited? (select all that apply)", - "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", - "is_dichotomous": true, - "name": "Nordic countries" - }, - "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" - } - ] - } + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00c0", + "references": { + "alias": "dk", + "description": "milstat_1", + "name": "Denmark" + } + } + }, + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00c1", + "references": { + "alias": "fi", + "description": "milstat_2", + "name": "Finland" } - ], - "missing": 4, - "measures": { - "count": { - "data": [ - 13.9429388352064, - 7.8457608236017, - 37.4420619336165, - 8.98775222464318, - 6.75088547545906, - 43.4921238923224, - 2.82339879190361, - 9.39810389656636, - 47.0092589039547, - 14.0988863511179, - 6.85411398939268, - 38.2777612519141, - 24.1996722313659, - 6.74355140124564, - 28.2875379598131, - 6.09707382055611, - 26.718686588361, - 109.24835924782, - 12.5606144044164, - 28.2251273511302, - 101.278377901191, - 19.5475853813478, - 21.4339030929137, - 101.082631182476, - 43.2918709372284, - 19.8440855063107, - 78.9281632131983, - 73.3217773970914, - 14.9175541691936, - 53.8247880904524, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 4.17553624143876, - 54.6907178153611, - 254.977373906795, - 24.8653747443075, - 52.1215412608349, - 236.856711958452, - 51.0432735515856, - 40.9110163859404, - 221.889338026069, - 131.976608396645, - 33.6954282163294, - 148.17159135062, - 129.768419276977, - 36.053069785047, - 148.022138901571, - 7.415972143434, - 55.4788654934193, - 306.660319448431, - 24.3169927551292, - 53.592299451144, - 291.645864879011, - 52.3448557839427, - 50.2386009854065, - 266.971700315935, - 177.521025752456, - 29.7689365082192, - 162.265194824609, - 149.47577168069, - 37.4519525284223, - 182.627432876171, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 4.42368570698185, - 0, - 0, - 4.42368570698185, - 0, - 0, - 4.42368570698185, - 1.35440634933271, - 0, - 3.06927935764914, - 3.06927935764914, - 0, - 1.35440634933271, - 0, - 0, - 0, - 0, - 0, - 0, - 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": 4, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": false, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } + } + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00c2", + "references": { + "alias": "is", + "description": "milstat_3", + "name": "Iceland" + } + } + }, + { + "id": 4, + "missing": false, + "value": { + "derived": false, + "id": "00c3", + "references": { + "alias": "no", + "description": "milstat_4", + "name": "Norway" } + } }, - "element": "crunch:cube", - "counts": [ - 8, - 7, - 40, - 7, - 8, - 40, - 4, - 9, - 42, - 13, - 7, - 35, - 27, - 5, - 23, - 7, - 17, - 102, - 16, - 18, - 92, - 21, - 16, - 89, - 36, - 14, - 76, - 58, - 11, - 57, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 6, - 51, - 253, - 26, - 49, - 235, - 39, - 42, - 229, - 130, - 29, - 151, - 134, - 33, - 143, - 5, - 64, - 332, - 27, - 59, - 315, - 54, - 57, - 290, - 190, - 31, - 180, - 166, - 42, - 193, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 4, - 0, - 0, - 4, - 0, - 0, - 4, - 2, - 0, - 2, - 2, - 0, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 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": 896 + { + "id": 5, + "missing": false, + "value": { + "derived": false, + "id": "00c4", + "references": { + "alias": "se", + "description": "milstat_5", + "name": "Sweden" + } + } + } + ], + "subtype": { + "class": "variable" + } } - } -} + }, + { + "derived": true, + "references": { + "alias": "nordics", + "description": "Which of the following Nordic countries have you visited? (select all that apply)", + "is_dichotomous": true, + "name": "Nordic countries", + "notes": "A multiple response variable", + "subreferences": [ + { + "alias": "dk", + "description": "milstat_1", + "name": "Denmark" + }, + { + "alias": "fi", + "description": "milstat_2", + "name": "Finland" + }, + { + "alias": "is", + "description": "milstat_3", + "name": "Iceland" + }, + { + "alias": "no", + "description": "milstat_4", + "name": "Norway" + }, + { + "alias": "se", + "description": "milstat_5", + "name": "Sweden" + } + ], + "uniform_basis": false + }, + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true + }, + { + "id": 0, + "missing": false, + "name": "Other", + "numeric_value": 0 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00c0", + "00c1", + "00c2", + "00c3", + "00c4" + ] + } + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 13.9429388352064, + 7.8457608236017, + 37.4420619336165, + 8.98775222464318, + 6.75088547545906, + 43.4921238923224, + 2.82339879190361, + 9.39810389656636, + 47.0092589039547, + 14.0988863511179, + 6.85411398939268, + 38.2777612519141, + 24.1996722313659, + 6.74355140124564, + 28.2875379598131, + 6.09707382055611, + 26.718686588361, + 109.24835924782, + 12.5606144044164, + 28.2251273511302, + 101.278377901191, + 19.5475853813478, + 21.4339030929137, + 101.082631182476, + 43.2918709372284, + 19.8440855063107, + 78.9281632131983, + 73.3217773970914, + 14.9175541691936, + 53.8247880904524, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4.17553624143876, + 54.6907178153611, + 254.977373906795, + 24.8653747443075, + 52.1215412608349, + 236.856711958452, + 51.0432735515856, + 40.9110163859404, + 221.889338026069, + 131.976608396645, + 33.6954282163294, + 148.17159135062, + 129.768419276977, + 36.053069785047, + 148.022138901571, + 7.415972143434, + 55.4788654934193, + 306.660319448431, + 24.3169927551292, + 53.592299451144, + 291.645864879011, + 52.3448557839427, + 50.2386009854065, + 266.971700315935, + 177.521025752456, + 29.7689365082192, + 162.265194824609, + 149.47577168069, + 37.4519525284223, + 182.627432876171, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4.42368570698185, + 0, + 0, + 4.42368570698185, + 0, + 0, + 4.42368570698185, + 1.35440634933271, + 0, + 3.06927935764914, + 3.06927935764914, + 0, + 1.35440634933271, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 4 + } + }, + "missing": 4, + "n": 896 + } +} \ No newline at end of file diff --git a/tests/fixtures/cat-subvar-x-mr-augmented.json b/tests/fixtures/cat-subvar-x-mr-augmented.json index 6ab709d81..580562780 100644 --- a/tests/fixtures/cat-subvar-x-mr-augmented.json +++ b/tests/fixtures/cat-subvar-x-mr-augmented.json @@ -1,947 +1,906 @@ { - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F519304a0c6324316a05d8653575293b2%2Fsubvariables%2F00001%2F%22%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%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:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F0yADwLRARYg8QMoiERXLx300011d%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [] - } + "query": { + "dimensions": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/519304a0c6324316a05d8653575293b2/subvariables/00001/" }, - "dimensions": [ - { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/519304a0c6324316a05d8653575293b2/subvariables/00001/" + { + "args": [ + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + }, + { + "value": "subvariables" + } + ], + "function": "dimension" + }, + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + }, + { + "args": [ + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + }, + { + "value": "subvariables" + } + ], + "function": "dimension" + }, + { + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ], + "function": "as_selected" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" + }, + "result": { + "counts": [ + 4535, + 0, + 0, + 3574, + 961, + 0, + 593, + 3942, + 0, + 0, + 5266, + 0, + 518, + 4748, + 0, + 2706, + 2560, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3574, + 518, + 0, + 4092, + 0, + 0, + 530, + 3562, + 0, + 961, + 4748, + 0, + 0, + 5709, + 0, + 2769, + 2940, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 593, + 2706, + 0, + 530, + 2769, + 0, + 3299, + 0, + 0, + 3942, + 2560, + 0, + 3562, + 2940, + 0, + 0, + 6502, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 539, + 0, + 0, + 317, + 222, + 0, + 296, + 243, + 0, + 0, + 1703, + 0, + 92, + 1611, + 0, + 870, + 833, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 317, + 92, + 0, + 409, + 0, + 0, + 231, + 178, + 0, + 222, + 1611, + 0, + 0, + 1833, + 0, + 935, + 898, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 296, + 870, + 0, + 231, + 935, + 0, + 1166, + 0, + 0, + 243, + 833, + 0, + 178, + 898, + 0, + 0, + 1076, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": false, + "references": { + "alias": "KNOWPARTIES_b_W57__1", + "name": "Increasing taxes" }, - { - "function": "dimension", - "args": [ + "type": { + "categories": [ { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" - } - ] + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true }, { - "value": "subvariables" - } - ] - }, - { - "function": "as_selected", - "args": [ + "id": 0, + "missing": false, + "name": "Other", + "numeric_value": 0 + }, { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null } - ] - }, - { - "function": "dimension", - "args": [ + ], + "class": "categorical", + "ordinal": false + } + }, + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 + } + }, + "name": "Trust", + "notes": null, + "subreferences": [ { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" - } - ] + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" }, { - "value": "subvariables" - } - ] - }, - { - "function": "as_selected", - "args": [ + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, { - "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" } - ] - } - ], - "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" - }, - "query_environment": { - "filter": [] - }, - "result": { - "dimensions": [ - { - "references": { - "alias": "KNOWPARTIES_b_W57__1", - "name": "Increasing taxes" - }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "selected": true, - "id": 1, - "missing": false, - "name": "Selected" - }, - { - "numeric_value": 0, - "id": 0, - "name": "Other", - "missing": false - }, - { - "numeric_value": null, - "id": -1, - "name": "No Data", - "missing": true - } - ] + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - { - "references": { - "uniform_basis": false, - "description": null, - "format": { - "summary": { - "digits": 0 + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00000", + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + } } }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00002", + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + } } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null }, - "name": "Trust" - }, - "derived": true, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - "id": "00000" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - "id": "00002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - }, - "id": "00001" - }, - "missing": false + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00001", + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } } - ], - "class": "enum" + } + ], + "subtype": { + "class": "variable" } - }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": null, - "name": "Trust", - "format": { - "summary": { - "digits": 0 - } - }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null + } + }, + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 } }, - "type": { - "ordinal": false, - "subvariables": [ - "00000", - "00002", - "00001" - ], - "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" - } - ] + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - { - "references": { - "uniform_basis": false, - "description": null, - "format": { - "summary": { - "digits": 0 - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null + { + "id": 0, + "missing": false, + "name": "Other", + "numeric_value": 0 }, - "name": "Trust" + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ] + } + }, + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 + } }, - "derived": true, - "type": { - "subtype": { - "class": "variable" + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - "id": "00000" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - "id": "00002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" - }, - "id": "00001" - }, - "missing": false - } - ], - "class": "enum" + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - { - "derived": true, - "references": { - "uniform_basis": false, - "description": null, - "name": "Trust", - "format": { - "summary": { - "digits": 0 + "type": { + "class": "enum", + "elements": [ + { + "id": 1, + "missing": false, + "value": { + "derived": false, + "id": "00000", + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + } } }, - "subreferences": [ - { - "alias": "CR_SOURCESUM_NYTimes__1", - "name": "NYTimes" - }, - { - "alias": "CR_SOURCESUM_WashingtonPost__1", - "name": "WaPo" - }, - { - "alias": "CR_SOURCESUM_FoxNews__1", - "name": "FoxNews" + { + "id": 2, + "missing": false, + "value": { + "derived": false, + "id": "00002", + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + } } - ], - "notes": null, - "api_derivation": null, - "dichotomous": true, - "alias": "Trust", - "view": { - "show_counts": false, - "include_noneoftheabove": false, - "include_missing": false, - "column_width": null - } - }, - "type": { - "ordinal": false, - "subvariables": [ - "00000", - "00002", - "00001" - ], - "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" + }, + { + "id": 3, + "missing": false, + "value": { + "derived": false, + "id": "00001", + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } } - ] - } - } - ], - "missing": 0, - "measures": { - "count": { - "data": [ - 3463.892577872864, - 0, - 0, - 2646.7341674907043, - 817.1584103821615, - 0, - 589.8272763930723, - 2874.0653014797867, - 0, - 0, - 5240.548677632821, - 0, - 472.27257430366546, - 4768.276103329146, - 0, - 2655.052324985961, - 2585.4963526468764, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 2646.7341674907043, - 472.27257430366546, - 0, - 3119.0067417943724, - 0, - 0, - 528.7644489981124, - 2590.2422927962575, - 0, - 817.1584103821615, - 4768.276103329146, - 0, - 0, - 5585.43451371131, - 0, - 2716.1151523809235, - 2869.319361330401, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 589.8272763930723, - 2655.052324985961, - 0, - 528.7644489981124, - 2716.1151523809235, - 0, - 3244.879601379037, - 0, - 0, - 2874.0653014797867, - 2585.4963526468764, - 0, - 2590.2422927962575, - 2869.319361330401, - 0, - 0, - 5459.561654126631, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 724.2440963902744, - 0, - 0, - 399.6531812493329, - 324.59091514094115, - 0, - 457.9330031888786, - 266.31109320139575, - 0, - 0, - 2614.3151323535144, - 0, - 109.76172944859509, - 2504.5534029049213, - 0, - 1430.9522070403475, - 1183.3629253131694, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 399.6531812493329, - 109.76172944859509, - 0, - 509.41491069792835, - 0, - 0, - 330.9453797307386, - 178.4695309671894, - 0, - 324.59091514094115, - 2504.5534029049213, - 0, - 0, - 2829.1443180458605, - 0, - 1557.9398304984857, - 1271.2044875473734, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 457.9330031888786, - 1430.9522070403475, - 0, - 330.9453797307386, - 1557.9398304984857, - 0, - 1888.8852102292237, - 0, - 0, - 266.31109320139575, - 1183.3629253131694, - 0, - 178.4695309671894, - 1271.2044875473734, - 0, - 0, - 1449.6740185145632, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 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": 0, - "metadata": { - "references": {}, - "derived": true, - "type": { - "integer": false, - "missing_rules": {}, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" } + ], + "subtype": { + "class": "variable" } } }, - "n": 12043, - "filter_stats": { - "filtered_complete": { - "unweighted": { - "selected": 12043, - "other": 0, - "missing": 0 + { + "derived": true, + "references": { + "alias": "Trust", + "api_derivation": null, + "description": null, + "dichotomous": true, + "format": { + "summary": { + "digits": 0 + } }, - "weighted": { - "selected": 12043.000484249482, - "other": 0, - "missing": 0 + "name": "Trust", + "notes": null, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "uniform_basis": false, + "view": { + "column_width": null, + "include_missing": false, + "include_noneoftheabove": false, + "show_counts": false } }, - "filtered": { - "unweighted": { - "selected": 12043, - "other": 0, - "missing": 0 - }, - "weighted": { - "selected": 12043.000484249482, - "other": 0, - "missing": 0 - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Selected", + "numeric_value": 1, + "selected": true + }, + { + "id": 0, + "missing": false, + "name": "Other", + "numeric_value": 0 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ] } - }, - "unfiltered": { - "unweighted_n": 12043, - "weighted_n": 12043.000484249482 - }, - "filtered": { - "unweighted_n": 12043, - "weighted_n": 12043.000484249482 - }, - "counts": [ - 4535, - 0, - 0, - 3574, - 961, - 0, - 593, - 3942, - 0, - 0, - 5266, - 0, - 518, - 4748, - 0, - 2706, - 2560, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 3574, - 518, - 0, - 4092, - 0, - 0, - 530, - 3562, - 0, - 961, - 4748, - 0, - 0, - 5709, - 0, - 2769, - 2940, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 593, - 2706, - 0, - 530, - 2769, - 0, - 3299, - 0, - 0, - 3942, - 2560, - 0, - 3562, - 2940, - 0, - 0, - 6502, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 539, - 0, - 0, - 317, - 222, - 0, - 296, - 243, - 0, - 0, - 1703, - 0, - 92, - 1611, - 0, - 870, - 833, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 317, - 92, - 0, - 409, - 0, - 0, - 231, - 178, - 0, - 222, - 1611, - 0, - 0, - 1833, - 0, - 935, - 898, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 296, - 870, - 0, - 231, - 935, - 0, - 1166, - 0, - 0, - 243, - 833, - 0, - 178, - 898, - 0, - 0, - 1076, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "element": "crunch:cube" - } + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 3463.892577872864, + 0, + 0, + 2646.7341674907043, + 817.1584103821615, + 0, + 589.8272763930723, + 2874.0653014797867, + 0, + 0, + 5240.548677632821, + 0, + 472.27257430366546, + 4768.276103329146, + 0, + 2655.052324985961, + 2585.4963526468764, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2646.7341674907043, + 472.27257430366546, + 0, + 3119.0067417943724, + 0, + 0, + 528.7644489981124, + 2590.2422927962575, + 0, + 817.1584103821615, + 4768.276103329146, + 0, + 0, + 5585.43451371131, + 0, + 2716.1151523809235, + 2869.319361330401, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 589.8272763930723, + 2655.052324985961, + 0, + 528.7644489981124, + 2716.1151523809235, + 0, + 3244.879601379037, + 0, + 0, + 2874.0653014797867, + 2585.4963526468764, + 0, + 2590.2422927962575, + 2869.319361330401, + 0, + 0, + 5459.561654126631, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 724.2440963902744, + 0, + 0, + 399.6531812493329, + 324.59091514094115, + 0, + 457.9330031888786, + 266.31109320139575, + 0, + 0, + 2614.3151323535144, + 0, + 109.76172944859509, + 2504.5534029049213, + 0, + 1430.9522070403475, + 1183.3629253131694, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 399.6531812493329, + 109.76172944859509, + 0, + 509.41491069792835, + 0, + 0, + 330.9453797307386, + 178.4695309671894, + 0, + 324.59091514094115, + 2504.5534029049213, + 0, + 0, + 2829.1443180458605, + 0, + 1557.9398304984857, + 1271.2044875473734, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 457.9330031888786, + 1430.9522070403475, + 0, + 330.9453797307386, + 1557.9398304984857, + 0, + 1888.8852102292237, + 0, + 0, + 266.31109320139575, + 1183.3629253131694, + 0, + 178.4695309671894, + 1271.2044875473734, + 0, + 0, + 1449.6740185145632, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 0 + } + }, + "missing": 0, + "n": 12043 } } \ No newline at end of file diff --git a/tests/fixtures/cat-x-cat-german-weighted.json b/tests/fixtures/cat-x-cat-german-weighted.json index befc8c6aa..a1fe4e6d4 100644 --- a/tests/fixtures/cat-x-cat-german-weighted.json +++ b/tests/fixtures/cat-x-cat-german-weighted.json @@ -1,230 +1,215 @@ { - "element": "shoji:view", - "self": "/api/datasets/123/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22variable%22:%22/api/datasets/123%2Fvariables%2F003588%2F%22%7D,%7B%22variable%22:%22/api/datasets/123%2Fvariables%2F006336%2F%22%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:%22/api/datasets/123%2Fvariables%2F001100%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [ - - ] - } - }, - "dimensions": [ - { - "variable": "/api/datasets/123/variables/003588/" - }, - { - "variable": "/api/datasets/123/variables/006336/" - } - ], - "weight": "/api/datasets/123/variables/001100/" + "query": { + "dimensions": [ + { + "variable": "/api/datasets/123/variables/003588/" + }, + { + "variable": "/api/datasets/123/variables/006336/" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": "/api/datasets/123/variables/001100/" + }, + "result": { + "counts": [ + 3039, + 3096, + 1718, + 793, + 652, + 2851, + 129, + 226, + 24573, + 3450, + 3098, + 1675, + 793, + 657, + 3409, + 145, + 236, + 21959, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": false, + "references": { + "alias": "pdl_gender", + "description": "Bitte geben Sie Ihr Geschlecht an.", + "name": "Geschlecht", + "view": { + "roles": [ + "market_sizing", + "group_definition", + "profiles_datapoints" + ] + } }, - "query_environment": { - "filter": [ - + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "männlich", + "numeric_value": null + }, + { + "id": 2, + "missing": false, + "name": "weiblich", + "numeric_value": null + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false + } + }, + { + "derived": false, + "references": { + "alias": "pdl_holidays_taken_12_months", + "description": "Wie oft waren Sie in den letzten 12 Monaten im Urlaub?
Bitte berücksichtigen Sie hier alle Reisen innerhalb Deutschlands und ins Ausland, bei denen Sie mindestens *einmal übernachtet* haben, allerdings keine Dienstreisen oder Besuche bei Verwandten oder Freunden.", + "name": "Urlaub - Anzahl letzte 12 Monate", + "view": { + "roles": [ + "market_sizing", + "group_definition", + "profiles_datapoints" ] + } }, - "result": { - "dimensions": [ - { - "derived": false, - "references": { - "alias": "pdl_gender", - "description": "Bitte geben Sie Ihr Geschlecht an.", - "name": "Geschlecht", - "view": { - "roles": [ - "market_sizing", - "group_definition", - "profiles_datapoints" - ] - } - }, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": null, - "id": 1, - "name": "männlich", - "missing": false - }, - { - "numeric_value": null, - "id": 2, - "name": "weiblich", - "missing": false - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - }, - { - "derived": false, - "references": { - "alias": "pdl_holidays_taken_12_months", - "description": "Wie oft waren Sie in den letzten 12 Monaten im Urlaub?
Bitte berücksichtigen Sie hier alle Reisen innerhalb Deutschlands und ins Ausland, bei denen Sie mindestens *einmal übernachtet* haben, allerdings keine Dienstreisen oder Besuche bei Verwandten oder Freunden.", - "name": "Urlaub - Anzahl letzte 12 Monate", - "view": { - "roles": [ - "market_sizing", - "group_definition", - "profiles_datapoints" - ] - } - }, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": null, - "id": 1, - "name": "ein Mal", - "missing": false - }, - { - "numeric_value": null, - "id": 2, - "name": "zwei Mal", - "missing": false - }, - { - "numeric_value": null, - "id": 3, - "name": "drei Mal", - "missing": false - }, - { - "numeric_value": null, - "id": 4, - "name": "vier Mal", - "missing": false - }, - { - "numeric_value": null, - "id": 5, - "name": "fünf Mal oder mehr", - "missing": false - }, - { - "numeric_value": null, - "id": 666, - "name": "kein Mal - ich war in den letzten zwölf Monaten nicht im Urlaub", - "missing": false - }, - { - "numeric_value": null, - "id": 888, - "name": "weiß nicht", - "missing": false - }, - { - "numeric_value": null, - "id": 777, - "name": "keine Angabe", - "missing": false - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - } - ], - "missing": 46532, - "measures": { - "count": { - "data": [ - 3702.47166525454, - 3643.75050423928, - 1997.62192817279, - 918.590665092077, - 771.467154586644, - 3320.71410531516, - 166.440540767205, - 278.104078376692, - 20391.8539581973, - 4114.85193945534, - 3647.97800892696, - 1924.89008795962, - 925.519741720192, - 731.59384577218, - 4172.16468576896, - 184.569635535064, - 281.00640173165, - 21325.4110531336, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "n_missing": 46532, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": false, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "ein Mal", + "numeric_value": null + }, + { + "id": 2, + "missing": false, + "name": "zwei Mal", + "numeric_value": null + }, + { + "id": 3, + "missing": false, + "name": "drei Mal", + "numeric_value": null }, - "element": "crunch:cube", - "counts": [ - 3039, - 3096, - 1718, - 793, - 652, - 2851, - 129, - 226, - 24573, - 3450, - 3098, - 1675, - 793, - 657, - 3409, - 145, - 236, - 21959, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "n": 72499 + { + "id": 4, + "missing": false, + "name": "vier Mal", + "numeric_value": null + }, + { + "id": 5, + "missing": false, + "name": "fünf Mal oder mehr", + "numeric_value": null + }, + { + "id": 666, + "missing": false, + "name": "kein Mal - ich war in den letzten zwölf Monaten nicht im Urlaub", + "numeric_value": null + }, + { + "id": 888, + "missing": false, + "name": "weiß nicht", + "numeric_value": null + }, + { + "id": 777, + "missing": false, + "name": "keine Angabe", + "numeric_value": null + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false } - } -} + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 3702.47166525454, + 3643.75050423928, + 1997.62192817279, + 918.590665092077, + 771.467154586644, + 3320.71410531516, + 166.440540767205, + 278.104078376692, + 20391.8539581973, + 4114.85193945534, + 3647.97800892696, + 1924.89008795962, + 925.519741720192, + 731.59384577218, + 4172.16468576896, + 184.569635535064, + 281.00640173165, + 21325.4110531336, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 46532 + } + }, + "missing": 46532, + "n": 72499 + } +} \ No newline at end of file diff --git a/tests/fixtures/cat-x-cat-hs-2rows-1col.json b/tests/fixtures/cat-x-cat-hs-2rows-1col.json index 10fd3b22f..989b89482 100644 --- a/tests/fixtures/cat-x-cat-hs-2rows-1col.json +++ b/tests/fixtures/cat-x-cat-hs-2rows-1col.json @@ -1,387 +1,346 @@ { - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/d1e8df9e55d44277b7b410a530338e11/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Fd1e8df9e55d44277b7b410a530338e11%2Fvariables%2F000067%2F%22%7D,%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Fd1e8df9e55d44277b7b410a530338e11%2Fvariables%2F000026%2F%22%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": [] - } + "query": { + "dimensions": [ + { + "variable": "https://alpha.crunch.io/api/datasets/d1e8df9e55d44277b7b410a530338e11/variables/000067/" }, - "dimensions": [ - { - "variable": "https://alpha.crunch.io/api/datasets/d1e8df9e55d44277b7b410a530338e11/variables/000067/" - }, - { - "variable": "https://alpha.crunch.io/api/datasets/d1e8df9e55d44277b7b410a530338e11/variables/000026/" - } - ], - "weight": null + { + "variable": "https://alpha.crunch.io/api/datasets/d1e8df9e55d44277b7b410a530338e11/variables/000026/" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } }, - "query_environment": { - "filter": [] - }, - "result": { - "dimensions": [ - { - "references": { - "alias": "food_groups", - "notes": "A categorical variable where the missing categories are interspersed throughout the non-missing categories", - "description": "Four of the five USDA food groups", - "name": "Food groups", - "view": { - "show_counts": false, - "show_numeric_values": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 0, - 2 - ], - "name": "veg + fruit", - "anchor": 2 - }, - { - "function": "subtotal", - "args": [ - 5, - 2 - ], - "name": "grain + fruit", - "anchor": 5 - } - ] - }, - "include_missing": false, - "column_width": null + "weight": null + }, + "result": { + "counts": [ + 32, + 33, + 158, + 66, + 93, + 49, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 2, + 0, + 0, + 0, + 8, + 45, + 218, + 102, + 70, + 51, + 1, + 0, + 0, + 3, + 27, + 132, + 60, + 47, + 25, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 12, + 21, + 105, + 82, + 190, + 23, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": false, + "references": { + "alias": "food_groups", + "description": "Four of the five USDA food groups", + "name": "Food groups", + "notes": "A categorical variable where the missing categories are interspersed throughout the non-missing categories", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ + { + "anchor": 2, + "args": [ + 0, + 2 + ], + "function": "subtotal", + "name": "veg + fruit" + }, + { + "anchor": 5, + "args": [ + 5, + 2 + ], + "function": "subtotal", + "name": "grain + fruit" + } + ] } - }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 0, - "id": 0, - "name": "Vegetables", - "missing": false - }, - { - "numeric_value": 32766, - "id": 32766, - "name": "Don't know", - "missing": true - }, - { - "numeric_value": 2, - "id": 2, - "name": "Fruit", - "missing": false - }, - { - "numeric_value": 5, - "id": 5, - "name": "Grain", - "missing": false - }, - { - "numeric_value": null, - "id": -1, - "name": "No Data", - "missing": true - }, - { - "numeric_value": 4, - "id": 4, - "name": "Meat", - "missing": false - }, - { - "numeric_value": 32767, - "id": 32767, - "name": "Not asked", - "missing": true - } - ] } }, - { - "derived": false, - "references": { - "alias": "pasta", - "notes": "A categorical variable", - "view": { - "show_counts": false, - "show_numeric_values": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 4, - 5 - ], - "name": "orecchiette + quad", - "anchor": 5 - } - ] - }, - "include_missing": false, - "column_width": null + "type": { + "categories": [ + { + "id": 0, + "missing": false, + "name": "Vegetables", + "numeric_value": 0 }, - "description": "The geometry of pasta", - "name": "Shapes of pasta" - }, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "missing": false, - "id": 1, - "name": "Bucatini" - }, - { - "numeric_value": 2, - "missing": false, - "id": 2, - "name": "Chitarra" - }, - { - "numeric_value": 0, - "missing": false, - "id": 0, - "name": "Boccoli" - }, - { - "numeric_value": 4, - "missing": false, - "id": 4, - "name": "Orecchiette" - }, - { - "numeric_value": 5, - "missing": false, - "id": 5, - "name": "Quadrefiore" - }, - { - "numeric_value": 6, - "missing": false, - "id": 6, - "name": "Fileja" - }, - { - "numeric_value": 32766, - "missing": true, - "id": 32766, - "name": "Skipped" - }, - { - "numeric_value": 32767, - "missing": true, - "id": 32767, - "name": "Not asked" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - } - ], - "missing": 10, - "measures": { - "count": { - "data": [ - 32, - 33, - 158, - 66, - 93, - 49, - 3, - 0, - 0, - 0, - 0, - 3, - 0, - 1, - 2, - 0, - 0, - 0, - 8, - 45, - 218, - 102, - 70, - 51, - 1, - 0, - 0, - 3, - 27, - 132, - 60, - 47, - 25, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 12, - 21, - 105, - 82, - 190, - 23, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "n_missing": 10, - "metadata": { - "references": {}, - "derived": true, - "type": { - "integer": true, - "missing_rules": {}, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" + { + "id": 32766, + "missing": true, + "name": "Don't know", + "numeric_value": 32766 + }, + { + "id": 2, + "missing": false, + "name": "Fruit", + "numeric_value": 2 + }, + { + "id": 5, + "missing": false, + "name": "Grain", + "numeric_value": 5 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + }, + { + "id": 4, + "missing": false, + "name": "Meat", + "numeric_value": 4 + }, + { + "id": 32767, + "missing": true, + "name": "Not asked", + "numeric_value": 32767 } - } + ], + "class": "categorical", + "ordinal": false } }, - "n": 1662, - "filter_stats": { - "filtered_complete": { - "unweighted": { - "selected": 1662, - "other": 0, - "missing": 0 - }, - "weighted": { - "selected": 1662, - "other": 0, - "missing": 0 + { + "derived": false, + "references": { + "alias": "pasta", + "description": "The geometry of pasta", + "name": "Shapes of pasta", + "notes": "A categorical variable", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ + { + "anchor": 5, + "args": [ + 4, + 5 + ], + "function": "subtotal", + "name": "orecchiette + quad" + } + ] + } } }, - "filtered": { - "unweighted": { - "selected": 1662, - "other": 0, - "missing": 0 - }, - "weighted": { - "selected": 1662, - "other": 0, - "missing": 0 - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Bucatini", + "numeric_value": 1 + }, + { + "id": 2, + "missing": false, + "name": "Chitarra", + "numeric_value": 2 + }, + { + "id": 0, + "missing": false, + "name": "Boccoli", + "numeric_value": 0 + }, + { + "id": 4, + "missing": false, + "name": "Orecchiette", + "numeric_value": 4 + }, + { + "id": 5, + "missing": false, + "name": "Quadrefiore", + "numeric_value": 5 + }, + { + "id": 6, + "missing": false, + "name": "Fileja", + "numeric_value": 6 + }, + { + "id": 32766, + "missing": true, + "name": "Skipped", + "numeric_value": 32766 + }, + { + "id": 32767, + "missing": true, + "name": "Not asked", + "numeric_value": 32767 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false } - }, - "unfiltered": { - "unweighted_n": 1662, - "weighted_n": 1662 - }, - "filtered": { - "unweighted_n": 1662, - "weighted_n": 1662 - }, - "counts": [ - 32, - 33, - 158, - 66, - 93, - 49, - 3, - 0, - 0, - 0, - 0, - 3, - 0, - 1, - 2, - 0, - 0, - 0, - 8, - 45, - 218, - 102, - 70, - 51, - 1, - 0, - 0, - 3, - 27, - 132, - 60, - 47, - 25, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 12, - 21, - 105, - 82, - 190, - 23, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "element": "crunch:cube" - } + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 32, + 33, + 158, + 66, + 93, + 49, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 2, + 0, + 0, + 0, + 8, + 45, + 218, + 102, + 70, + 51, + 1, + 0, + 0, + 3, + 27, + 132, + 60, + 47, + 25, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 12, + 21, + 105, + 82, + 190, + 23, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": true, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 10 + } + }, + "missing": 10, + "n": 1662 } } \ No newline at end of file diff --git a/tests/fixtures/cat-x-cat-hs-total-bottom.json b/tests/fixtures/cat-x-cat-hs-total-bottom.json index 0e781c049..7202e50ab 100644 --- a/tests/fixtures/cat-x-cat-hs-total-bottom.json +++ b/tests/fixtures/cat-x-cat-hs-total-bottom.json @@ -1,397 +1,356 @@ { - "element": "shoji:view", - "self": "https://app.crunch.io/api/datasets/3ffb2ac160d94b159611c32adb87348d/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2F3ffb2ac160d94b159611c32adb87348d%2Fvariables%2F000067%2F%22%7D,%7B%22variable%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2F3ffb2ac160d94b159611c32adb87348d%2Fvariables%2F000026%2F%22%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:%22https:%2F%2Fapp.crunch.io%2Fapi%2Fdatasets%2F3ffb2ac160d94b159611c32adb87348d%2Fvariables%2F0000d0%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [] - } + "query": { + "dimensions": [ + { + "variable": "https://app.crunch.io/api/datasets/3ffb2ac160d94b159611c32adb87348d/variables/000067/" }, - "dimensions": [ - { - "variable": "https://app.crunch.io/api/datasets/3ffb2ac160d94b159611c32adb87348d/variables/000067/" - }, - { - "variable": "https://app.crunch.io/api/datasets/3ffb2ac160d94b159611c32adb87348d/variables/000026/" - } - ], - "weight": "https://app.crunch.io/api/datasets/3ffb2ac160d94b159611c32adb87348d/variables/0000d0/" + { + "variable": "https://app.crunch.io/api/datasets/3ffb2ac160d94b159611c32adb87348d/variables/000026/" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } }, - "query_environment": { - "filter": [] - }, - "result": { - "dimensions": [ - { - "references": { - "alias": "food_groups", - "notes": "A categorical variable where the missing categories are interspersed throughout the non-missing categories", - "view": { - "show_counts": false, - "show_numeric_values": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 0, - 2 - ], - "name": "veg + fruit", - "anchor": 2 - }, - { - "function": "subtotal", - "args": [ - 4, - 5 - ], - "name": "Meat + Grain", - "anchor": 4 - } - ] - }, - "include_missing": false, - "column_width": null - }, - "description": "Four of the five USDA food groups", - "name": "Food groups" - }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 0, - "id": 0, - "name": "Vegetables", - "missing": false - }, - { - "numeric_value": 32766, - "id": 32766, - "name": "Don't know", - "missing": true - }, - { - "numeric_value": 2, - "id": 2, - "name": "Fruit", - "missing": false - }, - { - "numeric_value": 5, - "id": 5, - "name": "Grain", - "missing": false - }, - { - "numeric_value": null, - "id": -1, - "name": "No Data", - "missing": true - }, - { - "numeric_value": 4, - "id": 4, - "name": "Meat", - "missing": false - }, - { - "numeric_value": 32767, - "id": 32767, - "name": "Not asked", - "missing": true - } - ] + "weight": "https://app.crunch.io/api/datasets/3ffb2ac160d94b159611c32adb87348d/variables/0000d0/" + }, + "result": { + "counts": [ + 32, + 33, + 158, + 66, + 93, + 49, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 2, + 0, + 0, + 0, + 8, + 45, + 218, + 102, + 70, + 51, + 1, + 0, + 0, + 3, + 27, + 132, + 60, + 47, + 25, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 12, + 21, + 105, + 82, + 190, + 23, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": false, + "references": { + "alias": "food_groups", + "description": "Four of the five USDA food groups", + "name": "Food groups", + "notes": "A categorical variable where the missing categories are interspersed throughout the non-missing categories", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ + { + "anchor": 2, + "args": [ + 0, + 2 + ], + "function": "subtotal", + "name": "veg + fruit" + }, + { + "anchor": 4, + "args": [ + 4, + 5 + ], + "function": "subtotal", + "name": "Meat + Grain" + } + ] + } } }, - { - "references": { - "alias": "pasta", - "notes": "A categorical variable", - "view": { - "show_counts": false, - "show_numeric_values": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 0, - 2 - ], - "name": "chitarra + boccoli", - "anchor": 0 - }, - { - "function": "subtotal", - "args": [ - 32766, - 6, - 5 - ], - "name": "total_test", - "anchor": 32766 - } - ] - }, - "include_missing": false, - "column_width": null + "type": { + "categories": [ + { + "id": 0, + "missing": false, + "name": "Vegetables", + "numeric_value": 0 }, - "description": "The geometry of pasta", - "name": "Shapes of pasta" - }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "missing": false, - "id": 1, - "name": "Bucatini" - }, - { - "numeric_value": 2, - "missing": false, - "id": 2, - "name": "Chitarra" - }, - { - "numeric_value": 0, - "missing": false, - "id": 0, - "name": "Boccoli" - }, - { - "numeric_value": 4, - "missing": false, - "id": 4, - "name": "Orecchiette" - }, - { - "numeric_value": 5, - "missing": false, - "id": 5, - "name": "Quadrefiore" - }, - { - "numeric_value": 6, - "missing": false, - "id": 6, - "name": "Fileja" - }, - { - "numeric_value": 32766, - "missing": false, - "id": 32766, - "name": "Skipped" - }, - { - "numeric_value": 32767, - "missing": true, - "id": 32767, - "name": "Not asked" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - } - ], - "missing": 6, - "measures": { - "count": { - "data": [ - 27.846185080981197, - 26.920661525986212, - 119.91831256419233, - 55.51449163731197, - 81.57047239456325, - 61.333970868068164, - 3.671124729035447, - 0.0, - 0.0, - 0.0, - 0.0, - 5.407380731071661, - 0.0, - 0.844129024876369, - 3.688193845495, - 0.0, - 0.0, - 0.0, - 13.379718875837938, - 56.383387585584515, - 193.16744602691415, - 96.34530049597807, - 59.34230602464896, - 66.21849064852807, - 0.752560977946403, - 0.0, - 0.0, - 4.0124416740416375, - 32.156209896736364, - 138.8576652538452, - 73.05682658220181, - 38.990044193849364, - 31.101371133359986, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 13.992415961563905, - 26.603860648430295, - 114.90006611707656, - 88.92700924810279, - 188.80820544734632, - 38.2897508064271, - 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": 6, - "metadata": { - "references": {}, - "derived": true, - "type": { - "integer": false, - "missing_rules": {}, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" + { + "id": 32766, + "missing": true, + "name": "Don't know", + "numeric_value": 32766 + }, + { + "id": 2, + "missing": false, + "name": "Fruit", + "numeric_value": 2 + }, + { + "id": 5, + "missing": false, + "name": "Grain", + "numeric_value": 5 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + }, + { + "id": 4, + "missing": false, + "name": "Meat", + "numeric_value": 4 + }, + { + "id": 32767, + "missing": true, + "name": "Not asked", + "numeric_value": 32767 } - } + ], + "class": "categorical", + "ordinal": false } }, - "n": 1662, - "filter_stats": { - "filtered_complete": { - "unweighted": { - "selected": 1662, - "other": 0, - "missing": 0 - }, - "weighted": { - "selected": 1662.0000000000011, - "other": 0, - "missing": 0 + { + "derived": false, + "references": { + "alias": "pasta", + "description": "The geometry of pasta", + "name": "Shapes of pasta", + "notes": "A categorical variable", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ + { + "anchor": 0, + "args": [ + 0, + 2 + ], + "function": "subtotal", + "name": "chitarra + boccoli" + }, + { + "anchor": 32766, + "args": [ + 32766, + 6, + 5 + ], + "function": "subtotal", + "name": "total_test" + } + ] + } } }, - "filtered": { - "unweighted": { - "selected": 1662, - "other": 0, - "missing": 0 - }, - "weighted": { - "selected": 1662.0000000000011, - "other": 0, - "missing": 0 - } + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Bucatini", + "numeric_value": 1 + }, + { + "id": 2, + "missing": false, + "name": "Chitarra", + "numeric_value": 2 + }, + { + "id": 0, + "missing": false, + "name": "Boccoli", + "numeric_value": 0 + }, + { + "id": 4, + "missing": false, + "name": "Orecchiette", + "numeric_value": 4 + }, + { + "id": 5, + "missing": false, + "name": "Quadrefiore", + "numeric_value": 5 + }, + { + "id": 6, + "missing": false, + "name": "Fileja", + "numeric_value": 6 + }, + { + "id": 32766, + "missing": false, + "name": "Skipped", + "numeric_value": 32766 + }, + { + "id": 32767, + "missing": true, + "name": "Not asked", + "numeric_value": 32767 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false } - }, - "unfiltered": { - "unweighted_n": 1662, - "weighted_n": 1662.0000000000011 - }, - "filtered": { - "unweighted_n": 1662, - "weighted_n": 1662.0000000000011 - }, - "counts": [ - 32, - 33, - 158, - 66, - 93, - 49, - 3, - 0, - 0, - 0, - 0, - 3, - 0, - 1, - 2, - 0, - 0, - 0, - 8, - 45, - 218, - 102, - 70, - 51, - 1, - 0, - 0, - 3, - 27, - 132, - 60, - 47, - 25, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 12, - 21, - 105, - 82, - 190, - 23, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "element": "crunch:cube" - } + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 27.846185080981197, + 26.920661525986212, + 119.91831256419233, + 55.51449163731197, + 81.57047239456325, + 61.333970868068164, + 3.671124729035447, + 0.0, + 0.0, + 0.0, + 0.0, + 5.407380731071661, + 0.0, + 0.844129024876369, + 3.688193845495, + 0.0, + 0.0, + 0.0, + 13.379718875837938, + 56.383387585584515, + 193.16744602691415, + 96.34530049597807, + 59.34230602464896, + 66.21849064852807, + 0.752560977946403, + 0.0, + 0.0, + 4.0124416740416375, + 32.156209896736364, + 138.8576652538452, + 73.05682658220181, + 38.990044193849364, + 31.101371133359986, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 13.992415961563905, + 26.603860648430295, + 114.90006611707656, + 88.92700924810279, + 188.80820544734632, + 38.2897508064271, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": false, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 6 + } + }, + "missing": 6, + "n": 1662 } } \ No newline at end of file diff --git a/tests/fixtures/econ-blame-x-ideology-row-and-col-hs.json b/tests/fixtures/econ-blame-x-ideology-row-and-col-hs.json index 44726b3b0..3a6fc8ddb 100644 --- a/tests/fixtures/econ-blame-x-ideology-row-and-col-hs.json +++ b/tests/fixtures/econ-blame-x-ideology-row-and-col-hs.json @@ -1,387 +1,375 @@ { - "element": "shoji:view", - "self": "http://local.crunch.io:8080/api/datasets/53434aae61864813abb2a736e3e44ccb/cube/?filter=%5B%5D&query=%7B%22dimensions%22:%5B%7B%22variable%22:%22http:%2F%2Flocal.crunch.io:8080%2Fapi%2Fdatasets%2F53434aae61864813abb2a736e3e44ccb%2Fvariables%2F000000%2F%22%7D,%7B%22variable%22:%22http:%2F%2Flocal.crunch.io:8080%2Fapi%2Fdatasets%2F53434aae61864813abb2a736e3e44ccb%2Fvariables%2F000001%2F%22%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": [ - - ] + "query": { + "dimensions": [ + { + "variable": "http://local.crunch.io:8080/api/datasets/53434aae61864813abb2a736e3e44ccb/variables/000000/" + }, + { + "variable": "http://local.crunch.io:8080/api/datasets/53434aae61864813abb2a736e3e44ccb/variables/000001/" + } + ], + "measures": { + "count": { + "args": [], + "function": "cube_count" + } + }, + "weight": null + }, + "query_environment": { + "filter": [] + }, + "result": { + "counts": [ + 3, + 14, + 80, + 114, + 67, + 7, + 0, + 0, + 0, + 59, + 132, + 162, + 29, + 12, + 2, + 0, + 0, + 0, + 6, + 29, + 109, + 67, + 26, + 5, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 2, + 0, + 0, + 0, + 3, + 6, + 23, + 7, + 5, + 24, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "dimensions": [ + { + "derived": false, + "references": { + "alias": "ShutdownBlame", + "description": "If President Obama and the Republicans in Congress do not reach a budget agreement in time to avoid a shutdown of the federal government, who do you think will more to blame--President Obama or the Republican Congress?", + "name": "ShutdownBlame", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ + { + "anchor": 2, + "args": [ + 1, + 2 + ], + "function": "subtotal", + "name": "Test New Heading (Obama and Republicans)" } + ] }, - "dimensions": [ - { - "variable": "http://local.crunch.io:8080/api/datasets/53434aae61864813abb2a736e3e44ccb/variables/000000/" - }, + "transforms": { + "insertions": [ { - "variable": "http://local.crunch.io:8080/api/datasets/53434aae61864813abb2a736e3e44ccb/variables/000001/" + "anchor": 1, + "args": [ + 1, + 2 + ], + "function": "subtotal", + "name": "test new heading" } - ], - "weight": null - }, - "query_environment": { - "filter": [ - - ] + ] + } + } }, - "result": { - "dimensions": [ - { - "derived": false, - "references": { - "alias": "ShutdownBlame", - "description": "If President Obama and the Republicans in Congress do not reach a budget agreement in time to avoid a shutdown of the federal government, who do you think will more to blame--President Obama or the Republican Congress?", - "name": "ShutdownBlame", - "view": { - "show_numeric_values": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 1, - 2 - ], - "name": "Test New Heading (Obama and Republicans)", - "anchor": 2 - } - ] - }, - "include_missing": false, - "show_counts": false, - "transforms": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 1, - 2 - ], - "anchor": 1, - "name": "test new heading" - } - ] - }, - "column_width": null - } - }, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "missing": false, - "id": 1, - "name": "President Obama" - }, - { - "numeric_value": 2, - "missing": false, - "id": 2, - "name": "Republicans in Congress" - }, - { - "numeric_value": 3, - "missing": false, - "id": 3, - "name": "Both" - }, - { - "numeric_value": 4, - "missing": false, - "id": 4, - "name": "Neither" - }, - { - "numeric_value": 5, - "missing": false, - "id": 5, - "name": "Not sure" - }, - { - "numeric_value": 8, - "missing": true, - "id": 8, - "name": "Skipped" - }, - { - "numeric_value": 9, - "missing": true, - "id": 9, - "name": "Not Asked" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - }, + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "President Obama", + "numeric_value": 1 + }, + { + "id": 2, + "missing": false, + "name": "Republicans in Congress", + "numeric_value": 2 + }, + { + "id": 3, + "missing": false, + "name": "Both", + "numeric_value": 3 + }, + { + "id": 4, + "missing": false, + "name": "Neither", + "numeric_value": 4 + }, + { + "id": 5, + "missing": false, + "name": "Not sure", + "numeric_value": 5 + }, + { + "id": 8, + "missing": true, + "name": "Skipped", + "numeric_value": 8 + }, + { + "id": 9, + "missing": true, + "name": "Not Asked", + "numeric_value": 9 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false + } + }, + { + "derived": false, + "references": { + "alias": "RespondentIdeology", + "description": "In general, how would you describe your own political viewpoint?", + "name": "RespondentIdeology", + "view": { + "column_width": null, + "include_missing": false, + "show_counts": false, + "show_numeric_values": false, + "transform": { + "insertions": [ { - "derived": false, - "references": { - "alias": "RespondentIdeology", - "view": { - "show_counts": false, - "show_numeric_values": false, - "transform": { - "insertions": [ - { - "function": "subtotal", - "args": [ - 3, - 2 - ], - "name": "Test 2nd dim Heading", - "anchor": 3 - } - ] - }, - "include_missing": false, - "column_width": null - }, - "description": "In general, how would you describe your own political viewpoint?", - "name": "RespondentIdeology" - }, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "missing": false, - "id": 1, - "name": "Very liberal" - }, - { - "numeric_value": 2, - "missing": false, - "id": 2, - "name": "Liberal" - }, - { - "numeric_value": 3, - "missing": false, - "id": 3, - "name": "Moderate" - }, - { - "numeric_value": 4, - "missing": false, - "id": 4, - "name": "Conservative" - }, - { - "numeric_value": 5, - "missing": false, - "id": 5, - "name": "Very Conservative" - }, - { - "numeric_value": 6, - "missing": false, - "id": 6, - "name": "Not sure" - }, - { - "numeric_value": 8, - "missing": true, - "id": 8, - "name": "Skipped" - }, - { - "numeric_value": 9, - "missing": true, - "id": 9, - "name": "Not Asked" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - } - ], - "missing": 3, - "measures": { - "count": { - "data": [ - 3, - 14, - 80, - 114, - 67, - 7, - 0, - 0, - 0, - 59, - 132, - 162, - 29, - 12, - 2, - 0, - 0, - 0, - 6, - 29, - 109, - 67, - 26, - 5, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 2, - 0, - 0, - 0, - 3, - 6, - 23, - 7, - 5, - 24, - 0, - 0, - 0, - 0, - 0, - 1, - 2, - 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": 3, - "metadata": { - "references": { - - }, - "derived": true, - "type": { - "integer": true, - "missing_rules": { - - }, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } + "anchor": 3, + "args": [ + 3, + 2 + ], + "function": "subtotal", + "name": "Test 2nd dim Heading" } + ] + } + } + }, + "type": { + "categories": [ + { + "id": 1, + "missing": false, + "name": "Very liberal", + "numeric_value": 1 + }, + { + "id": 2, + "missing": false, + "name": "Liberal", + "numeric_value": 2 + }, + { + "id": 3, + "missing": false, + "name": "Moderate", + "numeric_value": 3 + }, + { + "id": 4, + "missing": false, + "name": "Conservative", + "numeric_value": 4 + }, + { + "id": 5, + "missing": false, + "name": "Very Conservative", + "numeric_value": 5 }, - "element": "crunch:cube", - "counts": [ - 3, - 14, - 80, - 114, - 67, - 7, - 0, - 0, - 0, - 59, - 132, - 162, - 29, - 12, - 2, - 0, - 0, - 0, - 6, - 29, - 109, - 67, - 26, - 5, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 2, - 0, - 0, - 0, - 3, - 6, - 23, - 7, - 5, - 24, - 0, - 0, - 0, - 0, - 0, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "n": 1000 + { + "id": 6, + "missing": false, + "name": "Not sure", + "numeric_value": 6 + }, + { + "id": 8, + "missing": true, + "name": "Skipped", + "numeric_value": 8 + }, + { + "id": 9, + "missing": true, + "name": "Not Asked", + "numeric_value": 9 + }, + { + "id": -1, + "missing": true, + "name": "No Data", + "numeric_value": null + } + ], + "class": "categorical", + "ordinal": false } - } -} + } + ], + "element": "crunch:cube", + "measures": { + "count": { + "data": [ + 3, + 14, + 80, + 114, + 67, + 7, + 0, + 0, + 0, + 59, + 132, + 162, + 29, + 12, + 2, + 0, + 0, + 0, + 6, + 29, + 109, + 67, + 26, + 5, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 2, + 0, + 0, + 0, + 3, + 6, + 23, + 7, + 5, + 24, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "metadata": { + "derived": true, + "references": {}, + "type": { + "class": "numeric", + "integer": true, + "missing_reasons": { + "No Data": -1 + }, + "missing_rules": {} + } + }, + "n_missing": 3 + } + }, + "missing": 3, + "n": 1000 + } +} \ No newline at end of file