2727
2828# Constants
2929QUARTER = os .path .basename (PATHS ["data_quarter" ])
30+ FILE_PATHS = [
31+ shared .path_join (PATHS ["data_phase" ], "gcs_product_totals.csv" ),
32+ shared .path_join (PATHS ["data_phase" ], "gcs_status_combined_totals.csv" ),
33+ shared .path_join (PATHS ["data_phase" ], "gcs_status_lastest_totals.csv" ),
34+ shared .path_join (PATHS ["data_phase" ], "gcs_status_prior_totals.csv" ),
35+ shared .path_join (PATHS ["data_phase" ], "gcs_status_retired_totals.csv" ),
36+ shared .path_join (PATHS ["data_phase" ], "gcs_totals_by_country.csv" ),
37+ shared .path_join (PATHS ["data_phase" ], "gcs_totals_by_free_cultural.csv" ),
38+ shared .path_join (PATHS ["data_phase" ], "gcs_totals_by_language.csv" ),
39+ shared .path_join (PATHS ["data_phase" ], "gcs_totals_by_restrictions.csv" ),
40+ ]
3041
3142
3243def parse_arguments ():
@@ -62,7 +73,7 @@ def parse_arguments():
6273 return args
6374
6475
65- def check_for_data_file (file_path ):
76+ def check_for_data_files (file_path ):
6677 if os .path .exists (file_path ):
6778 raise shared .QuantifyingException (
6879 f"Processed data already exists for { QUARTER } " , 0
@@ -118,7 +129,6 @@ def process_product_totals(args, count_data):
118129 data .items (), columns = ["CC legal tool product" , "Count" ]
119130 )
120131 file_path = shared .path_join (PATHS ["data_phase" ], "gcs_product_totals.csv" )
121- check_for_data_file (file_path )
122132 data_to_csv (args , data , file_path )
123133
124134
@@ -200,8 +210,7 @@ def process_latest_prior_retired_totals(args, count_data):
200210 file_path = shared .path_join (
201211 PATHS ["data_phase" ], f"gcs_status_{ key } _totals.csv"
202212 )
203- check_for_data_file (file_path )
204- data_to_csv (args , dataframe , file_path )
213+ data_to_csv (args , dataframe , file_path )
205214
206215
207216def process_totals_by_free_cultural (args , count_data ):
@@ -234,7 +243,6 @@ def process_totals_by_free_cultural(args, count_data):
234243 file_path = shared .path_join (
235244 PATHS ["data_phase" ], "gcs_totals_by_free_cultural.csv"
236245 )
237- check_for_data_file (file_path )
238246 data_to_csv (args , data , file_path )
239247
240248
@@ -269,7 +277,6 @@ def process_totals_by_restrictions(args, count_data):
269277 file_path = shared .path_join (
270278 PATHS ["data_phase" ], "gcs_totals_by_restrictions.csv"
271279 )
272- check_for_data_file (file_path )
273280 data_to_csv (args , data , file_path )
274281
275282
@@ -291,7 +298,6 @@ def process_totals_by_language(args, data):
291298 file_path = shared .path_join (
292299 PATHS ["data_phase" ], "gcs_totals_by_language.csv"
293300 )
294- check_for_data_file (file_path )
295301 data_to_csv (args , data , file_path )
296302
297303
@@ -313,14 +319,14 @@ def process_totals_by_country(args, data):
313319 file_path = shared .path_join (
314320 PATHS ["data_phase" ], "gcs_totals_by_country.csv"
315321 )
316- check_for_data_file (file_path )
317322 data_to_csv (args , data , file_path )
318323
319324
320325def main ():
321326 args = parse_arguments ()
322327 shared .paths_log (LOGGER , PATHS )
323328 shared .git_fetch_and_merge (args , PATHS ["repo" ])
329+ check_for_data_files (FILE_PATHS )
324330
325331 # Count data
326332 file1_count = shared .path_join (PATHS ["data_1-fetch" ], "gcs_1_count.csv" )
0 commit comments