Skip to content

Commit

Permalink
Merge pull request #126 from Crunch-io/trim-cubes
Browse files Browse the repository at this point in the history
Remove type/categories from subvariable 'elements' in cubes
  • Loading branch information
Neal Richardson committed Jan 8, 2019
2 parents fc97baf + 9c2aa59 commit 8917d24
Show file tree
Hide file tree
Showing 128 changed files with 63,637 additions and 118,291 deletions.
198 changes: 124 additions & 74 deletions tests/fixtures/admit-x-dept-unweighted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,96 +6,133 @@
"measures": {
"count": {
"function": "cube_count",
"args": []
"args": [

]
}
},
"dimensions": [{
"variable": "/api/datasets/123/variables/000000/"
}, {
"variable": "/api/datasets/123/variables/000002/"
}],
"dimensions": [
{
"variable": "/api/datasets/123/variables/000000/"
},
{
"variable": "/api/datasets/123/variables/000002/"
}
],
"weight": null
},
"query_environment": {
"filter": []
"filter": [

]
},
"result": {
"dimensions": [{
"derived": false,
"references": {
"alias": "Admit",
"name": "Admit",
"description": null
},
"type": {
"ordinal": false,
"class": "categorical",
"categories": [{
"numeric_value": null,
"id": 1,
"name": "Admitted",
"missing": false
}, {
"numeric_value": null,
"missing": false,
"id": 2,
"name": "Rejected"
}]
}
}, {
"derived": false,
"references": {
"alias": "Dept",
"name": "Dept",
"description": null
"dimensions": [
{
"derived": false,
"references": {
"alias": "Admit",
"name": "Admit",
"description": null
},
"type": {
"ordinal": false,
"class": "categorical",
"categories": [
{
"numeric_value": null,
"id": 1,
"name": "Admitted",
"missing": false
},
{
"numeric_value": null,
"missing": false,
"id": 2,
"name": "Rejected"
}
]
}
},
"type": {
"ordinal": false,
"class": "categorical",
"categories": [{
"numeric_value": null,
"id": 1,
"name": "A",
"missing": false
}, {
"numeric_value": null,
"missing": false,
"id": 2,
"name": "B"
}, {
"numeric_value": null,
"missing": false,
"id": 3,
"name": "C"
}, {
"numeric_value": null,
"missing": false,
"id": 4,
"name": "D"
}, {
"numeric_value": null,
"missing": false,
"id": 5,
"name": "E"
}, {
"numeric_value": null,
"missing": false,
"id": 6,
"name": "F"
}]
{
"derived": false,
"references": {
"alias": "Dept",
"name": "Dept",
"description": null
},
"type": {
"ordinal": false,
"class": "categorical",
"categories": [
{
"numeric_value": null,
"id": 1,
"name": "A",
"missing": false
},
{
"numeric_value": null,
"missing": false,
"id": 2,
"name": "B"
},
{
"numeric_value": null,
"missing": false,
"id": 3,
"name": "C"
},
{
"numeric_value": null,
"missing": false,
"id": 4,
"name": "D"
},
{
"numeric_value": null,
"missing": false,
"id": 5,
"name": "E"
},
{
"numeric_value": null,
"missing": false,
"id": 6,
"name": "F"
}
]
}
}
}],
],
"missing": 0,
"measures": {
"count": {
"data": [601, 370, 322, 269, 147, 46, 332, 215, 596, 523, 437, 668],
"data": [
601,
370,
322,
269,
147,
46,
332,
215,
596,
523,
437,
668
],
"n_missing": 0,
"metadata": {
"references": {},
"references": {

},
"derived": true,
"type": {
"integer": true,
"missing_rules": {},
"missing_rules": {

},
"missing_reasons": {
"No Data": -1
},
Expand All @@ -105,7 +142,20 @@
}
},
"element": "crunch:cube",
"counts": [601, 370, 322, 269, 147, 46, 332, 215, 596, 523, 437, 668],
"counts": [
601,
370,
322,
269,
147,
46,
332,
215,
596,
523,
437,
668
],
"n": 4526
}
}
Expand Down
138 changes: 84 additions & 54 deletions tests/fixtures/admit-x-gender-weighted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,101 @@
"measures": {
"count": {
"function": "cube_count",
"args": []
"args": [

]
}
},
"dimensions": [{
"variable": "/api/datasets/123/variables/000000/"
}, {
"variable": "/api/datasets/123/variables/000001/"
}],
"dimensions": [
{
"variable": "/api/datasets/123/variables/000000/"
},
{
"variable": "/api/datasets/123/variables/000001/"
}
],
"weight": "/api/datasets/123/variables/000003/"
},
"query_environment": {
"filter": []
"filter": [

]
},
"result": {
"dimensions": [{
"derived": false,
"references": {
"alias": "Admit",
"name": "Admit",
"description": null
},
"type": {
"ordinal": false,
"class": "categorical",
"categories": [{
"numeric_value": null,
"id": 1,
"name": "Admitted",
"missing": false
}, {
"numeric_value": null,
"missing": false,
"id": 2,
"name": "Rejected"
}]
}
}, {
"derived": false,
"references": {
"alias": "Gender",
"name": "Gender",
"description": null
"dimensions": [
{
"derived": false,
"references": {
"alias": "Admit",
"name": "Admit",
"description": null
},
"type": {
"ordinal": false,
"class": "categorical",
"categories": [
{
"numeric_value": null,
"id": 1,
"name": "Admitted",
"missing": false
},
{
"numeric_value": null,
"missing": false,
"id": 2,
"name": "Rejected"
}
]
}
},
"type": {
"ordinal": false,
"class": "categorical",
"categories": [{
"numeric_value": null,
"id": 1,
"name": "Male",
"missing": false
}, {
"numeric_value": null,
"missing": false,
"id": 2,
"name": "Female"
}]
{
"derived": false,
"references": {
"alias": "Gender",
"name": "Gender",
"description": null
},
"type": {
"ordinal": false,
"class": "categorical",
"categories": [
{
"numeric_value": null,
"id": 1,
"name": "Male",
"missing": false
},
{
"numeric_value": null,
"missing": false,
"id": 2,
"name": "Female"
}
]
}
}
}],
],
"missing": 45,
"measures": {
"count": {
"data": [1169.7863186983059, 547.0152580585578, 1473.809547706473, 1261.3443143399054],
"data": [
1169.78631869831,
547.015258058558,
1473.80954770647,
1261.34431433991
],
"n_missing": 45,
"metadata": {
"references": {},
"references": {

},
"derived": true,
"type": {
"integer": false,
"missing_rules": {},
"missing_rules": {

},
"missing_reasons": {
"No Data": -1
},
Expand All @@ -85,7 +110,12 @@
}
},
"element": "crunch:cube",
"counts": [1198, 557, 1493, 1278],
"counts": [
1198,
557,
1493,
1278
],
"n": 4526
}
}
Expand Down
Loading

0 comments on commit 8917d24

Please sign in to comment.