Skip to content

Commit

Permalink
Merge ae7dee9 into e1adf9d
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestoarbitrio committed Oct 22, 2019
2 parents e1adf9d + ae7dee9 commit 355e76a
Show file tree
Hide file tree
Showing 9 changed files with 3,289 additions and 69 deletions.
238 changes: 186 additions & 52 deletions src/cr/cube/matrix.py

Large diffs are not rendered by default.

378 changes: 378 additions & 0 deletions tests/fixtures/ca-food-groups-x-shape-of-pasta-with-insertions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,378 @@
{
"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": []
}
},
"dimensions": [
{
"variable": "https://alpha.crunch.io/api/datasets/d1e8df9e55d44277b7b410a530338e11/variables/000067/"
},
{
"variable": "https://alpha.crunch.io/api/datasets/d1e8df9e55d44277b7b410a530338e11/variables/000026/"
}
],
"weight": null
},
"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": [
5,
2
],
"name": "grain + fruit",
"anchor": 5
}
]
},
"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
}
]
}
},
{
"references": {
"alias": "pasta",
"notes": "A categorical variable",
"view": {
"show_counts": false,
"show_numeric_values": false,
"transform": {
"insertions": [
{
"function": "subtotal",
"args": [
4,
5
],
"name": "test",
"anchor": 5
}
]
},
"include_missing": false,
"column_width": null
},
"description": "The geometry of pasta",
"name": "Shapes of pasta"
},
"derived": false,
"type": {
"ordinal": false,
"class": "categorical",
"categories": [
{
"numeric_value": 1,
"id": 1,
"name": "Bucatini",
"missing": false
},
{
"numeric_value": 2,
"id": 2,
"name": "Chitarra",
"missing": false
},
{
"numeric_value": 0,
"id": 0,
"name": "Boccoli",
"missing": false
},
{
"numeric_value": 4,
"id": 4,
"name": "Orecchiette",
"missing": false
},
{
"numeric_value": 5,
"id": 5,
"name": "Quadrefiore",
"missing": false
},
{
"numeric_value": 6,
"id": 6,
"name": "Fileja",
"missing": false
},
{
"numeric_value": 32766,
"id": 32766,
"name": "Skipped",
"missing": true
},
{
"numeric_value": 32767,
"id": 32767,
"name": "Not asked",
"missing": true
},
{
"numeric_value": null,
"id": -1,
"name": "No Data",
"missing": true
}
]
}
}
],
"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"
}
}
}
},
"n": 1662,
"filter_stats": {
"filtered_complete": {
"unweighted": {
"selected": 1662,
"other": 0,
"missing": 0
},
"weighted": {
"selected": 1662,
"other": 0,
"missing": 0
}
},
"filtered": {
"unweighted": {
"selected": 1662,
"other": 0,
"missing": 0
},
"weighted": {
"selected": 1662,
"other": 0,
"missing": 0
}
}
},
"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"
}
}
}

0 comments on commit 355e76a

Please sign in to comment.