Skip to content

Commit dcd0acc

Browse files
committed
Swopping keys and values for source_signal_mappings dict
Previously, keys weren't unique but values are. Swopped this to fix the issue.
1 parent 22d0491 commit dcd0acc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

_delphi_utils_python/delphi_utils/validator/datafetcher.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def get_geo_signal_combos(data_source):
112112
"""
113113
# Maps data_source name with what's in the API, lists used in case of multiple names
114114

115-
source_signal_mappings = {i['db_source']:i['source'] for i in
115+
source_signal_mappings = {i['source']:i['db_source'] for i in
116116
requests.get("https://api.covidcast.cmu.edu/epidata/covidcast/meta").json()}
117117
meta = covidcast.metadata()
118118
source_meta = meta[meta['data_source'] == data_source]
@@ -125,8 +125,9 @@ def get_geo_signal_combos(data_source):
125125
# True/False indicate if status is active, "unknown" means we should check
126126
sig_combo_seen = dict()
127127
for combo in geo_signal_combos:
128-
if source_signal_mappings.get(data_source):
129-
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]
130131
else:
131132
src_list = [data_source]
132133
for src in src_list:

0 commit comments

Comments
 (0)