Skip to content
Snippets Groups Projects
Commit 4e664999 authored by Fernando Erd's avatar Fernando Erd :ok_hand:
Browse files

v1.11.0

parent 0189356c
Branches
Tags
1 merge request!206v1.11.0
Pipeline #20346 failed
...@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ...@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## 1.11.0 - 2019-05-24
## Changed
- Add university teacher indicator for 2017
## 1.10.5 - 2019-05-23 ## 1.10.5 - 2019-05-23
## Changed ## Changed
- Revert api.js - Revert api.js
......
...@@ -24,5 +24,7 @@ module.exports = function genderIES(id) { ...@@ -24,5 +24,7 @@ module.exports = function genderIES(id) {
return 'Feminino'; return 'Feminino';
case 2: case 2:
return 'Masculino'; return 'Masculino';
default:
return 'Não declarado';
} }
}; };
...@@ -25,6 +25,6 @@ module.exports = function studentDeficiency(id) { ...@@ -25,6 +25,6 @@ module.exports = function studentDeficiency(id) {
case 1: case 1:
return 'Sim'; return 'Sim';
default: default:
return 'Não classificado' return 'Não declarado'
} }
}; };
...@@ -23,12 +23,14 @@ module.exports = function teacherSchooling(id) { ...@@ -23,12 +23,14 @@ module.exports = function teacherSchooling(id) {
case 1: case 1:
return 'Sem graduação'; return 'Sem graduação';
case 2: case 2:
return 'graduação'; return 'Graduação';
case 3: case 3:
return 'Especialização'; return 'Especialização';
case 4: case 4:
return 'Mestrado'; return 'Mestrado';
case 5: case 5:
return 'Doutorado'; return 'Doutorado';
default:
return 'Não declarado';
} }
}; };
...@@ -28,5 +28,7 @@ module.exports = function workRegime(id) { ...@@ -28,5 +28,7 @@ module.exports = function workRegime(id) {
return 'Tempo Parcial'; return 'Tempo Parcial';
case 4: case 4:
return 'Horista'; return 'Horista';
default:
return 'Não declarado';
} }
}; };
...@@ -112,6 +112,8 @@ const courseCount = require(`${libs}/routes/courseCount`); ...@@ -112,6 +112,8 @@ const courseCount = require(`${libs}/routes/courseCount`);
const university = require(`${libs}/routes/university`); const university = require(`${libs}/routes/university`);
const universityTeacher = require(`${libs}/routes/universityTeacher`);
api.get('/', (req, res) => { api.get('/', (req, res) => {
res.json({ msg: 'SimCAQ API is running' }); res.json({ msg: 'SimCAQ API is running' });
}); });
...@@ -159,6 +161,7 @@ api.use('/employees', employees); ...@@ -159,6 +161,7 @@ api.use('/employees', employees);
api.use('/financial', financial); api.use('/financial', financial);
api.use('/university_enrollment', universityEnrollment); api.use('/university_enrollment', universityEnrollment);
api.use('/university', university); api.use('/university', university);
api.use('/university_teacher', universityTeacher);
api.use('/course_count', courseCount); api.use('/course_count', courseCount);
module.exports = api; module.exports = api;
/*
Copyright (C) 2016 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/>.
*/
const express = require('express');
const teacherEnrollmentApp = express.Router();
const libs = `${process.cwd()}/libs`;
const log = require(`${libs}/log`)(module);
const squel = require('squel');
const query = require(`${libs}/middlewares/query`).query;
const response = require(`${libs}/middlewares/response`);
const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`);
const id2str = require(`${libs}/middlewares/id2str`);
const addMissing = require(`${libs}/middlewares/addMissing`);
const config = require(`${libs}/config`);
const cache = require('apicache').options({ debug: config.debug, statusCodes: {include: [200]} }).middleware;
let rqf = new ReqQueryFields();
teacherEnrollmentApp.get('/years', (req, res, next) => {
req.sql.from('docente_ens_superior')
.field('DISTINCT docente_ens_superior.ano_censo', 'year')
.where('docente_ens_superior.ano_censo = 2017');
next();
}, query, response('years'));
teacherEnrollmentApp.get('/year_range', (req, res, next) => {
req.sql.from('docente_ens_superior')
.field('MIN(docente_ens_superior.ano_censo)', 'start_year')
.field('MAX(docente_ens_superior.ano_censo)', 'end_year');
next();
}, query, response('range'));
teacherEnrollmentApp.get('/academic_organization', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 5; ++i) {
req.result.push({
id: i,
name: id2str.academicOrganization(i)
});
};
next();
}, response('academic_organization'));
teacherEnrollmentApp.get('/upper_adm_dependency', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 7; ++i) {
req.result.push({
id: i,
name: id2str.upperAdmDependency(i)
});
};
next();
}, response('upper_adm_dependency'));
teacherEnrollmentApp.get('/teacher_situation', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 6; ++i) {
req.result.push({
id: i,
name: id2str.teacherSituation(i)
});
};
next();
}, response('teacher_situation'));
teacherEnrollmentApp.get('/work_regime', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 4; ++i) {
req.result.push({
id: i,
name: id2str.workRegime(i)
});
};
next();
}, response('work_regime'));
teacherEnrollmentApp.get('/substitute', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 1; ++i) {
req.result.push({
id: i,
name: id2str.booleanVariable(i)
});
};
next();
}, response('substitute'));
teacherEnrollmentApp.get('/visitor', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 1; ++i) {
req.result.push({
id: i,
name: id2str.booleanVariable(i)
});
};
next();
}, response('visitor'));
teacherEnrollmentApp.get('/ead_teacher', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 1; ++i) {
req.result.push({
id: i,
name: id2str.booleanVariable(i)
});
};
next();
}, response('ead_teacher'));
teacherEnrollmentApp.get('/graduation_presential', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 1; ++i) {
req.result.push({
id: i,
name: id2str.booleanVariable(i)
});
};
next();
}, response('graduation_presential'));
teacherEnrollmentApp.get('/postgraduate_ead_teacher', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 1; ++i) {
req.result.push({
id: i,
name: id2str.booleanVariable(i)
});
};
next();
}, response('postgraduate_ead_teacher'));
teacherEnrollmentApp.get('/postgraduate_presential_teacher', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 1; ++i) {
req.result.push({
id: i,
name: id2str.booleanVariable(i)
});
};
next();
}, response('postgraduate_presential_teacher'));
teacherEnrollmentApp.get('/deficiency', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 1; ++i) {
req.result.push({
id: i,
name: id2str.booleanVariable(i)
});
};
next();
}, response('deficiency'));
teacherEnrollmentApp.get('/ethnic_group_teacher_ies', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 5; ++i) {
req.result.push({
id: i,
name: id2str.ethnicGroupTeacherIES(i)
});
};
next();
}, response('ethnic_group_teacher_ies'));
teacherEnrollmentApp.get('/teacher_schooling', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 5; ++i) {
req.result.push({
id: i,
name: id2str.teacherSchooling(i)
});
};
next();
}, response('teacher_schooling'));
teacherEnrollmentApp.get('/gender_ies', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 2; ++i) {
req.result.push({
id: i,
name: id2str.genderIES(i)
});
};
next();
}, response('gender_ies'));
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'min_year',
table: '@',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
table: '@',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: '@',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
table: '@',
field: 'ano_censo'
}
}).addValue({
name: 'state',
table: 'estado',
tableField: ['nome', 'id'],
resultField: ['state_name', 'state_id'],
where: {
relation: '=',
type: 'integer',
field: 'cod_uf_ies',
table: '@'
},
join: {
primary: 'id',
foreign: 'cod_uf_ies',
foreignTable: '@'
}
}).addValue({
name: 'city',
table: 'municipio',
tableField: ['nome', 'id'],
resultField: ['city_name', 'city_id'],
where: {
relation: '=',
type: 'integer',
field: 'cod_municipio_ies',
table: '@'
},
join: {
primary: 'id',
foreign: 'cod_municipio_ies',
foreignTable: '@'
}
}).addValue({
name: 'region',
table: 'regiao',
tableField: ['nome', 'id'],
resultField: ['region_name', 'region_id'],
where: {
relation: '=',
type: 'integer',
field: 'id'
},
join: {
primary: 'id',
foreign: 'cod_regiao_ies',
foreignTable: 'docente_ens_superior'
}
}).addValue({
name: 'university',
table: 'docente_ens_superior',
tableField: ['cod_ies', 'nome_ies'],
resultField: ['university_id', 'university_name'],
where: {
relation: '=',
type: 'integer',
field: 'cod_ies'
}
}).addValue({
name: 'upper_adm_dependency',
table: 'docente_ens_superior',
tableField: 'cod_categoria_administrativa',
resultField: 'upper_adm_dependency_id',
where: {
relation: '=',
type: 'integer',
table: 'docente_ens_superior',
field: 'cod_categoria_administrativa'
}
}).addValue({
name: 'academic_organization',
table: 'docente_ens_superior',
tableField: 'cod_organizacao_academica',
resultField: 'academic_organization_id',
where: {
relation: '=',
type: 'integer',
table: 'docente_ens_superior',
field: 'cod_organizacao_academica'
}
}).addValue({
name:'academic_level',
table: 'docente_ens_superior',
tableField: 'cod_grau_academico',
resultField: 'academic_level_id',
where: {
relation: '=',
type: 'integer',
field: 'cod_grau_academico'
}
}).addValue({
name:'upper_education_mod',
table: 'docente_ens_superior',
tableField: 'cod_modalidade_ensino',
resultField: 'upper_education_mod_id',
where: {
relation: '=',
type: 'integer',
field: 'cod_modalidade_ensino'
}
}).addValue({
name:'teacher_situation',
table: 'docente_ens_superior',
tableField: 'cod_situacao_docente',
resultField: 'teacher_situation_id',
where: {
relation: '=',
type: 'integer',
field: 'cod_situacao_docente'
}
}).addValue({
name:'work_regime',
table: 'docente_ens_superior',
tableField: 'cod_regime_trabalho',
resultField: 'work_regime_id',
where: {
relation: '=',
type: 'integer',
field: 'cod_regime_trabalho'
}
}).addValue({
name:'substitute',
table: 'docente_ens_superior',
tableField: 'docente_substituto',
resultField: 'substitute_id',
where: {
relation: '=',
type: 'integer',
field: 'docente_substituto'
}
}).addValue({
name:'visitor',
table: 'docente_ens_superior',
tableField: 'docente_visitante',
resultField: 'visitor_id',
where: {
relation: '=',
type: 'integer',
field: 'docente_visitante'
}
}).addValue({
name:'ead_teacher',
table: 'docente_ens_superior',
tableField: 'ministra_aula_ead',
resultField: 'ead_teacher_id',
where: {
relation: '=',
type: 'integer',
field: 'ministra_aula_ead'
}
}).addValue({
name:'graduation_presential',
table: 'docente_ens_superior',
tableField: 'atua_atividade_graduacao_presencial',
resultField: 'graduation_presential_id',
where: {
relation: '=',
type: 'integer',
field: 'atua_atividade_graduacao_presencial'
}
}).addValue({
name:'postgraduate_ead_teacher',
table: 'docente_ens_superior',
tableField: 'atua_atividade_posgraduacao_distancia',
resultField: 'postgraduate_ead_teacher_id',
where: {
relation: '=',
type: 'integer',
field: 'atua_atividade_posgraduacao_distancia'
}
}).addValue({
name:'postgraduate_presential_teacher',
table: 'docente_ens_superior',
tableField: 'atua_atividade_posgraduacao_presencial',
resultField: 'postgraduate_presential_teacher_id',
where: {
relation: '=',
type: 'integer',
field: 'atua_atividade_posgraduacao_presencial'
}
}).addValue({
name:'teacher_schooling',
table: 'docente_ens_superior',
tableField: 'cod_escolaridade_docente',
resultField: 'teacher_schooling_id',
where: {
relation: '=',
type: 'integer',
field: 'cod_escolaridade_docente'
}
}).addValue({
name:'ethnic_group_teacher_ies',
table: 'docente_ens_superior',
tableField: 'cod_cor_raca_docente',
resultField: 'ethnic_group_teacher_ies_id',
where: {
relation: '=',
type: 'integer',
field: 'cod_cor_raca_docente'
}
}).addValue({
name:'gender_ies',
table: 'docente_ens_superior',
tableField: 'sexo_docente',
resultField: 'gender_ies_id',
where: {
relation: '=',
type: 'integer',
field: 'sexo_docente'
}
}).addValue({
name:'deficiency',
table: 'docente_ens_superior',
tableField: 'docente_deficiencia',
resultField: 'deficiency_id',
where: {
relation: '=',
type: 'integer',
field: 'docente_deficiencia'
}
});
teacherEnrollmentApp.get('/', rqf.parse(), (req, res, next) => {
req.sql.field('COUNT(*)', 'total')
.field("'Brasil'", 'name')
.field('docente_ens_superior.ano_censo', 'year')
.from('docente_ens_superior')
.group('docente_ens_superior.ano_censo')
.order('docente_ens_superior.ano_censo')
next();
}, rqf.build(), query, addMissing(rqf), id2str.transform(false), response('teacherEnrollment'));
module.exports = teacherEnrollmentApp;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment