diff --git a/cub.sql b/cub.sql index bfc9b22b54b22a330a17d0419a506da403f10b27..887cc02e2cc763871e058e2fdb54b65af2a810f7 100644 --- a/cub.sql +++ b/cub.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- depends: estado diff --git a/docente_por_escola.sql b/docente_por_escola.sql index aa03ecac8ce8df839eff9d9b59eee85d1e769f9f..a5197624be34cb3b34e82516879fc66b3621025e 100644 --- a/docente_por_escola.sql +++ b/docente_por_escola.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- depends: docente, turma diff --git a/estado.sql b/estado.sql index d4d70016258bd4c7ad94a4e02d84b77f0b3ec562..a7e51e115b6d6b47cab763783b6b382eba5585c4 100644 --- a/estado.sql +++ b/estado.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- depends: regiao diff --git a/formacao_superior.sql b/formacao_superior.sql index 4c532220238258b82be7786234b24429daf3e24c..eba1b50fb2ca7b2dfdea20366097126731a49dba 100644 --- a/formacao_superior.sql +++ b/formacao_superior.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- Docentes: Tabela de CURSOS DE FORMAÇÃO SUPERIOR diff --git a/formacao_superior_seed.sql b/formacao_superior_seed.sql index 18b66a5ca95682e2f067e846d6c46b1b4776a58c..d94ef2e8904a4a9e51edecb0b82e8f978881c6d5 100644 --- a/formacao_superior_seed.sql +++ b/formacao_superior_seed.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ COPY 255 RECORDS INTO formacao_superior FROM stdin USING DELIMITERS ';','\n'; diff --git a/ibge_pib.sql b/ibge_pib.sql index d1372a6dfc99b9cffcaef0f32cf6118024acdc91..0d525b2593245e2c8236d9c072c32a803706b951 100644 --- a/ibge_pib.sql +++ b/ibge_pib.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- msqldump dump table ibge_pib Thu Apr 12 11:01:08 2018 diff --git a/idm.sql b/idm.sql index 9bf97ee1f7e40b47aaea6bfb022bc136e2f4266e..212f53a89d34c789420815472008f39268fbb4ce 100644 --- a/idm.sql +++ b/idm.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- depends: matrícula @@ -23,31 +23,80 @@ along with database. If not, see <https://www.gnu.org/licenses/>. CREATE TABLE indice_distribuicao_matriculas AS ( - WITH div_estado AS (SELECT count(serie_ano_id) AS total_estado, serie_ano_id, estado_id - FROM matricula - WHERE ano_censo=2017 AND tipo <= 3 AND dependencia_adm_id <=3 - GROUP BY serie_ano_id, estado_id), + WITH div_estado AS + (SELECT count(serie_ano_id) AS total_estado, serie_ano_id, estado_id, ano_censo, localizacao_id + FROM matricula + WHERE ano_censo>=2017 AND tipo <= 3 AND dependencia_adm_id <=3 + GROUP BY serie_ano_id, estado_id, ano_censo, localizacao_id), + + div_estado_mod AS + (SELECT count(serie_ano_id) AS total_estado_mod, cast(LEFT(serie_ano_id, 1) as integer) as serie_mod, estado_id, + ano_censo, localizacao_id + FROM matricula + WHERE ano_censo >= 2017 AND tipo <= 3 AND dependencia_adm_id <= 3 + GROUP BY serie_mod, estado_id, ano_censo, localizacao_id), - div_brasil AS (SELECT sum(total_estado) AS total_brasil, serie_ano_id - FROM div_estado - GROUP BY serie_ano_id), + div_brasil AS + (SELECT sum(total_estado) AS total_brasil, serie_ano_id, ano_censo, localizacao_id + FROM div_estado + GROUP BY serie_ano_id, ano_censo, localizacao_id), + + div_brasil_mod AS + (SELECT sum(total_brasil) AS total_brasil_mod, cast(LEFT(serie_ano_id, 1) as integer) as serie_mod, ano_censo, localizacao_id + FROM div_brasil + GROUP BY serie_mod, ano_censo, localizacao_id), nivel_sim1 AS - (SELECT ano_censo, matricula.estado_id, municipio_id, matricula.serie_ano_id, total_brasil AS total_etapa, - cast(count(matricula.serie_ano_id) AS double)/total_etapa AS indice, 1 AS nivel_simulacao + (SELECT matricula.ano_censo, matricula.estado_id, municipio_id, matricula.serie_ano_id, total_brasil AS total_etapa, + cast(count(matricula.serie_ano_id) AS double)/total_etapa AS indice, 1 AS nivel_simulacao, + matricula.localizacao_id FROM matricula JOIN div_brasil ON matricula.serie_ano_id=div_brasil.serie_ano_id - WHERE ano_censo=2017 AND tipo <= 3 AND dependencia_adm_priv <=3 - GROUP BY ano_censo, matricula.estado_id, municipio_id, matricula.serie_ano_id, total_etapa), + AND matricula.ano_censo=div_brasil.ano_censo + AND matricula.localizacao_id=div_brasil.localizacao_id + WHERE matricula.ano_censo>=2017 AND tipo <= 3 AND dependencia_adm_priv <=3 + GROUP BY matricula.ano_censo, matricula.estado_id, municipio_id, matricula.serie_ano_id, total_etapa, + matricula.localizacao_id), nivel_sim2 AS - (SELECT ano_censo, matricula.estado_id, municipio_id, matricula.serie_ano_id, total_estado AS total_etapa, - cast(count(matricula.serie_ano_id) AS double)/total_etapa AS indice, 2 AS nivel_simulacao - FROM matricula JOIN div_estado ON - matricula.serie_ano_id=div_estado.serie_ano_id AND matricula.estado_id=div_estado.estado_id - WHERE ano_censo=2017 AND tipo <= 3 AND dependencia_adm_priv <=3 - GROUP BY ano_censo, matricula.estado_id, municipio_id, matricula.serie_ano_id, total_etapa) - + (SELECT matricula.ano_censo, matricula.estado_id, municipio_id, matricula.serie_ano_id, total_estado AS total_etapa, + cast(count(matricula.serie_ano_id) AS double)/total_etapa AS indice, 2 AS nivel_simulacao, + matricula.localizacao_id + FROM matricula JOIN div_estado ON matricula.serie_ano_id=div_estado.serie_ano_id + AND matricula.estado_id=div_estado.estado_id + AND matricula.ano_censo=div_estado.ano_censo + AND matricula.localizacao_id=div_estado.localizacao_id + WHERE matricula.ano_censo>=2017 AND tipo <= 3 AND dependencia_adm_priv <=3 + GROUP BY matricula.ano_censo, matricula.estado_id, municipio_id, matricula.serie_ano_id, total_etapa, + matricula.localizacao_id), + + nivel_sim1_mod AS + (SELECT matricula.ano_censo, matricula.estado_id, municipio_id, serie_mod as serie_ano_id, + total_brasil_mod AS total_etapa, cast(count(matricula.serie_ano_id) AS double)/total_etapa AS indice, + 1 AS nivel_simulacao, matricula.localizacao_id + FROM matricula JOIN div_brasil_mod ON LEFT(matricula.serie_ano_id, 1)=div_brasil_mod.serie_mod + AND matricula.ano_censo=div_brasil_mod.ano_censo + AND matricula.localizacao_id=div_brasil_mod.localizacao_id + WHERE matricula.ano_censo>=2017 AND tipo <= 3 AND dependencia_adm_priv <=3 + GROUP BY matricula.ano_censo, matricula.estado_id, municipio_id, serie_mod, total_etapa, + matricula.localizacao_id), + + nivel_sim2_mod AS + (SELECT matricula.ano_censo, matricula.estado_id, municipio_id, serie_mod as serie_ano_id, + total_estado_mod AS total_etapa, cast(count(matricula.serie_ano_id) AS double)/total_etapa AS indice, + 2 AS nivel_simulacao, matricula.localizacao_id + FROM matricula JOIN div_estado_mod ON LEFT(matricula.serie_ano_id, 1)=div_estado_mod.serie_mod + AND matricula.estado_id=div_estado_mod.estado_id + AND matricula.ano_censo=div_estado_mod.ano_censo + AND matricula.localizacao_id=div_estado_mod.localizacao_id + WHERE matricula.ano_censo>=2017 AND tipo <= 3 AND dependencia_adm_priv <=3 + GROUP BY matricula.ano_censo, matricula.estado_id, municipio_id, serie_mod, total_etapa, + matricula.localizacao_id) + SELECT * FROM nivel_sim1 UNION ALL SELECT * FROM nivel_sim2 +UNION ALL +SELECT * FROM nivel_sim1_mod +UNION ALL +SELECT * FROM nivel_sim2_mod ); diff --git a/instituicao_superior.sql b/instituicao_superior.sql index 5b88f55f91c5da3399a1199decb4f797dbc1cf58..063c678dfcf3874600e53aabfe97628b8900b26b 100644 --- a/instituicao_superior.sql +++ b/instituicao_superior.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- msqldump dump table instituicao_superior Thu Feb 8 10:59:55 2018 diff --git a/municipio.sql b/municipio.sql index 92e7742654006d0e68c6e500affc95844c5fb7a1..f070dbd9e26d1e7e2f6ae3217300fd304649fff5 100644 --- a/municipio.sql +++ b/municipio.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- depends: estado diff --git a/projecao_matricula.sql b/projecao_matricula.sql index b2fb12af59eeb2c6b3da5448cabb276b279842f8..af14e5dce61e1a83213a794d2b443e4da1f06782 100644 --- a/projecao_matricula.sql +++ b/projecao_matricula.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ -- depends: matricula 2017+ diff --git a/regiao.sql b/regiao.sql index e40d2cb6b61b97c48a78a65ebb977fb19f754677..640ff0ea344bc0e00097069ea3a0438b98d4f088 100644 --- a/regiao.sql +++ b/regiao.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ CREATE TABLE regiao diff --git a/siope_mun.sql b/siope_mun.sql index 95d69efcf6d341374953b0c10dc8beec79813e0c..e50bad5c6da24ec38c3b90d07f98988cfeed46be 100644 --- a/siope_mun.sql +++ b/siope_mun.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ CREATE TABLE siope_mun ( diff --git a/siope_mun_seed.sql b/siope_mun_seed.sql index c3d2a745b9537340e3e15cb83ba664c6c0edb021..f26dd9c277e3f510d4cb8362e30467b09a18fbdb 100644 --- a/siope_mun_seed.sql +++ b/siope_mun_seed.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ COPY 5163 RECORDS INTO siope_mun FROM stdin USING DELIMITERS ';','\n'; diff --git a/siope_uf.sql b/siope_uf.sql index 4bda6dab6425051b3c7ca0ae20f49690f79c0b40..3fe4f3fca1e17363c9e12e024600b6da8df6202b 100644 --- a/siope_uf.sql +++ b/siope_uf.sql @@ -2,20 +2,20 @@ Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -This file is part of database. +This file is part of HOTMapper. -database is free software: you can redistribute it and/or modify +HOTMapper 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. -database is distributed in the hope that it will be useful, +HOTMapper 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 database. If not, see <https://www.gnu.org/licenses/>. +along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. */ CREATE TABLE siope_uf (