Skip to content

Commit 6abcab3

Browse files
authored
Merge pull request #1481 from cmu-delphi/release/indicators_v0.2.22_utils_v0.2.10
Release covidcast-indicators 0.2.22
2 parents b685b2e + 3af5cdc commit 6abcab3

File tree

32 files changed

+1328
-32
lines changed

32 files changed

+1328
-32
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.21
2+
current_version = 0.2.22
33
commit = True
44
message = chore: bump covidcast-indicators to {new_version}
55
tag = False

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: github.event.pull_request.draft == false
1717
strategy:
1818
matrix:
19-
packages: [_delphi_utils_python, changehc, claims_hosp, combo_cases_and_deaths, doctor_visits, google_symptoms, hhs_hosp, hhs_facilities, jhu, nchs_mortality, nowcast, quidel, quidel_covidtest, safegraph_patterns, sir_complainsalot, usafacts]
19+
packages: [_delphi_utils_python, changehc, claims_hosp, combo_cases_and_deaths, doctor_visits, dsew_community_profile, google_symptoms, hhs_hosp, hhs_facilities, jhu, nchs_mortality, nowcast, quidel, quidel_covidtest, safegraph_patterns, sir_complainsalot, usafacts]
2020
defaults:
2121
run:
2222
working-directory: ${{ matrix.packages }}

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- Keep in sync with '.github/workflows/python-ci.yml'.
1010
- TODO: #527 Get this list automatically from python-ci.yml at runtime.
1111
*/
12-
def indicator_list = ["changehc", "claims_hosp", "facebook", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "usafacts"]
12+
def indicator_list = ["changehc", "claims_hosp", "facebook", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "usafacts", "dsew_community_profile"]
1313
def build_package = [:]
1414
def deploy_staging = [:]
1515
def deploy_production = [:]

_delphi_utils_python/.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.9
2+
current_version = 0.2.10
33
commit = True
44
message = chore: bump delphi_utils to {new_version}
55
tag = False

_delphi_utils_python/delphi_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
from .nancodes import Nans
1616
from .weekday import Weekday
1717

18-
__version__ = "0.2.9"
18+
__version__ = "0.2.10"

_delphi_utils_python/delphi_utils/validator/datafetcher.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,9 @@ def get_geo_signal_combos(data_source):
111111
Cross references based on combinations reported available by COVIDcast metadata.
112112
"""
113113
# Maps data_source name with what's in the API, lists used in case of multiple names
114-
# pylint: disable=fixme
115-
# TODO: Extract this mapping from meta response instead of hard-coding
116-
# https://github.com/cmu-delphi/covidcast-indicators/issues/1457
117-
source_signal_mappings = {
118-
'indicator-combination': ['indicator-combination-cases-deaths'],
119-
'quidel': ['quidel-covid-ag'],
120-
'safegraph': ['safegraph-weekly']
121-
}
114+
115+
source_signal_mappings = {i['source']:i['db_source'] for i in
116+
requests.get("https://api.covidcast.cmu.edu/epidata/covidcast/meta").json()}
122117
meta = covidcast.metadata()
123118
source_meta = meta[meta['data_source'] == data_source]
124119
# Need to convert np.records to tuples so they are hashable and can be used in sets and dicts.
@@ -130,8 +125,9 @@ def get_geo_signal_combos(data_source):
130125
# True/False indicate if status is active, "unknown" means we should check
131126
sig_combo_seen = dict()
132127
for combo in geo_signal_combos:
133-
if source_signal_mappings.get(data_source):
134-
src_list = source_signal_mappings.get(data_source)
128+
if data_source in source_signal_mappings.values():
129+
src_list = [key for (key, value) in source_signal_mappings.items()
130+
if value == data_source]
135131
else:
136132
src_list = [data_source]
137133
for src in src_list:

_delphi_utils_python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
setup(
2828
name="delphi_utils",
29-
version="0.2.9",
29+
version="0.2.10",
3030
description="Shared Utility Functions for Indicators",
3131
long_description=long_description,
3232
long_description_content_type="text/markdown",

_delphi_utils_python/tests/validator/test_datafetcher.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,44 @@ def test_make_date_filter(self):
2121
assert not date_filter(FILENAME_REGEX.match("20200620_a_b.csv"))
2222
assert not date_filter(FILENAME_REGEX.match("202006_a_b.csv"))
2323

24-
# pylint: disable=fixme
25-
# TODO: mock out the advanced meta endpoint /covidcast/meta as well
26-
# https://github.com/cmu-delphi/covidcast-indicators/issues/1456
24+
# Solution from https://stackoverflow.com/questions/15753390/
25+
#how-can-i-mock-requests-and-the-response
26+
def mocked_requests_get(*args, **kwargs):
27+
class MockResponse:
28+
def __init__(self, json_data, status_code):
29+
self.json_data = json_data
30+
self.status_code = status_code
31+
32+
def json(self):
33+
return self.json_data
34+
if len(kwargs) == 0:
35+
return MockResponse([{'source': 'chng', 'db_source': 'chng'},
36+
{'source': 'covid-act-now', 'db_source': 'covid-act-now'}], 200)
37+
elif kwargs["params"] == {'signal': 'chng:inactive'}:
38+
return MockResponse([{"signals": [{"active": False}]}], 200)
39+
else:
40+
return MockResponse([{"signals": [{"active": True}]}], 200)
41+
@mock.patch('requests.get', side_effect=mocked_requests_get)
2742
@mock.patch("covidcast.metadata")
28-
def test_get_geo_signal_combos(self, mock_metadata):
43+
def test_get_geo_signal_combos(self, mock_metadata, mock_get):
2944
"""Test that the geo signal combos are correctly pulled from the covidcast metadata."""
3045
# Need to use actual data_source and signal names since we reference the API
46+
# We let the chng signal "inactive" be an inactive signal
3147
mock_metadata.return_value = pd.DataFrame({"data_source": ["chng", "chng", "chng",
3248
"covid-act-now",
3349
"covid-act-now",
34-
"covid-act-now"],
50+
"covid-act-now",
51+
"chng"],
3552
"signal": ["smoothed_outpatient_cli",
3653
"smoothed_outpatient_covid",
3754
"smoothed_outpatient_covid",
3855
"pcr_specimen_positivity_rate",
3956
"pcr_specimen_positivity_rate",
40-
"pcr_specimen_total_tests"],
57+
"pcr_specimen_total_tests",
58+
"inactive"],
4159
"geo_type": ["state", "state", "county",
42-
"hrr", "msa", "msa"]
60+
"hrr", "msa", "msa",
61+
"state"]
4362
})
4463

4564
assert set(get_geo_signal_combos("chng")) == set(
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"common": {
3+
"export_dir": "/common/covidcast/receiving/dsew-cpr",
4+
"log_filename": "/var/log/indicators/dsew_cpr.log"
5+
},
6+
"indicator": {
7+
"input_cache": "./input_cache",
8+
"reports": "new"
9+
},
10+
"validation": {
11+
"common": {
12+
"data_source": "dsew-cpr",
13+
"span_length": 14,
14+
"min_expected_lag": {"all": "5"},
15+
"max_expected_lag": {"all": "9"},
16+
"dry_run": true,
17+
"suppressed_errors": []
18+
},
19+
"static": {
20+
"minimum_sample_size": 0,
21+
"missing_se_allowed": true,
22+
"missing_sample_size_allowed": true
23+
},
24+
"dynamic": {
25+
"ref_window_size": 7,
26+
"smoothed_signals": [
27+
"naats_total_7dav",
28+
"naats_positivity_7dav"
29+
]
30+
}
31+
}
32+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"Survey of COVID-Like Illness - Wave 11": "fb-survey",
3939
"Survey of COVID-Like Illness - Wave 12": "fb-survey",
4040
"Survey of COVID-Like Illness - Wave 12 - Full Launch": "fb-survey",
41+
"Survey of COVID-Like Illness - Wave 13": "fb-survey",
4142
"Survey of COVID-Like Illness - Wave 4": "fb-survey",
4243
"Survey of COVID-Like Illness - Wave 5": "fb-survey",
4344
"Survey of COVID-Like Illness - Wave 6": "fb-survey",

0 commit comments

Comments
 (0)