Skip to content

Commit

Permalink
fix(sia): handles files with final 'a', 'b' and 'c' (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
luabida authored Sep 21, 2023
1 parent 0300efb commit 2d8cfb2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source/tutorials/Dengue.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
}
],
"source": [
"munrj = gpd.read_file('../data/rj-municipalities.json')\n",
"munrj = gpd.read_file('./rj-municipalities.json')\n",
"munrj.plot();"
]
},
Expand Down
1 change: 1 addition & 0 deletions docs/source/tutorials/rj-municipalities.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions pysus/ftp/databases/sia.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ def describe(self, file: File) -> dict:

def format(self, file: File) -> tuple:
if file.extension.upper() in [".DBC", ".DBF"]:
year, month = file.name[-4:-2], file.name[-2:]
group, _uf = file.name[:-6].upper(), file.name[-6:-4].upper()
digits = ''.join([d for d in file.name if d.isdigit()])
chars, _ = file.name.split(digits)
year, month = digits[:2], digits[2:]
group, _uf = chars[:-2].upper(), chars[-2:].upper()
return group, _uf, zfill_year(year), month
return ()

Expand Down
1 change: 1 addition & 0 deletions pysus/tests/test_data/test_sia.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_download_before_2008(self):
self.assertIn("PA_CODUNI", df.columns)
self.assertIsInstance(df, pd.DataFrame)

@pytest.mark.skip(reason="This test takes too long")
@pytest.mark.timeout(5)
@unittest.expectedFailure
def test_download_before_1994(self):
Expand Down
1 change: 1 addition & 0 deletions pysus/tests/test_ibge.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def test_metadata(self):
self.assertIsInstance(md, dict)
self.assertGreater(len(md), 0)

@pytest.mark.skip(reason="This test takes too long")
@pytest.mark.timeout(5)
def test_FetchData(self):
ds = IBGE.FetchData(475, periodos=1996, variavel=93, localidades='N3[all]',
Expand Down

0 comments on commit 2d8cfb2

Please sign in to comment.