@@ -210,8 +210,9 @@ def make_signal_type_spelling_consistent(signal):
210
210
combined_pat2 = '|' .join ((pat3 , pat4 ))
211
211
212
212
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 )
215
216
return (new_signal )
216
217
217
218
def preprocess_table_columns (table ):
@@ -240,6 +241,7 @@ def preprocess_table_columns(table):
240
241
table .columns = [re .sub ("flutest" ,"flu test" , col ) for col in table .columns ]
241
242
table .columns = [re .sub (r"other hpiv" ,"hpivother" ,t ) for t in table .columns ]
242
243
244
+ table .columns = [make_signal_type_spelling_consistent (col ) for col in table .columns ]
243
245
return (table )
244
246
245
247
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_
251
253
table ["geo_value" ]= [re .sub ("^province of$" ,"alberta" ,c ) for c in table ["geo_value" ]]
252
254
253
255
# make naming consistent
254
- table .columns = [make_signal_type_spelling_consistent (col ) for col in table .columns ]
255
256
table .columns = [add_flu_prefix (col ) for col in table .columns ]
256
- matches = ['test' ,'geo_value' ]
257
+ matches = ['test' ,'geo_value' , 'positive' ]
257
258
258
259
new_names = []
259
260
for i in range (len (table .columns )):
@@ -305,7 +306,6 @@ def create_number_detections_table(table,modified_date,start_year):
305
306
306
307
def create_percent_positive_detection_table (table ,modified_date ,start_year , flu = False ,overwrite_weeks = False ):
307
308
table = deduplicate_rows (table )
308
- table .columns = [re .sub (" *%" , "_pct_positive" ,col ) for col in table .columns ]
309
309
table .columns = [re .sub (' +' , ' ' ,col ) for col in table .columns ]
310
310
table .insert (2 ,"issue" ,modified_date )
311
311
table = table .rename (columns = {'week end' :"time_value" })
0 commit comments