Skip to content

Commit 48b4357

Browse files
authored
Merge pull request #806 from sgsmob/google_symptoms
Refactor parameters for Google symptoms
2 parents 8f06b22 + abf10a7 commit 48b4357

File tree

4 files changed

+35
-24
lines changed

4 files changed

+35
-24
lines changed
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
2-
"export_start_date": "2020-02-20",
3-
"static_file_dir": "./static",
4-
"export_dir": "/common/covidcast/receiving/google-symptoms",
5-
"cache_dir": "./cache",
6-
"base_url": "https://raw.githubusercontent.com/google-research/open-covid-19-data/master/data/exports/search_trends_symptoms_dataset/United%20States%20of%20America{sub_url}2020_US_{state}daily_symptoms_dataset.csv",
7-
"log_filename": "/var/log/indicators/google_symptoms.log"
2+
"common": {
3+
"export_dir": "/common/covidcast/receiving/google-symptoms",
4+
"log_filename": "/var/log/indicators/google_symptoms.log"
5+
},
6+
"indicator": {
7+
"export_start_date": "2020-02-20",
8+
"num_export_days": 14,
9+
"path_to_bigquery_credentials": "credentials.json",
10+
"static_file_dir": "./static"
11+
}
812
}

google_symptoms/delphi_google_symptoms/run.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ def run_module():
3030

3131
params = read_params()
3232
export_start_date = datetime.strptime(
33-
params["export_start_date"], "%Y-%m-%d")
34-
export_dir = params["export_dir"]
35-
num_export_days = params.get("num_export_days", "all")
33+
params["indicator"]["export_start_date"], "%Y-%m-%d")
34+
export_dir = params["common"]["export_dir"]
35+
num_export_days = params["indicator"].get("num_export_days", "all")
3636

3737
logger = get_structured_logger(
38-
__name__, filename=params.get("log_filename"),
39-
log_exceptions=params.get("log_exceptions", True))
38+
__name__, filename=params["common"].get("log_filename"),
39+
log_exceptions=params["common"].get("log_exceptions", True))
4040

4141
# Pull GS data
42-
dfs = pull_gs_data(params["path_to_bigquery_credentials"],
42+
dfs = pull_gs_data(params["indicator"]["path_to_bigquery_credentials"],
4343
export_start_date,
4444
num_export_days)
4545
gmpr = geomap.GeoMapper()

google_symptoms/params.json.template

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
2-
"export_start_date": "2020-02-20",
3-
"static_file_dir": "./static",
4-
"export_dir": "./receiving",
5-
"cache_dir": "./cache",
6-
"path_to_bigquery_credentials": "credentials.json",
7-
"log_exceptions": false
2+
"common": {
3+
"export_dir": "./receiving",
4+
"log_exceptions": false
5+
},
6+
"indicator": {
7+
"export_start_date": "2020-02-20",
8+
"num_export_days": 14,
9+
"path_to_bigquery_credentials": "credentials.json",
10+
"static_file_dir": "./static"
11+
}
812
}
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"export_start_date": "2020-02-20",
3-
"static_file_dir": "../static",
4-
"export_dir": "./receiving",
5-
"cache_dir": "./cache",
6-
"num_export_days": 14,
7-
"path_to_bigquery_credentials": ""
2+
"common": {
3+
"export_dir": "./receiving"
4+
},
5+
"indicator": {
6+
"export_start_date": "2020-02-20",
7+
"num_export_days": 14,
8+
"path_to_bigquery_credentials": "",
9+
"static_file_dir": "../static"
10+
}
811
}

0 commit comments

Comments
 (0)