Skip to content

Only iterate over valid geo x signal combos in validation #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions validator/delphi_validator/datafetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))

Expand Down
2 changes: 0 additions & 2 deletions validator/tests/test_datafetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down