Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrige inconsistências no README #208

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 3 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This package collects a set of utilities for handling with public databases published by Brazil's DATASUS
The documentation of how to use PySUS can be found [here](http://pysus.readthedocs.io/en/latest/)

If you use PySUS for a publication, please use the bibtex below to cite it:
If you use PySUS for a publication, please use the bibtex below to cite it:
```bibtex
@software{flavio_codeco_coelho_2021_4883502,
author = {Flávio Codeço Coelho and
Expand All @@ -26,7 +26,6 @@ If you use PySUS for a publication, please use the bibtex below to cite it:

## Features


- Decode encoded patient age to any time unit (years, months, etc)
- Convert `.dbc` files to DBF databases or read them into pandas dataframes. DBC files are basically DBFs compressed by a proprietary algorithm.
- Read SINAN dbf files returning DataFrames with properly typed columns
Expand Down Expand Up @@ -54,7 +53,7 @@ If you use windows, or for some other reason is not able to install PySUS on you
First, clone the Pysus repository:

```bash
git clone https://github.com/fccoelho/PySUS.git
git clone https://github.com/AlertaDengue/PySUS.git
```
then from within the PySUS directory build the container

Expand Down Expand Up @@ -138,30 +137,10 @@ datetime.date(2016, 4, 1)

```

**Reading `.dbc` file:**

```python
>>> from pysus.utilities.readdbc import read_dbc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true that this function no longer exists within pysus, but for people that have standalone DBC files they can still use the pyreaddbc.read_dbc Perhaps this example could be modified to just fix the import, and be kept in the README

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this function is not even there. There are open issues about it in the repo, too.

>>> from pyreaddbc import read_dbc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'read_dbc' from 'pyreaddbc' (/Users/ccc/Library/Caches/pypoetry/virtualenvs/pysus-Np31jkgz-py3.11/lib/python3.11/site-packages/pyreaddbc/__init__.py)
>>> from pyreaddbc import readdbc
>>> filename = '~/Downloads/DOAC2023.dbc'
>>> readdbc(filename, encoding='iso-8859-1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable

Copy link
Collaborator

@fccoelho fccoelho Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I am going to fix this, by re-adding this function to Pyreaddbc. I think it's useful


>>> df = read_dbc(filename, encoding='iso-8859-1')
>>> df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1239 entries, 0 to 1238
Data columns (total 58 columns):
AP_MVM 1239 non-null object
AP_CONDIC 1239 non-null object
AP_GESTAO 1239 non-null object
AP_CODUNI 1239 non-null object
AP_AUTORIZ 1239 non-null object
AP_CMP 1239 non-null object
AP_PRIPAL 1239 non-null object
AP_VL_AP 1239 non-null float64
...
```
Downloading and reading SINASC data:

```python
In[1]: from pysus.online_data.sinasc import download
In[1]: from pysus.online_data.SINASC import download
In[2]: df = download('SE', 2015)
In[3]: df.head()
Out[3]:
Expand Down