Skip to content

Commit 6ebc42e

Browse files
authored
Merge pull request #1498 from cmu-delphi/release/indicators_v0.2.24_utils_v0.2.11
Release covidcast-indicators 0.2.24
2 parents 9971712 + 39b4d1d commit 6ebc42e

File tree

8 files changed

+54
-24
lines changed

8 files changed

+54
-24
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.2.23
2+
current_version = 0.2.24
33
commit = True
44
message = chore: bump covidcast-indicators to {new_version}
55
tag = False

ansible/templates/google_symptoms-params-prod.json.j2

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
"min_expected_lag": {"all": "3"},
2727
"max_expected_lag": {"all": "4"},
2828
"suppressed_errors": [
29+
{"signal": "ageusia_raw_search"},
30+
{"signal": "ageusia_smoothed_search"},
31+
{"signal": "anosmia_raw_search"},
32+
{"signal": "anosmia_smoothed_search"},
33+
{"signal": "sum_anosmia_ageusia_raw_search"},
34+
{"signal": "sum_anosmia_ageusia_smoothed_search"}
2935
]
3036
},
3137
"static": {
@@ -39,9 +45,9 @@
3945
"s01_smoothed_search",
4046
"s02_smoothed_search",
4147
"s03_smoothed_search",
48+
"s04_smoothed_search",
4249
"s05_smoothed_search",
4350
"s06_smoothed_search",
44-
"s08_smoothed_search",
4551
"scontrol_smoothed_search"
4652
]
4753
}

google_symptoms/delphi_google_symptoms/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"Rhinitis", "Common cold"],
1212
"s03": ["Fever", "Hyperthermia", "Chills", "Shivering", "Low grade fever"],
1313
#"s04": ["Fatigue", "Weakness", "Muscle weakness", "Myalgia", "Pain"],
14-
"s05": ["Shortness of breath", "Wheeze", "Croup", "Pneumonia", "Asthma",
14+
"s04": ["Shortness of breath", "Wheeze", "Croup", "Pneumonia", "Asthma",
1515
"Crackles", "Acute bronchitis", "Bronchitis"],
16-
"s06": ["Anosmia", "Dysgeusia", "Ageusia"],
16+
"s05": ["Anosmia", "Dysgeusia", "Ageusia"],
1717
#"s07": ["Nausea", "Vomiting", "Diarrhea", "Indigestion", "Abdominal pain"],
18-
"s08": ["Laryngitis", "Sore throat", "Throat irritation"],
18+
"s06": ["Laryngitis", "Sore throat", "Throat irritation"],
1919
#"s09": ["Headache", "Migraine", "Cluster headache", "Dizziness", "Lightheadedness"],
2020
#"s10": ["Night sweats","Perspiration", "hyperhidrosis"],
2121
"scontrol": ["Type 2 diabetes", "Urinary tract infection", "Hair loss",

google_symptoms/delphi_google_symptoms/run.py

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from .pull import pull_gs_data
2424

2525

26+
# pylint: disable=R0912
27+
# pylint: disable=R0915
2628
def run_module(params):
2729
"""
2830
Run Google Symptoms module.
@@ -57,22 +59,37 @@ def run_module(params):
5759
num_export_days = params["indicator"]["num_export_days"]
5860

5961
if num_export_days is None:
60-
# Calculate number of days based on what's missing from the API.
62+
# Generate a list of signals we expect to produce
63+
sensor_names = set(
64+
"_".join([metric, smoother, "search"])
65+
for metric, smoother in product(COMBINED_METRIC, SMOOTHERS)
66+
)
67+
68+
# Fetch metadata to check how recent each signal is
6169
metadata = covidcast.metadata()
62-
gs_metadata = metadata[(metadata.data_source == "google-symptoms")]
63-
64-
# Calculate number of days based on what validator expects.
65-
max_expected_lag = lag_converter(
66-
params["validation"]["common"].get("max_expected_lag", {"all": 4})
67-
)
68-
global_max_expected_lag = max( list(max_expected_lag.values()) )
69-
70-
# Select the larger number of days. Prevents validator from complaining about missing dates,
71-
# and backfills in case of an outage.
72-
num_export_days = max(
73-
(datetime.today() - to_datetime(min(gs_metadata.max_time))).days + 1,
74-
params["validation"]["common"].get("span_length", 14) + global_max_expected_lag
75-
)
70+
# Filter to only those we currently want to produce, ignore any old or deprecated signals
71+
gs_metadata = metadata[(metadata.data_source == "google-symptoms") &
72+
(metadata.signal.isin(sensor_names))]
73+
74+
if sensor_names.difference(set(gs_metadata.signal)):
75+
# If any signal not in metadata yet, we need to backfill its full history.
76+
num_export_days = "all"
77+
else:
78+
# Calculate number of days based on what's missing from the API and
79+
# what the validator expects.
80+
max_expected_lag = lag_converter(
81+
params["validation"]["common"].get("max_expected_lag", {"all": 4})
82+
)
83+
global_max_expected_lag = max( list(max_expected_lag.values()) )
84+
85+
# Select the larger number of days. Prevents validator from complaining about
86+
# missing dates, and backfills in case of an outage.
87+
num_export_days = max(
88+
(datetime.today() - to_datetime(min(gs_metadata.max_time))).days + 1,
89+
params["validation"]["common"].get("span_length", 14) + global_max_expected_lag
90+
)
91+
if num_export_days == "all":
92+
num_export_days = (export_end_date - export_start_date).days + 1
7693

7794
logger = get_structured_logger(
7895
__name__, filename=params["common"].get("log_filename"),

google_symptoms/params.json.template

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"min_expected_lag": {"all": "3"},
1717
"max_expected_lag": {"all": "4"},
1818
"suppressed_errors": [
19+
{"signal": "ageusia_raw_search"},
20+
{"signal": "ageusia_smoothed_search"},
21+
{"signal": "anosmia_raw_search"},
22+
{"signal": "anosmia_smoothed_search"},
23+
{"signal": "sum_anosmia_ageusia_raw_search"},
24+
{"signal": "sum_anosmia_ageusia_smoothed_search"}
1925
]
2026
},
2127
"static": {
@@ -29,9 +35,9 @@
2935
"s01_smoothed_search",
3036
"s02_smoothed_search",
3137
"s03_smoothed_search",
38+
"s04_smoothed_search",
3239
"s05_smoothed_search",
3340
"s06_smoothed_search",
34-
"s08_smoothed_search",
3541
"scontrol_smoothed_search"
3642
]
3743
}

google_symptoms/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
required = [
55
"mock",
66
"numpy",
7-
"pandas",
7+
"pandas==1.3.5",
88
"pydocstyle",
99
"pytest",
1010
"pytest-cov",

google_symptoms/tests/test_run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def test_output_files_exist(self, run_as_module):
2525
geos = ["county", "state", "hhs", "nation"]
2626
metrics = ["s01", "s02", "s03",
2727
#"s04",
28-
"s05", "s06",
28+
"s04", "s05",
2929
#"s07",
30-
"s08",
30+
"s06",
3131
#"s09", "s10",
3232
"scontrol"]
3333
smoother = ["raw", "smoothed"]

safegraph_patterns/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"pydocstyle",
88
"pytest",
99
"pytest-cov",
10+
"coverage==6.2.0",
1011
"pylint==2.8.3",
1112
"delphi-utils"
1213
]

0 commit comments

Comments
 (0)