From 658289283b6502abe6eab6318d883f07fcb78885 Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Fri, 23 Feb 2024 10:41:01 -0300
Subject: [PATCH 01/11] [ADD] Adding '/state', '/modality_shift' and
 '/age_range' subroutes to newPnad

---
 src/libs/routes_v1/newPnad.js | 40 +++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index a2b13aa0..eeeea886 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -217,6 +217,42 @@ PnadNovoApp.get('/modality', (req, res, next) => {
     next();
 }, response('modality'));
 
+PnadNovoApp.get('/modality_shift', (req, res, next) => {
+    req.result = []
+    for (let i = 1; i < 8; i++) {
+        req.result.push({
+            id: i, name: id2str.modalityShift(i)
+        });
+    }
+    req.result.push({id: 99, name: id2str.modality(99)});
+    req.result.push({id: null, name: id2str.modality(null)});
+    next();
+}, response('modality_shift'));
+
+PnadNovoApp.get('/state', (req, res, next) => {
+    req.result = []
+    for (let i = 11; i < 54; i++) {
+        req.result.push({
+            id: i, name: id2str.stateName(i)
+        });
+    }
+    req.result.push({id: 99, name: id2str.stateName(99)});
+
+    next();
+}, response('state'));
+
+PnadNovoApp.get('/age_range', (req, res, next) => {
+    req.result = []
+    for (let i = 1; i < 12; i++) {
+        req.result.push({
+            id: i, name: id2str.ageRangeAll(i)
+        });
+    }
+
+    next();
+}, response('state'));
+
+
 rqf.addField({
     name: 'filter',
     field: false,
@@ -378,12 +414,12 @@ rqf.addField({
 }).addValue({
     name: 'income_range',
     table: 'pnad_novo',
-    tableField: 'faixa_rendimento',
+    tableField: 'faixa_rendimento_aux',
     resultField: 'income_range_id',
     where: {
         relation: '=',
         type: 'integer',
-        field: 'faixa_rendimento'
+        field: 'faixa_rendimento_aux'
     }
 }).addValue({
     name: 'gender',
-- 
GitLab


From 89e35c274a055e388a236c3b346a36a89becc8c1 Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Fri, 23 Feb 2024 11:14:28 -0300
Subject: [PATCH 02/11] [FIX] '/state' subroute fixed in newPnad

---
 src/libs/convert/stateName.js |  2 ++
 src/libs/routes_v1/newPnad.js | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/libs/convert/stateName.js b/src/libs/convert/stateName.js
index 092969fa..9254af00 100644
--- a/src/libs/convert/stateName.js
+++ b/src/libs/convert/stateName.js
@@ -76,5 +76,7 @@ module.exports = function stateName(id) {
         return 'Distrito Federal';
         case 99:
         return 'Exterior';
+        default:
+        return 'Não declarada';
     }
 };
diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index eeeea886..b07e3069 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -232,9 +232,11 @@ PnadNovoApp.get('/modality_shift', (req, res, next) => {
 PnadNovoApp.get('/state', (req, res, next) => {
     req.result = []
     for (let i = 11; i < 54; i++) {
-        req.result.push({
-            id: i, name: id2str.stateName(i)
-        });
+        if (id2str.stateName(i) !== 'Não declarada') {
+            req.result.push({
+                id: i, name: id2str.stateName(i)
+            });
+        }
     }
     req.result.push({id: 99, name: id2str.stateName(99)});
 
@@ -379,7 +381,7 @@ rqf.addField({
     where: {
         relation: '=',
         type: 'integer',
-        field: 'modality_shift_id'
+        field: 'turno_nivel_etapa'
     }
 }).addValue({
     name: 'bolsa_familia',
-- 
GitLab


From 0475af46386cdfc505748ddb31005f5ada986f13 Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Mon, 26 Feb 2024 10:17:42 -0300
Subject: [PATCH 03/11] [FIX] '/state' subroute changed to '/new_pnad_state'

---
 src/libs/middlewares/id2str.js | 3 ++-
 src/libs/routes_v1/newPnad.js  | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js
index d15505d3..8141d1f6 100644
--- a/src/libs/middlewares/id2str.js
+++ b/src/libs/middlewares/id2str.js
@@ -220,7 +220,8 @@ const ids = {
     reg_code_id: regionCode,
     metro_code_id: metroCode,
     modality_shift_id: modalityShift,
-    income_range_id: incomeRange
+    income_range_id: incomeRange,
+    new_pnad_state_id: stateName
 };
 
 function transform(removeId=false) {
diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index b07e3069..800d5adc 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -229,7 +229,7 @@ PnadNovoApp.get('/modality_shift', (req, res, next) => {
     next();
 }, response('modality_shift'));
 
-PnadNovoApp.get('/state', (req, res, next) => {
+PnadNovoApp.get('/new_pnad_state', (req, res, next) => {
     req.result = []
     for (let i = 11; i < 54; i++) {
         if (id2str.stateName(i) !== 'Não declarada') {
@@ -241,7 +241,7 @@ PnadNovoApp.get('/state', (req, res, next) => {
     req.result.push({id: 99, name: id2str.stateName(99)});
 
     next();
-}, response('state'));
+}, response('new_pnad_state'));
 
 PnadNovoApp.get('/age_range', (req, res, next) => {
     req.result = []
@@ -252,7 +252,7 @@ PnadNovoApp.get('/age_range', (req, res, next) => {
     }
 
     next();
-}, response('state'));
+}, response('age_range'));
 
 
 rqf.addField({
@@ -273,7 +273,7 @@ rqf.addField({
         field: 'id'
     }
 }).addValue({
-    name: 'state',
+    name: 'new_pnad_state',
     table: 'estado',
     tableField: ['nome', 'id'],
     resultField: ['state_name', 'state_id'],
-- 
GitLab


From 863375b5049aee8366621e2a319e6e7e22d1c28e Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Mon, 26 Feb 2024 10:57:19 -0300
Subject: [PATCH 04/11] [FIX] Subroute '/new_pnad_state changed to '/state',
 '/reg_code' to '/region' and '/age_range' to '/age_range_all'

---
 src/libs/middlewares/id2str.js |  3 +--
 src/libs/routes_v1/newPnad.js  | 12 ++++++------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js
index 8141d1f6..d15505d3 100644
--- a/src/libs/middlewares/id2str.js
+++ b/src/libs/middlewares/id2str.js
@@ -220,8 +220,7 @@ const ids = {
     reg_code_id: regionCode,
     metro_code_id: metroCode,
     modality_shift_id: modalityShift,
-    income_range_id: incomeRange,
-    new_pnad_state_id: stateName
+    income_range_id: incomeRange
 };
 
 function transform(removeId=false) {
diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index 800d5adc..09b292fc 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -229,7 +229,7 @@ PnadNovoApp.get('/modality_shift', (req, res, next) => {
     next();
 }, response('modality_shift'));
 
-PnadNovoApp.get('/new_pnad_state', (req, res, next) => {
+PnadNovoApp.get('/state', (req, res, next) => {
     req.result = []
     for (let i = 11; i < 54; i++) {
         if (id2str.stateName(i) !== 'Não declarada') {
@@ -241,9 +241,9 @@ PnadNovoApp.get('/new_pnad_state', (req, res, next) => {
     req.result.push({id: 99, name: id2str.stateName(99)});
 
     next();
-}, response('new_pnad_state'));
+}, response('state'));
 
-PnadNovoApp.get('/age_range', (req, res, next) => {
+PnadNovoApp.get('/age_range_all', (req, res, next) => {
     req.result = []
     for (let i = 1; i < 12; i++) {
         req.result.push({
@@ -252,7 +252,7 @@ PnadNovoApp.get('/age_range', (req, res, next) => {
     }
 
     next();
-}, response('age_range'));
+}, response('age_range_all'));
 
 
 rqf.addField({
@@ -273,7 +273,7 @@ rqf.addField({
         field: 'id'
     }
 }).addValue({
-    name: 'new_pnad_state',
+    name: 'state',
     table: 'estado',
     tableField: ['nome', 'id'],
     resultField: ['state_name', 'state_id'],
@@ -404,7 +404,7 @@ rqf.addField({
         field: 'cor_raca'
     }
 }).addValue({
-    name: 'age_range',
+    name: 'age_range_all',
     table: 'pnad_novo',
     tableField: 'faixa_etaria',
     resultField: 'age_range_all_id',
-- 
GitLab


From 98e690250cc9adc867a550a62a1115d43593bd70 Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Mon, 26 Feb 2024 11:07:16 -0300
Subject: [PATCH 05/11] [FIX] '/region' subroute duplicate removed

---
 src/libs/middlewares/id2str.js |  2 +-
 src/libs/routes_v1/newPnad.js  | 29 ++++-------------------------
 2 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js
index d15505d3..02273a8b 100644
--- a/src/libs/middlewares/id2str.js
+++ b/src/libs/middlewares/id2str.js
@@ -217,7 +217,7 @@ const ids = {
     bolsa_familia_id: attendsSchool,
     new_pnad_ethnic_group_id: ethnicGroupNewPnad,
     cap_code_id: capitalCode,
-    reg_code_id: regionCode,
+    region_id: regionCode,
     metro_code_id: metroCode,
     modality_shift_id: modalityShift,
     income_range_id: incomeRange
diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index 09b292fc..d2ad0de7 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -97,7 +97,7 @@ PnadNovoApp.get('/new_pnad_adm_dependency', (req, res, next) => {
     next();
 }, response('new_pnad_adm_dependency'));
 
-PnadNovoApp.get('/reg_code', (req, res, next) => {
+PnadNovoApp.get('/region', (req, res, next) => {
     req.result = []
     for (let i = 1; i < 6; i++) {
         req.result.push({
@@ -106,18 +106,7 @@ PnadNovoApp.get('/reg_code', (req, res, next) => {
     }
 
     next();
-}, response('reg_code'));
-
-PnadNovoApp.get('/reg_code', (req, res, next) => {
-    req.result = []
-    for (let i = 1; i < 6; i++) {
-        req.result.push({
-            id: i, name: id2str.regionCode(i)
-        });
-    }
-
-    next();
-}, response('reg_code'));
+}, response('region'));
 
 PnadNovoApp.get('/cap_code', (req, res, next) => {
     req.result = []
@@ -444,10 +433,10 @@ rqf.addField({
         field: 'cod_cap'
     }
 }).addValue({
-    name: 'reg_code',
+    name: 'region',
     table: 'pnad_novo',
     tableField: 'cod_regiao',
-    resultField: 'reg_code_id',
+    resultField: 'region_id',
     where: {
         relation: '=',
         type: 'integer',
@@ -514,16 +503,6 @@ rqf.addField({
         type: 'integer',
         field: 'microrregiao_id'
     }
-}).addValue({
-    name: 'region',
-    table: 'pnad_novo',
-    tableField: 'cod_regiao',
-    resultField: 'reg_code_id',
-    where: {
-        relation: '=',
-        type: 'integer',
-        field: 'cod_regiao',
-    }
 });
 
 PnadNovoApp.get('/', rqf.parse(), rqf.build(),  (req, res, next) => {
-- 
GitLab


From 18a0b62470020395ce60f083a6ca851cafd81eaf Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Mon, 26 Feb 2024 11:31:38 -0300
Subject: [PATCH 06/11] [FIX] Some fixes based on 'LDE fix' file

---
 src/libs/convert/capitalCode.js        |  4 +++-
 src/libs/convert/ethnicGroupNewPnad.js |  2 +-
 src/libs/convert/metroCode.js          |  4 +++-
 src/libs/routes_v1/newPnad.js          | 19 ++++++++++++-------
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/src/libs/convert/capitalCode.js b/src/libs/convert/capitalCode.js
index 2e4774f5..09727c63 100644
--- a/src/libs/convert/capitalCode.js
+++ b/src/libs/convert/capitalCode.js
@@ -20,6 +20,8 @@ along with simcaq-node.  If not, see <https://www.gnu.org/licenses/>.
 
 module.exports = function capitalCode(id) {
     switch (id) {
+        case null:
+        return 'Não é capital';
         case 11:
         return 'Porto Velho';
         case 12:
@@ -75,7 +77,7 @@ module.exports = function capitalCode(id) {
         case 53:
         return 'Brasília';
         default:
-        return 'Não é capital';
+        return 'Não informado';
     }
 };
 
diff --git a/src/libs/convert/ethnicGroupNewPnad.js b/src/libs/convert/ethnicGroupNewPnad.js
index cfbd60e1..702a90ff 100644
--- a/src/libs/convert/ethnicGroupNewPnad.js
+++ b/src/libs/convert/ethnicGroupNewPnad.js
@@ -31,6 +31,6 @@ module.exports = function ethnicGroupNewPnad(id) {
         case 5:
         return 'Indígena';
         case 9:
-        return 'Sem declaração';
+        return 'Não declarado';
     }
 };
diff --git a/src/libs/convert/metroCode.js b/src/libs/convert/metroCode.js
index e7729bb4..95425f33 100644
--- a/src/libs/convert/metroCode.js
+++ b/src/libs/convert/metroCode.js
@@ -20,6 +20,8 @@ along with simcaq-node.  If not, see <https://www.gnu.org/licenses/>.
 
 module.exports = function metroCode(id) {
     switch (id) {
+        case null:
+        return 'Não é região metropolitana ou região administrativa integrada';
         case 13:
         return 'Região Metropolitana de Manaus';
         case 15:
@@ -63,6 +65,6 @@ module.exports = function metroCode(id) {
         case 52:
         return 'Região Metropolitana de Goiânia';
         default:
-        return 'Não é região metropolitana ou região administrativa integrada';
+        return 'Não informado';
     }
 };
diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index d2ad0de7..63fcc78d 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -77,12 +77,12 @@ PnadNovoApp.get('/years_of_study', (req, res, next) => {
 PnadNovoApp.get('/instruction_level', (req, res, next) => {
     req.result = []
 
-    for (let i = 1; i < 9; i++) {
+    for (let i = 1; i < 8; i++) {
         req.result.push({
             id: i, name: id2str.instructionLevel(i)
         });
     }
-
+    req.result.push({id: 99, name: id2str.instructionLevel(99)});
     next();
 }, response('instruction_level'));
 
@@ -111,10 +111,13 @@ PnadNovoApp.get('/region', (req, res, next) => {
 PnadNovoApp.get('/cap_code', (req, res, next) => {
     req.result = []
     for (let i = 11; i < 54; i++) {
+        if (id2str.capitalCode(i) !== 'Não informado') {
         req.result.push({
             id: i, name: id2str.capitalCode(i)
         });
+        }
     }
+    req.result.push({id: null, name: id2str.capitalCode(null)});
 
     next();
 }, response('cap_code'));
@@ -122,17 +125,20 @@ PnadNovoApp.get('/cap_code', (req, res, next) => {
 PnadNovoApp.get('/metro_code', (req, res, next) => {
     req.result = []
     for (let i = 13; i < 53; i++) {
+        if (id2str.metroCode(i) !== 'Não informado') {
         req.result.push({
             id: i, name: id2str.metroCode(i)
         });
+        }
     }
+    req.result.push({id: null, name: id2str.metroCode(null)});
 
     next();
 }, response('metro_code'));
 
 PnadNovoApp.get('/attended_modality', (req, res, next) => {
     req.result = []
-    for (let i = 1; i < 15; i++) {
+    for (let i = 1; i < 16; i++) {
         req.result.push({
             id: i, name: id2str.attendedModality(i)
         });
@@ -143,12 +149,12 @@ PnadNovoApp.get('/attended_modality', (req, res, next) => {
 
 PnadNovoApp.get('/income_range', (req, res, next) => {
     req.result = []
-    for (let i = 1; i < 15; i++) {
+    for (let i = 1; i < 8; i++) {
         req.result.push({
-            id: i, name: id2str.attendedModality(i)
+            id: i, name: id2str.incomeRange(i)
         });
     }
-    req.result.push({id: 99, name: id2str.attendedModality(99)});
+    req.result.push({id: 9, name: id2str.incomeRange(9)});
     next();
 }, response('income_range'));
 
@@ -159,7 +165,6 @@ PnadNovoApp.get('/attends_school', (req, res, next) => {
             id: i, name: id2str.attendsSchool(i)
         });
     }
-    req.result.push({id: 9, name: id2str.attendsSchool(9)});
     next();
 }, response('attends_school'));
 
-- 
GitLab


From ad2a32307cda7881deab230e6655c91ef6ca0df3 Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Tue, 27 Feb 2024 09:44:00 -0300
Subject: [PATCH 07/11] [FIX] modified values for the frontend to be able to
 make the request (capitalCode, metroCode and modalityShift)

---
 src/libs/convert/capitalCode.js   | 4 ++--
 src/libs/convert/metroCode.js     | 4 ++--
 src/libs/convert/modalityShift.js | 4 ++--
 src/libs/routes_v1/newPnad.js     | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/libs/convert/capitalCode.js b/src/libs/convert/capitalCode.js
index 09727c63..fe7c0862 100644
--- a/src/libs/convert/capitalCode.js
+++ b/src/libs/convert/capitalCode.js
@@ -20,8 +20,6 @@ along with simcaq-node.  If not, see <https://www.gnu.org/licenses/>.
 
 module.exports = function capitalCode(id) {
     switch (id) {
-        case null:
-        return 'Não é capital';
         case 11:
         return 'Porto Velho';
         case 12:
@@ -76,6 +74,8 @@ module.exports = function capitalCode(id) {
         return 'Goiânia';
         case 53:
         return 'Brasília';
+        case 99:
+        return 'Não é capital';
         default:
         return 'Não informado';
     }
diff --git a/src/libs/convert/metroCode.js b/src/libs/convert/metroCode.js
index 95425f33..0442f2c7 100644
--- a/src/libs/convert/metroCode.js
+++ b/src/libs/convert/metroCode.js
@@ -20,8 +20,6 @@ along with simcaq-node.  If not, see <https://www.gnu.org/licenses/>.
 
 module.exports = function metroCode(id) {
     switch (id) {
-        case null:
-        return 'Não é região metropolitana ou região administrativa integrada';
         case 13:
         return 'Região Metropolitana de Manaus';
         case 15:
@@ -64,6 +62,8 @@ module.exports = function metroCode(id) {
         return 'Região Metropolitana de Vale do Rio Cuiabá';
         case 52:
         return 'Região Metropolitana de Goiânia';
+        case 99:
+        return 'Não é região metropolitana ou região administrativa integrada';
         default:
         return 'Não informado';
     }
diff --git a/src/libs/convert/modalityShift.js b/src/libs/convert/modalityShift.js
index 23661130..7cde03d0 100644
--- a/src/libs/convert/modalityShift.js
+++ b/src/libs/convert/modalityShift.js
@@ -20,8 +20,6 @@ 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:
@@ -36,6 +34,8 @@ module.exports = function modalityShift(id) {
         return 'Não se aplica - pós graduação presencial';
         case 7:
         return 'EaD ou semipresencial';
+        case 9:
+        return 'Não informado';
         case 99:
         return 'Não frequenta instituição de ensino';
     } 
diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index 63fcc78d..729d7b99 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -117,7 +117,7 @@ PnadNovoApp.get('/cap_code', (req, res, next) => {
         });
         }
     }
-    req.result.push({id: null, name: id2str.capitalCode(null)});
+    req.result.push({id: 99, name: id2str.capitalCode(99)});
 
     next();
 }, response('cap_code'));
@@ -131,7 +131,7 @@ PnadNovoApp.get('/metro_code', (req, res, next) => {
         });
         }
     }
-    req.result.push({id: null, name: id2str.metroCode(null)});
+    req.result.push({id: 99, name: id2str.metroCode(99)});
 
     next();
 }, response('metro_code'));
@@ -218,8 +218,8 @@ PnadNovoApp.get('/modality_shift', (req, res, next) => {
             id: i, name: id2str.modalityShift(i)
         });
     }
+    req.result.push({id: 9, name: id2str.modality(9)});
     req.result.push({id: 99, name: id2str.modality(99)});
-    req.result.push({id: null, name: id2str.modality(null)});
     next();
 }, response('modality_shift'));
 
-- 
GitLab


From e57bfeb71d409a67f4f852de501878f005a19034 Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Tue, 27 Feb 2024 09:51:49 -0300
Subject: [PATCH 08/11] [FIX] id2str function fixed in subroute
 '/modality_shift'

---
 src/libs/routes_v1/newPnad.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index 729d7b99..720f3646 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -218,8 +218,8 @@ PnadNovoApp.get('/modality_shift', (req, res, next) => {
             id: i, name: id2str.modalityShift(i)
         });
     }
-    req.result.push({id: 9, name: id2str.modality(9)});
-    req.result.push({id: 99, name: id2str.modality(99)});
+    req.result.push({id: 9, name: id2str.modalityShift(9)});
+    req.result.push({id: 99, name: id2str.modalityShift(99)});
     next();
 }, response('modality_shift'));
 
-- 
GitLab


From f6620da0e35226894645a7a7009fa538b91530d9 Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Tue, 27 Feb 2024 10:13:44 -0300
Subject: [PATCH 09/11] [FIX] modified values for the frontend to be able to
 make the request (modality)

---
 src/libs/convert/modality.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/libs/convert/modality.js b/src/libs/convert/modality.js
index a4c56f52..d57d9338 100644
--- a/src/libs/convert/modality.js
+++ b/src/libs/convert/modality.js
@@ -26,6 +26,8 @@ module.exports = function modality(id) {
         return 'A distância';
         case 3:
         return 'Não informado';
+        case 9:
+        return 'Sem dados para 2022';
         case 99:
         return 'Não frequenta instituição de ensino'
     }
-- 
GitLab


From 608c3802423905eb61b4f9b0e9c337c6800c4a6d Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Wed, 28 Feb 2024 10:32:28 -0300
Subject: [PATCH 10/11] [TEST] Trying to modify the order of 'order by' in
 query exec

---
 src/libs/routes_v1/newPnad.js | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index 720f3646..c5756a4d 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -297,16 +297,6 @@ rqf.addField({
         foreign: 'cod_uf',
         foreignTable: 'pnad_novo'
     }
-}).addValue({
-    name: 'illiteracy',
-    table: 'pnad_novo',
-    tableField: 'analfabetismo',
-    resultField: 'illiteracy_id',
-    where: {
-        relation: '=',
-        type: 'integer',
-        field: 'analfabetismo'
-    }
 }).addValue({
     name: 'years_of_study',
     table: 'pnad_novo',
@@ -367,6 +357,16 @@ rqf.addField({
         type: 'integer',
         field: 'nivel_etapa_modalidade_freq'
     }
+}).addValue({
+    name: 'illiteracy',
+    table: 'pnad_novo',
+    tableField: 'analfabetismo',
+    resultField: 'illiteracy_id',
+    where: {
+        relation: '=',
+        type: 'integer',
+        field: 'analfabetismo'
+    }
 }).addValue({
     name: 'modality_shift',
     table: 'pnad_novo',
@@ -518,6 +518,6 @@ PnadNovoApp.get('/', rqf.parse(), rqf.build(),  (req, res, next) => {
     .order('pnad_novo.ano_ref')
     console.log(req.sql.toString())
     next();
-}, query, id2str.transform(false),response('pnad_novo'));
+}, query, id2str.transform(false), response('pnad_novo'));
 
 module.exports = PnadNovoApp;
-- 
GitLab


From 0b6452f01016ce8de48322d1940fe79c84af48dc Mon Sep 17 00:00:00 2001
From: fgs21 <fgs21@inf.ufpr.br>
Date: Wed, 28 Feb 2024 10:51:19 -0300
Subject: [PATCH 11/11] [TEST] Trying to modify the order of 'order by' in dim
 'state'

---
 src/libs/routes_v1/newPnad.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libs/routes_v1/newPnad.js b/src/libs/routes_v1/newPnad.js
index c5756a4d..bab8cdf9 100644
--- a/src/libs/routes_v1/newPnad.js
+++ b/src/libs/routes_v1/newPnad.js
@@ -269,8 +269,8 @@ rqf.addField({
 }).addValue({
     name: 'state',
     table: 'estado',
-    tableField: ['nome', 'id'],
-    resultField: ['state_name', 'state_id'],
+    tableField: ['id', 'nome'],
+    resultField: ['state_id', 'state_nome'],
     where: {
         relation: '=',
         type: 'integer',
-- 
GitLab