diff --git a/validator/delphi_validator/datafetcher.py b/validator/delphi_validator/datafetcher.py index 702069301..f9f6dfeba 100644 --- a/validator/delphi_validator/datafetcher.py +++ b/validator/delphi_validator/datafetcher.py @@ -7,7 +7,6 @@ import threading from os import listdir from os.path import isfile, join -from itertools import product import pandas as pd import numpy as np @@ -115,10 +114,10 @@ def get_geo_signal_combos(data_source): """ meta = covidcast.metadata() source_meta = meta[meta['data_source'] == data_source] - unique_signals = source_meta['signal'].unique().tolist() - unique_geotypes = source_meta['geo_type'].unique().tolist() + # Need to convert np.records to tuples so they are hashable and can be used in sets and dicts. + geo_signal_combos = list(map(tuple, + source_meta[["geo_type", "signal"]].to_records(index=False))) - geo_signal_combos = list(product(unique_geotypes, unique_signals)) print("Number of expected geo region-signal combinations:", len(geo_signal_combos)) diff --git a/validator/tests/test_datafetcher.py b/validator/tests/test_datafetcher.py index b2c926203..4c2efeb9b 100644 --- a/validator/tests/test_datafetcher.py +++ b/validator/tests/test_datafetcher.py @@ -33,12 +33,10 @@ def test_get_geo_signal_combos(self, mock_metadata): }) assert set(get_geo_signal_combos("a")) == set([("state", "w"), - ("county", "w"), ("state", "x"), ("county", "x")]) assert set(get_geo_signal_combos("b")) == set([("hrr", "y"), ("msa", "y"), - ("hrr", "z"), ("msa", "z")]) @mock.patch("covidcast.signal")