Skip to content

Commit

Permalink
Merge pull request #48 from analytics-ufcg/224-add-riscos
Browse files Browse the repository at this point in the history
224 - Adiciona previsões no AL_DB (provisório)
  • Loading branch information
biabs1 authored Aug 3, 2020
2 parents 6a5ecad + 88f5f16 commit 03ec0bb
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 0 deletions.
1 change: 1 addition & 0 deletions feed-al/DAO.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ create <- function() {
system(paste0("psql -h ", host, " -U ", user, " -d ", db, " -f ", " /feed-al/scripts/create/create_municipio.sql"))
system(paste0("psql -h ", host, " -U ", user, " -d ", db, " -f ", " /feed-al/scripts/create/create_licitacao.sql"))
system(paste0("psql -h ", host, " -U ", user, " -d ", db, " -f ", " /feed-al/scripts/create/create_contrato.sql"))
system(paste0("psql -h ", host, " -U ", user, " -d ", db, " -f ", " /feed-al/scripts/create/create_previsao.sql"))
system(paste0("psql -h ", host, " -U ", user, " -d ", db, " -f ", " /feed-al/scripts/create/create_empenho.sql"))
system(paste0("psql -h ", host, " -U ", user, " -d ", db, " -f ", " /feed-al/scripts/create/create_participante.sql"))
system(paste0("psql -h ", host, " -U ", user, " -d ", db, " -f ", " /feed-al/scripts/create/create_pagamento.sql"))
Expand Down
31 changes: 31 additions & 0 deletions feed-al/scripts/create/create_previsao.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
DROP TABLE IF EXISTS previsao;

CREATE TABLE IF NOT EXISTS "previsao" (
"id_contrato" VARCHAR(50),
"cd_u_gestora" INTEGER,
"nu_licitacao" VARCHAR(10),
"nu_contrato" VARCHAR(9),
"dt_ano" SMALLINT,
"data_inicio" DATE,
"nu_cpfcnpj" VARCHAR(14),
"tp_licitacao" SMALLINT,
"vl_total_contrato" DECIMAL,
"n_licitacoes_part" INTEGER,
"n_licitacoes_venceu" INTEGER,
"montante_lic_venceu" DECIMAL,
"perc_vitoria" DECIMAL,
"media_n_licitacoes_part" DECIMAL,
"media_n_licitacoes_venceu" DECIMAL,
"n_propostas" INTEGER,
"media_n_propostas" DECIMAL,
"total_ganho" DECIMAL,
"status_tramita" SMALLINT,
"razao_contrato_por_vl_recebido" DECIMAL,
"media_num_contratos" DECIMAL,
"num_contratos" DECIMAL,
"vig_pred" VARCHAR(1),
"vig_prob_0" DECIMAL,
"vig_prob_1" DECIMAL,
FOREIGN KEY("id_contrato") REFERENCES contrato("id_contrato") ON DELETE CASCADE ON UPDATE CASCADE

);
1 change: 1 addition & 0 deletions feed-al/scripts/drop/drop_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ DROP TABLE IF EXISTS "pagamento";
DROP TABLE IF EXISTS "estorno_pagamento";
DROP TABLE IF EXISTS "proposta";
DROP TABLE IF EXISTS "participante";
DROP TABLE IF EXISTS "previsao";
DROP TABLE IF EXISTS "contrato";
DROP TABLE IF EXISTS "empenho";
DROP TABLE IF EXISTS "licitacao";
Expand Down
1 change: 1 addition & 0 deletions feed-al/scripts/import/import_data.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
\copy municipio FROM '/data/municipios.csv' WITH NULL AS 'NA' DELIMITER ',' CSV HEADER;
\copy licitacao FROM '/data/licitacoes.csv' WITH NULL AS 'NA' DELIMITER ',' CSV HEADER;
\copy contrato FROM '/data/contratos.csv' WITH NULL AS 'NA' DELIMITER ',' CSV HEADER;
\copy previsao FROM '/data/previsoes.csv' WITH NULL AS 'NA' DELIMITER ',' CSV HEADER;
\copy empenho FROM PROGRAM 'awk FNR-1 /data/empenhos/*.csv | cat' WITH NULL AS 'NA' DELIMITER ',' CSV;
\copy participante FROM '/data/participantes.csv' WITH NULL AS 'NA' DELIMITER ',' CSV HEADER;
\copy proposta FROM '/data/propostas.csv' WITH NULL AS 'NA' DELIMITER ',' CSV HEADER;
Expand Down
1 change: 1 addition & 0 deletions transformador/data/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*
# exceto o .gitignore
!.gitignore
!previsoes.csv
Loading

0 comments on commit 03ec0bb

Please sign in to comment.