Skip to content

Commit d44a079

Browse files
committed
Fix 2012 being used instead of 2013 in the first two weeks of the 2013-2014 season
1 parent df8c38d commit d44a079

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/acquisition/rvdss/pull_historic.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,14 @@ def fix_edge_cases(table,season,caption,current_week):
330330
# In multiple weeks of the 2021-2022 season, in the positive hpiv table,
331331
# the date for week 12 is 2022-03-19, instead of 2022-03-26
332332
table.loc[table['week'] == 12, 'week end'] = "2022-03-26"
333+
elif season[0] == '2013' and "detections" not in caption.text.lower():
334+
# In the first 2 weeks of the 2013-2014 season, in various tables,
335+
# the date for week 35/36 has 2012 instead of 2013
336+
if current_week == 36:
337+
table.loc[table['week'] == 35, 'week end'] = "2013-08-31"
338+
table.loc[table['week'] == 36, 'week end'] = "2013-09-07"
339+
elif current_week == 35:
340+
table.loc[table['week'] == 35, 'week end'] = "2013-08-31"
333341
return(table)
334342

335343
def fetch_one_season_from_report(url):

tests/acquisition/rvdss/test_pull_historic.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
'hmpv%.5':1}]),
4848
pd.DataFrame(columns=["week end","pos_tests","percent_pos"]),
4949
pd.DataFrame([{"week":32,"week end":"2017-08-17"}]),
50-
pd.DataFrame([{"week":12,"week end":"2022-03-19"}])]
50+
pd.DataFrame([{"week":12,"week end":"2022-03-19"}]),
51+
pd.DataFrame([{"week":35,"week end":"2012-08-31"}]),
52+
pd.DataFrame({"week":[35,36],"week end":["2012-08-31","2012-09-07"]})]
5153

5254
expected_edge_case_tables=[
5355
pd.DataFrame(columns=['week', 'week end', 'canada tests', 'entero/rhino%', 'at tests',
@@ -69,7 +71,9 @@
6971
'hmpv%.5':1}]),
7072
pd.DataFrame(columns=["week end","pos_tests","percent_pos"]),
7173
pd.DataFrame([{"week":32,"week end":"2017-08-12"}]),
72-
pd.DataFrame([{"week":12,"week end":"2022-03-26"}])]
74+
pd.DataFrame([{"week":12,"week end":"2022-03-26"}]),
75+
pd.DataFrame([{"week":35,"week end":"2013-08-31"}]),
76+
pd.DataFrame({"week":[35,36],"week end":["2013-08-31","2013-09-07"]})]
7377

7478
example_edge_case_captions=[
7579
[t for t in captions if "Entero" in t.text][0],
@@ -79,13 +83,16 @@
7983
[t for t in captions if "hMPV" in t.text][0],
8084
[t for t in captions if "hMPV" in t.text][0],
8185
[t for t in captions if "Influenza" in t.text][0],
82-
[t for t in captions if "Para" in t.text][0]]
86+
[t for t in captions if "Para" in t.text][0],
87+
[t for t in captions if "RSV" in t.text][0],
88+
[t for t in captions if "Influenza" in t.text][0]]
8389

8490
example_edge_case_seasons=[["2017","2018"],["2017","2018"],["2017","2018"],
8591
["2015","2016"],["2022","2023"],["2021","2022"],
86-
["2016","2017"],["2021","2022"]]
92+
["2016","2017"],["2021","2022"], ["2013","2014"],
93+
["2013","2014"]]
8794

88-
example_edge_case_weeks=[35,35,47,41,11,10,32,14]
95+
example_edge_case_weeks=[35,35,47,41,11,10,32,14,35,36]
8996

9097
class TestPullHistoric():
9198

0 commit comments

Comments
 (0)