-
Notifications
You must be signed in to change notification settings - Fork 16
Gate pulling/syncing data from AWS in safegraph behind a flag in params #363
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
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e57673a
Revert "Add 7-day average of each signal to Safegraph indicator"
krivard 283e8c2
Merge pull request #336 from cmu-delphi/revert-309-weekday
krivard d243e3f
Revert "Revert "Add 7-day average of each signal to Safegraph indicat…
krivard d266d21
migrate safegraph.run back onto using functools.partial
sgsmob 47a9a26
fix output file format from YYYY-MM-DD to YYYYMMDD
sgsmob 936721e
Merge branch 'krivard/fix-weekday' of github.com:cmu-delphi/covidcast…
sgsmob f03aef5
Merge branch 'main' of github.com:cmu-delphi/covidcast-indicators int…
sgsmob fee7222
add a test for delphi_safegraph.run_module
sgsmob 7f701b4
bring safegraph_patterns more structurally in line with safegraph
sgsmob 67bc0a9
lint and other style cleanups
sgsmob 357f207
clarify bool parameter handling
sgsmob 4aba282
remove unnecessary import in test
sgsmob 7e3e516
update bool handling for safegraph_patterns too
sgsmob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import pytest | ||
|
||
import os | ||
from os.path import join | ||
|
||
from delphi_safegraph.run import run_module | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def run_as_module(): | ||
# Clean receiving directory | ||
for fname in os.listdir("receiving"): | ||
if ".csv" in fname: | ||
os.remove(join("receiving", fname)) | ||
run_module() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+213 Bytes
safegraph/tests/raw_data/social-distancing/2020/06/10/2020-06-10-social-distancing.csv.gz
Binary file not shown.
Binary file added
BIN
+205 Bytes
safegraph/tests/raw_data/social-distancing/2020/06/11/2020-06-11-social-distancing.csv.gz
Binary file not shown.
Binary file added
BIN
+229 Bytes
safegraph/tests/raw_data/social-distancing/2020/06/12/2020-06-12-social-distancing.csv.gz
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Tests for the `run_module()` function.""" | ||
import os | ||
|
||
import pandas as pd | ||
|
||
from delphi_safegraph.constants import (SIGNALS, | ||
GEO_RESOLUTIONS) | ||
|
||
|
||
class TestRun: | ||
"""Tests for the `run_module()` function.""" | ||
|
||
def test_output_files_exist(self, run_as_module): | ||
"""Tests that the outputs of `run_module` exist.""" | ||
csv_files = set( | ||
x for x in os.listdir("receiving") if x.endswith(".csv")) | ||
expected_files = set() | ||
for date in ("20200612", "20200611", "20200610"): | ||
for geo in GEO_RESOLUTIONS: | ||
for signal in SIGNALS: | ||
print(date, geo, signal) | ||
single_date_signal = "_".join([date, geo, signal]) + ".csv" | ||
expected_files.add(single_date_signal) | ||
single_date_signal = "_".join( | ||
[date, geo, "wip", signal, "7d_avg"]) + ".csv" | ||
expected_files.add(single_date_signal) | ||
|
||
assert expected_files == csv_files | ||
|
||
def test_output_files_format(self, run_as_module): | ||
"""Tests that output files are in the correct format.""" | ||
csv_files = os.listdir("receiving") | ||
for filename in csv_files: | ||
if not filename.endswith(".csv"): | ||
continue | ||
# Print the file name so that we can tell which file (if any) | ||
# triggered the error. | ||
print(filename) | ||
df = pd.read_csv(os.path.join("receiving", filename)) | ||
assert (df.columns.values == | ||
["geo_id", "val", "se", "sample_size"]).all() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,5 @@ | |
"aws_secret_access_key": "", | ||
"aws_default_region": "", | ||
"aws_endpoint": "", | ||
"test": "False" | ||
"sync": true, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.