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

[ADD] Adding new id2str filters

parent 3a3ce712
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 modality(id) {
switch (id) {
case 1:
return 'Creche';
case 2:
return 'Pré-escola';
case 3:
return 'Alfabetização de jovens e adultos';
case 4:
return 'Ensino Fundamental - Anos iniciais'
case 5:
return 'Ensino Fundamental - Anos finais';
case 6:
return 'EJA - Ensino Fundamental';
case 7:
return 'Ensino Médio';
case 8:
return 'Educação profissional - técnica integrada';
case 9:
return 'Educação profissional - técnica concomitante e subsequente';
case 10:
return 'Ensino Médio Regular e Profissional articulado';
case 11:
return 'EJA - Ensino Médio';
case 12:
return 'Superior';
case 13:
return 'Especialização';
case 14:
return 'Mestrado';
case 15:
return 'Doutorado';
case 99:
return 'Não frequenta instituição de ensino';
}
};
/*
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 attendsSchool(id) {
switch (id) {
case 1:
return 'Sim';
case 2:
return 'Não';
}
};
/*
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 instructionLevel(id) {
switch (id) {
case 1:
return 'Sem instrução e menos de 1 ano de estudo';
case 2:
return 'Fundamental incompleto ou equivalente';
case 3:
return 'Fundamental completo ou equivalente';
case 4:
return 'Médio incompleto ou equivalente';
case 5:
return 'Médio completo ou equivalente';
case 6:
return 'Superior incompleto ou equivalente';
case 7:
return 'Superior completo ou equivalente';
case 8:
return 'Não se aplica - 17 anos ou menos';
}
};
/*
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 modality(id) {
switch (id) {
case 1:
return 'Presencial';
case 2:
return 'A distância';
case 3:
return 'Não informado';
case 99:
return 'Não frequenta instituição de ensino'
}
};
......@@ -104,6 +104,10 @@ const scholarDependency = require(`${libs}/convert/scholarDependency`);
const newPnadAdmDependency = require(`${libs}/convert/newPnadAdmDependency`);
const illiteracy = require(`${libs}/convert/Illiteracy`);
const yearsOfStudy = require(`${libs}/convert/yearsOfStudy`);
const instructionLevel = require(`${libs}/convert/instructionLevel`);
const attendsSchool = require(`${libs}/convert/attendsSchool`);
const modality = require(`${libs}/convert/modality`);
const attendedModality = require(`${libs}/convert/attendedModality`);
const ids = {
gender_id: gender,
......@@ -199,7 +203,11 @@ const ids = {
scholar_dependency_id: scholarDependency,
new_pnad_adm_dependency_id: newPnadAdmDependency,
illiteracy_id: illiteracy,
years_of_study_id: yearsOfStudy
years_of_study_id: yearsOfStudy,
instruction_level_id: instructionLevel,
attends_school_id: attendsSchool,
modality_id: modality,
attended_modality_id: attendedModality
};
function transform(removeId=false) {
......@@ -318,5 +326,9 @@ module.exports = {
admDependencyPub,
newPnadAdmDependency,
illiteracy,
yearsOfStudy
yearsOfStudy,
instructionLevel,
attendsSchool,
modality,
attendedModality
};
......@@ -75,16 +75,14 @@ PnadNovoApp.get('/years_of_study', (req, res, next) => {
}, response('years_of_study'));
PnadNovoApp.get('/instruction_level', (req, res, next) => {
req.result = [
{id: 1, name: 'Sem instrução e menos de 1 ano de estudo'},
{id: 2, name: 'Fundamental incompleto ou equivalente'},
{id: 3, name: 'Fundamental completo ou equivalente'},
{id: 4, name: 'Médio incompleto ou equivalente'},
{id: 5, name: 'Médio completo ou equivalente'},
{id: 6, name: 'Superior incompleto ou equivalente'},
{id: 7, name: 'Superior completo ou equivalente'},
{id: 8, name: 'Não se aplica - 17 anos ou menos'}
];
req.result = []
for (let i = 1; i < 9; i++) {
req.result.push({
id: i, name: id2str.instructionLevel(i)
});
}
next();
}, response('instruction_level'));
......@@ -161,7 +159,7 @@ rqf.addField({
name: 'years_of_study',
table: 'pnad_novo',
tableField: 'anos_de_estudo',
resultField: 'years_of_study',
resultField: 'years_of_study_id',
where: {
relation: '=',
type: 'integer',
......@@ -171,7 +169,7 @@ rqf.addField({
name: 'instruction_level',
table: 'pnad_novo',
tableField: 'nivel_de_instrucao',
resultField: 'instruction_level',
resultField: 'instruction_level_id',
where: {
relation: '=',
type: 'integer',
......@@ -191,7 +189,7 @@ rqf.addField({
name: 'attends_school',
table: 'pnad_novo',
tableField: 'frequenta_escola',
resultField: 'attends_school',
resultField: 'attends_school_id',
where: {
relation: '=',
type: 'integer',
......@@ -201,7 +199,7 @@ rqf.addField({
name: 'modality',
table: 'pnad_novo',
tableField: 'modalidade',
resultField: 'modality',
resultField: 'modality_id',
where: {
relation: '=',
type: 'integer',
......@@ -211,7 +209,7 @@ rqf.addField({
name: 'attended_modality',
table: 'pnad_novo',
tableField: 'nivel_etapa_modalidade_freq',
resultField: 'attended_modality',
resultField: 'attended_modality_id',
where: {
relation: '=',
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