siconfipy

Access data from the Brazilian Public Sector (SICONFI)


Keywords
accounts, brazil, brazilian, budget, economics, python, siconfi
License
MIT
Install
pip install siconfipy==0.0.4b1

Documentation

siconfipy

pypi PyPI status PyPI license Code style: black

Python library to access data from the Brazilian Public Sector Accounting and Tax Information System (SICONFI/National Treasure)

This package is available for R

Installation

Install from pip

pip install siconfipy

Install from github

pip install git+https://github.com/pedrocastroo/siconfipy.git

Dependencies:

  • pandas>=2.25.1
  • requests>=1.2.1

Using

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

Examples

Load siconfipy

import siconfipy

or load functions

from siconfipy import get_fiscal, get_budget, br_cods

Fiscal 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, period or cod. Example: year=[2018,2019,2020] or cod=[35,33]. More details help(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+13

Acess 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.

TODO

  • README.md pt-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

Contributing

Bugs or suggestions: open an issue detailing the problem/suggestion, be as reproducible as possible.

License

This project is released under the MIT License.