Implement UC201 - Select Location
Issue
Closes issue simcaq/SCRUM#71
Routes
-
/api/v1/location/sociodemographic
: Sociodemographic data for the whole country. -
/api/v1/location/sociodemographic/region/:id
: Sociodemographic data for a region identified by:id
. -
/api/v1/location/sociodemographic/state/:id
: Sociodemographic data for a state identified by:id
. -
/api/v1/location/sociodemographic/city/:id
: Sociodemographic data for a city identified by:id
. -
/api/v1/location/educational
: Educational data for the whole country. -
/api/v1/location/educational/region/:id
: Educational data for a region identified by:id
. -
/api/v1/location/educational/state/:id
: Educational data for a state identified by:id
-
/api/v1/location/educational/city/:id
: Educational data for a city identified by:id
-
/api/v1/location/educational/school_level
: Educational data grouped by school levels and years -
/api/v1/location/educational/school_level/region/:id
: Educational data grouped by school levels and years for a region identified by:id
. -
/api/v1/location/educational/school_level/state/:id
: Educational data grouped by school levels and years for a state identified by:id
-
/api/v1/location/educational/school_level/city/:id
: Educational data grouped by school levels and years for a city identified by:id
Response Format
/api/v1/sociodemographic/*
routes
Complete result is contained in the result
attribute, as usual.
Each subattribute of result
defines the following:
-
population
: most recent population census -
gdp
: most recent country GDP ('PIB' in Portuguese) survey -
idh
: most recent IDH survey -
analfab
: most recent analfabetism census -
gini
: most recent Gini index census
Example JSON object:
{
"result": {
"population": {
"name":"Brasil",
"population":"203984155",
"census_year":2015
},
"gdp": {
"name":"Brasil",
"gdp_per_capita":17378.46570581903,
"census_year":2013
},
"idh": {
"name":"Brasil",
"idhm":0.6591849721373367,
"census_year":2010
},
"analfab": {
"name":"Brasil",
"analfabetism":16.15446881179219,
"census_year":2010
},
"gini": {
"name":"Brasil",
"gini":0.4943627539097612,
"census_year":2010
}
}
}
/api/v1/educational/*
Complete result is contained in the result
attribute, as usual.
Each subattribute of result
defines the following:
-
school
: most recent school census. -
school_per_location
: most school census, per location. -
enrollment
: enrollments survey -
enrollment_per_adm_dep
: enrollments survey per administrative dependency -
enrollment_per_school_level
: enrollments survey per school (or educational) level
Example JSON object:
{
"result": {
"school": [
{
"name": "Acrelândia",
"location": "Total",
"total": 7,
"census_year": 2015
}
],
"school_per_location": [
{
"name": "Acrelândia",
"location": "Rural",
"total": 7,
"census_year": 2015
}
],
"enrollment": [
{
"name": "Acrelândia",
"total": "4182",
"census_year": 2015
}
],
"enrollment_per_adm_dep": [
{
"name": "Acrelândia",
"total": "1862",
"census_year": 2015,
"adm_dependency": "Estadual"
},
{
"name": "Acrelândia",
"total": "2320",
"census_year": 2015,
"adm_dependency": "Municipal"
}
],
"enrollment_per_school_level": [
{
"name": "Acrelândia",
"total": "288",
"census_year": 2015,
"school_level": "Creche"
},
{
"name": "Acrelândia",
"total": "296",
"census_year": 2015,
"school_level": "EJA"
},
{
"name": "Acrelândia",
"total": "1006",
"census_year": 2015,
"school_level": "Ensino Fundamental - Anos Finais"
},
{
"name": "Acrelândia",
"total": "1451",
"census_year": 2015,
"school_level": "Ensino Fundamental - Anos Iniciais"
},
{
"name": "Acrelândia",
"total": "120",
"census_year": 2015,
"school_level": "Ensino Fundamental multietapa e correção de fluxo"
},
{
"name": "Acrelândia",
"total": "636",
"census_year": 2015,
"school_level": "Ensino Médio"
},
{
"name": "Acrelândia",
"total": "385",
"census_year": 2015,
"school_level": "Pré-Escola"
}
]
}
}
The /api/v1/location/educational/school_level
is an exception, though, for this route the following response format is used:
{
"result": [
{
"degree": "Creche",
"census_year": 2015,
"table": [
{
"title": "Creche",
"value": 2966217
}
]
},
{
"degree": "EI + EF",
"census_year": 2015,
"table": [
{
"title": "Não classificado",
"value": 319208
}
]
},
{
"degree": "EJA",
"census_year": 2015,
"table": [
{
"title": "EJA AI",
"value": 50573
},
{
"title": "Não classificado",
"value": 3377148
}
]
},
{
"degree": "Educação Especial exclusiva + classes especiais",
"census_year": 2015,
"table": [
{
"title": "Creche",
"value": 5164
},
{
"title": "Pré-escola",
"value": 6077
},
{
"title": "1 Ano",
"value": 539
},
{
"title": "2 Ano - 1 Serie",
"value": 10940
},
{
"title": "3 Ano - 2 Serie",
"value": 7757
},
{
"title": "4 Ano - 3 Serie",
"value": 5482
},
{
"title": "5 Ano - 4 Serie",
"value": 6676
},
{
"title": "6 Ano - 5 Serie",
"value": 1493
},
{
"title": "7 Ano - 6 Serie",
"value": 723
},
{
"title": "8 Ano - 7 Serie",
"value": 669
},
{
"title": "9 Ano - 8 Serie",
"value": 1328
},
{
"title": "2 Ano",
"value": 414
},
{
"title": "3 Ano",
"value": 307
},
{
"title": "4 Ano",
"value": 5
},
{
"title": "EP",
"value": 333
},
{
"title": "Não classificado",
"value": 95781
}
]
},
{
"degree": "Educação Infantil Unificada",
"census_year": 2015,
"table": [
{
"title": "Não classificado",
"value": 177984
}
]
},
{
"degree": "Educação Profissional",
"census_year": 2015,
"table": [
{
"title": "EP",
"value": 970112
},
{
"title": "Não classificado",
"value": 330392
}
]
},
{
"degree": "Ensino Fundamental - Anos Finais",
"census_year": 2015,
"table": [
{
"title": "6 Ano - 5 Serie",
"value": 3396116
},
{
"title": "7 Ano - 6 Serie",
"value": 3050495
},
{
"title": "8 Ano - 7 Serie",
"value": 2948056
},
{
"title": "9 Ano - 8 Serie",
"value": 2778677
}
]
},
{
"degree": "Ensino Fundamental - Anos Iniciais",
"census_year": 2015,
"table": [
{
"title": "1 Ano",
"value": 2712767
},
{
"title": "2 Ano - 1 Serie",
"value": 2757733
},
{
"title": "3 Ano - 2 Serie",
"value": 3061560
},
{
"title": "4 Ano - 3 Serie",
"value": 2890353
},
{
"title": "5 Ano - 4 Serie",
"value": 2956770
}
]
},
{
"degree": "Ensino Fundamental multietapa e correção de fluxo",
"census_year": 2015,
"table": [
{
"title": "Não classificado",
"value": 1043714
}
]
},
{
"degree": "Ensino Médio",
"census_year": 2015,
"table": [
{
"title": "1 Ano",
"value": 3230496
},
{
"title": "2 Ano",
"value": 2609223
},
{
"title": "3 Ano",
"value": 2170754
},
{
"title": "4 Ano",
"value": 57113
}
]
},
{
"degree": "Não classificado",
"census_year": 2015,
"table": [
{
"title": "Não classificado",
"value": 23480
}
]
},
{
"degree": "Pré-Escola",
"census_year": 2015,
"table": [
{
"title": "Pré-escola",
"value": 4686197
}
]
}
]
}
Merge request reports
Activity
Depends on fixing the problems in !26 (closed)
@grc15 The are the route definition and response formats to implement the frontend.
@rce16 Databases are up and running again. Seems to be a problem with a the VMs/infrastructure and data corruption.
All tests are running smoothly now, there is just a minor issue with the test coverage.
Branch testing is under the global threshold and, therefore, the CI is failing.
MR !26 (closed) is superseded by this merge request and can be closed.
Mentioned in merge request !26 (closed)
Added 1 commit:
- 71db7dcc - Add ordering to educational route queries in location module
@rce16 Please check the format for the
location/educational/school_level/
route@vsbc14 Can you help with istanbul? It seems that it is being run on the code that is generated by babel, not the source itself. For that reason, our test coverage seems to be below what it should be and the build is failing.
Let me know if you need more info on how to reproduce and/or any demonstration of the issue aforementioned.
@jvtr12 output format is just perfect. Only one thing is missing, sorry if I forgot to mention before: we must be able to acquire that data for each desired spatial cut. Something like:
- location/educational/school_level (already there)
- location/educational/school_level/region/:id
- location/educational/school_level/state/:id
- location/educational/school_level/city/:id
or
- location/educational/region/:id/school_level
- location/educational/state/:id/school_level
- location/educational/city/:id/school_level
Adding those routes for the router would ensure we have any necessary data for the simulation enrollments tables.
@rce16 No problem, working on it