diff --git a/.gitignore b/.gitignore index ef9ffce5a3513eab4c6abb309fcf1e2505eb28e8..074d0194fecf09dd1a526a5446e149e6094483ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Dados_Servidores logstash_configs configs +Favorecidos diff --git a/README b/README index 64ac6cc0469da448bb9f9a2928b6e79025702d99..ee645d2ad69a2c76e462cf277de65a0ee8a26e22 100644 --- a/README +++ b/README @@ -3,16 +3,15 @@ Projeto utilizando ElasticSearch + Kibana na tentativa de auxiliar a transparên Ãrvore de Diretórios: . -├── Dados\_Servidores - Contém uma diretório para cada mês. +├── Dados_Servidores - Contém uma diretório para cada mês. │  ├── 2016-12 - Diretório que contém os CSVs referentes a Dezembro de 2016. │  ├── 2016-11 - Diretório que contém os CSVs referentes a Novembro de 2016. │  ├── ... │  └── Processados - Diretório que contém CSVs resultantes da união de CSVs do portal transparência. -├── configs - Diretório com arquivos de configuração para unir CSVs do portal transparência em um só, que é inserido no Kibana/ElasticSearch. ├── config.json.example - Exemplo de arquivo do diretório 'configs'. -├── logstash\_configs - Diretório com arquivos de configuração do Logstash para inserção de dados no Kibana/ElasticSearch. -├── logstash\_config.example - Exemplo de arquivo do diretório 'logstash\_configs'. É usado pelo script 'create\_config.py' para gerar o arquivo de configuração do logstash. -├── create\_config.py - Script que cria arquivos de configuração que ficam contidos nos diretórios 'configs' e 'logstash\_configs'. -├── resumo\_cadastro.sh - Script que filtra dados do CSV de Cadastro do Portal Transparência, selecionando dados das Universidades interessantes para este projeto. -├── merge\_files\_es.py - Script que usa um arquivo de configuração do diretório 'configs' para unir dois CSVs (Cadastro e Remuneração) do portal transparência em um só e salvá-lo no diretório Dados\_Servidores/Processados -└── insert\_data.sh - Script que gerencia os outros scripts. +├── logstash_configs - Diretório com arquivos de configuração do Logstash para inserção de dados no Kibana/ElasticSearch. +├── logstash_config.example - Exemplo de arquivo do diretório 'logstash_configs'. É usado pelo script 'create_config.py' para gerar o arquivo de configuração do logstash. +├── create_config.py - Script que cria arquivos de configuração que ficam contidos nos diretórios 'configs' e 'logstash_configs'. +├── resumo_cadastro.sh - Script que filtra dados do CSV de Cadastro do Portal Transparência, selecionando dados das Universidades interessantes para este projeto. +├── merge_files_es.py - Script que usa um arquivo de configuração do diretório 'configs' para unir dois CSVs (Cadastro e Remuneração) do portal transparência em um só e salvá-lo no diretório Dados_Servidores/Processados +└── insert_data.sh - Script que gerencia os outros scripts. diff --git a/add_registers.sh b/add_registers.sh new file mode 100755 index 0000000000000000000000000000000000000000..780b46d4e42ed8357e4d1bb91d30afe31ffcb161 --- /dev/null +++ b/add_registers.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +./insert_resgiter_payment.sh 2016 11 30 +./insert_resgiter_payment.sh 2016 10 31 +./insert_resgiter_payment.sh 2016 09 30 +./insert_resgiter_payment.sh 2016 08 31 +./insert_resgiter_payment.sh 2016 07 31 +./insert_resgiter_payment.sh 2016 06 30 +./insert_resgiter_payment.sh 2016 05 31 +./insert_resgiter_payment.sh 2016 04 30 +./insert_resgiter_payment.sh 2016 03 31 +./insert_resgiter_payment.sh 2016 02 29 +./insert_resgiter_payment.sh 2016 01 31 + +./insert_resgiter_payment.sh 2015 12 31 +./insert_resgiter_payment.sh 2015 11 30 +./insert_resgiter_payment.sh 2015 10 31 +./insert_resgiter_payment.sh 2015 09 30 +./insert_resgiter_payment.sh 2015 08 31 +./insert_resgiter_payment.sh 2015 07 31 +./insert_resgiter_payment.sh 2015 06 30 +./insert_resgiter_payment.sh 2015 05 31 +./insert_resgiter_payment.sh 2015 04 30 +./insert_resgiter_payment.sh 2015 03 31 +./insert_resgiter_payment.sh 2015 02 28 +./insert_resgiter_payment.sh 2015 01 31 + +./insert_resgiter_payment.sh 2014 12 31 +./insert_resgiter_payment.sh 2014 11 30 +./insert_resgiter_payment.sh 2014 10 31 +./insert_resgiter_payment.sh 2014 09 30 +./insert_resgiter_payment.sh 2014 08 31 +./insert_resgiter_payment.sh 2014 07 31 +./insert_resgiter_payment.sh 2014 06 30 +./insert_resgiter_payment.sh 2014 05 31 +./insert_resgiter_payment.sh 2014 04 30 +./insert_resgiter_payment.sh 2014 03 31 +./insert_resgiter_payment.sh 2014 02 28 +./insert_resgiter_payment.sh 2014 01 31 + +./insert_resgiter_payment.sh 2013 12 31 +./insert_resgiter_payment.sh 2013 11 30 +./insert_resgiter_payment.sh 2013 10 31 +./insert_resgiter_payment.sh 2013 09 30 +./insert_resgiter_payment.sh 2013 08 31 +./insert_resgiter_payment.sh 2013 07 31 +./insert_resgiter_payment.sh 2013 06 30 +./insert_resgiter_payment.sh 2013 05 31 +./insert_resgiter_payment.sh 2013 04 30 +./insert_resgiter_payment.sh 2013 03 31 +./insert_resgiter_payment.sh 2013 02 28 +./insert_resgiter_payment.sh 2013 01 31 diff --git a/configs/config-2016-01.json b/configs/config-2016-01.json deleted file mode 100644 index 79f65e99337cf5eaadce46248519692a43d16900..0000000000000000000000000000000000000000 --- a/configs/config-2016-01.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-01/" - , "date": "20160131" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-02.json b/configs/config-2016-02.json deleted file mode 100644 index f5b11af8428e812ec98c49507ef4b5093213856d..0000000000000000000000000000000000000000 --- a/configs/config-2016-02.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-02/" - , "date": "20160229" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-03.json b/configs/config-2016-03.json deleted file mode 100644 index 08db9b1112361ba22969448d707540424755af00..0000000000000000000000000000000000000000 --- a/configs/config-2016-03.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-03/" - , "date": "20160331" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-04.json b/configs/config-2016-04.json deleted file mode 100644 index b1c6c2e0d05eb0cd53ad1195bfed68f5b0e84789..0000000000000000000000000000000000000000 --- a/configs/config-2016-04.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-04/" - , "date": "20160430" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-05.json b/configs/config-2016-05.json deleted file mode 100644 index 7fd76ded3ae5eefdec7e1a5e66c101bae32d317e..0000000000000000000000000000000000000000 --- a/configs/config-2016-05.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-05/" - , "date": "20160531" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-06.json b/configs/config-2016-06.json deleted file mode 100644 index 0d8123e622f9fb240e9e301839c22267decc0c3e..0000000000000000000000000000000000000000 --- a/configs/config-2016-06.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-06/" - , "date": "20160630" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-07.json b/configs/config-2016-07.json deleted file mode 100644 index eb70d53dd52976ce3f4be245efae4e960f183ebf..0000000000000000000000000000000000000000 --- a/configs/config-2016-07.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-07/" - , "date": "20160731" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-08.json b/configs/config-2016-08.json deleted file mode 100644 index a3cd033dbc58379845843504e3aaa98e2000fb2e..0000000000000000000000000000000000000000 --- a/configs/config-2016-08.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-08/" - , "date": "20160831" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-09.json b/configs/config-2016-09.json deleted file mode 100644 index ea230f360caa521abed67500e1c6ce08656c166c..0000000000000000000000000000000000000000 --- a/configs/config-2016-09.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-09/" - , "date": "20160930" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-10.json b/configs/config-2016-10.json deleted file mode 100644 index c6e61ed8a96076c1442028bdf5972bc826babdf4..0000000000000000000000000000000000000000 --- a/configs/config-2016-10.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-10/" - , "date": "20161031" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/config-2016-11.json b/configs/config-2016-11.json deleted file mode 100644 index 9db5dcebc26be21d0806ac4747e8b57ed5d37817..0000000000000000000000000000000000000000 --- a/configs/config-2016-11.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "path": "Dados_Servidores/2016-11/" - , "date": "20161130" - , "file1" : "_Remuneracao.csv" - , "file2" : "_Cadastro_Ufpr_Unique.csv" - , "idColumn1" : 2 - , "idColumn2" : 0 - , "columnsToAdd1" : [2, 4, 5] - , "columnsToAdd2" : [] - , "quotechar": "\"" - , "delimiter": "\t" - , "lineterminator": "\n" - , "outputFile": "result.csv" - , "notFoundFile1": "not_found_1.txt" - , "notFoundFile2": "not_found_2.txt" -} diff --git a/configs/generate_config.sh b/configs/generate_config.sh deleted file mode 100644 index 22810d5c37eae46b1811373dce58a2cfb5ff5fb6..0000000000000000000000000000000000000000 --- a/configs/generate_config.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -read "What is the script's date? [YYYY-MM-DD]:" date -case $yn in | YES ) - -esac diff --git a/insert_data.sh b/insert_resgiter_payment.sh similarity index 100% rename from insert_data.sh rename to insert_resgiter_payment.sh diff --git a/logstash_config.example b/logstash_config.example index bfe3b5586dbe81c3818276b1e20f88c7f545eee4..c2d4084be6955d841b43322bf9d809ac2b073101 100644 --- a/logstash_config.example +++ b/logstash_config.example @@ -8,7 +8,7 @@ input { filter { csv { - columns => [ "ID_SERVIDOR_PORTAL", "NOME", "CPF", "MATRICULA", "DESCRICAO_CARGO", "CLASSE_CARGO", "REFERENCIA_CARGO", "PADRAO_CARGO", "NIVEL_CARGO", "SIGLA_FUNCAO", "NIVEL_FUNCAO", "FUNCAO", "CODIGO_ATIVIDADE", "ATIVIDADE", "OPCAO_PARCIAL", "COD_UORG_LOTACAO", "UORG_LOTACAO", "COD_ORG_LOTACAO", "ORG_LOTACAO", "COD_ORGSUP_LOTACAO", "ORGSUP_LOTACAO", "COD_UORG_EXERCICIO", "UORG_EXERCICIO", "COD_ORG_EXERCICIO", "ORG_EXERCICIO", "COD_ORGSUP_EXERCICIO", "ORGSUP_EXERCICIO", "TIPO_VINCULO", "SITUACAO_VINCULO", "DATA_INICIO_AFASTAMENTO", "DATA_TERMINO_AFASTAMENTO", "REGIME_JURIDICO", "JORNADA_DE_TRABALHO", "DATA_INGRESSO_CARGOFUNCAO", "DATA_NOMEACAO_CARGOFUNCAO", "DATA_INGRESSO_ORGAO", "DOCUMENTO_INGRESSO_SERVICOPUBLICO", "DATA_DIPLOMA_INGRESSO_SERVICOPUBLICO", "DIPLOMA_INGRESSO_CARGOFUNCAO", "DIPLOMA_INGRESSO_ORGAO", "DIPLOMA_INGRESSO_SERVICOPUBLICO", "UF_EXERCICIO", "ANO", "MES", "ID_SERVIDOR_PORTAL", "CPF", "NOME", "REMUNERAÇÃO BÃSICA BRUTA (R$)", "REMUNERAÇÃO BÃSICA BRUTA (U$)", "ABATE-TETO (R$)", "ABATE-TETO (U$)", "GRATIFICAÇÃO NATALINA (R$)", "GRATIFICAÇÃO NATALINA (U$)", "ABATE-TETO DA GRATIFICAÇÃO NATALINA (R$)", "ABATE-TETO DA GRATIFICAÇÃO NATALINA (U$)", "FÉRIAS (R$)", "FÉRIAS (U$)", "OUTRAS REMUNERAÇÕES EVENTUAIS (R$)", "OUTRAS REMUNERAÇÕES EVENTUAIS (U$)", "IRRF (R$)", "IRRF (U$)", "PSS/RPGS (R$)", "PSS/RPGS (U$)", "PENSÃO MILITAR (R$)", "PENSÃO MILITAR (U$)", "FUNDO DE SAÚDE (R$)", "FUNDO DE SAÚDE (U$)", "DEMAIS DEDUÇÕES (R$)", "DEMAIS DEDUÇÕES (U$)", "REMUNERAÇÃO APÓS DEDUÇÕES OBRIGATÓRIAS (R$)", "REMUNERAÇÃO APÓS DEDUÇÕES OBRIGATÓRIAS (U$)", "VERBAS INDENIZATÓRIAS REGISTRADAS EM SISTEMAS DE PESSOAL - CIVIL (R$)(*)", "VERBAS INDENIZATÓRIAS REGISTRADAS EM SISTEMAS DE PESSOAL - CIVIL (U$)(*) ", "VERBAS INDENIZATÓRIAS REGISTRADAS EM SISTEMAS DE PESSOAL - MILITAR (R$)(*)", "VERBAS INDENIZATÓRIAS REGISTRADAS EM SISTEMAS DE PESSOAL - MILITAR (U$)(*)", "TOTAL DE VERBAS INDENIZATÓRIAS (R$)(*)", "TOTAL DE VERBAS INDENIZATÓRIAS (U$)(*)", "TOTAL DE HONORÃRIOS (JETONS)"] + columns => [ "ID_SERVIDOR_PORTAL", "NOME", "CPF", "MATRICULA", "DESCRICAO_CARGO", "CLASSE_CARGO", "REFERENCIA_CARGO", "PADRAO_CARGO", "NIVEL_CARGO", "SIGLA_FUNCAO", "NIVEL_FUNCAO", "FUNCAO", "CODIGO_ATIVIDADE", "ATIVIDADE", "OPCAO_PARCIAL", "COD_UORG_LOTACAO", "UORG_LOTACAO", "COD_ORG_LOTACAO", "ORG_LOTACAO", "COD_ORGSUP_LOTACAO", "ORGSUP_LOTACAO", "COD_UORG_EXERCICIO", "UORG_EXERCICIO", "COD_ORG_EXERCICIO", "ORG_EXERCICIO", "COD_ORGSUP_EXERCICIO", "ORGSUP_EXERCICIO", "TIPO_VINCULO", "SITUACAO_VINCULO", "DATA_INICIO_AFASTAMENTO", "DATA_TERMINO_AFASTAMENTO", "REGIME_JURIDICO", "JORNADA_DE_TRABALHO", "DATA_INGRESSO_CARGOFUNCAO", "DATA_NOMEACAO_CARGOFUNCAO", "DATA_INGRESSO_ORGAO", "DOCUMENTO_INGRESSO_SERVICOPUBLICO", "DATA_DIPLOMA_INGRESSO_SERVICOPUBLICO", "DIPLOMA_INGRESSO_CARGOFUNCAO", "DIPLOMA_INGRESSO_ORGAO", "DIPLOMA_INGRESSO_SERVICOPUBLICO", "UF_EXERCICIO", "ANO", "MES", "REMUNERAÇÃO BÃSICA BRUTA (R$)", "REMUNERAÇÃO BÃSICA BRUTA (U$)", "ABATE-TETO (R$)", "ABATE-TETO (U$)", "GRATIFICAÇÃO NATALINA (R$)", "GRATIFICAÇÃO NATALINA (U$)", "ABATE-TETO DA GRATIFICAÇÃO NATALINA (R$)", "ABATE-TETO DA GRATIFICAÇÃO NATALINA (U$)", "FÉRIAS (R$)", "FÉRIAS (U$)", "OUTRAS REMUNERAÇÕES EVENTUAIS (R$)", "OUTRAS REMUNERAÇÕES EVENTUAIS (U$)", "IRRF (R$)", "IRRF (U$)", "PSS/RPGS (R$)", "PSS/RPGS (U$)", "PENSÃO MILITAR (R$)", "PENSÃO MILITAR (U$)", "FUNDO DE SAÚDE (R$)", "FUNDO DE SAÚDE (U$)", "DEMAIS DEDUÇÕES (R$)", "DEMAIS DEDUÇÕES (U$)", "REMUNERAÇÃO APÓS DEDUÇÕES OBRIGATÓRIAS (R$)", "REMUNERAÇÃO APÓS DEDUÇÕES OBRIGATÓRIAS (U$)", "VERBAS INDENIZATÓRIAS REGISTRADAS EM SISTEMAS DE PESSOAL - CIVIL (R$)(*)", "VERBAS INDENIZATÓRIAS REGISTRADAS EM SISTEMAS DE PESSOAL - CIVIL (U$)(*) ", "VERBAS INDENIZATÓRIAS REGISTRADAS EM SISTEMAS DE PESSOAL - MILITAR (R$)(*)", "VERBAS INDENIZATÓRIAS REGISTRADAS EM SISTEMAS DE PESSOAL - MILITAR (U$)(*)", "TOTAL DE VERBAS INDENIZATÓRIAS (R$)(*)", "TOTAL DE VERBAS INDENIZATÓRIAS (U$)(*)", "TOTAL DE HONORÃRIOS (JETONS)"] separator => " " add_field => { "timestamp" => "%(timestamp)s" } } diff --git a/merge_files_es.py b/merge_files_es.py index 48517fcd04d750d123d5ee36bab165b8b4834b7b..8cb001556dffb5ec0bd63a91fab1925f630c1535 100755 --- a/merge_files_es.py +++ b/merge_files_es.py @@ -65,15 +65,20 @@ def getDataFromRows(row1, row2): newRow = [] for value in row2: newRow.append(value) - for value in row1: - newRow.append(value) + # Append columns ANO e MES. + newRow.append(row1[0]) + newRow.append(row1[1]) + # Start i in 5 because we want to ignore columns ID_SERVIDOR_PORTAL, CPF and NOME from Remuneracao.csv (we already have it from Cadastro.csv). We might not have data from them. + for i in range(5, len(row1)): + newRow.append(row1[i]) return newRow def getDataWithEmptyRow(columns, row): newRow = [] for value in row: newRow.append(value) - for i in range(0, columns): + # Append since 3 because we want to ignore columns ID_SERVIDOR_PORTAL, CPF and NOME from Remuneracao.csv (we already have this data from Cadastro.csv). + for i in range(3, columns): newRow.append('') return newRow diff --git a/scripts/expenses/process_expenses.sh b/scripts/expenses/process_expenses.sh new file mode 100755 index 0000000000000000000000000000000000000000..1e3ca452e01ad9bfd31c5ad4cee1e50e28606135 --- /dev/null +++ b/scripts/expenses/process_expenses.sh @@ -0,0 +1,76 @@ +./resumo_gastos.sh ../../Favorecidos/ 2016-11 +./resumo_gastos.sh ../../Favorecidos/ 2016-10 +./resumo_gastos.sh ../../Favorecidos/ 2016-09 +./resumo_gastos.sh ../../Favorecidos/ 2016-08 +./resumo_gastos.sh ../../Favorecidos/ 2016-07 +./resumo_gastos.sh ../../Favorecidos/ 2016-06 +./resumo_gastos.sh ../../Favorecidos/ 2016-05 +./resumo_gastos.sh ../../Favorecidos/ 2016-04 +./resumo_gastos.sh ../../Favorecidos/ 2016-03 +./resumo_gastos.sh ../../Favorecidos/ 2016-02 +./resumo_gastos.sh ../../Favorecidos/ 2016-01 + +./resumo_gastos.sh ../../Favorecidos/ 2015-12 +./resumo_gastos.sh ../../Favorecidos/ 2015-11 +./resumo_gastos.sh ../../Favorecidos/ 2015-10 +./resumo_gastos.sh ../../Favorecidos/ 2015-09 +./resumo_gastos.sh ../../Favorecidos/ 2015-08 +./resumo_gastos.sh ../../Favorecidos/ 2015-07 +./resumo_gastos.sh ../../Favorecidos/ 2015-06 +./resumo_gastos.sh ../../Favorecidos/ 2015-05 +./resumo_gastos.sh ../../Favorecidos/ 2015-04 +./resumo_gastos.sh ../../Favorecidos/ 2015-03 +./resumo_gastos.sh ../../Favorecidos/ 2015-02 +./resumo_gastos.sh ../../Favorecidos/ 2015-01 + +./resumo_gastos.sh ../../Favorecidos/ 2014-12 +./resumo_gastos.sh ../../Favorecidos/ 2014-11 +./resumo_gastos.sh ../../Favorecidos/ 2014-10 +./resumo_gastos.sh ../../Favorecidos/ 2014-09 +./resumo_gastos.sh ../../Favorecidos/ 2014-08 +./resumo_gastos.sh ../../Favorecidos/ 2014-07 +./resumo_gastos.sh ../../Favorecidos/ 2014-06 +./resumo_gastos.sh ../../Favorecidos/ 2014-05 +./resumo_gastos.sh ../../Favorecidos/ 2014-04 +./resumo_gastos.sh ../../Favorecidos/ 2014-03 +./resumo_gastos.sh ../../Favorecidos/ 2014-02 +./resumo_gastos.sh ../../Favorecidos/ 2014-01 + +./resumo_gastos.sh ../../Favorecidos/ 2013-12 +./resumo_gastos.sh ../../Favorecidos/ 2013-11 +./resumo_gastos.sh ../../Favorecidos/ 2013-10 +./resumo_gastos.sh ../../Favorecidos/ 2013-09 +./resumo_gastos.sh ../../Favorecidos/ 2013-08 +./resumo_gastos.sh ../../Favorecidos/ 2013-07 +./resumo_gastos.sh ../../Favorecidos/ 2013-06 +./resumo_gastos.sh ../../Favorecidos/ 2013-05 +./resumo_gastos.sh ../../Favorecidos/ 2013-04 +./resumo_gastos.sh ../../Favorecidos/ 2013-03 +./resumo_gastos.sh ../../Favorecidos/ 2013-02 +./resumo_gastos.sh ../../Favorecidos/ 2013-01 + +./resumo_gastos.sh ../../Favorecidos/ 2012-12 +./resumo_gastos.sh ../../Favorecidos/ 2012-11 +./resumo_gastos.sh ../../Favorecidos/ 2012-10 +./resumo_gastos.sh ../../Favorecidos/ 2012-09 +./resumo_gastos.sh ../../Favorecidos/ 2012-08 +./resumo_gastos.sh ../../Favorecidos/ 2012-07 +./resumo_gastos.sh ../../Favorecidos/ 2012-06 +./resumo_gastos.sh ../../Favorecidos/ 2012-05 +./resumo_gastos.sh ../../Favorecidos/ 2012-04 +./resumo_gastos.sh ../../Favorecidos/ 2012-03 +./resumo_gastos.sh ../../Favorecidos/ 2012-02 +./resumo_gastos.sh ../../Favorecidos/ 2012-01 + +./resumo_gastos.sh ../../Favorecidos/ 2011-12 +./resumo_gastos.sh ../../Favorecidos/ 2011-11 +./resumo_gastos.sh ../../Favorecidos/ 2011-10 +./resumo_gastos.sh ../../Favorecidos/ 2011-09 +./resumo_gastos.sh ../../Favorecidos/ 2011-08 +./resumo_gastos.sh ../../Favorecidos/ 2011-07 +./resumo_gastos.sh ../../Favorecidos/ 2011-06 +./resumo_gastos.sh ../../Favorecidos/ 2011-05 +./resumo_gastos.sh ../../Favorecidos/ 2011-04 +./resumo_gastos.sh ../../Favorecidos/ 2011-03 +./resumo_gastos.sh ../../Favorecidos/ 2011-02 +./resumo_gastos.sh ../../Favorecidos/ 2011-01 diff --git a/scripts/expenses/resume_expenses.sh b/scripts/expenses/resume_expenses.sh new file mode 100755 index 0000000000000000000000000000000000000000..319a7e0e3407ee1fc0f0acce95a6db8779f1f3dc --- /dev/null +++ b/scripts/expenses/resume_expenses.sh @@ -0,0 +1,25 @@ +# Setembro 2016 +# Path example: ../../Favorecidos/ +path=$1 +# Date example: 2016-11 +date=$2 +# dateWithoutHyphen example: 201611 +dateWithoutHyphen=${date//-} + +if [ "$#" -ne 2 ]; then + echo "Usage: $0 <path> <date>" + exit +fi + +echo "Processing data with args = $path and ${date}" + +input="${path}${date}/${dateWithoutHyphen}_GastosDiretos.csv" +output="${path}/Processados/${dateWithoutHyphen}.csv" + +# About this command: +# - Grep removes everyone that does not work in UFPR. +# - Tr removes null characters (ctrl + @). +# - Head -n1 gets first line (column names). Then, I append the data. + +head -n1 $input > $output +cat $input | egrep --binary-files=text "UNIVERSIDADE FEDERAL DO PARANA" | tr -d '\000' >> $output diff --git a/scripts/expenses/unzip.sh b/scripts/expenses/unzip.sh new file mode 100755 index 0000000000000000000000000000000000000000..922585b844c2aea6defaef16b1062486c0bbfd0e --- /dev/null +++ b/scripts/expenses/unzip.sh @@ -0,0 +1,9 @@ +echo Running with args $1 and $2 + +path="../../Favorecidos/" + +mkdir ${path}$1 +mv ~/Downloads/$2_GastosDiretos.zip ${path}$1 +unzip ${path}$1/$2_GastosDiretos.zip +mv ${path}$2_GastosDiretos.csv ${path}$1 +rm ${path}$1/$2_GastosDiretos.zip diff --git a/scripts/expenses/unzipCaller.sh b/scripts/expenses/unzipCaller.sh new file mode 100755 index 0000000000000000000000000000000000000000..4d49afe0a5f19d2a6eaa819ede51fec78325958f --- /dev/null +++ b/scripts/expenses/unzipCaller.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +./unzip.sh 2015-12 201512 +./unzip.sh 2015-11 201511 +./unzip.sh 2015-10 201510 +./unzip.sh 2015-09 201509 +./unzip.sh 2015-08 201508 +./unzip.sh 2015-07 201507 +./unzip.sh 2015-06 201506 +./unzip.sh 2015-05 201505 +./unzip.sh 2015-04 201504 +./unzip.sh 2015-03 201503 +./unzip.sh 2015-02 201502 +./unzip.sh 2015-01 201501 + +./unzip.sh 2014-12 201412 +./unzip.sh 2014-11 201411 +./unzip.sh 2014-10 201410 +./unzip.sh 2014-09 201409 +./unzip.sh 2014-08 201408 +./unzip.sh 2014-07 201407 +./unzip.sh 2014-06 201406 +./unzip.sh 2014-05 201405 +./unzip.sh 2014-04 201404 +./unzip.sh 2014-03 201403 +./unzip.sh 2014-02 201402 +./unzip.sh 2014-01 201401 + +./unzip.sh 2013-12 201312 +./unzip.sh 2013-11 201311 +./unzip.sh 2013-10 201310 +./unzip.sh 2013-09 201309 +./unzip.sh 2013-08 201308 +./unzip.sh 2013-07 201307 +./unzip.sh 2013-06 201306 +./unzip.sh 2013-05 201305 +./unzip.sh 2013-04 201304 +./unzip.sh 2013-03 201303 +./unzip.sh 2013-02 201302 +./unzip.sh 2013-01 201301 + +./unzip.sh 2012-12 201212 +./unzip.sh 2012-11 201211 +./unzip.sh 2012-10 201210 +./unzip.sh 2012-09 201209 +./unzip.sh 2012-08 201208 +./unzip.sh 2012-07 201207 +./unzip.sh 2012-06 201206 +./unzip.sh 2012-05 201205 +./unzip.sh 2012-04 201204 +./unzip.sh 2012-03 201203 +./unzip.sh 2012-02 201202 +./unzip.sh 2012-01 201201 + +./unzip.sh 2011-12 201112 +./unzip.sh 2011-11 201111 +./unzip.sh 2011-10 201110 +./unzip.sh 2011-09 201109 +./unzip.sh 2011-08 201108 +./unzip.sh 2011-07 201107 +./unzip.sh 2011-06 201106 +./unzip.sh 2011-05 201105 +./unzip.sh 2011-04 201104 +./unzip.sh 2011-03 201103 +./unzip.sh 2011-02 201102 +./unzip.sh 2011-01 201101