# datasus-db
[![PyPI version](https://badge.fury.io/py/datasus-db.svg)](https://pypi.org/project/datasus-db/ "Go to project PyPi page")
[![Documentation](https://img.shields.io/badge/Documentation-3fba11)](https://mymatsubara.github.io/datasus-db/datasus_db.html "Go to project documentation")
A python package to **download and import** public available data from **DATASUS's** ftp servers into a [DuckDB](https://duckdb.org/) database.
## Why DuckDB?
[DuckDB](https://duckdb.org/) is a local database similar to [sqlite](https://www.sqlite.org/index.html), 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](https://www.sqlite.org/index.html).
## Installation
```
pip install datasus-db
```
## Usage
```python
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](https://img.shields.io/badge/VIEW-DOCUMENTATION-3fba11?style=for-the-badge)](https://mymatsubara.github.io/datasus-db/datasus_db.html "Go to project documentation")
## Found a bug or want a new feature?
Feel free to create an [issue](https://github.com/mymatsubara/datasus-dbc-py/issues/new) here if you found a bug or if you want a new feature!
Raw data
{
"_id": null,
"home_page": "https://github.com/mymatsubara/datasus-db",
"name": "datasus-db",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "datasus, duckdb, data science, database",
"author": "Murilo Matsubara",
"author_email": "murilo.matsubara@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/43/87/ea20110b53b7ae6599d98431b94b85df32848f30995cb872b1d312fa88a5/datasus_db-0.1.3.tar.gz",
"platform": null,
"description": "# datasus-db\n\n[![PyPI version](https://badge.fury.io/py/datasus-db.svg)](https://pypi.org/project/datasus-db/ \"Go to project PyPi page\")\n[![Documentation](https://img.shields.io/badge/Documentation-3fba11)](https://mymatsubara.github.io/datasus-db/datasus_db.html \"Go to project documentation\")\n\nA python package to **download and import** public available data from **DATASUS's** ftp servers into a [DuckDB](https://duckdb.org/) database.\n\n## Why DuckDB?\n[DuckDB](https://duckdb.org/) is a local database similar to [sqlite](https://www.sqlite.org/index.html), 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](https://www.sqlite.org/index.html).\n\n\n## Installation\n```\npip install datasus-db\n```\n\n## Usage\n\n```python\nimport datasus_db\nimport logging\n\n\ndef main():\n # If you want to enable logging\n logging.getLogger().setLevel(logging.INFO)\n\n # Import SIM DO (Sistema de Informa\u00e7\u00f5es de Mortalidade - Declara\u00e7\u00f5es de \u00d3bito) data\n # By default the data is imported to the file `datasus.db`\n datasus_db.import_sim_do()\n\n # Import PO (Painel de Oncologia) data\n datasus_db.import_po(db_file=\"other-name.db\")\n\n # Import SIH RD (Sistema de Informa\u00e7\u00f5es Hospitalares do SUS - AIH Reduzida) data\n datasus_db.import_sih_rd()\n\n # Import SP (Autoriza\u00e7\u00e3o de Interna\u00e7\u00e3o Hospitalar Sa\u00fade do Profissional) from SIHSUS (Sistema de Informa\u00e7\u00f5es Hospitalares do SUS).\n datasus_db.import_sih_sp()\n\n # Import PA (Produ\u00e7\u00e3o Ambulatorial) from SIASUS (Sistema de Informa\u00e7\u00f5es Ambulatorial do SUS).\n datasus_db.import_sia_pa()\n\n # Import IBGE POP (Popula\u00e7\u00e3o IBGE - Agregada por munic\u00edpio, sexo e faixa etaria) data\n datasus_db.import_ibge_pop()\n\n # Import IBGE POP TCU (Popula\u00e7\u00e3o IBGE - Tribunal de Contas da Uni\u00e3o) data\n datasus_db.import_ibge_pop_tcu()\n\n # Import auxiliar tables (Municipios, UFs e doen\u00e7as)\n datasus_db.import_auxiliar_tables()\n\n\nif __name__ == \"__main__\":\n main()\n```\n\n## Documentation\nCheck out the project's documentation:\n\n[![View documentation](https://img.shields.io/badge/VIEW-DOCUMENTATION-3fba11?style=for-the-badge)](https://mymatsubara.github.io/datasus-db/datasus_db.html \"Go to project documentation\")\n\n## Found a bug or want a new feature?\nFeel free to create an [issue](https://github.com/mymatsubara/datasus-dbc-py/issues/new) here if you found a bug or if you want a new feature!\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Download and import DATASUS's public data to a DuckDB database",
"version": "0.1.3",
"project_urls": {
"Documentation": "https://mymatsubara.github.io/datasus-db/datasus_db.html",
"Homepage": "https://github.com/mymatsubara/datasus-db",
"Repository": "https://github.com/mymatsubara/datasus-db"
},
"split_keywords": [
"datasus",
" duckdb",
" data science",
" database"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "82feb395db3b68e527157002324b21ed3c7e4627d125b972d83a1c674f573f1f",
"md5": "a6c144c5167510dcb15e59bafa01ecef",
"sha256": "14ff906fc23a484f62f54a78b6ea41d60eb14b84ef76482a825d593da274c718"
},
"downloads": -1,
"filename": "datasus_db-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a6c144c5167510dcb15e59bafa01ecef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 22058,
"upload_time": "2024-05-02T19:01:58",
"upload_time_iso_8601": "2024-05-02T19:01:58.250480Z",
"url": "https://files.pythonhosted.org/packages/82/fe/b395db3b68e527157002324b21ed3c7e4627d125b972d83a1c674f573f1f/datasus_db-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4387ea20110b53b7ae6599d98431b94b85df32848f30995cb872b1d312fa88a5",
"md5": "0eb693cb7de5a1f6e51b0e762a18225d",
"sha256": "b63c10b1ad34797806909086ad98cd65fbcb0442c3ec373b83f05c2a7e7f656a"
},
"downloads": -1,
"filename": "datasus_db-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "0eb693cb7de5a1f6e51b0e762a18225d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 14149,
"upload_time": "2024-05-02T19:02:00",
"upload_time_iso_8601": "2024-05-02T19:02:00.478854Z",
"url": "https://files.pythonhosted.org/packages/43/87/ea20110b53b7ae6599d98431b94b85df32848f30995cb872b1d312fa88a5/datasus_db-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-02 19:02:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mymatsubara",
"github_project": "datasus-db",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "datasus-db"
}