Skip to content
Snippets Groups Projects
Commit 7fc31867 authored by Fernando Gbur dos Santos's avatar Fernando Gbur dos Santos
Browse files

[ADD] Illieteracy convert file created, and added to id2str

parent 86cc749e
No related branches found
No related tags found
3 merge requests!391Hom -> Prod,!386Merge development -> homologa,!385Merge new_pnad -> development
/*
Copyright (C) 2024 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of simcaq-node.
simcaq-node is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
simcaq-node is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/
module.exports = function newPnadAdmDependency(id) {
switch (id) {
case 0:
return 'Não';
case 1:
return 'Sim';
case 9:
return 'Não se aplica - 14 anos ou menos';
}
};
...@@ -102,6 +102,7 @@ const type = require(`${libs}/convert/type`); ...@@ -102,6 +102,7 @@ const type = require(`${libs}/convert/type`);
const level = require(`${libs}/convert/level`); const level = require(`${libs}/convert/level`);
const scholarDependency = require(`${libs}/convert/scholarDependency`); const scholarDependency = require(`${libs}/convert/scholarDependency`);
const newPnadAdmDependency = require(`${libs}/convert/newPnadAdmDependency`); const newPnadAdmDependency = require(`${libs}/convert/newPnadAdmDependency`);
const Illiteracy = require(`${libs}/convert/Illiteracy`);
const ids = { const ids = {
gender_id: gender, gender_id: gender,
...@@ -195,7 +196,8 @@ const ids = { ...@@ -195,7 +196,8 @@ const ids = {
type_id: type, type_id: type,
level_id: level, level_id: level,
scholar_dependency_id: scholarDependency, scholar_dependency_id: scholarDependency,
new_pnad_adm_dependency_id: newPnadAdmDependency new_pnad_adm_dependency_id: newPnadAdmDependency,
illiteracy_id: Illiteracy
}; };
function transform(removeId=false) { function transform(removeId=false) {
...@@ -312,5 +314,6 @@ module.exports = { ...@@ -312,5 +314,6 @@ module.exports = {
pee, pee,
shift, shift,
admDependencyPub, admDependencyPub,
newPnadAdmDependency newPnadAdmDependency,
Illiteracy
}; };
...@@ -49,11 +49,15 @@ PnadNovoApp.get('/years', (req, res, next) => { ...@@ -49,11 +49,15 @@ PnadNovoApp.get('/years', (req, res, next) => {
}, query, response('years')); }, query, response('years'));
PnadNovoApp.get('/illiteracy', (req, res, next) => { PnadNovoApp.get('/illiteracy', (req, res, next) => {
req.result = [ req.result = []
{id: 0, name: 'Não'},
{id: 1, name: 'Sim'}, for (let i = 0; i < 2; i++) {
{id: 9, name: 'Não se aplica - 14 anos ou menos'} req.result.push({
]; id: i, name: id2str.Illiteracy(i)
});
req.result.push({id: 9, name: id2str.Illiteracy(9)});
}
next(); next();
}, response('illiteracy')); }, response('illiteracy'));
...@@ -148,7 +152,7 @@ rqf.addField({ ...@@ -148,7 +152,7 @@ rqf.addField({
name: 'illiteracy', name: 'illiteracy',
table: 'pnad_novo', table: 'pnad_novo',
tableField: 'analfabetismo', tableField: 'analfabetismo',
resultField: 'illiteracy', resultField: 'illiteracy_id',
where: { where: {
relation: '=', relation: '=',
type: 'integer', type: 'integer',
......
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