Skip to content

Commit 8d44629

Browse files
authored
Merge pull request #1956 from cmu-delphi/release/indicators_v0.3.54_utils_v0.3.23
Release covidcast-indicators 0.3.54
2 parents dd4e3b4 + 154649e commit 8d44629

25 files changed

+120
-109
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.3.53
2+
current_version = 0.3.54
33
commit = True
44
message = chore: bump covidcast-indicators to {new_version}
55
tag = False

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

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"span_length": 14,
2929
"min_expected_lag": {"all": "3"},
3030
"max_expected_lag": {"all": "4"},
31+
"dry_run": true,
3132
"suppressed_errors": [
3233
{"signal": "ageusia_raw_search"},
3334
{"signal": "ageusia_smoothed_search"},

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"indicator": {
88
"export_start_date": "2020-02-01",
99
"static_file_dir": "./static",
10-
"token": "{{ nchs_mortality_token }}"
10+
"socrata_token": "{{ nchs_mortality_token }}"
1111
},
1212
"archive": {
1313
"aws_credentials": {
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"common": {
3-
"export_dir": "./receiving",
4-
"log_filename": "./nwss_wastewater.log",
3+
"export_dir": "/common/covidcast/receiving/nwss_wastewater",
4+
"log_filename": "/var/log/indicators/nwss_wastewater.log",
55
"log_exceptions": false
66
},
77
"indicator": {
88
"wip_signal": true,
99
"export_start_date": "2020-02-01",
1010
"static_file_dir": "./static",
11-
"token": ""
11+
"socrata_token": "{{ nwss_wastewater_token }}"
1212
}
1313
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"chng": {
1616
"max_age": 6,
17-
"maintainers": ["U01AP8GSWG3","U01069KCRS7"]
17+
"maintainers": ["U01AP8GSWG3","U01069KCRS7"],
18+
"retired-signals": ["7dav_outpatient_covid","7dav_inpatient_covid"]
1819
},
1920
"google-symptoms": {
2021
"max_age": 6,

changehc/version.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
current_version = 0.3.53
1+
current_version = 0.3.54

claims_hosp/version.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
current_version = 0.3.53
1+
current_version = 0.3.54

doctor_visits/version.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
current_version = 0.3.53
1+
current_version = 0.3.54

google_symptoms/params.json.template

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"span_length": 14,
1717
"min_expected_lag": {"all": "3"},
1818
"max_expected_lag": {"all": "4"},
19+
"dry_run": true,
1920
"suppressed_errors": [
2021
{"signal": "ageusia_raw_search"},
2122
{"signal": "ageusia_smoothed_search"},

google_symptoms/version.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
current_version = 0.3.53
1+
current_version = 0.3.54

hhs_hosp/version.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
current_version = 0.3.53
1+
current_version = 0.3.54

nchs_mortality/delphi_nchs_mortality/pull.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def standardize_columns(df):
2222
return df.rename(columns=dict(rename_pairs))
2323

2424

25-
def pull_nchs_mortality_data(token: str, test_file: Optional[str]=None):
25+
def pull_nchs_mortality_data(socrata_token: str, test_file: Optional[str] = None):
2626
"""Pull the latest NCHS Mortality data, and conforms it into a dataset.
2727
2828
The output dataset has:
@@ -38,7 +38,7 @@ def pull_nchs_mortality_data(token: str, test_file: Optional[str]=None):
3838
3939
Parameters
4040
----------
41-
token: str
41+
socrata_token: str
4242
My App Token for pulling the NCHS mortality data
4343
test_file: Optional[str]
4444
When not null, name of file from which to read test data
@@ -57,7 +57,7 @@ def pull_nchs_mortality_data(token: str, test_file: Optional[str]=None):
5757
df = pd.read_csv("./test_data/%s"%test_file)
5858
else:
5959
# Pull data from Socrata API
60-
client = Socrata("data.cdc.gov", token)
60+
client = Socrata("data.cdc.gov", socrata_token)
6161
results = client.get("r8kw-7aab", limit=10**10)
6262
df = pd.DataFrame.from_records(results)
6363
# drop "By Total" rows

nchs_mortality/delphi_nchs_mortality/run.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def run_module(params: Dict[str, Any]):
4242
- "export_start_date": str, date from which to export data in YYYY-MM-DD format
4343
- "static_file_dir": str, directory containing population csv files
4444
- "test_file" (optional): str, name of file from which to read test data
45-
- "token": str, authentication for upstream data pull
45+
- "socrata_token": str, authentication for upstream data pull
4646
- "archive" (optional): if provided, output will be archived with S3
4747
- "aws_credentials": Dict[str, str], AWS login credentials (see S3 documentation)
4848
- "bucket_name: str, name of S3 bucket to read/write
@@ -59,7 +59,7 @@ def run_module(params: Dict[str, Any]):
5959
days=date.today().weekday() + 2)
6060
export_start_date = export_start_date.strftime('%Y-%m-%d')
6161
daily_export_dir = params["common"]["daily_export_dir"]
62-
token = params["indicator"]["token"]
62+
socrata_token = params["indicator"]["socrata_token"]
6363
test_file = params["indicator"].get("test_file", None)
6464

6565
if "archive" in params:
@@ -70,7 +70,7 @@ def run_module(params: Dict[str, Any]):
7070
daily_arch_diff.update_cache()
7171

7272
stats = []
73-
df_pull = pull_nchs_mortality_data(token, test_file)
73+
df_pull = pull_nchs_mortality_data(socrata_token, test_file)
7474
for metric in METRICS:
7575
for geo in ["state", "nation"]:
7676
if metric == 'percent_of_expected_deaths':

nchs_mortality/params.json.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"indicator": {
99
"export_start_date": "2020-02-01",
1010
"static_file_dir": "./static",
11-
"token": ""
11+
"socrata_token": ""
1212
},
1313
"archive": {
1414
"aws_credentials": {

nchs_mortality/tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"export_start_date": "2020-04-11",
2222
"static_file_dir": "../static",
2323
"test_file": "test_data.csv",
24-
"token": ""
24+
"socrata_token": ""
2525
},
2626
"archive": {
2727
"aws_credentials": {

nchs_mortality/tests/test_pull.py

+57-36
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,91 @@
88

99
# export_start_date = PARAMS["indicator"]["export_start_date"]
1010
EXPORT_DIR = "./receiving"
11-
TOKEN = ""
11+
SOCRATA_TOKEN = ""
1212

1313

1414
class TestPullNCHS:
1515
def test_standardize_columns(self):
1616
df = standardize_columns(
17-
pd.DataFrame({
18-
"start_week": [1],
19-
"covid_deaths": [2],
20-
"pneumonia_and_covid_deaths": [4],
21-
"pneumonia_influenza_or_covid_19_deaths": [8]
22-
}))
23-
expected = pd.DataFrame({
24-
"timestamp": [1],
25-
"covid_19_deaths": [2],
26-
"pneumonia_and_covid_19_deaths": [4],
27-
"pneumonia_influenza_or_covid_19_deaths": [8]
28-
})
17+
pd.DataFrame(
18+
{
19+
"start_week": [1],
20+
"covid_deaths": [2],
21+
"pneumonia_and_covid_deaths": [4],
22+
"pneumonia_influenza_or_covid_19_deaths": [8],
23+
}
24+
)
25+
)
26+
expected = pd.DataFrame(
27+
{
28+
"timestamp": [1],
29+
"covid_19_deaths": [2],
30+
"pneumonia_and_covid_19_deaths": [4],
31+
"pneumonia_influenza_or_covid_19_deaths": [8],
32+
}
33+
)
2934
pd.testing.assert_frame_equal(expected, df)
3035

3136
def test_good_file(self):
32-
df = pull_nchs_mortality_data(TOKEN, "test_data.csv")
37+
df = pull_nchs_mortality_data(SOCRATA_TOKEN, "test_data.csv")
3338

3439
# Test columns
35-
assert (df.columns.values == [
36-
'covid_19_deaths', 'total_deaths', 'percent_of_expected_deaths',
37-
'pneumonia_deaths', 'pneumonia_and_covid_19_deaths',
38-
'influenza_deaths', 'pneumonia_influenza_or_covid_19_deaths',
39-
"timestamp", "geo_id", "population"]).all()
40+
assert (
41+
df.columns.values
42+
== [
43+
"covid_19_deaths",
44+
"total_deaths",
45+
"percent_of_expected_deaths",
46+
"pneumonia_deaths",
47+
"pneumonia_and_covid_19_deaths",
48+
"influenza_deaths",
49+
"pneumonia_influenza_or_covid_19_deaths",
50+
"timestamp",
51+
"geo_id",
52+
"population",
53+
]
54+
).all()
4055

4156
# Test aggregation for NYC and NY
4257
raw_df = pd.read_csv("./test_data/test_data.csv", parse_dates=["start_week"])
4358
raw_df = standardize_columns(raw_df)
4459
for metric in METRICS:
45-
ny_list = raw_df.loc[(raw_df["state"] == "New York")
46-
& (raw_df[metric].isnull()), "timestamp"].values
47-
nyc_list = raw_df.loc[(raw_df["state"] == "New York City")
48-
& (raw_df[metric].isnull()), "timestamp"].values
49-
final_list = df.loc[(df["geo_id"] == "ny")
50-
& (df[metric].isnull()), "timestamp"].values
60+
ny_list = raw_df.loc[
61+
(raw_df["state"] == "New York") & (raw_df[metric].isnull()), "timestamp"
62+
].values
63+
nyc_list = raw_df.loc[
64+
(raw_df["state"] == "New York City") & (raw_df[metric].isnull()),
65+
"timestamp",
66+
].values
67+
final_list = df.loc[
68+
(df["geo_id"] == "ny") & (df[metric].isnull()), "timestamp"
69+
].values
5170
assert set(final_list) == set(ny_list).intersection(set(nyc_list))
5271

5372
# Test missing value
5473
gmpr = GeoMapper()
5574
state_ids = pd.DataFrame(list(gmpr.get_geo_values("state_id")))
56-
state_names = gmpr.replace_geocode(state_ids,
57-
"state_id",
58-
"state_name",
59-
from_col=0,
60-
date_col=None)
75+
state_names = gmpr.replace_geocode(
76+
state_ids, "state_id", "state_name", from_col=0, date_col=None
77+
)
6178
for state, geo_id in zip(state_names, state_ids):
6279
if state in set(["New York", "New York City"]):
6380
continue
6481
for metric in METRICS:
65-
test_list = raw_df.loc[(raw_df["state"] == state)
66-
& (raw_df[metric].isnull()), "timestamp"].values
67-
final_list = df.loc[(df["geo_id"] == geo_id)
68-
& (df[metric].isnull()), "timestamp"].values
82+
test_list = raw_df.loc[
83+
(raw_df["state"] == state) & (raw_df[metric].isnull()), "timestamp"
84+
].values
85+
final_list = df.loc[
86+
(df["geo_id"] == geo_id) & (df[metric].isnull()), "timestamp"
87+
].values
6988
assert set(final_list) == set(test_list)
7089

7190
def test_bad_file_with_inconsistent_time_col(self):
7291
with pytest.raises(ValueError):
73-
pull_nchs_mortality_data(TOKEN, "bad_data_with_inconsistent_time_col.csv")
92+
pull_nchs_mortality_data(
93+
SOCRATA_TOKEN, "bad_data_with_inconsistent_time_col.csv"
94+
)
7495

7596
def test_bad_file_with_missing_cols(self):
7697
with pytest.raises(ValueError):
77-
pull_nchs_mortality_data(TOKEN, "bad_data_with_missing_cols.csv")
98+
pull_nchs_mortality_data(SOCRATA_TOKEN, "bad_data_with_missing_cols.csv")

nchs_mortality/version.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
current_version = 0.3.53
1+
current_version = 0.3.54

nwss_wastewater/delphi_nwss/constants.py

-20
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@
1010
# "wwss", # wastewater sample site, name will probably need to change
1111
]
1212

13-
## example:
14-
#
15-
# FULL_TIME = "full_time_work_prop"
16-
# PART_TIME = "part_time_work_prop"
17-
# COVIDNET = "covidnet"
18-
#
19-
# SIGNALS = [
20-
# FULL_TIME,
21-
# PART_TIME,
22-
# COVIDNET
23-
# ]
24-
2513
SIGNALS = ["pcr_conc_smoothed"]
2614
METRIC_SIGNALS = ["detect_prop_15d", "percentile", "ptc_15d"]
2715
METRIC_DATES = ["date_start", "date_end"]
@@ -38,12 +26,4 @@
3826
}
3927
SIG_DIGITS = 7
4028

41-
## example:
42-
# SMOOTHERS = [
43-
# (Smoother("identity", impute_method=None), ""),
44-
# (Smoother("moving_average", window_length=7), "_7dav"),
45-
# ]
46-
47-
SMOOTHERS = []
48-
4929
NEWLINE = "\n"

0 commit comments

Comments
 (0)