Skip to content

Commit 81e5f42

Browse files
committed
filter weeks with user-provided age threshold
1 parent 70a44c6 commit 81e5f42

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/acquisition/flusurv/flusurv_update.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
| rate_age_7 | double | YES | | NULL | |
4141
+--------------+-------------+------+-----+---------+----------------+
4242
id: unique identifier for each record
43-
release_date: the date when this record was first published by the CDC
44-
issue: the epiweek of publication (e.g. issue 201453 includes epiweeks up to
43+
release_date: the date when this record was first received by Delphi
44+
issue: the epiweek of receipt by Delphi (e.g. issue 201453 includes epiweeks up to
4545
and including 2014w53, but not 2015w01 or following)
4646
epiweek: the epiweek during which the data was collected
4747
location: the name of the catchment (e.g. 'network_all', 'CA', 'NY_albany')
@@ -138,10 +138,12 @@ def update(fetcher, location, test_mode=False):
138138
# insert/update each row of data (one per epiweek)
139139
for epiweek in epiweeks:
140140
lag = delta_epiweeks(epiweek, fetcher.metadata.issue)
141-
if lag > MAX_AGE_TO_CONSIDER_WEEKS:
142-
# Ignore values older than one year, as (1) they are assumed not to
143-
# change, and (2) it would adversely affect database performance if all
144-
# values (including duplicates) were stored on each run.
141+
if lag > fetcher.metadata.max_age_weeks:
142+
# Ignore obs older than `max_age_weeks` from user command line
143+
# argument `max_age`. We restricted our FluSurv API call to only
144+
# seasons older than `max_age_weeks` (in order to reduce the
145+
# amount of data being pulled), but the season by the cutoff date
146+
# may still have some weeks older than we'd like to include.
145147
continue
146148

147149
missing_expected_groups = EXPECTED_GROUPS - data[epiweek].keys()

0 commit comments

Comments
 (0)