datasus-db

Download and import DATASUS's public data to a DuckDB database


Keywords
datasus, duckdb, data, science, database, data-science, health-data
License
MIT
Install
pip install datasus-db==0.1.3

Documentation

datasus-db

PyPI version Documentation

A python package to download and import public available data from DATASUS's ftp servers into a DuckDB database.

Why DuckDB?

DuckDB is a local database similar to sqlite, but it is tailor made with analytical processing in mind, which makes it a great tool for analysing DATASUS's data. To see all the features DuckDB provides, check out their documentation.

Installation

pip install datasus-db

Usage

import datasus_db
import logging


def main():
    # If you want to enable logging
    logging.getLogger().setLevel(logging.INFO)

    # Import SIM DO (Sistema de InformaƧƵes de Mortalidade - DeclaraƧƵes de Ɠbito) data
    # By default the data is imported to the file `datasus.db`
    datasus_db.import_sim_do()

    # Import PO (Painel de Oncologia) data
    datasus_db.import_po(db_file="other-name.db")

    # Import SIH RD (Sistema de InformaƧƵes Hospitalares do SUS - AIH Reduzida) data
    datasus_db.import_sih_rd()

    # Import SP (AutorizaĆ§Ć£o de InternaĆ§Ć£o Hospitalar SaĆŗde do Profissional) from SIHSUS (Sistema de InformaƧƵes Hospitalares do SUS).
    datasus_db.import_sih_sp()

    # Import PA (ProduĆ§Ć£o Ambulatorial) from SIASUS (Sistema de InformaƧƵes Ambulatorial do SUS).
    datasus_db.import_sia_pa()

    # Import IBGE POP (PopulaĆ§Ć£o IBGE - Agregada por municĆ­pio, sexo e faixa etaria) data
    datasus_db.import_ibge_pop()

    # Import IBGE POP TCU (PopulaĆ§Ć£o IBGE - Tribunal de Contas da UniĆ£o) data
    datasus_db.import_ibge_pop_tcu()

    # Import auxiliar tables (Municipios, UFs e doenƧas)
    datasus_db.import_auxiliar_tables()


if __name__ == "__main__":
    main()

Documentation

Check out the project's documentation:

View documentation

Found a bug or want a new feature?

Feel free to create an issue here if you found a bug or if you want a new feature!