Skip to content

Commit 5696636

Browse files
committed
change slash to underscore in constants and move more processing code into seperate function
1 parent 0be5f08 commit 5696636

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/acquisition/rvdss/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
"adenovirus": "adv",
88
"adeno": "adv",
99
"human metapneumovirus": "hmpv",
10-
"enterovirus/rhinovirus": "evrv",
10+
"enterovirus_rhinovirus": "evrv",
1111
"rhinovirus": "evrv",
1212
"rhv": "evrv",
13-
"entero/rhino": "evrv",
13+
"entero_rhino": "evrv",
1414
"rhino":"evrv",
15-
"ev/rv":"evrv",
15+
"ev_rv":"evrv",
1616
"coronavirus":"hcov",
1717
"coron":"hcov",
1818
"coro":"hcov",

src/acquisition/rvdss/rvdss_historic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ def make_signal_type_spelling_consistent(signal):
210210
combined_pat2 = '|'.join((pat3, pat4))
211211

212212
new_signal = re.sub(combined_pat, "positive_tests",signal)
213-
new_signal = re.sub(combined_pat2, "positive_tests",signal)
214-
new_signal = re.sub("total ", "",signal)
213+
new_signal = re.sub(combined_pat2, "tests",new_signal)
214+
new_signal =re.sub(" *%", "_pct_positive",new_signal)
215+
new_signal = re.sub("total ", "",new_signal)
215216
return(new_signal)
216217

217218
def preprocess_table_columns(table):
@@ -240,6 +241,7 @@ def preprocess_table_columns(table):
240241
table.columns = [re.sub("flutest","flu test", col) for col in table.columns]
241242
table.columns = [re.sub(r"other hpiv","hpivother",t) for t in table.columns]
242243

244+
table.columns=[make_signal_type_spelling_consistent(col) for col in table.columns]
243245
return(table)
244246

245247
def create_detections_table(table,modified_date,week_number,week_end_date,start_year):
@@ -251,9 +253,8 @@ def create_detections_table(table,modified_date,week_number,week_end_date,start_
251253
table["geo_value"]=[re.sub("^province of$","alberta",c) for c in table["geo_value"]]
252254

253255
# make naming consistent
254-
table.columns=[make_signal_type_spelling_consistent(col) for col in table.columns]
255256
table.columns=[add_flu_prefix(col) for col in table.columns]
256-
matches=['test','geo_value']
257+
matches=['test','geo_value','positive']
257258

258259
new_names = []
259260
for i in range(len(table.columns)):
@@ -305,7 +306,6 @@ def create_number_detections_table(table,modified_date,start_year):
305306

306307
def create_percent_positive_detection_table(table,modified_date,start_year, flu=False,overwrite_weeks=False):
307308
table = deduplicate_rows(table)
308-
table.columns=[re.sub(" *%", "_pct_positive",col) for col in table.columns]
309309
table.columns = [re.sub(' +', ' ',col) for col in table.columns]
310310
table.insert(2,"issue",modified_date)
311311
table=table.rename(columns={'week end':"time_value"})

0 commit comments

Comments
 (0)