Skip to content

Get google symptoms to pass pydocstyle #561

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 1 commit into from
Nov 20, 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
3 changes: 2 additions & 1 deletion google_symptoms/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ install: venv

lint:
. env/bin/activate; \
pylint $(dir)
pylint $(dir); \
pydocstyle $(dir)

test:
. env/bin/activate ;\
Expand Down
4 changes: 2 additions & 2 deletions google_symptoms/delphi_google_symptoms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""Module to pull and clean indicators from the Google Research's Open
COVID-19 Data project.
"""Module to pull and clean indicators from the Google Research's Open COVID-19 Data project.

This file defines the functions that are made public by the module. As the
module is intended to be executed though the main method, these are primarily
for testing.
Expand Down
2 changes: 1 addition & 1 deletion google_symptoms/delphi_google_symptoms/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Registry for constants"""
"""Registry for constants."""
from functools import partial
from datetime import timedelta

Expand Down
4 changes: 3 additions & 1 deletion google_symptoms/delphi_google_symptoms/geo.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
"""Functions for mapping between geo regions."""
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from delphi_utils import GeoMapper
from .constants import METRICS, COMBINED_METRIC

gmpr = GeoMapper()

def generate_transition_matrix(geo_res):
"""
Generate transition matrix from county to msa/hrr
Generate transition matrix from county to msa/hrr.

Parameters
----------
Expand Down
10 changes: 7 additions & 3 deletions google_symptoms/delphi_google_symptoms/pull.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Retrieve data and wrangle into appropriate format."""
# -*- coding: utf-8 -*-
import re

Expand All @@ -8,6 +9,8 @@

def get_geo_id(region_code):
"""
Extract fips code from region code.

There are region code in the format of "US-state" and "US-state-fips". In
county level report, we only consider rows with fips info provided.
"""
Expand All @@ -19,8 +22,7 @@ def get_geo_id(region_code):

def preprocess(df, level):
"""
Conforms the pulled data from Google COVID-19 Search Trends symptoms
data into a dataset
Conforms the pulled data from Google COVID-19 Search Trends symptoms data into a dataset.

The output dataset has:

Expand Down Expand Up @@ -90,7 +92,9 @@ def preprocess(df, level):
return df

def pull_gs_data(base_url):
"""Pulls the latest Google COVID-19 Search Trends symptoms dataset, and
"""Pull latest dataset and transform it into the appropriate format.

Pull the latest Google COVID-19 Search Trends symptoms dataset, and
conforms it into a dataset as described in preprocess function.

Note that we retrieve state level data from "2020_US_daily_symptoms_dataset.csv"
Expand Down
2 changes: 1 addition & 1 deletion google_symptoms/delphi_google_symptoms/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def run_module():

"""Run Google Symptoms module."""
params = read_params()
export_start_date = datetime.strptime(params["export_start_date"], "%Y-%m-%d")
export_dir = params["export_dir"]
Expand Down
9 changes: 5 additions & 4 deletions google_symptoms/delphi_google_symptoms/smooth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Functions for smoothing signals."""
# -*- coding: utf-8 -*-
import numpy as np

def identity(x):
'''Trivial "smoother" that does no smoothing.
"""Trivial "smoother" that does no smoothing.

Parameters
----------
Expand All @@ -13,11 +14,11 @@ def identity(x):
-------
np.ndarray:
Same as x
'''
"""
return x

def kday_moving_average(x, k):
'''Compute k-day moving average on x.
"""Compute k-day moving average on x.

Parameters
----------
Expand All @@ -28,7 +29,7 @@ def kday_moving_average(x, k):
-------
np.ndarray:
k-day moving average. The first k-1 entries are np.nan.
'''
"""
if not isinstance(k, int):
raise ValueError('k must be int.')
# temp = np.append(np.zeros(k - 1), x)
Expand Down