Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • simcaq/simcaq-node
  • SMPPIR/SMPPIR-Node
2 results
Select Git revision
Show changes
Commits on Source (1107)
Showing
with 474 additions and 304 deletions
......@@ -24,3 +24,13 @@ docs/
.vscode/
package-lock.json
Dockerfile
DockerfileAntigo
src/libs/db/postgres.js
docker-compose.yml
entrypoint.sh
gulpfile*
gulpfile.template.js
gulpfile.babel.js
image: node:9.2.1
stages:
- test
services:
- mongo:latest
variables:
MONGO_URI: 'mongodb://mongo/app_name'
NODE_ENV: 'test'
before_script:
- node -v
- npm install --global gulp gulp-cli babel babel-cli babel-core babel-register mocha gulp-mocha gulp-eslint
- npm install
- curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- python get-pip.py
run_tests:
stage: test
script:
- git clone https://gitlab.c3sl.ufpr.br/simcaq/lde-api-regression-test.git
- ping -W1 -c1 mongo
- sed -i -e 's/false/true/g' config.json
- gulp build
- gulp test
- cd lde-api-regression-test
- pip install -r requirements.txt
- python regression_test.py --compare
tags:
- node
......@@ -4,6 +4,126 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## 1.15.7 - 2020-11-11
#Changes
- Fix Universitys in first step in course and enrollment indicators
- Fix Clear filters
## 1.15.6 - 2020-10-06
## Fix
- Change json subroute in university enrollment
## 1.15.5 - 2020-10-02
## Fix
- Employees indicator with school filter
## 1.15.4 - 2020-09-30
## Changed
- Remove next in univsersity enrollment
## 1.15.3 - 2020-09-30
## Changed
- Change result finish university
## 1.15.2 - 2020-09-21
## Changed
- Add localoffer in dims location in university enrollment
## 1.15.1 - 2020-07-31
## Changed
- Classroom_count final result is now rounded to 2 decimals intead of using ceil
## 1.15.0 - 2020-07-16
## Added
- Route location
## Changed
- Dim income_level in route pibpercapita now uses a different table, pib_quintis
- Population now uses ibge_pib table
## 1.14.2 - 2020-07-14
## Changed
- Courses route
- Addmissing
## 1.14.1 - 2020-06-24
- Fix gross and liquid enrollment ratio indicators
## 1.14.0 - 2020-06-17
## Added
- Route school_location
- Route mesoregion
- Route microregion
## Changed
- City route now returns microregion_id and mesoregion_id
- Update classCount base filters
- Update classroom base query
- Update classroomCount base filters in school
- Removed addMissing from cub route
- Changed dailyChargeAmount filter pattern
- Enrollment now has mesoregion/microregion dims/filters
- Changed reqFilters in outOfSchool route
- School now has mesoregion/microregion dims/filters
- Teacher now has mesoregion/microregion dims/filters
- UnivesityEnrollment now has mesoregion/microregion dims/filters
## 1.13.4 - 2020-06-05
- Arrangment filter in school indicator 2007-2019
- Employees Indicator 2007-2019
## 1.13.3 - 2020-05-21
## 1.13.2 - 2020-05-21
## Changed
- Rename rural category
## 1.13.1 - 2020-05-12
## Changed
- Fix dot error
## 1.13.0 - 2020-04-XX
## Added
- Added 2019 data
- Added Goverment agreement in school
- Added Arrangment dims in school
## Changed
- Updated 2007-2018
- Updated education level mod
- Updated adm_dependency_detailed filter
- Updated rural_location filter
- Updated period labels
- AddMissing will now force ordination by id
- Updated all routes to contain id in region, state and city dims
## 1.12.6 - 2020-02-02
## Changed
- Fix teacher education mod dimension
- Fix text
## 1.12.5 - 2020-01-27
## Changed
- Fix duplicated cities in courseCount
## 1.12.4 - 2020-01-27
## Changed
- Fix addMissing
## 1.12.3 - 2019-12-20
## Changed
- Fix new categories in education type for teacher
## 1.12.2 - 2019-12-19
## Changed
- Fix addMissing
- Add new categories in education type for teacher
## 1.12.1 - 2019-12-12
## Changed
- Added categories to adm dependency
## 1.12.0 - 2019-11-25
## Changed
- Add teacher count to classroom_count route
## 1.11.17 - 2019-10-08
## Changed
- Fix query\_exec
......
{
"development":
{
"port": 3000,
"ip": "127.0.0.1",
"debug" : true,
"monetdb": {
"host": "simcaqdb3.c3sl.ufpr.br",
"port": 50000,
"dbname": "simcaq_dev4",
"user": "monetdb",
"password":"monetdb",
"nrConnections": "4"
},
"cdn" : {
"url": "http://simcaqdb3.c3sl.ufpr.br:3000",
"download": "https://simcaqdev.c3sl.ufpr.br/download/"
},
"mongodb" : {
"uri": "mongodb://localhost/dev_users"
},
"monq": {
"uri": "mongodb://localhost/dev_monq"
},
"default": {
"api": {
"version" : "v1"
},
"lde": {
"url": "http://ldedev.c3sl.ufpr.br/#"
},
"simcaq": {
"url": "http://simcaqdev.c3sl.ufpr.br/#"
}
},
"email": {
"port": 25,
"host": "mx.c3sl.ufpr.br",
"secure": false,
"ignoreTLS": true,
"from": "\"Laboratório de Dados Educacionais\" <lde@c3sl.ufpr.br>"
},
"security": {
"tokenLife": 3600
}
},
"test":
{
"port": 4000,
"ip": "127.0.0.1",
"debug" : true,
"monetdb": {
"host": "simcaqdb3.c3sl.ufpr.br",
"port": 50000,
"dbname": "simcaq_dev4",
"user": "monetdb",
"password":"monetdb",
"nrConnections": "4"
},
"cdn" : {
"url": "http://simcaqdb3.c3sl.ufpr.br:3000",
"download": "https://simcaqdev.c3sl.ufpr.br/download/"
},
"mongodb" : {
"uri": "mongodb://localhost/test_users",
"secret": "SimCAQC3SL"
},
"monq": {
"uri": "mongodb://localhost/test_monq"
},
"default": {
"api": {
"version" : "v1"
},
"lde": {
"url": "http://ldedev.c3sl.ufpr.br/#"
},
"simcaq": {
"url": "http://simcaqdev.c3sl.ufpr.br/#"
}
},
"email": {
"port": 25,
"host": "mx.c3sl.ufpr.br",
"secure": false,
"ignoreTLS": true,
"from": "\"Laboratório de Dados Educacionais\" <lde@c3sl.ufpr.br>"
},
"security": {
"tokenLife": 3600
}
},
"production":
{
"port": 6000,
"ip": "127.0.0.1",
"debug" : false,
"monetdb": {
"host": "simcaqdb3.c3sl.ufpr.br",
"port": 50000,
"dbname": "simcaq_dev4",
"user": "monetdb",
"password":"monetdb",
"nrConnections": "4"
},
"cdn" : {
"url": "http://simcaqdb3.c3sl.ufpr.br:7000",
"download": "https://simcaq.c3sl.ufpr.br/download/"
},
"mongodb" : {
"uri": "mongodb://localhost/users",
"secret": "SimCAQC3SL"
},
"monq": {
"uri": "mongodb://localhost/monq"
},
"default": {
"api": {
"version" : "v1"
},
"lde": {
"url": "http://lde.c3sl.ufpr.br/#"
},
"simcaq": {
"url": "http://simcaq.c3sl.ufpr.br/#"
}
},
"email": {
"port": 25,
"host": "mx.c3sl.ufpr.br",
"secure": false,
"ignoreTLS": true,
"from": "\"Laboratório de Dados Educacionais\" <lde@c3sl.ufpr.br>"
},
"security": {
"tokenLife": 3600
}
}
}
require('babel-core/register');
const fs = require('fs');
const gulp = require('gulp');
const babel = require('gulp-babel');
const eslint = require('gulp-eslint');
const mocha = require('gulp-mocha');
const istanbul = require('gulp-istanbul');
const nodemon = require('gulp-nodemon');
const Cache = require('gulp-file-cache');
const docco = require('gulp-docco');
const mkdirp = require('mkdirp');
const cache = new Cache();
function createLogDir() {
const logDirPath = 'build/logs';
mkdirp(logDirPath, (err) => {
if(err) console.error(err);
});
}
gulp.task('lint', () => {
// run ESLint
gulp.src('src/**/*.js')
.pipe(eslint())
.pipe(eslint.format());
})
/**
* Compile source files
*/
gulp.task('compile', ['lint'], () => {
// compile source to ES5
gulp.src('src/**/*.js')
.pipe(cache.filter()) // cache source files
.pipe(babel()) // compile only modified files
// .pipe(cache.cache()) // cache compiled files
.pipe(gulp.dest('build')); // move compiled files to build directory
});
gulp.task('build', ['compile'], () => {
var filesToCopy = [ 'config.json', 'package.json' ];
// copy configuration file to build directory
gulp.src(filesToCopy)
.pipe(gulp.dest('build'));
createLogDir();
});
gulp.task('docco', () => {
gulp.src('./src/**/*.js')
.pipe(docco())
.pipe(gulp.dest('./docs'));
});
gulp.task('doc', ['docco']);
gulp.task('pre-test', () => {
return gulp.src(['build/**/*.js', '!build/{test,test/**}'])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], () => {
process.chdir('build');
gulp.src(['test/**/*.js'], {read: false})
.pipe(mocha({timeout: 60000}))
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({
thresholds: {
global: {
statements: 80,
branches: 70,
lines: 80,
functions: 80
}
}
}))
.on('error', () => {
process.exit(1);
})
.on('end', () => {
process.exit();
});
});
gulp.task('watch', ['compile'], () => {
console.log('Watching source directory for changes');
gulp.watch('src/**/*.js').on('change', () => {
console.log('Recompiling source');
gulp.start('compile');
console.log('Source recompilation done');
});
});
gulp.task('run', () => {
process.chdir('build');
nodemon({
script: 'server.js',
tasks: ['watch'],
ignore: ["test/test.js", "gulpfile.babel.js"],
ext: 'js html json',
env: { 'NODE_ENV': 'development' }
});
});
gulp.task('default', ['run']);
......@@ -19,6 +19,7 @@
"babel-core": "^6.26.3",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"bcrypt": "^5.1.0",
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.18.3",
"chai": "^3.5.0",
......@@ -51,6 +52,7 @@
"mocha": "^3.5.3",
"monetdb-pool": "0.0.8",
"mongoose": "^4.13.17",
"multer": "^1.4.5-lts.1",
"natives": "^1.1.6",
"nconf": "^0.8.5",
"node-uuid": "^1.4.8",
......@@ -60,7 +62,10 @@
"passport": "^0.3.2",
"passport-http-bearer": "^1.0.1",
"passport-oauth2-client-password": "^0.1.2",
"pg": "^8.10.0",
"request": "^2.88.0",
"sequelize": "^6.31.0",
"sequelize-cli": "^6.6.0",
"sqlstring": "^2.3.1",
"squel": "^5.12.2",
"winston": "^2.4.4"
......
*downloads.js
*resetToken.js (V)
*pqr.js
*simulation.js
*user.js (V)
*verifyToken.js (V)
......@@ -14,14 +14,11 @@ const config = require(`${libs}/config`);
const app = express();
const api = require('./routes/api');
const api_v1 = require('./routes_v1/api');
const api_v2 = require('./routes_v2/api');
const passport = require('passport');
const mongoose = require(`${libs}/db/mongoose`);
const db = mongoose();
require(`${libs}/middlewares/passport`);
app.use(bodyParser.json({limit: '50mb'}));
......@@ -65,7 +62,10 @@ app.use((req, res, next) => {
next();
});
// Mounts all API routes under /api/v1
app.use('/api/v1', api);
app.use('/api/v1', api_v1);
// Mounts all API routes under /api/v2
app.use('/api/v2', api_v2);
// Catch 404 and forward to error handler
app.use((req, res, next) => {
......
......@@ -26,6 +26,8 @@ module.exports = function academicLevel(id) {
return 'Licenciatura';
case 3:
return 'Tecnológico';
case 4:
return 'Bacharelado e Licenciatura';
default:
return 'Não classificada';
}
......
......@@ -27,11 +27,15 @@ module.exports = function admDependencyPriv(id) {
case 3:
return 'Municipal';
case 4:
return 'Privada conveniada';
return 'Privada conveniada sem fins lucrativos';
case 5:
return 'Privada não conveniada sem fins lucrativos';
return 'Privada conveniada com fins lucrativos';
case 6:
return 'Privada não conveniada sem fins lucrativos';
case 7:
return 'Privada não conveniada com fins lucrativos';
case 8:
return 'Privada sem detalhamento';
default:
return 'Não classificada';
}
......
/*
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/>.
*/
module.exports = function admDependencyPub(id) {
switch (id) {
case 1:
return 'Rede pública';
case 2:
return 'Rede estadual';
case 3:
return 'Rede municipal';
default:
return 'Não classificada';
}
};
/*
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/>.
*/
module.exports = function ageRange19to64(id) {
switch (id) {
case 6:
return '19 a 24 anos';
case 7:
return '25 a 29 anos';
case 8:
return '30 a 40 anos';
case 9:
return '41 a 50 anos';
case 10:
return '51 a 64 anos';
case 11:
return 'Mais que 64 anos';
default:
return 'Não declarada';
}
};
/*
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/>.
*/
module.exports = function ageRangeAggregate(id) {
switch (id) {
case 1:
return '0 a 3 anos';
case 2:
return '4 a 5 anos';
case 3:
return '6 a 10 anos';
case 4:
return '11 a 14 anos';
case 5:
return '15 a 17 anos';
case 6:
return '18 anos ou mais';
default:
return 'Não declarada';
}
};
......@@ -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 ageRange(id) {
module.exports = function ageRangeAll(id) {
switch (id) {
case 1:
return '0 a 3 anos';
......
/*
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/>.
*/
module.exports = function ageRangeEntity(id) {
switch (id) {
case 1:
return 'Até 24 anos';
case 2:
return '25 a 29 anos';
case 3:
return '30 a 39 anos';
case 4:
return '40 a 49 anos';
case 5:
return '50 a 54 anos';
case 6:
return '55 a 59 anos';
case 7:
return '60 anos ou mais';
default:
return 'Não declarada';
}
};
/*
Copyright (C) 2025 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 ageRangePopSchool(id) {
switch (id) {
case 1:
return '0 a 3 anos';
case 2:
return '4 a 5 anos';
case 3:
return '6 a 10 anos';
case 4:
return '11 a 14 anos';
case 5:
return '15 a 17 anos';
case 6:
return '18 a 24 anos';
case 7:
return 'Acima de 24 anos';
default:
return 'Não declarada';
}
};
/*
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 names = ["CRE", "PRE", "EF-AI", "EF-AF", "MULTIETAPA", "EM", "EJA", "PROF", "EE"]
module.exports = function arrangement(id) {
let binaryId = id.toString(2)
let str = ''
for (let i = 0; i <= binaryId.length; i++) {
if (binaryId.charAt(i) === "1") {
str += names[ i + (names.length - binaryId.length) ] + '/';
}
}
return str.slice(0, -1);
}
\ No newline at end of file
/*
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 attendedModality(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 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';
}
};
/*
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/>.
*/
// 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';
}
};
......@@ -19,10 +19,16 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/
module.exports = function booleanVariable(id) {
if (id == null)
return 'Não Declarado';
else if (id == false)
return 'Não';
else if (id == true)
switch(id){
case 1:
return 'Sim';
case true:
return 'Sim';
case 0:
return 'Não';
case false:
return 'Não';
default:
return 'Não Declarado';
}
};