Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SMPPIR-Node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMPPIR
SMPPIR-Node
Commits
80f3da87
Commit
80f3da87
authored
5 years ago
by
Edu Trevisan
Browse files
Options
Downloads
Patches
Plain Diff
Sim
parent
8f8f35ec
No related branches found
No related tags found
1 merge request
!28
Development
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/libs/routes/SMPPIR/sim.js
+166
-0
166 additions, 0 deletions
src/libs/routes/SMPPIR/sim.js
src/libs/routes/SMPPIR/taxa_homicidios.js
+90
-0
90 additions, 0 deletions
src/libs/routes/SMPPIR/taxa_homicidios.js
src/libs/routes/api.js
+5
-0
5 additions, 0 deletions
src/libs/routes/api.js
with
261 additions
and
0 deletions
src/libs/routes/SMPPIR/sim.js
0 → 100644
+
166
−
0
View file @
80f3da87
/*
Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of SMPPIR-Node.
SMPPIR-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.
SMPPIR-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 SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>.
*/
const
express
=
require
(
'
express
'
);
const
router
=
express
.
Router
();
const
libs
=
`
${
process
.
cwd
()}
/libs`
;
const
squel
=
require
(
'
squel
'
);
const
query
=
require
(
`
${
libs
}
/middlewares/query`
).
query
;
const
response
=
require
(
`
${
libs
}
/middlewares/response`
);
const
ReqQueryFields
=
require
(
`
${
libs
}
/middlewares/reqQueryFields`
);
const
rqf
=
new
ReqQueryFields
();
rqf
.
addField
({
name
:
'
filter
'
,
field
:
false
,
where
:
true
,
}).
addField
({
name
:
'
dims
'
,
field
:
true
,
where
:
false
,
})
.
addValue
({
name
:
'
year
'
,
table
:
'
sim
'
,
tableField
:
'
ano_obito
'
,
resultField
:
'
ano
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
ano_obito
'
,
},
})
.
addValue
({
name
:
'
uf
'
,
table
:
'
sim
'
,
tableField
:
'
"ocor_SIGLA_UF"
'
,
resultField
:
'
uf
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
string
'
,
field
:
'
"ocor_SIGLA_UF"
'
,
},
})
.
addValue
({
name
:
'
def_raca_cor
'
,
table
:
'
sim
'
,
tableField
:
'
def_raca_cor
'
,
resultField
:
'
def_raca_cor
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
string
'
,
field
:
'
def_raca_cor
'
,
},
})
.
addValue
({
name
:
'
raca_cor
'
,
table
:
'
sim
'
,
tableField
:
'
"RACACOR"
'
,
resultField
:
'
raca_cor
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
RACACOR
'
,
},
})
.
addValue
({
name
:
'
def_tipo_obito
'
,
table
:
'
sim
'
,
tableField
:
'
def_circ_obito
'
,
resultField
:
'
def_tipo_obito
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
def_circ_obito
'
,
},
})
.
addValue
({
name
:
'
tipo_obito
'
,
table
:
'
sim
'
,
tableField
:
'
"CIRCOBITO"
'
,
resultField
:
'
tipo_obito
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
"CIRCOBITO"
'
,
},
})
.
addValue
({
name
:
'
min_idade
'
,
table
:
'
sim
'
,
tableField
:
'
idade_obito_anos
'
,
resultField
:
'
idade
'
,
where
:
{
relation
:
'
>=
'
,
type
:
'
integer
'
,
field
:
'
idade_obito_anos
'
,
},
})
.
addValue
({
name
:
'
max_idade
'
,
table
:
'
sim
'
,
tableField
:
'
idade_obito_anos
'
,
resultField
:
'
idade
'
,
where
:
{
relation
:
'
<=
'
,
type
:
'
integer
'
,
field
:
'
idade_obito_anos
'
,
},
})
.
addValue
({
name
:
'
sexo
'
,
table
:
'
sim
'
,
tableField
:
'
"SEXO"
'
,
resultField
:
'
sexo
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
"SEXO"
'
,
},
})
.
addValue
({
name
:
'
def_sexo
'
,
table
:
'
sim
'
,
tableField
:
'
def_sexo
'
,
resultField
:
'
def_sexo
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
string
'
,
field
:
'
def_sexo
'
,
},
})
router
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
console
.
log
(
req
.
sql
.
toString
());
req
.
sql
.
field
(
'
count(*) AS Total
'
)
.
from
(
'
sim
'
);
next
();
},
query
,
response
(
'
sim
'
));
module
.
exports
=
router
;
This diff is collapsed.
Click to expand it.
src/libs/routes/SMPPIR/taxa_homicidios.js
0 → 100644
+
90
−
0
View file @
80f3da87
/*
Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of SMPPIR-Node.
SMPPIR-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.
SMPPIR-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 SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>.
*/
const
express
=
require
(
'
express
'
);
const
router
=
express
.
Router
();
const
libs
=
`
${
process
.
cwd
()}
/libs`
;
const
squel
=
require
(
'
squel
'
);
const
query
=
require
(
`
${
libs
}
/middlewares/query`
).
query
;
const
response
=
require
(
`
${
libs
}
/middlewares/response`
);
const
ReqQueryFields
=
require
(
`
${
libs
}
/middlewares/reqQueryFields`
);
const
rqf
=
new
ReqQueryFields
();
rqf
.
addField
({
name
:
'
filter
'
,
field
:
false
,
where
:
true
,
}).
addField
({
name
:
'
dims
'
,
field
:
true
,
where
:
false
,
})
.
addValue
({
name
:
'
year
'
,
table
:
'
taxa_homicidios
'
,
tableField
:
'
ano
'
,
resultField
:
'
ano
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
ano
'
,
},
})
.
addValue
({
name
:
'
uf
'
,
table
:
'
taxa_homicidios
'
,
tableField
:
'
uf
'
,
resultField
:
'
uf
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
string
'
,
field
:
'
uf
'
,
},
})
.
addValue
({
name
:
'
raca_cor
'
,
table
:
'
taxa_homicidios
'
,
tableField
:
'
raca_cor
'
,
resultField
:
'
raca_cor
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
string
'
,
field
:
'
raca_cor
'
,
},
})
router
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
console
.
log
(
req
.
sql
.
toString
());
req
.
sql
.
field
(
'
cast(cast(sum(obito) as float)*100000/cast(sum(filtro_ibge) as float) as integer) as taxa
'
)
.
from
(
'
taxa_homicidios
'
);
next
();
},
query
,
response
(
'
taxa_homicidios
'
));
module
.
exports
=
router
;
This diff is collapsed.
Click to expand it.
src/libs/routes/api.js
+
5
−
0
View file @
80f3da87
...
...
@@ -92,6 +92,9 @@ const youth_jobs = require(`${libs}/routes/SMPPIR/youth_jobs`)
const
youth_education
=
require
(
`
${
libs
}
/routes/SMPPIR/youth_education`
)
const
sim
=
require
(
`
${
libs
}
/routes/SMPPIR/sim`
)
const
taxa_homicidios
=
require
(
`
${
libs
}
/routes/SMPPIR/taxa_homicidios`
)
const
universityEnrollment
=
require
(
`
${
libs
}
/routes/universityEnrollment`
);
...
...
@@ -139,5 +142,7 @@ api.use('/ciganos_culture', ciganos_culture);
api
.
use
(
'
/ciganos_sustentability
'
,
ciganos_sustentability
);
api
.
use
(
'
/youth_jobs
'
,
youth_jobs
)
api
.
use
(
'
/youth_education
'
,
youth_education
)
api
.
use
(
'
/sim
'
,
sim
)
api
.
use
(
'
/taxa_homicidios
'
,
taxa_homicidios
)
module
.
exports
=
api
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment