Download and import DATASUS's public data to a DuckDB database
Project description
datasus-db
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 SIH RD (Sistema de Informações Hospitalares do SUS - AIH Reduzida) data
# If you want, you can import to another duckdb file changing the `db_file` argument
datasus_db.import_sih_rd(db_file="other-name.db")
# Import PO (Painel de Oncologia) data
datasus_db.import_po()
# 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:
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!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
datasus_db-0.1.1.tar.gz
(12.8 kB
view hashes)
Built Distribution
datasus_db-0.1.1-py3-none-any.whl
(19.5 kB
view hashes)
Close
Hashes for datasus_db-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5e1de3613f0f8c1757d1def313b9b815bcb25bd1cddfe0f80ddc2b647dea93e |
|
MD5 | d4f2ba7917a29f72f9d9df2058423748 |
|
BLAKE2b-256 | 51b56dec319c3fc087a648ba62fc7deb73af8afd51bba904669961f2bbc88a52 |