diff --git a/src/libs/convert/attendedModality.js b/src/libs/convert/attendedModality.js new file mode 100644 index 0000000000000000000000000000000000000000..be06810ecc0bf861454dc364af7543ae3f700bbb --- /dev/null +++ b/src/libs/convert/attendedModality.js @@ -0,0 +1,56 @@ +/* +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'; + } +}; diff --git a/src/libs/convert/attendsSchool.js b/src/libs/convert/attendsSchool.js new file mode 100644 index 0000000000000000000000000000000000000000..836e9fbd7dbd455d7c781785d40a76fe7857f1b8 --- /dev/null +++ b/src/libs/convert/attendsSchool.js @@ -0,0 +1,28 @@ +/* +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'; + } +}; diff --git a/src/libs/convert/instructionLevel.js b/src/libs/convert/instructionLevel.js new file mode 100644 index 0000000000000000000000000000000000000000..7750a704d90a916bc9ec01f04b43a262a9c02307 --- /dev/null +++ b/src/libs/convert/instructionLevel.js @@ -0,0 +1,40 @@ +/* +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'; + } +}; diff --git a/src/libs/convert/modality.js b/src/libs/convert/modality.js new file mode 100644 index 0000000000000000000000000000000000000000..a4c56f52ae800dace35c344245b30cf4c741655a --- /dev/null +++ b/src/libs/convert/modality.js @@ -0,0 +1,32 @@ +/* +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' + } +}; diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js index 8f45de99d125ac2b368c247c81b022186568c081..798df7f44edf595f8088c3a003de1dc8ec4e0f14 100644 --- a/src/libs/middlewares/id2str.js +++ b/src/libs/middlewares/id2str.js @@ -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 }; diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js index 360a16aee501669d64388067d164e14ee7a3acc9..449d9cc4b5c0586db2263ce9d84662b8e2e36ce1 100644 --- a/src/libs/routes_v1/newPnad.js +++ b/src/libs/routes_v1/newPnad.js @@ -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',