Más contenido relacionado Similar a JSON-stat in the session "The future of standards in statistics", United Nations, Geneva (20) Más de Xavier Badosa (10) JSON-stat in the session "The future of standards in statistics", United Nations, Geneva1. JSON-stat
standards in statistics
Workshop on International Collaboration
for Standards-Based Modernisation
United Nations Economic Commission for Europe
Geneva, 7 May 2015
The future of
Xavier Badosa
Statistical Institute of Catalonia
}
37. {
"BEAAPI": {
"Request": {...},
"Results": {
"Statistic": "Per capita personal income",
"UnitOfMeasure":"dollars",
"PublicTable":"CA1-3 Personal income summary",
"UTCProductionTime":"2014-05-11T17:02:55.817",
"NoteRef":"2", "Dimensions": [...],
"Data": [
{
"GeoFips":"00000",
"GeoName":"United States",
"Code":"PCPI_CI",
"TimePeriod":"2009",
"CL_UNIT":"USD",
"UNIT_MULT":"0",
"DataValue":"39357"
},
...
], "Notes": [...]
}
}
}
38. {
"BEAAPI": {
"Request": {...},
"Results": {
"Statistic": "Per capita personal income",
"UnitOfMeasure":"dollars",
"PublicTable":"CA1-3 Personal income summary",
"UTCProductionTime":"2014-05-11T17:02:55.817",
"NoteRef":"2", "Dimensions": [...],
"Data": [
{
"GeoFips":"00000",
"GeoName":"United States",
"Code":"PCPI_CI",
"TimePeriod":"2009",
"CL_UNIT":"USD",
"UNIT_MULT":"0",
"DataValue":"39357"
},
...
], "Notes": [...]
}
}
}
General
39. {
"BEAAPI": {
"Request": {...},
"Results": {
"Statistic": "Per capita personal income",
"UnitOfMeasure":"dollars",
"PublicTable":"CA1-3 Personal income summary",
"UTCProductionTime":"2014-05-11T17:02:55.817",
"NoteRef":"2", "Dimensions": [...],
"Data": [
{
"GeoFips":"00000",
"GeoName":"United States",
"Code":"PCPI_CI",
"TimePeriod":"2009",
"CL_UNIT":"USD",
"UNIT_MULT":"0",
"DataValue":"39357"
},
...
], "Notes": [...]
}
}
}
General Light?
40. {
"BEAAPI": {
"Request": {...},
"Results": {
"Statistic": "Per capita personal income",
"UnitOfMeasure":"dollars",
"PublicTable":"CA1-3 Personal income summary",
"UTCProductionTime":"2014-05-11T17:02:55.817",
"NoteRef":"2", "Dimensions": [...],
"Data": [
{
"GeoFips":"00000",
"GeoName":"United States",
"Code":"PCPI_CI",
"TimePeriod":"2009",
"CL_UNIT":"USD",
"UNIT_MULT":"0",
"DataValue":"39357"
},
...
], "Notes": [...]
}
}
}
General Light?Cubic
44. {
"columns": [
{ "code":"region", "text": "Region" },
{ "code":"ageG5", "text":"Age", "comment": ... },
{ "code":"period", "text":"Time", "type":"t" },
{ "code":"x", "text":"Population", "type":"c", "unit":"amount" }
],
"comments": [...],
"data":[
{ "key": ["02","0-7","2003"], "values": [ 100 ] },
{ "key": ["02","0-7","2004"], "values": [ 101 ] },
...
]
}
45. "dataSets" : [
{
"action" : "Information",
"series" : {
"0:0:0:0" : {
"attributes" : [0, 0, 0],
"observations" : {
"0" : [100.0, null],
"1" : [103.3038, null],
"2" : [105.1249, null],
"3" : [107.7003, null]
}
},
"0:0:0:1" : {
"attributes" : [0, 0, 0],
"observations" : {
...
49. [
]
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
"value" :
50. {
"dataset": {
"label": "Value (NOK 1 000) by imports/exports...",
"source": "Statistics Norway",
"updated": "2014-05-13T18:36:18Z",
"dimension": {...},
"value": [ 77287250, 70377617, 73499048, ... ],
...
}
}
51. function arr2num( arr, size ){
for(var i=0, num=0, mult=1, ndims=size.length; i<ndims; i++){
mult*=(i>0) ? size[ndims-i] : 1;
num+=mult*arr[ndims-i-1];
}
return num;
}
Maths is
what computers
do best
Row-major order
58. JSON-stat
1. Keeps metadata and data apart
2. Avoids indices
3. Has a simple ontology
Cubic
Simple
General
Light4. Requires very few properties
67. Credits
“Soma” (blocks’ background)
by Dru! (CC BY–NC)
“Deep in conversation” (bar conversation)
by Ross Pollack (BY–NC–SA)
“Metal movable type”
by Willi Heidelbach (CC BY–SA)
“Portrait” (cubic head)
by Thomas Leth-Olsen (CC BY)
“Sterile” (walking girl)
by Lee Nachtigal (CC BY)
“Railroad”
by Xavier Badosa (CC BY)
“Dartboard”
by Jacob Vance (CC BY–NC)