Skip to content

Commit 88476b1

Browse files
authored
Merge pull request #1471 from cmu-delphi/fix_geosigcombo_hardcoding
Remove hard-coding from get_geo_signal_combos
2 parents 6141756 + dcd0acc commit 88476b1

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

_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:

0 commit comments

Comments
 (0)