Skip to content

Commit 392a2be

Browse files
authored
Merge pull request #699 from cmu-delphi/gs-pull-from-bigquery
Convert Google Symptoms pipeline to pull data from BigQuery
2 parents 19527e7 + 8124f2d commit 392a2be

File tree

67 files changed

+46784
-10605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+46784
-10605
lines changed

google_symptoms/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ lint:
1616
. env/bin/activate; pydocstyle $(dir)
1717

1818
test:
19-
. env/bin/activate ; (cd tests && ../env/bin/pytest --cov=$(dir) --cov-report=term-missing)
19+
. env/bin/activate ;
20+
(cd tests && ../env/bin/pytest --cov=$(dir) --cov-report=term-missing)
2021

2122
clean:
2223
rm -rf env
2324
rm -f params.json
25+
26+
run:
27+
env/bin/python -m $(dir)
28+
env/bin/python -m delphi_utils.archive --archive_type s3 --indicator_prefix $(dir)

google_symptoms/README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Google Symptoms
22

3-
We import the normalized symptom search term popularity data from the Google
4-
Research's Open COVID-19 Data project and export the county-level and state-level
5-
data as-is. We also aggregate the data to the MSA and HRR levels. For detailed
3+
We import the normalized symptom search term popularity data from the Google
4+
Research's Open COVID-19 Data project via BigQuery and export the county-level and state-level
5+
data as-is. We also aggregate the data to the MSA and HRR levels. For detailed
66
information see the files `DETAILS.md` contained in this directory.
77

88
## Running the Indicator
@@ -17,19 +17,20 @@ make install
1717
```
1818

1919
This command will install the package in editable mode, so you can make changes that
20-
will automatically propagate to the installed package.
20+
will automatically propagate to the installed package.
2121

22-
All of the user-changable parameters are stored in `params.json`. To execute the module
22+
All of the user-changable parameters are stored in `params.json`. You will need to
23+
acquire a BigQuery API key with affiliated billing to fetch data. To execute the module
2324
and produce the output datasets (by default, in `receiving`), run the following.
2425

2526
```
2627
env/bin/python -m delphi_google_symptoms
2728
```
2829

29-
If you want to enter the virtual environment in your shell,
30-
you can run `source env/bin/activate`. Run `deactivate` to leave the virtual environment.
30+
If you want to enter the virtual environment in your shell,
31+
you can run `source env/bin/activate`. Run `deactivate` to leave the virtual environment.
3132

32-
Once you are finished, you can remove the virtual environment and
33+
Once you are finished, you can remove the virtual environment and
3334
params file with the following:
3435

3536
```
@@ -58,7 +59,7 @@ To run individual tests, run the following:
5859
```
5960

6061
The output will show the number of unit tests that passed and failed, along
61-
with the percentage of code covered by the tests.
62+
with the percentage of code covered by the tests.
6263

6364
None of the linting or unit tests should fail, and the code lines that are not covered by unit tests should be small and
64-
should not include critical sub-routines.
65+
should not include critical sub-routines.

google_symptoms/delphi_google_symptoms/constants.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
COMBINED_METRIC = "sum_anosmia_ageusia"
1313
SMOOTHERS = ["raw", "smoothed"]
1414
GEO_RESOLUTIONS = [
15-
"state",
16-
"county",
17-
"msa",
18-
"hrr",
19-
"hhs",
20-
"nation"
15+
"state",
16+
"county",
17+
"msa",
18+
"hrr",
19+
"hhs",
20+
"nation"
2121
]
2222

2323
seven_day_moving_average = partial(kday_moving_average, k=7)
@@ -26,19 +26,19 @@
2626
"smoothed": (seven_day_moving_average, lambda d: d),
2727
}
2828

29-
STATE_TO_ABBREV = {'Alabama':'al',
29+
STATE_TO_ABBREV = {'Alabama': 'al',
3030
'Alaska': 'ak',
31-
# 'American Samoa': 'as',
31+
# 'American Samoa': 'as',
3232
'Arizona': 'az',
3333
'Arkansas': 'ar',
3434
'California': 'ca',
3535
'Colorado': 'co',
3636
'Connecticut': 'ct',
3737
'Delaware': 'de',
38-
# 'District of Columbia': 'dc',
38+
# 'District of Columbia': 'dc',
3939
'Florida': 'fl',
4040
'Georgia': 'ga',
41-
# 'Guam': 'gu',
41+
# 'Guam': 'gu',
4242
'Hawaii': 'hi',
4343
'Idaho': 'id',
4444
'Illinois': 'il',
@@ -59,24 +59,24 @@
5959
'Nevada': 'nv',
6060
'New_Hampshire': 'nh',
6161
'New_Jersey': 'nj',
62-
'New_Mexico':'nm',
62+
'New_Mexico': 'nm',
6363
'New_York': 'ny',
6464
'North_Carolina': 'nc',
6565
'North_Dakota': 'nd',
66-
# 'Northern Mariana Islands': 'mp',
66+
# 'Northern Mariana Islands': 'mp',
6767
'Ohio': 'oh',
6868
'Oklahoma': 'ok',
6969
'Oregon': 'or',
7070
'Pennsylvania': 'pa',
71-
# 'Puerto Rico': 'pr',
71+
# 'Puerto Rico': 'pr',
7272
'Rhode_Island': 'ri',
7373
'South_Carolina': 'sc',
7474
'South_Dakota': 'sd',
7575
'Tennessee': 'tn',
7676
'Texas': 'tx',
7777
'Utah': 'ut',
7878
'Vermont': 'vt',
79-
# 'Virgin Islands': 'vi',
79+
# 'Virgin Islands': 'vi',
8080
'Virginia': 'va',
8181
'Washington': 'wa',
8282
'West_Virginia': 'wv',

0 commit comments

Comments
 (0)