@@ -33,10 +33,9 @@ def compare_dates(date1, date2, flag):
33
33
if flag == "l" :
34
34
return date1
35
35
return date2
36
- else :
37
- if flag == "l" :
38
- return date2
39
- return date1
36
+ if flag == "l" :
37
+ return date2
38
+ return date1
40
39
41
40
def check_whether_date_in_range (search_date , start_date , end_date ):
42
41
"""
@@ -130,9 +129,9 @@ def get_from_email(column_names, start_dates, end_dates, mail_server,
130
129
continue
131
130
132
131
# Check whether we pull the data from a valid time range
133
- WhetherInRange = check_whether_date_in_range (
132
+ whether_in_range = check_whether_date_in_range (
134
133
search_date , start_dates [test ], end_dates [test ])
135
- if not WhetherInRange :
134
+ if not whether_in_range :
136
135
continue
137
136
138
137
print (f"Pulling { test } data received on %s" % search_date .date ())
@@ -370,7 +369,7 @@ def pull_quidel_data(params):
370
369
return dfs , _end_date
371
370
372
371
def check_export_end_date (input_export_end_dates , _end_date ,
373
- END_FROM_TODAY_MINUS ):
372
+ end_from_today_minus ):
374
373
"""
375
374
Update the export_end_date according to the data received
376
375
By default, set the export end date to be the last pulling date - 5 days
@@ -393,7 +392,7 @@ def check_export_end_date(input_export_end_dates, _end_date,
393
392
export_end_dates = {}
394
393
for test_type in TEST_TYPES :
395
394
export_end_dates [test_type ] = _end_date \
396
- - timedelta (days = END_FROM_TODAY_MINUS )
395
+ - timedelta (days = end_from_today_minus )
397
396
if input_export_end_dates [test_type ] != "" :
398
397
input_export_end_dates [test_type ] = datetime .strptime (
399
398
input_export_end_dates [test_type ], '%Y-%m-%d' )
@@ -403,7 +402,7 @@ def check_export_end_date(input_export_end_dates, _end_date,
403
402
return export_end_dates
404
403
405
404
def check_export_start_date (export_start_dates , export_end_dates ,
406
- EXPORT_DAY_RANGE ):
405
+ export_day_range ):
407
406
"""
408
407
Update the export_start_date according to the export_end_date so that it
409
408
could be export_end_date - EXPORT_DAY_RANGE
@@ -414,7 +413,7 @@ def check_export_start_date(export_start_dates, export_end_dates,
414
413
export_end_date: dict
415
414
Calculated according to the data received.
416
415
The type of values are datetime.datetime
417
- EXPORT_DAY_RANGE : int
416
+ export_day_range : int
418
417
Number of days to report
419
418
420
419
Returns:
@@ -430,7 +429,7 @@ def check_export_start_date(export_start_dates, export_end_dates,
430
429
export_start_dates [test_type ], '%Y-%m-%d' )
431
430
# Only export data from -45 days to -5 days
432
431
export_start_dates [test_type ] = compare_dates (
433
- export_end_dates [test_type ] - timedelta (days = EXPORT_DAY_RANGE ),
432
+ export_end_dates [test_type ] - timedelta (days = export_day_range ),
434
433
export_start_dates [test_type ], "l" )
435
434
if test_type == "covid_ag" :
436
435
export_start_dates [test_type ] = compare_dates (
0 commit comments