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

[ADD] filters 'attendModality, attendsSchool, capitalCode, ethnicGroupNewPnad,...

[ADD] filters 'attendModality, attendsSchool, capitalCode, ethnicGroupNewPnad, metroCode and regionCode' added to convert files and id2str
parent 362c4a7d
Branches
Tags
3 merge requests!391Hom -> Prod,!386Merge development -> homologa,!385Merge new_pnad -> development
......@@ -18,7 +18,7 @@ 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) {
module.exports = function attendedModality(id) {
switch (id) {
case 1:
return 'Creche';
......
......@@ -18,11 +18,14 @@ You should have received a copy of the GNU General Public License
along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/
// This file is used to convert the attendsSchool AND 'bolsa_familia' variable to a human-readable format.
module.exports = function attendsSchool(id) {
switch (id) {
case 1:
return 'Sim';
case 2:
return 'Não';
case 9:
return 'Sem informaçã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 capitalCode(id) {
switch (id) {
case 11:
return 'Porto Velho';
case 12:
return 'Rio Branco';
case 13:
return 'Manaus';
case 14:
return 'Boa Vista';
case 15:
return 'Belém';
case 16:
return 'Macapá';
case 17:
return 'Palmas';
case 21:
return 'São Luís';
case 22:
return 'Teresina';
case 23:
return 'Fortaleza';
case 24:
return 'Natal';
case 25:
return 'João Pessoa';
case 26:
return 'Recife';
case 27:
return 'Maceió';
case 28:
return 'Aracaju';
case 29:
return 'Salvador';
case 31:
return 'Belo Horizonte';
case 32:
return 'Vitória';
case 33:
return 'Rio de Janeiro';
case 35:
return 'São Paulo';
case 41:
return 'Curitiba';
case 42:
return 'Florianópolis';
case 43:
return 'Porto Alegre';
case 50:
return 'Campo Grande';
case 51:
return 'Cuiabá';
case 52:
return 'Goiânia';
case 53:
return 'Brasília';
default:
return 'Não é capital';
}
};
/*
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 ethnicGroupNewPnad(id) {
switch (id) {
case 1:
return 'Branca';
case 2:
return 'Preta';
case 3:
return 'Amarela';
case 4:
return 'Parda';
case 5:
return 'Indígena';
case 9:
return 'Sem declaraçã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 metroCode(id) {
switch (id) {
case 13:
return 'Região Metropolitana de Manaus';
case 15:
return 'Região Metropolitana de Belém';
case 16:
return 'Região Metropolitana de Macapá';
case 21:
return 'Região Metropolitana de Grande São Luís';
case 22:
return 'Região Administrativa Integrada de Desenvolvimento de Grande Teresina'
case 23:
return 'Região Metropolitana de Fortaleza';
case 24:
return 'Região Metropolitana de Natal';
case 25:
return 'Região Metropolitana de João Pessoa';
case 26:
return 'Região Metropolitana de Recife';
case 27:
return 'Região Metropolitana de Maceió';
case 28:
return 'Região Metropolitana de Aracaju';
case 29:
return 'Região Metropolitana de Salvador';
case 31:
return 'Região Metropolitana de Belo Horizonte';
case 32:
return 'Região Metropolitana de Grande Vitória';
case 33:
return 'Região Metropolitana do Rio de Janeiro';
case 35:
return 'Região Metropolitana de São Paulo';
case 41:
return 'Região Metropolitana de Curitiba';
case 42:
return 'Região Metropolitana de Florianópolis';
case 43:
return 'Região Metropolitana de Porto Alegre';
case 51:
return 'Região Metropolitana de Vale do Rio Cuiabá';
case 52:
return 'Região Metropolitana de Goiânia';
default:
return 'Não é região metropolitana ou região administrativa integrada';
}
};
/*
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 regionCode(id) {
switch (id) {
case 1:
return 'Norte';
case 2:
return 'Nordeste';
case 3:
return 'Sudeste';
case 4:
return 'Sul'
case 5:
return 'Centro-Oeste';
}
};
......@@ -108,6 +108,10 @@ 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 ethnicGroupNewPnad = require(`${libs}/convert/ethnicGroupNewPnad`);
const capitalCode = require(`${libs}/convert/capitalCode`);
const regionCode = require(`${libs}/convert/regionCode`);
const metroCode = require(`${libs}/convert/metroCode`);
const ids = {
gender_id: gender,
......@@ -207,7 +211,12 @@ const ids = {
instruction_level_id: instructionLevel,
attends_school_id: attendsSchool,
modality_id: modality,
attended_modality_id: attendedModality
attended_modality_id: attendedModality,
bolsa_familia_id: attendsSchool,
new_pnad_ethnic_group_id: ethnicGroupNewPnad,
cap_code_id: capitalCode,
reg_code_id: regionCode,
metro_code_id: metroCode
};
function transform(removeId=false) {
......@@ -330,5 +339,9 @@ module.exports = {
instructionLevel,
attendsSchool,
modality,
attendedModality
attendedModality,
ethnicGroupNewPnad,
capitalCode,
regionCode,
metroCode
};
......@@ -219,17 +219,17 @@ rqf.addField({
name: 'bolsa_familia',
table: 'pnad_novo',
tableField: 'recebeu_rendimentos_de_programa_bolsa_familia',
resultField: 'bolsa_familia',
resultField: 'bolsa_familia_id',
where: {
relation: '=',
type: 'integer',
field: 'recebeu_rendimentos_de_programa_bolsa_familia'
}
}).addValue({
name: 'race',
name: 'new_pnad_ethnic_group',
table: 'pnad_novo',
tableField: 'cor_raca',
resultField: 'race',
resultField: 'new_pnad_ethnic_group_id',
where: {
relation: '=',
type: 'integer',
......@@ -249,7 +249,7 @@ rqf.addField({
name: 'gender',
table: 'pnad_novo',
tableField: 'sexo',
resultField: 'gender',
resultField: 'gender_id',
where: {
relation: '=',
type: 'integer',
......@@ -259,7 +259,7 @@ rqf.addField({
name: 'cap_code',
table: 'pnad_novo',
tableField: 'cod_cap',
resultField: 'cap_code',
resultField: 'cap_code_id',
where: {
relation: '=',
type: 'integer',
......@@ -269,7 +269,7 @@ rqf.addField({
name: 'reg_code',
table: 'pnad_novo',
tableField: 'cod_regiao',
resultField: 'reg_code',
resultField: 'reg_code_id',
where: {
relation: '=',
type: 'integer',
......@@ -279,7 +279,7 @@ rqf.addField({
name: 'metro_code',
table: 'pnad_novo',
tableField: 'cod_rm_ride',
resultField: 'metro_code',
resultField: 'metro_code_id',
where: {
relation: '=',
type: 'integer',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment