@@ -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
217218def 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
245247def 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
306307def 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