Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
simcaq-node
Commits
52559851
There was a problem fetching the pipeline summary.
Commit
52559851
authored
7 years ago
by
Fernando Erd
Browse files
Options
Downloads
Patches
Plain Diff
Fixed State in IDHM
parent
ced1531a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!116
Release v1.0.0
,
!68
Fix dims in IDHM and IDHMR
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/libs/convert/stateName.js
+58
-0
58 additions, 0 deletions
src/libs/convert/stateName.js
src/libs/middlewares/id2str.js
+3
-1
3 additions, 1 deletion
src/libs/middlewares/id2str.js
src/libs/routes/idhm.js
+15
-11
15 additions, 11 deletions
src/libs/routes/idhm.js
with
76 additions
and
12 deletions
src/libs/convert/stateName.js
0 → 100644
+
58
−
0
View file @
52559851
module
.
exports
=
function
stateName
(
id
)
{
switch
(
id
)
{
case
11
:
return
'
Rondônia
'
;
case
12
:
return
'
Acre
'
;
case
13
:
return
'
Amazonas
'
;
case
14
:
return
'
Roraima
'
;
case
15
:
return
'
Pará
'
;
case
16
:
return
'
Amapá
'
;
case
17
:
return
'
Tocantins
'
;
case
21
:
return
'
Maranhão
'
;
case
22
:
return
'
Piauí
'
;
case
23
:
return
'
Ceará
'
;
case
24
:
return
'
Rio Grande do Norte
'
;
case
25
:
return
'
Paraíba
'
;
case
26
:
return
'
Pernambuco
'
;
case
27
:
return
'
Alagoas
'
;
case
28
:
return
'
Sergipe
'
;
case
29
:
return
'
Bahia
'
;
case
31
:
return
'
Minas Gerais
'
;
case
32
:
return
'
Espírito Santo
'
;
case
33
:
return
'
Rio de Janeiro
'
;
case
35
:
return
'
São Paulo
'
;
case
41
:
return
'
Paraná
'
;
case
42
:
return
'
Santa Catarina
'
;
case
43
:
return
'
Rio Grande do Sul
'
;
case
50
:
return
'
Mato Grosso do Sul
'
;
case
51
:
return
'
Mato Grosso
'
;
case
52
:
return
'
Goiás
'
;
case
53
:
return
'
Distrito Federal
'
;
}
};
This diff is collapsed.
Click to expand it.
src/libs/middlewares/id2str.js
+
3
−
1
View file @
52559851
...
...
@@ -15,6 +15,7 @@ const educationType = require(`${libs}/convert/educationType`);
const
citySize
=
require
(
`
${
libs
}
/convert/citySize`
);
const
incomeLevel
=
require
(
`
${
libs
}
/convert/incomeLevel`
);
const
idhmLevel
=
require
(
`
${
libs
}
/convert/idhmLevel`
);
const
stateName
=
require
(
`
${
libs
}
/convert/stateName`
);
const
ids
=
{
gender_id
:
gender
,
...
...
@@ -62,7 +63,8 @@ const ids = {
education_type_id
:
educationType
,
income_level_id
:
incomeLevel
,
city_size_id
:
citySize
,
idhm_level_id
:
idhmLevel
idhm_level_id
:
idhmLevel
,
state_id
:
stateName
};
function
transform
(
removeId
=
false
)
{
...
...
This diff is collapsed.
Click to expand it.
src/libs/routes/idhm.js
+
15
−
11
View file @
52559851
...
...
@@ -132,13 +132,14 @@ rqf.addField({
idhmApp
.
get
(
'
/
'
,
rqf
.
parse
(),
(
req
,
res
,
next
)
=>
{
log
.
debug
(
req
.
sql
.
toParam
());
if
((
Object
.
keys
(
req
.
filter
).
length
===
0
)
&&
(
Object
.
keys
(
req
.
dims
).
length
===
0
))
{
res
.
status
(
400
);
next
({
status
:
400
,
message
:
'
Wrong/No filter specified
'
});
}
if
(
"
state
"
in
req
.
filter
&&
!
(
"
city
"
in
req
.
filter
))
{
req
.
sql
.
from
(
'
adh_idh_uf
'
)
.
field
(
'
adh_idh_uf.idhm
'
,
'
total
'
)
.
field
(
'
adh_idh_uf.ano_censo
'
,
'
year
'
)
.
field
(
'
adh_idh_uf.estado_id
'
,
'
state_id
'
)
.
group
(
'
adh_idh_uf.idhm
'
)
.
group
(
'
adh_idh_uf.ano_censo
'
)
.
group
(
'
adh_idh_uf.estado_id
'
)
}
else
if
(
"
state
"
in
req
.
filter
&&
!
(
"
city
"
in
req
.
filter
))
{
req
.
sql
.
from
(
'
adh_idh_uf
'
)
.
field
(
'
adh_idh_uf.idhm
'
,
'
total
'
)
.
field
(
'
adh_idh_uf.ano_censo
'
,
'
year
'
)
...
...
@@ -157,10 +158,13 @@ idhmApp.get('/', rqf.parse(), (req, res, next) => {
.
group
(
'
adh_idh.municipio_id
'
)
.
group
(
'
adh_idh.estado_id
'
)
}
else
{
next
({
status
:
400
,
message
:
'
Wrong/No filter specified
'
});
req
.
sql
.
from
(
'
adh_idh_uf
'
)
.
field
(
'
adh_idh_uf.idhm
'
,
'
total
'
)
.
field
(
'
adh_idh_uf.ano_censo
'
,
'
year
'
)
.
field
(
'
adh_idh_uf.estado_id
'
,
'
state_id
'
)
.
group
(
'
adh_idh_uf.idhm
'
)
.
group
(
'
adh_idh_uf.ano_censo
'
)
.
group
(
'
adh_idh_uf.estado_id
'
)
}
next
();
},
rqf
.
build
(),
query
,
id2str
.
transform
(),
response
(
'
idhm
'
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment