Python library to access data from the Brazilian Public Sector Accounting and Tax Information System (SICONFI/National Treasure)
This package is available for R
Install from pip
pip install siconfipyInstall from github
pip install git+https://github.com/pedrocastroo/siconfipy.gitDependencies:
pandas>=2.25.1requests>=1.2.1
siconfipy provides four main functions:
-
get_fiscal()- Fiscal Management Report -
get_budget()- Budget Execution Summary Report -
get_annual_acc()- Annual Statement of Accounts -
get_info()- Basic information of the federation entities
Utility functions:
find_cod() to get the id (cod_ibge) for each state or city
Datasets:
br_cods
Load siconfipy
import siconfipyor load functions
from siconfipy import get_fiscal, get_budget, br_codsFiscal management report for the state of Sao Paulo (35) for the first four months of 2020:
get_fiscal(year=2020, period=1, cod=35)You can pass a list of integers in
year,periodorcod. Example:year=[2018,2019,2020]orcod=[35,33]. More detailshelp(get_fiscal)
Summary of the budget execution report for the state of Rio de Janeiro (33) of 2018 for the first two months:
get_budget(year=2018, period=1, cod=33)Annual accounts statement of the Federal District (53) for 2018:
get_annual_acc(year=2018, cod=53)Use find_cod() to get the cod (cod_ibge column) parameter:
find_cod("Rio de Janeiro")
cod_ibge ente capital regiao uf esfera exercicio populacao cnpj
124 33 Rio de Janeiro 0 SE BR E 2021 17366189 4.249860e+13
3156 3304557 Rio de Janeiro 1 SE RJ M 2021 6747815 4.249873e+13Acess basic information of the federation entities:
get_info()br_cods provides results similar to get_info(), but with some corrections, see utils/build_datasets.py
All data, as column name is in pt-BR, the API does not provide an endpoint in en.
-
README.mdpt-br - Add Accounting Balance Matrix - balance sheet accounts
- Add Accounting Balances Matrix - Budget Accounts
- Add Accounting Balances Matrix - Control Accounts
- Add Extract of approved reports and matrices delivered
- Add Attachments of reports by sphere of government
Bugs or suggestions: open an issue detailing the problem/suggestion, be as reproducible as possible.
This project is released under the MIT License.