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
Harbor Registry
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
780ea8c4
There was a problem fetching the pipeline summary.
Commit
780ea8c4
authored
7 years ago
by
Fernando Erd
Browse files
Options
Downloads
Patches
Plain Diff
Add struct for gloss enrollment ratio indicator
parent
dcdc5773
No related branches found
No related tags found
2 merge requests
!116
Release v1.0.0
,
!106
Gloss enrollment ratio route
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/routes/api.js
+3
-0
3 additions, 0 deletions
src/libs/routes/api.js
src/libs/routes/glossEnrollmentRatio.js
+232
-0
232 additions, 0 deletions
src/libs/routes/glossEnrollmentRatio.js
with
235 additions
and
0 deletions
src/libs/routes/api.js
+
3
−
0
View file @
780ea8c4
...
...
@@ -34,6 +34,8 @@ const population = require('./population')
const
rateSchool
=
require
(
'
./rateSchool
'
)
const
glossEnrollmentRatio
=
require
(
'
./glossEnrollmentRatio
'
)
const
idhm
=
require
(
'
./idhm
'
);
const
idhmr
=
require
(
'
./idhmr
'
);
...
...
@@ -77,6 +79,7 @@ api.use('/idhme', idhme);
api
.
use
(
'
/pibpercapita
'
,
pibpercapita
);
api
.
use
(
'
/population
'
,
population
);
api
.
use
(
'
/rate_school
'
,
rateSchool
);
api
.
use
(
'
/gloss_enrollment_ratio
'
,
glossEnrollmentRatio
);
api
.
use
(
'
/idhml
'
,
idhml
);
api
.
use
(
'
/auth/token
'
,
oauth2
.
token
);
api
.
use
(
'
/verify
'
,
verifyToken
);
...
...
This diff is collapsed.
Click to expand it.
src/libs/routes/glossEnrollmentRatio.js
0 → 100644
+
232
−
0
View file @
780ea8c4
const
express
=
require
(
'
express
'
);
const
glossEnrollmentRatioApp
=
express
.
Router
();
const
libs
=
`
${
process
.
cwd
()}
/libs`
;
const
log
=
require
(
`
${
libs
}
/log`
)(
module
);
const
squel
=
require
(
'
squel
'
);
const
query
=
require
(
`
${
libs
}
/middlewares/query`
).
query
;
const
multiQuery
=
require
(
`
${
libs
}
/middlewares/multiQuery`
);
const
response
=
require
(
`
${
libs
}
/middlewares/response`
);
const
ReqQueryFields
=
require
(
`
${
libs
}
/middlewares/reqQueryFields`
);
const
id2str
=
require
(
`
${
libs
}
/middlewares/id2str`
);
const
config
=
require
(
`
${
libs
}
/config`
);
const
download
=
require
(
`
${
libs
}
/middlewares/downloadDatabase`
);
const
passport
=
require
(
'
passport
'
);
const
cache
=
require
(
'
apicache
'
).
options
({
debug
:
config
.
debug
,
statusCodes
:
{
include
:
[
200
]}
}).
middleware
;
glossEnrollmentRatioApp
.
use
(
cache
(
'
15 day
'
));
let
rqf
=
new
ReqQueryFields
();
// Complete range of the enrollments dataset.
// Returns a tuple of start and ending years of the complete enrollments dataset.
glossEnrollmentRatioApp
.
get
(
'
/year_range
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
pnad
'
)
.
field
(
'
MIN(pnad.ano_censo)
'
,
'
start_year
'
)
.
field
(
'
MAX(pnad.ano_censo)
'
,
'
end_year
'
);
next
();
},
query
,
response
(
'
range
'
));
glossEnrollmentRatioApp
.
get
(
'
/years
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
pnad
'
)
.
field
(
'
DISTINCT pnad.ano_censo
'
,
'
year
'
);
next
();
},
query
,
response
(
'
years
'
));
glossEnrollmentRatioApp
.
get
(
'
/source
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
fonte
'
)
.
field
(
'
fonte
'
,
'
source
'
)
.
where
(
'
tabela =
\'
pnad
\'
'
);
next
();
},
query
,
response
(
'
source
'
));
glossEnrollmentRatioApp
.
get
(
'
/location
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
1
,
name
:
'
Urbana
'
},
{
id
:
2
,
name
:
'
Rural
'
}
];
next
();
},
response
(
'
location
'
));
glossEnrollmentRatioApp
.
get
(
'
/ethnic_group_pnad
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
0
,
name
:
'
Indígena
'
},
{
id
:
1
,
name
:
'
Branca e amarela
'
},
{
id
:
2
,
name
:
'
Preta e parda
'
},
{
id
:
9
,
name
:
'
Sem declaração
'
}
];
next
();
},
response
(
'
ethnic_group_pnad
'
));
glossEnrollmentRatioApp
.
get
(
'
/gender
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
2
,
name
:
'
Masculino
'
},
{
id
:
4
,
name
:
'
Feminino
'
}
];
next
();
},
response
(
'
gender
'
));
glossEnrollmentRatioApp
.
get
(
'
/fifth_household_income
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
1
,
name
:
'
20% menores
'
},
{
id
:
2
,
name
:
'
2o quinto
'
},
{
id
:
3
,
name
:
'
3o quinto
'
},
{
id
:
4
,
name
:
'
4o quinto
'
},
{
id
:
5
,
name
:
'
20% maiores
'
},
{
id
:
-
1
,
name
:
'
Sem declaração
'
}
];
next
();
},
response
(
'
fifth_household_income
'
));
glossEnrollmentRatioApp
.
get
(
'
/extremes_household_income
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
1
,
name
:
'
10% menores
'
},
{
id
:
2
,
name
:
'
10% maiores
'
},
{
id
:
-
1
,
name
:
'
Sem declaração
'
}
];
next
();
},
response
(
'
extremes_household_income
'
));
rqf
.
addField
({
name
:
'
filter
'
,
field
:
false
,
where
:
true
}).
addField
({
name
:
'
dims
'
,
field
:
true
,
where
:
false
}).
addValue
({
name
:
'
region
'
,
table
:
'
regiao
'
,
tableField
:
'
nome
'
,
resultField
:
'
region_name
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
id
'
},
join
:
{
primary
:
'
id
'
,
foreign
:
'
regiao_id
'
,
foreignTable
:
'
pnad
'
}
}).
addValue
({
name
:
'
state
'
,
table
:
'
estado
'
,
tableField
:
'
nome
'
,
resultField
:
'
state_name
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
id
'
},
join
:
{
primary
:
'
id
'
,
foreign
:
'
estado_id
'
,
foreignTable
:
'
pnad
'
}
}).
addValue
({
name
:
'
ethnic_group_pnad
'
,
table
:
'
pnad
'
,
tableField
:
'
cor_raca_id
'
,
resultField
:
'
ethnic_group_pnad_id
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
cor_raca_id
'
}
}).
addValue
({
name
:
'
min_year
'
,
table
:
'
pnad
'
,
tableField
:
'
ano_censo
'
,
resultField
:
'
year
'
,
where
:
{
relation
:
'
>=
'
,
type
:
'
integer
'
,
table
:
'
pnad
'
,
field
:
'
ano_censo
'
}
}).
addValue
({
name
:
'
max_year
'
,
table
:
'
pnad
'
,
tableField
:
'
ano_censo
'
,
resultField
:
'
year
'
,
where
:
{
relation
:
'
<=
'
,
type
:
'
integer
'
,
table
:
'
pnad
'
,
field
:
'
ano_censo
'
}
}).
addValue
({
name
:
'
age_range
'
,
table
:
'
pnad
'
,
tableField
:
'
faixa_etaria_31_03
'
,
resultField
:
'
age_range_id
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
faixa_etaria_31_03
'
}
}).
addValue
({
name
:
'
gender
'
,
table
:
'
pnad
'
,
tableField
:
'
sexo
'
,
resultField
:
'
gender_pnad_id
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
sexo
'
}
}).
addValue
({
name
:
'
location
'
,
table
:
'
pnad
'
,
tableField
:
'
localizacao_id
'
,
resultField
:
'
location_id
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
localizacao_id
'
}
}).
addValue
({
name
:
'
extremes_household_income
'
,
table
:
'
pnad
'
,
tableField
:
'
extremos_nivel_rendimento
'
,
resultField
:
'
extremes_household_income_id
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
extremos_nivel_rendimento
'
}
}).
addValue
({
name
:
'
fifth_household_income
'
,
table
:
'
pnad
'
,
tableField
:
'
quintil_nivel_rendimento
'
,
resultField
:
'
fifth_household_income_id
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
quintil_nivel_rendimento
'
}
});
glossEnrollmentRatioApp
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
next
();
},
id2str
.
transform
(
false
),
response
(
'
rateSchool
'
));
glossEnrollmentRatioApp
.
get
(
'
/download
'
,
passport
.
authenticate
(
'
bearer
'
,
{
session
:
false
}),
rqf
.
parse
(),
rqf
.
build
(),
download
(
'
pnad
'
,
'
mapping_pnad
'
));
module
.
exports
=
glossEnrollmentRatioApp
;
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