Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
const express = require('express');
const infrastructureApp = 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 multiQuery = require(`${libs}/middlewares/multiQuery`);
const response = require(`${libs}/middlewares/response`);
const id2str = require(`${libs}/middlewares/id2str`);
const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`);
const config = require(`${libs}/config`);
const cache = require('apicache').options({ debug: config.debug, statusCodes: {include: [200]} }).middleware;
let rqf = new ReqQueryFields();
infrastructureApp.use(cache('15 day'));
infrastructureApp.get('/year_range', (req, res, next) => {
req.sql.from('escola')
.field('MIN(escola.ano_censo)', 'start_year')
.field('MAX(escola.ano_censo)', 'end_year');
next();
}, query, response('range'));
infrastructureApp.get('/years', (req, res, next) => {
req.sql.from('escola')
.field('DISTINCT escola.ano_censo', 'year');
next();
}, query, response('years'));
infrastructureApp.get('/source', (req, res, next) => {
req.sql.from('fonte')
.field('fonte', 'source')
.where('tabela = \'escola\'');
next();
}, query, response('source'));
infrastructureApp.get('/location', (req, res, next) => {
req.result = [
{id: 1, name: 'Urbana'},
{id: 2, name: 'Rural'}
];
next();
}, response('location'));
infrastructureApp.get('/rural_location', (req, res, next) => {
req.result = [
{id: 1, name: "Urbana"},
{id: 2, name: "Rural"},
{id: 3, name: "Rural - Área de assentamento"},
{id: 4, name: "Rural - Terra indígena"},
{id: 5, name: "Rural - Área remanescente de quilombos"},
{id: 6, name: "Rural - Unidade de uso sustentável"}
];
next();
}, response('rural_location'));
infrastructureApp.get('/adm_dependency', (req, res, next) => {
req.sql.from('dependencia_adm')
.field('id')
.field('nome', 'name')
.where('id <= 4');
next();
}, query, response('adm_dependency'));
infrastructureApp.get('/adm_dependency_detailed', (req, res, next) => {
req.sql.from('dependencia_adm_priv')
.field('id', 'id')
.field('nome', 'name');
next();
}, query, response('adm_dependency_detailed'));
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValueToField({
name: 'city',
table: 'municipio',
tableField: ['nome', 'id'],
resultField: ['city_name', 'city_id'],
where: {
relation: '=',
type: 'integer',
field: 'municipio_id',
table: 'escola'
},
join: {
primary: 'id',
foreign: 'municipio_id',
foreignTable: 'escola'
}
}, 'dims').addValueToField({
name: 'city',
table: 'municipio',
tableField: 'id',
resultField: 'city_id',
where: {
relation: '=',
type: 'integer',
field: 'municipio_id',
table: 'escola'
},
join: {
primary: 'id',
foreign: 'municipio_id',
foreignTable: 'escola'
}
}, 'filter').addValueToField({
name: 'state',
table: 'estado',
tableField: ['nome', 'id'],
resultField: ['state_name', 'state_id'],
where: {
relation: '=',
type: 'integer',
field: 'estado_id',
table: 'escola'
},
join: {
primary: 'id',
foreign: 'estado_id',
foreignTable: 'escola'
}
}, 'dims').addValueToField({
name: 'state',
table: 'estado',
tableField: 'id',
resultField: 'state_id',
where: {
relation: '=',
type: 'integer',
field: 'estado_id',
table: 'escola'
},
join: {
primary: 'id',
foreign: 'estado_id',
foreignTable: 'escola'
}
}, 'filter').addValue({
name: 'region',
table: 'regiao',
tableField: 'nome',
resultField: 'region_name',
where: {
relation: '=',
type: 'integer',
field: 'id'
},
join: {
primary: 'id',
foreign: 'regiao_id',
foreignTable: 'escola'
}
}).addValue({
name: 'location',
table: 'escola',
tableField: 'cod_localizacao',
resultField: 'location_id',
where: {
relation: '=',
type: 'integer',
field: 'cod_localizacao'
}
}).addValue({
name: 'rural_location',
table: 'escola',
tableField: 'localidade_area_rural',
resultField: 'rural_location_id',
where: {
relation: '=',
type: 'integer',
field: 'localidade_area_rural'
}
}).addValue({
name: 'adm_dependency',
table: 'escola',
tableField: 'dependencia_adm_id',
resultField: 'adm_dependency_id',
where: {
relation: '=',
type: 'integer',
field: 'dependencia_adm_id'
}
}).addValue({
name: 'adm_dependency_detailed',
table: 'escola',
tableField: 'dependencia_adm_priv',
resultField: 'adm_dependency_detailed_id',
where: {
relation: '=',
type: 'integer',
field: 'dependencia_adm_priv'
}
}).addValue({
name: 'min_year',
table: 'escola',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'escola',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
field: 'ano_censo'
}
});
function matchQueries(queryTotal, queryPartial) {
let match = [];
queryTotal.forEach((result) => {
let newObj = {};
let keys = Object.keys(result);
keys.forEach((key) => {
newObj[key] = result[key];
});
let index = keys.indexOf('total');
if(index > -1) keys.splice(index, 1);
let objMatch = null;
for(let i = 0; i < queryPartial.length; ++i) {
let partial = queryPartial[i];
let foundMatch = true;
for(let j = 0; j < keys.length; ++j) {
let key = keys[j];
if(partial[key] !== result[key]) {
foundMatch = false;
break;
}
}
if(foundMatch) {
objMatch = partial;
break;
}
}
if(objMatch) {
newObj.percentage = (objMatch.total / result.total) * 100;
newObj.partial = objMatch.total;
newObj.total = result.total
match.push(newObj);
}
});
return match;
}
infrastructureApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.querySet = [];
req.queryIndex = {};
// Local de funcionamento
let allSchools = req.sql.clone();
allSchools.from('escola').field('COUNT(escola.id)', 'total')
.field("'Brasil'", 'name')
.field('escola.ano_censo', 'year')
.group('escola.ano_censo')
.where('escola.situacao_de_funcionamento = 1')
.where('escola.ensino_regular = 1 OR escola.ensino_eja = 1 OR escola.educacao_profissional = 1')
.where('escola.local_func_predio_escolar = 1')
.where('escola.dependencia_adm_id <= 3')
.order('escola.ano_censo');
// Bibliotecas
let allLibraries = allSchools.clone();
req.queryIndex.allLibraries = req.querySet.push(allLibraries) - 1;
let haveLibraries = allLibraries.clone();
haveLibraries.where('escola.biblioteca = 1');
req.queryIndex.haveLibraries = req.querySet.push(haveLibraries) - 1;
let needLibraries = allLibraries.clone();
needLibraries.where('escola.biblioteca = 0');
req.queryIndex.needLibraries = req.querySet.push(needLibraries) - 1;
// Bibliotecas/Sala de leitura
let allLibrariesReadingRoom = allSchools.clone();
allLibrariesReadingRoom.where('escola.cod_localizacao = 2');
req.queryIndex.allLibrariesReadingRoom = req.querySet.push(allLibrariesReadingRoom) - 1;
let haveLibrariesReadingRoom = allLibrariesReadingRoom.clone();
haveLibrariesReadingRoom.where('escola.biblioteca_sala_leitura = 1');
req.queryIndex.haveLibrariesReadingRoom = req.querySet.push(haveLibrariesReadingRoom) - 1;
let needLibrariesReadingRoom = allLibrariesReadingRoom.clone();
needLibrariesReadingRoom.where('escola.biblioteca_sala_leitura = 0');
req.queryIndex.needLibrariesReadingRoom = req.querySet.push(needLibrariesReadingRoom) - 1;
// Laboratório de informática
let allInfLab = allSchools.clone();
allInfLab.where('escola.reg_infantil_preescola = 1 OR escola.reg_fund_ai = 1 OR escola.reg_fund_af = 1 OR escola.reg_medio_medio = 1 OR escola.reg_medio_integrado = 1 OR escola.reg_medio_normal = 1 OR escola.ensino_eja_fund = 1 OR escola.ensino_eja_medio = 1 OR escola.ensino_eja_prof = 1');
req.queryIndex.allInfLab = req.querySet.push(allInfLab) - 1;
let haveInfLab = allInfLab.clone();
haveInfLab.where('escola.lab_informatica = 1');
req.queryIndex.haveInfLab = req.querySet.push(haveInfLab) - 1;
let needInfLab = allInfLab.clone();
needInfLab.where('escola.lab_informatica = 0');
req.queryIndex.needInfLab = req.querySet.push(needInfLab) - 1;
let allScienceLab = allSchools.clone();
allScienceLab.where('escola.reg_fund_af = 1 OR escola.reg_medio_medio = 1 OR escola.reg_medio_integrado = 1 OR escola.reg_medio_normal = 1 OR escola.ensino_eja_fund = 1 OR escola.ensino_eja_medio = 1 OR escola.ensino_eja_prof = 1');
req.queryIndex.allScienceLab = req.querySet.push(allScienceLab) - 1;
let haveScienceLab = allScienceLab.clone();
haveScienceLab.where('escola.lab_ciencias = 1');
req.queryIndex.haveScienceLab = req.querySet.push(haveScienceLab) - 1;
let needScienceLab = allScienceLab.clone();
needScienceLab.where('escola.lab_ciencias = 0');
req.queryIndex.needScienceLab = req.querySet.push(needScienceLab) - 1;
// Parque infantil
let allKidsPark = allSchools.clone();
allKidsPark.where('escola.reg_infantil_creche = 1 OR escola.reg_infantil_preescola = 1 OR escola.reg_fund_ai = 1');
req.queryIndex.allKidsPark = req.querySet.push(allKidsPark) - 1;
let haveKidsPark = allKidsPark.clone();
haveKidsPark.where('escola.parque_infantil = 1');
req.queryIndex.haveKidsPark = req.querySet.push(haveKidsPark) - 1;
let needKidsPark = allKidsPark.clone();
needKidsPark.where('escola.parque_infantil = 0');
req.queryIndex.needKidsPark = req.querySet.push(needKidsPark) - 1;
// Berçário
let allCribs = allSchools.clone();
req.queryIndex.allCribs = req.querySet.push(allCribs) - 1;
let haveCribs = allCribs.clone();
haveCribs.where('escola.bercario = 1');
req.queryIndex.haveCribs = req.querySet.push(haveCribs) - 1;
let needCribs = allCribs.clone();
needCribs.where('escola.bercario = 0');
req.queryIndex.needCribs = req.querySet.push(needCribs) - 1;
// Quadra Coberta
let allSportsCourt = allSchools.clone();
allSportsCourt.where('escola.reg_fund_ai = 1 OR escola.reg_fund_af = 1 OR escola.reg_medio_medio = 1 OR escola.reg_medio_integrado OR escola.reg_medio_normal = 1 OR escola.ensino_eja_fund = 1 OR escola.ensino_eja_medio = 1 OR escola.ensino_eja_prof = 1');
req.queryIndex.allSportsCourt = req.querySet.push(allSportsCourt) - 1;
let haveSportsCourt = allSportsCourt.clone();
haveSportsCourt.where('escola.quadra_esportes = 1');
req.queryIndex.haveSportsCourt = req.querySet.push(haveSportsCourt) - 1;
let needSportsCourt = allSportsCourt.clone();
needSportsCourt.where('escola.quadra_esportes = 0');
req.queryIndex.needSportsCourt = req.querySet.push(needSportsCourt) - 1;
// Cobertura de quadra esportiva
// FIXME: possível fixme no where
req.queryIndex.allSportsCourtCoverage = req.queryIndex.allSportsCourt;
let haveSportsCourtCoverage = allSportsCourt.clone();
haveSportsCourtCoverage.where('escola.quadra_esportes_descoberta = 1');
req.queryIndex.haveSportsCourtCoverage = req.querySet.push(haveSportsCourtCoverage) - 1;
let needSportsCourtCoverage = allSportsCourt.clone();
needSportsCourtCoverage.where('escola.quadra_esportes_descoberta = 0');
// Pátio
req.queryIndex.allCourtyard = req.queryIndex.allSchools;
let haveCourtyard = allSchools.clone();
haveCourtyard.where('escola.patio_coberto = 1');
req.queryIndex.haveCourtyard = req.querySet.push(haveCourtyard) - 1;
let needCourtyard = allSchools.clone();
needCourtyard.where('escola.patio_descoberto = 0');
req.queryIndex.needCourtyard = req.querySet.push(needCourtyard) - 1;
// Cobertura do Pátio
// TODO:
req.queryIndex.allDirectorRoom = req.queryIndex.allLibraries;
haveDirectorRoom.where('escola.sala_diretoria = 1');
req.queryIndex.haveDirectorRoom = req.querySet.push(haveDirectorRoom) - 1;
let needDirectorRoom = allLibraries.clone();
needDirectorRoom.where('escola.sala_diretoria = 0');
req.queryIndex.needDirectorRoom = req.querySet.push(needDirectorRoom) - 1;
req.queryIndex.allSecretary = req.queryIndex.allSchools;
haveSecretary.where('escola.secretaria = 1');
req.queryIndex.haveSecretary = req.querySet.push(haveSecretary) - 1;
let needSecretary = allSchools.clone();
needSecretary.where('escola.secretaria = 0');
req.queryIndex.needSecretary = req.querySet.push(needSecretary) - 1;
req.queryIndex.allTeacherRoom = req.queryIndex.allSchools;
haveTeacherRoom.where('escola.sala_professor = 1');
req.queryIndex.haveTeacherRoom = req.querySet.push(haveTeacherRoom) - 1;
let needTeacherRoom = allSchools.clone();
needTeacherRoom.where('escola.sala_professor = 0');
req.queryIndex.needTeacherRoom = req.querySet.push(needTeacherRoom) - 1;
req.queryIndex.allKitchen = req.queryIndex.allSchools;
haveKitchen.where('escola.cozinha = 1');
req.queryIndex.haveKitchen = req.querySet.push(haveKitchen) - 1;
let needKitchen = allSchools.clone();
needKitchen.where('escola.cozinha = 0');
req.queryIndex.needKitchen = req.querySet.push(needKitchen) - 1;
req.queryIndex.allStoreroom = req.queryIndex.allSchools;
haveStoreroom.where('escola.despensa = 1');
req.queryIndex.haveStoreroom = req.querySet.push(haveStoreroom) - 1;
let needStoreroom = allSchools.clone();
needStoreroom.where('escola.despensa = 0');
req.queryIndex.needStoreroom = req.querySet.push(needStoreroom) - 1;
req.queryIndex.allWarehouse = req.queryIndex.allSchools;
haveWarehouse.where('escola.almoxarifado = 1');
req.queryIndex.haveWarehouse = req.querySet.push(haveWarehouse) - 1;
let needWarehouse = allSchools.clone();
needWarehouse.where('escola.almoxarifado = 1');
req.queryIndex.needWarehouse = req.querySet.push(needWarehouse) - 1;
// Internet
req.queryIndex.allInternet = req.queryIndex.allLibrariesReadingRoom;
let haveInternet = allLibrariesReadingRoom.clone();
haveInternet.where('escola.internet = 1');
req.queryIndex.haveInternet = req.querySet.push(haveInternet) - 1;
let needInternet = allLibrariesReadingRoom.clone();
needInternet.where('escola.internet = 0');
req.queryIndex.needInternet = req.querySet.push(needInternet) - 1;
// Internet banda larga
req.queryIndex.allBroadbandInternet = req.queryIndex.allLibraries;
let haveBroadbandInternet = allLibraries.clone();
haveBroadbandInternet.where('escola.internet_banda_larga = 1');
req.queryIndex.haveBroadbandInternet = req.querySet.push(haveBroadbandInternet) - 1;
let needBroadbandInternet = allLibraries.clone();
needBroadbandInternet.where('escola.internet_banda_larga = 0');
req.queryIndex.needBroadbandInternet = req.querySet.push(needBroadbandInternet) - 1;
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
// Banheiro dentro do prédio
req.queryIndex.allInsideBathroom = req.queryIndex.allSecretary;
let haveInsideBathroom = allSecretary.clone();
haveInsideBathroom.where('escola.sanitario_dentro_predio = 1');
req.queryIndex.haveInsideBathroom = req.querySet.push(haveInsideBathroom) - 1;
// Banheiro adequado para educação infantil dentro do prédio
req.queryIndex.allInsideKidsBathroom = req.queryIndex.allKidsPark;
let haveInsideKidsBathroom = allKidsPark.clone();
haveInsideKidsBathroom.where('escola.sanitario_ei = 1');
req.queryIndex.haveInsideKidsBathroom = req.querySet.push(haveInsideKidsBathroom) - 1;
// Fornecimento de energia
req.queryIndex.allEletricEnergy = req.queryIndex.allSecretary;
let haveEletricEnergy = allSecretary.clone();
haveEletricEnergy.where('escola.fornecimento_energia = 1');
req.queryIndex.haveEletricEnergy = req.querySet.push(haveEletricEnergy) - 1;
// Abastecimento de água
req.queryIndex.allWaterSupply = req.queryIndex.allSecretary;
let haveWaterSupply = allSecretary.clone();
haveWaterSupply.where('escola.fornecimento_agua = 1');
req.queryIndex.haveWaterSupply = req.querySet.push(haveWaterSupply) - 1;
// Água filtrada
req.queryIndex.allFilteredWater = req.queryIndex.allSecretary;
let haveFilteredWater = allSecretary.clone();
haveFilteredWater.where('escola.agua_filtrada = 1');
req.queryIndex.haveFilteredWater = req.querySet.push(haveFilteredWater) - 1;
// Coleta de esgoto
req.queryIndex.allSewage = req.queryIndex.allSecretary;
let haveSewage = allSecretary.clone();
haveSewage.where('escola.esgoto_sanitario = 1');
req.queryIndex.haveSewage = req.querySet.push(haveSewage) - 1;
// Sala de recursos multifuncionais para Atendimento Educacional Especializado
req.queryIndex.allMultifunctionRoom = req.queryIndex.allSecretary;
let haveMultifunctionRoom = allSecretary.clone();
haveMultifunctionRoom.where('escola.sala_atendimento_especial = 1');
req.queryIndex.haveMultifunctionRoom = req.querySet.push(haveMultifunctionRoom) - 1;
// Banheiros adaptados para pessoas com deficiências
req.queryIndex.allSpecialBathroom = req.queryIndex.allSecretary;
let haveSpecialBathroom = allSecretary.clone();
haveSpecialBathroom.where('escola.sanitario_pne = 1');
req.queryIndex.haveSpecialBathroom = req.querySet.push(haveSpecialBathroom) - 1;
// Dependências adaptada para pessoas com deficiências
req.queryIndex.allAdaptedBuilding = req.queryIndex.allSecretary;
let haveAdaptedBuilding = allSecretary.clone();
haveAdaptedBuilding.where('escola.dependencias_pne = 1');
req.queryIndex.haveAdaptedBuilding = req.querySet.push(haveAdaptedBuilding) - 1;
next();
}, multiQuery, (req, res, next) => {
// Faz o matching entre os resultados
let school_place = matchQueries(req.result[req.queryIndex.allSchools], req.result[req.queryIndex.schoolPlace]);
let libraries = matchQueries(req.result[req.queryIndex.allLibraries], req.result[req.queryIndex.haveLibraries]);
let libraries_reading_room = matchQueries(req.result[req.queryIndex.allLibrariesReadingRoom], req.result[req.queryIndex.haveLibrariesReadingRoom]);
let computer_lab = matchQueries(req.result[req.queryIndex.allInfLab], req.result[req.queryIndex.haveInfLab]);
let science_lab = matchQueries(req.result[req.queryIndex.allScienceLab], req.result[req.queryIndex.haveScienceLab]);
let kids_park = matchQueries(req.result[req.queryIndex.allKidsPark], req.result[req.queryIndex.haveKidsPark]);
let nursery = matchQueries(req.result[req.queryIndex.allCribs], req.result[req.queryIndex.haveCribs]);
let sports_court = matchQueries(req.result[req.queryIndex.allSportsCourt], req.result[req.queryIndex.haveSportsCourt]);
let covered_sports_court = matchQueries(req.result[req.queryIndex.allCoveredSportsCourt], req.result[req.queryIndex.haveCoveredSportsCourt]);
let uncovered_sports_court = matchQueries(req.result[req.queryIndex.allUncoveredSportsCourt], req.result[req.queryIndex.haveUncoveredSportsCourt]);
let director_room = matchQueries(req.result[req.queryIndex.allDirectorRoom], req.result[req.queryIndex.haveDirectorRoom]);
let secretary = matchQueries(req.result[req.queryIndex.allSecretary], req.result[req.queryIndex.haveSecretary]);
let teacher_room = matchQueries(req.result[req.queryIndex.allTeacherRoom], req.result[req.queryIndex.haveTeacherRoom]);
let kitchen = matchQueries(req.result[req.queryIndex.allKitchen], req.result[req.queryIndex.haveKitchen]);
let storeroom = matchQueries(req.result[req.queryIndex.allStoreroom], req.result[req.queryIndex.haveStoreroom]);
let warehouse = matchQueries(req.result[req.queryIndex.allWarehouse], req.result[req.queryIndex.haveWarehouse]);
let internet = matchQueries(req.result[req.queryIndex.allInternet], req.result[req.queryIndex.haveInternet]);
let broadband_internet = matchQueries(req.result[req.queryIndex.allBroadbandInternet], req.result[req.queryIndex.haveBroadbandInternet]);
let inside_bathroom = matchQueries(req.result[req.queryIndex.allInsideBathroom], req.result[req.queryIndex.haveInsideBathroom]);
let inside_kids_bathroom = matchQueries(req.result[req.queryIndex.allInsideKidsBathroom], req.result[req.queryIndex.haveInsideKidsBathroom]);
let eletric_energy = matchQueries(req.result[req.queryIndex.allEletricEnergy], req.result[req.queryIndex.haveEletricEnergy]);
let water_supply = matchQueries(req.result[req.queryIndex.allWaterSupply], req.result[req.queryIndex.haveWaterSupply]);
let filtered_water = matchQueries(req.result[req.queryIndex.allFilteredWater], req.result[req.queryIndex.haveFilteredWater]);
let sewage_treatment = matchQueries(req.result[req.queryIndex.allSewage], req.result[req.queryIndex.haveSewage]);
let special_multifunction_room = matchQueries(req.result[req.queryIndex.allMultifunctionRoom], req.result[req.queryIndex.haveMultifunctionRoom]);
let special_bathroom = matchQueries(req.result[req.queryIndex.allSpecialBathroom], req.result[req.queryIndex.haveSpecialBathroom]);
let adapted_building = matchQueries(req.result[req.queryIndex.allAdaptedBuilding], req.result[req.queryIndex.haveAdaptedBuilding]);
req.result = [{
school_place,
libraries,
libraries_reading_room,
computer_lab,
science_lab,
kids_park,
nursery,
sports_court,
covered_sports_court,
uncovered_sports_court,
director_room,
secretary,
teacher_room,
kitchen,
storeroom,
warehouse,
internet,
broadband_internet,
inside_bathroom,
inside_kids_bathroom,
eletric_energy,
water_supply,
filtered_water,
sewage_treatment,
special_multifunction_room,
special_bathroom,
adapted_building
}];
next();
}, id2str.multitransform(false), response('infrastructure'));
module.exports = infrastructureApp;