-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
161 lines (101 loc) · 6.49 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
options(tidyverse.quiet = TRUE)
```
# siconvr
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/siconvr)](https://CRAN.R-project.org/package=siconvr)
[![R-CMD-check](https://github.com/meirelesff/siconvr/workflows/R-CMD-check/badge.svg)](https://github.com/meirelesff/siconvr/actions)
[![Codecov test coverage](https://codecov.io/gh/meirelesff/siconvr/branch/main/graph/badge.svg)](https://codecov.io/gh/meirelesff/siconvr?branch=main)
[![Travis build status](https://travis-ci.com/meirelesff/siconvr.svg?branch=main)](https://travis-ci.com/meirelesff/siconvr)
<!-- badges: end -->
`siconvr` is an R package designed to fetch and clean data on federal targeted transfers in Brazil from Plataforma +Brasil (previously SICONV). With `siconvr`, obtaining data on available policy programs maintained by the Brazilian Federal Government, proposals submitted by local governments, and NGOs to apply for such funds, among many others, takes a few seconds.
## Installing
Install the package from CRAN using:
```{r, eval=FALSE}
install.packages("siconvr")
```
To install the package's development version, use:
```{r, eval=FALSE}
if(!require(remotes)) install.packages("remotes")
remotes::install_github("meirelesff/siconvr")
```
Then load it with:
```{r}
library(siconvr)
```
## How to use
Using `siconvr` to fetch data from Plataforma +Brasil is easy: pass the type of data you want to the `get_siconv` function and you are ready to go. Here's an example:
```{r, eval=FALSE}
progs <- get_siconv("programas")
```
### Available datasets
Here a list of available datasets one can fetch using `siconvr`:
```{r echo=FALSE, message=TRUE, warning=FALSE}
library(tidyverse)
tribble(
~Option, ~Data,
"`programas`", "data on available programs maintained by the Federal Government",
"`programas_propostas`", "keys to match programs and proposals submitted to the Federal Government",
"`propostas`", "data on proposals submitted to the Federal Government",
"`convenios`", "data on proposals effectively accepted situation and amount transferred by the Federal Government",
"`pagamento`", "data on payments to local providers",
"`emendas`", "data on federal budget amendments made by Brazilian Federal Deputies and Senators, amount transferred and the transference recipient;",
"`planos`", "data on application plans submitted to the Federal Government. This document includes all goods, services and works required by the covenant to accomplish the project",
"`empenhos`", "data on transfers which the Federal Government has reserved its budget to pay the covenant when the project ends",
"`desembolsos`", "data on transfers disbursements by the Federal Government",
"`obtv`", "data on payments made to local suppliers and contractors hired to execute funded projects",
"`historico`", "proposals' track record",
"`ingresso_contrapartida`", "record of counterpart payments",
"`aditivos`", "data on contracts' budget addendums",
"`crono_metas`", "project's goals timeline",
"`cronogramas`", "project's execution timeline",
"`consorcios`", "data on proposals where multiple local governments or private entities cooperate to request federal resources",
"`empenhos_desembolsos`", "keys to match appropriations and disbursements by Federal Government",
"`proponentes`", "data on proposals' proponents",
"`cronograma_desembolsos`", "project's transfers disbursements timeline",
"`justificativas`", "proposals' justifications"
) %>%
knitr::kable()
```
### Schema
It also possible to check Plataforma +Brasil's database official documentation -- which includes the database diagram and schema, additional information on tables and variables, primary keys, among others -- by using this:
```{r, eval=FALSE}
show_schema()
```
`show_schema` will extract, read, and open in a web browser the database's docs. Files are saved in the working directory, so one doesn't need to download them again (to just download the docs, set the argument `browser` to `FALSE`).
### Options
By default, `get_siconv` tries to read fetched data using `UTF-8` encoding. In case this does not work for you, use the argument `encoding` to change that:
```{r, eval=FALSE}
emp <- get_siconv("empenhos", encoding = "latin-1")
```
To save Plataforma +Brasil server resources, `get_siconv` stores a cache of fetched data in a folder in working directory named `cache` -- so you don't need to download the same data again. To avoid cacheing date, set `cache` to `FALSE`:
```{r, eval=FALSE}
obtv <- get_siconv("obtv", cache = FALSE)
```
Finally, one might also want to avoid `get_siconv`'s messages when fetching data. This can be done with:
```{r, eval=FALSE}
historico <- get_siconv("historico", verbose = FALSE)
```
## Note
Since version `0.0.2`, `siconvr` fetches data from `antigo.plataformamaisbrasil.gov.br`. As the Brazilian Ministry of Economy changed its website, old content was moved to this new subdomain.
## Contributing
We welcome any help to improve `siconvr`. In case you wish to contribute with code, use [GitHub Pull Requests](https://docs.github.com/pt/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) -- we will be more than happy to acknowledge any assistance by updating our authors' list. Bug reports and suggestions can be done via [GitHub issues](https://github.com/meirelesff/siconvr/issues).
## Disclaimer
`siconvr` does not maintain or update Plataforma +Brasil's database, nor does it change or alter fetched data. Therefore, the authors hold no responsability for its uses or results.
In case you want to dive deeper into Plataforma +Brasil's sources and update policy, please check the following official sources:
- [Official website](http://plataformamaisbrasil.gov.br/)
- [SICONV's working plan](https://static.fecam.net.br/uploads/1542/arquivos/1302090_MODULO_A_SICONV_6_PLANO_DE_TRABALHO.pdf)
- [Guide for Delivering Programs](http://plataformamaisbrasil.gov.br/images/Disponibilizacao_de_Programas.pdf)
- [Financial Guide](http://plataformamaisbrasil.gov.br/images/manuais/M%C3%B3dulo_Fundo_a_Fundo/Tranfer%C3%AAncia/3_Manual_de_Cadastro_de_Conta_Banc%C3%A1ria_e_Empenho_-_Repassador_-_Transfer%C3%AAncia.pdf)
## Authors
[Fernando Meireles](https://fmeireles.com/) e [Marcus Vinícius de Sá Torres](https://marcustorresz.github.io/)