diff --git a/src/libs/convert/modalityShift.js b/src/libs/convert/modalityShift.js new file mode 100644 index 0000000000000000000000000000000000000000..23661130f016c476ff6da45217b0719ab59c1a15 --- /dev/null +++ b/src/libs/convert/modalityShift.js @@ -0,0 +1,42 @@ +/* +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 modalityShift(id) { + switch (id) { + case null: + return 'Não informado'; + case 1: + return 'Matutino'; + case 2: + return 'Vespertino'; + case 3: + return 'Noturno'; + case 4: + return 'Integral - matutino e vespertino'; + case 5: + return 'Outros'; + case 6: + return 'Não se aplica - pós graduação presencial'; + case 7: + return 'EaD ou semipresencial'; + 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 268df2a95aca24741461a21da681abbe5366541c..7229c2b48e5b02b6e9d95099e24b60b1bda39c92 100644 --- a/src/libs/middlewares/id2str.js +++ b/src/libs/middlewares/id2str.js @@ -112,6 +112,7 @@ const ethnicGroupNewPnad = require(`${libs}/convert/ethnicGroupNewPnad`); const capitalCode = require(`${libs}/convert/capitalCode`); const regionCode = require(`${libs}/convert/regionCode`); const metroCode = require(`${libs}/convert/metroCode`); +const modalityShift = require(`${libs}/convert/modalityShift`); const ids = { gender_id: gender, @@ -216,7 +217,8 @@ const ids = { new_pnad_ethnic_group_id: ethnicGroupNewPnad, cap_code_id: capitalCode, reg_code_id: regionCode, - metro_code_id: metroCode + metro_code_id: metroCode, + modality_shift_id: modalityShift }; function transform(removeId=false) { @@ -343,5 +345,6 @@ module.exports = { ethnicGroupNewPnad, capitalCode, regionCode, - metroCode + metroCode, + modalityShift }; diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js index 7fd00e5293332935dbdc353e5864dd6ecc33bb1b..cac2d7b833cda149d5013f91cc871507bf35afb9 100644 --- a/src/libs/routes_v1/newPnad.js +++ b/src/libs/routes_v1/newPnad.js @@ -215,6 +215,16 @@ rqf.addField({ type: 'integer', field: 'nivel_etapa_modalidade_freq' } +}).addValue({ + name: 'modality_shift', + table: 'pnad_novo', + tableField: 'turno_nivel_etapa', + resultField: 'modality_shift_id', + where: { + relation: '=', + type: 'integer', + field: 'modality_shift_id' + } }).addValue({ name: 'bolsa_familia', table: 'pnad_novo', @@ -239,7 +249,7 @@ rqf.addField({ name: 'age_range', table: 'pnad_novo', tableField: 'faixa_etaria', - resultField: 'age_range_id', + resultField: 'age_range_all_id', where: { relation: '=', type: 'integer',