Skip to content
Snippets Groups Projects
Commit 77346944 authored by João Victor Tozatti Risso's avatar João Victor Tozatti Risso
Browse files

Change ano_censo to census_year in sociodemographic route for the whole country

parent 1179684a
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!27Implement UC201 - Select Location
...@@ -74,7 +74,7 @@ locationApp.get('/sociodemographic', (req, res, next) => { ...@@ -74,7 +74,7 @@ locationApp.get('/sociodemographic', (req, res, next) => {
const populationQry = squel.select() const populationQry = squel.select()
.field('\'Brasil\'', 'name') .field('\'Brasil\'', 'name')
.field('SUM(populacao)', 'population') .field('SUM(populacao)', 'population')
.field('ibge_populacao.ano_censo') .field('ibge_populacao.ano_censo', 'census_year')
.from('ibge_populacao') .from('ibge_populacao')
.where(`ibge_populacao.ano_censo IN (${populationYearQry.toString()})`) .where(`ibge_populacao.ano_censo IN (${populationYearQry.toString()})`)
.group('ibge_populacao.ano_censo'); .group('ibge_populacao.ano_censo');
...@@ -86,7 +86,7 @@ locationApp.get('/sociodemographic', (req, res, next) => { ...@@ -86,7 +86,7 @@ locationApp.get('/sociodemographic', (req, res, next) => {
const pibQry = squel.select() const pibQry = squel.select()
.field('\'Brasil\'', 'name') .field('\'Brasil\'', 'name')
.field('AVG(ibge_pib.pib_per_capita)', 'gdp_per_capita') .field('AVG(ibge_pib.pib_per_capita)', 'gdp_per_capita')
.field('ibge_pib.ano_censo') .field('ibge_pib.ano_censo', 'census_year')
.from('ibge_pib') .from('ibge_pib')
.where(`ibge_pib.ano_censo IN (${pibYearQry.toString()})`) .where(`ibge_pib.ano_censo IN (${pibYearQry.toString()})`)
.group('ibge_pib.ano_censo'); .group('ibge_pib.ano_censo');
...@@ -98,7 +98,7 @@ locationApp.get('/sociodemographic', (req, res, next) => { ...@@ -98,7 +98,7 @@ locationApp.get('/sociodemographic', (req, res, next) => {
const idhQry = squel.select() const idhQry = squel.select()
.field('\'Brasil\'', 'name') .field('\'Brasil\'', 'name')
.field('AVG(idhm)', 'idhm') .field('AVG(idhm)', 'idhm')
.field('adh_idh.ano_censo') .field('adh_idh.ano_censo', 'census_year')
.from('adh_idh') .from('adh_idh')
.where(`adh_idh.ano_censo IN (${idhYearQry.toString()})`) .where(`adh_idh.ano_censo IN (${idhYearQry.toString()})`)
.group('adh_idh.ano_censo'); .group('adh_idh.ano_censo');
...@@ -110,7 +110,7 @@ locationApp.get('/sociodemographic', (req, res, next) => { ...@@ -110,7 +110,7 @@ locationApp.get('/sociodemographic', (req, res, next) => {
const analfabQry = squel.select() const analfabQry = squel.select()
.field('\'Brasil\'', 'name') .field('\'Brasil\'', 'name')
.field('AVG(t_analf15m)', 'analfabetism') .field('AVG(t_analf15m)', 'analfabetism')
.field('adh_analfabetismo.ano_censo') .field('adh_analfabetismo.ano_censo', 'census_year')
.from('adh_analfabetismo') .from('adh_analfabetismo')
.where(`adh_analfabetismo.ano_censo IN (${analfabYearQry.toString()})`) .where(`adh_analfabetismo.ano_censo IN (${analfabYearQry.toString()})`)
.group('adh_analfabetismo.ano_censo'); .group('adh_analfabetismo.ano_censo');
...@@ -122,13 +122,13 @@ locationApp.get('/sociodemographic', (req, res, next) => { ...@@ -122,13 +122,13 @@ locationApp.get('/sociodemographic', (req, res, next) => {
const giniQry = squel.select() const giniQry = squel.select()
.field('\'Brasil\'', 'name') .field('\'Brasil\'', 'name')
.field('AVG(gini)', 'gini') .field('AVG(gini)', 'gini')
.field('adh_gini.ano_censo') .field('adh_gini.ano_censo', 'census_year')
.from('adh_gini') .from('adh_gini')
.where(`adh_gini.ano_censo IN (${giniYearQry.toString()})`) .where(`adh_gini.ano_censo IN (${giniYearQry.toString()})`)
.group('adh_gini.ano_censo'); .group('adh_gini.ano_censo');
// map query objects to their respective response labels // map query objects to their respective response labels
const queryLabels = [ "population", "pib", "idh", "analfab", "gini" ]; const queryLabels = [ "population", "gdp", "idh", "analfab", "gini" ];
const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ]; const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ];
// wait until all queries finish or one of them fail // wait until all queries finish or one of them fail
Promise.all(dbExecAll(querySet)).then((queryResults) => { Promise.all(dbExecAll(querySet)).then((queryResults) => {
...@@ -248,7 +248,7 @@ locationApp.get('/sociodemographic/region/:id', (req, res, next) => { ...@@ -248,7 +248,7 @@ locationApp.get('/sociodemographic/region/:id', (req, res, next) => {
.group('adh_gini.ano_censo') .group('adh_gini.ano_censo')
.order('regiao.nome'); .order('regiao.nome');
// map query objects to their respective response labels // map query objects to their respective response labels
const queryLabels = [ "population", "pib", "idh", "analfab", "gini" ]; const queryLabels = [ "population", "gdp", "idh", "analfab", "gini" ];
const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ]; const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ];
// wait until all queries finish or one of them fail // wait until all queries finish or one of them fail
Promise.all(dbExecAll(querySet)).then((queryResults) => { Promise.all(dbExecAll(querySet)).then((queryResults) => {
...@@ -358,7 +358,7 @@ locationApp.get('/sociodemographic/state/:id', (req, res, next) => { ...@@ -358,7 +358,7 @@ locationApp.get('/sociodemographic/state/:id', (req, res, next) => {
.group('adh_gini.ano_censo') .group('adh_gini.ano_censo')
.order('estado.nome'); .order('estado.nome');
// map query objects to their respective response labels // map query objects to their respective response labels
const queryLabels = [ "population", "pib", "idh", "analfab", "gini" ]; const queryLabels = [ "population", "gdp", "idh", "analfab", "gini" ];
const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ]; const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ];
// wait until all queries finish or one of them fail // wait until all queries finish or one of them fail
Promise.all(dbExecAll(querySet)).then((queryResults) => { Promise.all(dbExecAll(querySet)).then((queryResults) => {
...@@ -458,7 +458,7 @@ locationApp.get('/sociodemographic/city/:id', (req, res, next) => { ...@@ -458,7 +458,7 @@ locationApp.get('/sociodemographic/city/:id', (req, res, next) => {
.group('adh_gini.ano_censo') .group('adh_gini.ano_censo')
.order('municipio.nome'); .order('municipio.nome');
// map query objects to their respective response labels // map query objects to their respective response labels
const queryLabels = [ "population", "pib", "idh", "analfab", "gini" ]; const queryLabels = [ "population", "gdp", "idh", "analfab", "gini" ];
const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ]; const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ];
// wait until all queries finish or one of them fail // wait until all queries finish or one of them fail
Promise.all(dbExecAll(querySet)).then((queryResults) => { Promise.all(dbExecAll(querySet)).then((queryResults) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment