Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
simcaq
simcaq-node
Commits
ffe11074
Commit
ffe11074
authored
5 months ago
by
tgcl21
Browse files
Options
Downloads
Patches
Plain Diff
Starter query works
parent
77ea9f08
No related branches found
No related tags found
2 merge requests
!502
Development
,
!492
Indicador Número de Matrículas do Ensino Superior (novo)
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/routes_v1/api.js
+2
-6
2 additions, 6 deletions
src/libs/routes_v1/api.js
src/libs/routes_v1/superiorEnrollmentAggregate.js
+273
-272
273 additions, 272 deletions
src/libs/routes_v1/superiorEnrollmentAggregate.js
with
275 additions
and
278 deletions
src/libs/routes_v1/api.js
+
2
−
6
View file @
ffe11074
...
@@ -172,16 +172,12 @@ const adjustedLiquidFrequency = require(`${libs}/routes_v1/adjustedLiquidFrequen
...
@@ -172,16 +172,12 @@ const adjustedLiquidFrequency = require(`${libs}/routes_v1/adjustedLiquidFrequen
const
iliteracyRate
=
require
(
`
${
libs
}
/routes_v1/iliteracyRate`
);
const
iliteracyRate
=
require
(
`
${
libs
}
/routes_v1/iliteracyRate`
);
// comentei para ver se o api.get abaixo ia dar certo (nao deu)
// comentei para ver se o api.get abaixo ia dar certo (nao deu)
//
const superiorEnrollmentAggregate = require(`${libs}/routes_v1/superiorEnrollmentAggregate`);
const
superiorEnrollmentAggregate
=
require
(
`
${
libs
}
/routes_v1/superiorEnrollmentAggregate`
);
api
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
api
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
res
.
json
({
msg
:
'
SimCAQ API v1 is running
'
});
res
.
json
({
msg
:
'
SimCAQ API v1 is running
'
});
});
});
api
.
get
(
'
/superior_enrollment_aggregate
'
,
(
req
,
res
)
=>
{
res
.
json
({
msg
:
'
oi
'
});
})
// mount API routes_v1
// mount API routes_v1
api
.
use
(
'
/test
'
,
test
);
api
.
use
(
'
/test
'
,
test
);
api
.
use
(
'
/user
'
,
user
);
api
.
use
(
'
/user
'
,
user
);
...
@@ -251,7 +247,7 @@ api.use('/superior_education_conclusion_tax', superiorEducationConclusionTax)
...
@@ -251,7 +247,7 @@ api.use('/superior_education_conclusion_tax', superiorEducationConclusionTax)
api
.
use
(
'
/basic_education_conclusion
'
,
basicEducationConclusion
);
api
.
use
(
'
/basic_education_conclusion
'
,
basicEducationConclusion
);
api
.
use
(
'
/adjusted_liquid_frequency
'
,
adjustedLiquidFrequency
);
api
.
use
(
'
/adjusted_liquid_frequency
'
,
adjustedLiquidFrequency
);
api
.
use
(
'
/iliteracy_rate
'
,
iliteracyRate
);
api
.
use
(
'
/iliteracy_rate
'
,
iliteracyRate
);
//
api.use('/superior_enrollment_aggregate', superiorEnrollmentAggregate);
api
.
use
(
'
/superior_enrollment_aggregate
'
,
superiorEnrollmentAggregate
);
//Publication
//Publication
api
.
use
(
'
/publication
'
,
publication
);
api
.
use
(
'
/publication
'
,
publication
);
...
...
This diff is collapsed.
Click to expand it.
src/libs/routes_v1/superiorEnrollmentAggregate.js
+
273
−
272
View file @
ffe11074
...
@@ -19,6 +19,7 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
...
@@ -19,6 +19,7 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/
*/
const
express
=
require
(
'
express
'
);
const
express
=
require
(
'
express
'
);
const
{
result
}
=
require
(
'
lodash
'
);
const
{
result
}
=
require
(
'
lodash
'
);
const
superiorEnrollmentAggregateApp
=
express
.
Router
();
const
superiorEnrollmentAggregateApp
=
express
.
Router
();
...
@@ -237,277 +238,277 @@ let rqf = new ReqQueryFields();
...
@@ -237,277 +238,277 @@ let rqf = new ReqQueryFields();
// }, response('special_education'));
// }, response('special_education'));
//
rqf.addField({
rqf
.
addField
({
//
name: 'filter',
name
:
'
filter
'
,
//
field: false,
field
:
false
,
//
where: true
where
:
true
//
}).addField({
}).
addField
({
//
name: 'dims',
name
:
'
dims
'
,
//
field: true,
field
:
true
,
//
where: false
where
:
false
//
}).addValue({
}).
addValue
({
//
name: 'adm_dependency',
name
:
'
adm_dependency
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'dependencia_adm_id',
tableField
:
'
dependencia_adm_id
'
,
//
resultField: 'adm_dependency_id',
resultField
:
'
adm_dependency_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'dependencia_adm_id'
field
:
'
dependencia_adm_id
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'adm_dependency_detailed',
name
:
'
adm_dependency_detailed
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'dependencia_adm_priv',
tableField
:
'
dependencia_adm_priv
'
,
//
resultField: 'adm_dependency_detailed_id',
resultField
:
'
adm_dependency_detailed_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'dependencia_adm_priv'
field
:
'
dependencia_adm_priv
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'education_level_mod',
name
:
'
education_level_mod
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'etapas_mod_ensino_segmento_id',
tableField
:
'
etapas_mod_ensino_segmento_id
'
,
//
resultField: 'education_level_mod_id',
resultField
:
'
education_level_mod_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'etapas_mod_ensino_segmento_id'
field
:
'
etapas_mod_ensino_segmento_id
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name:'integral_time',
name
:
'
integral_time
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'tempo_integral',
tableField
:
'
tempo_integral
'
,
//
resultField: 'integral_time_id',
resultField
:
'
integral_time_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'tempo_integral'
field
:
'
tempo_integral
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'education_level_short',
name
:
'
education_level_short
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'etapa_resumida',
tableField
:
'
etapa_resumida
'
,
//
resultField: 'education_level_short_id',
resultField
:
'
education_level_short_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'etapa_resumida'
field
:
'
etapa_resumida
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'region',
name
:
'
region
'
,
//
table: 'regiao',
table
:
'
regiao
'
,
//
tableField: ['nome', 'id'],
tableField
:
[
'
nome
'
,
'
id
'
],
//
resultField: ['region_name', 'region_id'],
resultField
:
[
'
region_name
'
,
'
region_id
'
],
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'id'
field
:
'
id
'
//
},
},
//
join: {
join
:
{
//
primary: 'id',
primary
:
'
id
'
,
//
foreign: 'regiao_id',
foreign
:
'
regiao_id
'
,
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'mesoregion',
name
:
'
mesoregion
'
,
//
table: 'municipio',
table
:
'
municipio
'
,
//
tableField: ['nome_mesorregiao', 'mesorregiao_id'],
tableField
:
[
'
nome_mesorregiao
'
,
'
mesorregiao_id
'
],
//
resultField: ['mesoregion_name', 'mesoregion_id'],
resultField
:
[
'
mesoregion_name
'
,
'
mesoregion_id
'
],
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'mesorregiao_id',
field
:
'
mesorregiao_id
'
,
//
table: 'municipio'
table
:
'
municipio
'
//
},
},
//
join: {
join
:
{
//
primary: 'id',
primary
:
'
id
'
,
//
foreign: 'municipio_id',
foreign
:
'
municipio_id
'
,
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'microregion',
name
:
'
microregion
'
,
//
table: 'municipio',
table
:
'
municipio
'
,
//
tableField: ['nome_microrregiao', 'microrregiao_id'],
tableField
:
[
'
nome_microrregiao
'
,
'
microrregiao_id
'
],
//
resultField: ['microregion_name', 'microregion_id'],
resultField
:
[
'
microregion_name
'
,
'
microregion_id
'
],
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'microrregiao_id',
field
:
'
microrregiao_id
'
,
//
table: 'municipio'
table
:
'
municipio
'
//
},
},
//
join: {
join
:
{
//
primary: 'id',
primary
:
'
id
'
,
//
foreign: 'municipio_id',
foreign
:
'
municipio_id
'
,
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'min_year',
name
:
'
min_year
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'ano_censo',
tableField
:
'
ano_censo
'
,
//
resultField: 'year',
resultField
:
'
year
'
,
//
where: {
where
:
{
//
relation: '>=',
relation
:
'
>=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'ano_censo',
field
:
'
ano_censo
'
,
//
},
},
//
}).addValue({
}).
addValue
({
//
name: 'max_year',
name
:
'
max_year
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'ano_censo',
tableField
:
'
ano_censo
'
,
//
resultField: 'year',
resultField
:
'
year
'
,
//
where: {
where
:
{
//
relation: '<=',
relation
:
'
<=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'ano_censo',
field
:
'
ano_censo
'
,
//
},
},
//
}).addValueToField({
}).
addValueToField
({
//
name: 'state',
name
:
'
state
'
,
//
table: 'estado',
table
:
'
estado
'
,
//
tableField: ['nome', 'id'],
tableField
:
[
'
nome
'
,
'
id
'
],
//
resultField: ['state_name', 'state_id'],
resultField
:
[
'
state_name
'
,
'
state_id
'
],
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'id'
field
:
'
id
'
//
},
},
//
join: {
join
:
{
//
primary: 'id',
primary
:
'
id
'
,
//
foreign: 'estado_id',
foreign
:
'
estado_id
'
,
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}, 'dims').addValueToField({
},
'
dims
'
).
addValueToField
({
//
name: 'state',
name
:
'
state
'
,
//
table: 'estado',
table
:
'
estado
'
,
//
tableField: 'nome',
tableField
:
'
nome
'
,
//
resultField: 'state_name',
resultField
:
'
state_name
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'id'
field
:
'
id
'
//
},
},
//
join: {
join
:
{
//
primary: 'id',
primary
:
'
id
'
,
//
foreign: 'estado_id',
foreign
:
'
estado_id
'
,
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}, 'filter').addValueToField({
},
'
filter
'
).
addValueToField
({
//
name: 'city',
name
:
'
city
'
,
//
table: 'municipio',
table
:
'
municipio
'
,
//
tableField: ['nome', 'id'],
tableField
:
[
'
nome
'
,
'
id
'
],
//
resultField: ['city_name', 'city_id'],
resultField
:
[
'
city_name
'
,
'
city_id
'
],
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'id'
field
:
'
id
'
//
},
},
//
join: {
join
:
{
//
primary: 'id',
primary
:
'
id
'
,
//
foreign: 'municipio_id',
foreign
:
'
municipio_id
'
,
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}, 'dims').addValueToField({
},
'
dims
'
).
addValueToField
({
//
name: 'city',
name
:
'
city
'
,
//
table: 'municipio',
table
:
'
municipio
'
,
//
tableField: 'nome',
tableField
:
'
nome
'
,
//
resultField: 'city_name',
resultField
:
'
city_name
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'id'
field
:
'
id
'
//
},
},
//
join: {
join
:
{
//
primary: 'id',
primary
:
'
id
'
,
//
foreign: 'municipio_id',
foreign
:
'
municipio_id
'
,
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}, 'filter').addValueToField({
},
'
filter
'
).
addValueToField
({
//
name: 'school',
name
:
'
school
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: ['nome_escola', 'id'],
tableField
:
[
'
nome_escola
'
,
'
id
'
],
//
resultField: ['school_name', 'school_id'],
resultField
:
[
'
school_name
'
,
'
school_id
'
],
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'id'
field
:
'
id
'
//
},
},
//
join: {
join
:
{
//
primary: ['id', 'ano_censo'],
primary
:
[
'
id
'
,
'
ano_censo
'
],
//
foreign: ['escola_id', 'ano_censo'],
foreign
:
[
'
escola_id
'
,
'
ano_censo
'
],
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}, 'dims').addValueToField({
},
'
dims
'
).
addValueToField
({
//
name: 'locale_id',
name
:
'
locale_id
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'localizacao_id',
tableField
:
'
localizacao_id
'
,
//
resultField: 'locale_id',
resultField
:
'
locale_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'localizacao_id'
field
:
'
localizacao_id
'
//
}
}
//
}, 'dims').addValueToField({
},
'
dims
'
).
addValueToField
({
//
name: 'school_id',
name
:
'
school_id
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'id',
tableField
:
'
id
'
,
//
resultField: 'school_id',
resultField
:
'
school_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'id'
field
:
'
id
'
//
},
},
//
join: {
join
:
{
//
primary: ['id', 'ano_censo'],
primary
:
[
'
id
'
,
'
ano_censo
'
],
//
foreign: ['escola_id', 'ano_censo'],
foreign
:
[
'
escola_id
'
,
'
ano_censo
'
],
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}, 'dims').addValueToField({
},
'
dims
'
).
addValueToField
({
//
name: 'school',
name
:
'
school
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'nome_escola',
tableField
:
'
nome_escola
'
,
//
resultField: 'school_name',
resultField
:
'
school_name
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'id'
field
:
'
id
'
//
},
},
//
join: {
join
:
{
//
primary: ['id', 'ano_censo'],
primary
:
[
'
id
'
,
'
ano_censo
'
],
//
foreign: ['escola_id', 'ano_censo'],
foreign
:
[
'
escola_id
'
,
'
ano_censo
'
],
//
foreignTable: 'escola'
foreignTable
:
'
escola
'
//
}
}
//
}, 'filter').addValue({
},
'
filter
'
).
addValue
({
//
name: 'location',
name
:
'
location
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'localizacao_id',
tableField
:
'
localizacao_id
'
,
//
resultField: 'location_id',
resultField
:
'
location_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'localizacao_id'
field
:
'
localizacao_id
'
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'diff_location',
name
:
'
diff_location
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'localizacao_diferenciada_par',
tableField
:
'
localizacao_diferenciada_par
'
,
//
resultField: 'diff_location_id',
resultField
:
'
diff_location_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'localizacao_diferenciada_par',
field
:
'
localizacao_diferenciada_par
'
,
//
}
}
//
}).addValue({
}).
addValue
({
//
name: 'government_agreement',
name
:
'
government_agreement
'
,
//
table: 'escola',
table
:
'
escola
'
,
//
tableField: 'dependencia_convenio_publico',
tableField
:
'
dependencia_convenio_publico
'
,
//
resultField: 'government_agreement_id',
resultField
:
'
government_agreement_id
'
,
//
where: {
where
:
{
//
relation: '=',
relation
:
'
=
'
,
//
type: 'integer',
type
:
'
integer
'
,
//
field: 'dependencia_convenio_publico'
field
:
'
dependencia_convenio_publico
'
//
}
}
//
});
});
superiorEnrollmentAggregateApp
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
superiorEnrollmentAggregateApp
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
...
@@ -521,6 +522,6 @@ superiorEnrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, nex
...
@@ -521,6 +522,6 @@ superiorEnrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, nex
console
.
log
(
req
.
sql
.
toString
());
console
.
log
(
req
.
sql
.
toString
());
next
();
next
();
},
id2str
.
transform
(
false
),
response
(
'
superior
E
nrollment
A
ggregate
'
));
},
query
,
id2str
.
transform
(
false
),
response
(
'
superior
_e
nrollment
_a
ggregate
'
));
module
.
exports
=
superiorEnrollmentAggregateApp
;
module
.
exports
=
superiorEnrollmentAggregateApp
;
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