Skip to content

Google Symptoms uses metadata to determine how many days of data to fetch #973

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
Mar 31, 2021
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
2 changes: 1 addition & 1 deletion ansible/templates/google_symptoms-params-prod.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"indicator": {
"export_start_date": "2020-02-20",
"num_export_days": 14,
"num_export_days": null,
"bigquery_credentials": {
"type": "{{ google_symptoms_account_type }}",
"project_id": "{{ google_symptoms_project_id }}",
Expand Down
9 changes: 8 additions & 1 deletion google_symptoms/delphi_google_symptoms/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import time
from datetime import datetime
from itertools import product
import covidcast

import numpy as np
from delphi_utils import (
Expand Down Expand Up @@ -46,7 +47,13 @@ def run_module(params):
export_start_date = datetime.strptime(
params["indicator"]["export_start_date"], "%Y-%m-%d")
export_dir = params["common"]["export_dir"]
num_export_days = params["indicator"].get("num_export_days", "all")
num_export_days = params["indicator"]["num_export_days"]

if num_export_days is None:
# Get number of days based on what's missing from the API.
metadata = covidcast.metadata()
gs_metadata = metadata[(metadata.data_source == "google-symptoms")]
num_export_days = max(gs_metadata.min_lag)

logger = get_structured_logger(
__name__, filename=params["common"].get("log_filename"),
Expand Down
2 changes: 1 addition & 1 deletion google_symptoms/params.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"indicator": {
"export_start_date": "2020-02-20",
"num_export_days": 14,
"num_export_days": null,
"bigquery_credentials": {}
},
"validation": {
Expand Down