Skip to content

Commit abce794

Browse files
authored
Merge pull request #375 from cmu-delphi/combo_cases-docs
Update combo cases docstrings to pass pydocstyle
2 parents 3dca3f3 + a4f5659 commit abce794

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

combo_cases_and_deaths/delphi_combo_cases_and_deaths/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Registry for signal names, geo types and other constants"""
1+
"""Registry for signal names, geo types and other constants."""
22
METRICS = [
33
"confirmed",
44
"deaths",

combo_cases_and_deaths/delphi_combo_cases_and_deaths/run.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
"""Functions to call when running the function.
3+
34
This module should contain a function called `run_module`, that is executed when
45
the module is run with `python -m delphi_combo_cases_and_deaths`.
56
This module produces a combined signal for jhu-csse and usa-facts. This signal
@@ -26,6 +27,8 @@ def check_none_data_frame(data_frame, label, date_range):
2627

2728
def maybe_append(df1, df2):
2829
"""
30+
Append dataframes if available, otherwise return non-None one.
31+
2932
If both data frames are available, append them and return. Otherwise, return
3033
whichever frame is not None.
3134
"""
@@ -41,9 +44,7 @@ def maybe_append(df1, df2):
4144
"stderr": "se",
4245
"sample_size": "sample_size"}
4346
def combine_usafacts_and_jhu(signal, geo, date_range, fetcher=covidcast.signal):
44-
"""
45-
Add rows for PR from JHU signals to USA-FACTS signals
46-
"""
47+
"""Add rows for PR from JHU signals to USA-FACTS signals."""
4748
print("Fetching usa-facts...")
4849
usafacts_df = fetcher("usa-facts", signal, date_range[0], date_range[1], geo)
4950
print("Fetching jhu-csse...")
@@ -74,7 +75,9 @@ def combine_usafacts_and_jhu(signal, geo, date_range, fetcher=covidcast.signal):
7475
return combined_df
7576

7677
def extend_raw_date_range(params, sensor_name):
77-
"""A complete issue includes smoothed signals as well as all raw data
78+
"""Extend the date range of the raw data backwards by 7 days.
79+
80+
A complete issue includes smoothed signals as well as all raw data
7881
that contributed to the smoothed values, so that it's possible to use
7982
the raw values in the API to reconstruct the smoothed signal at will.
8083
The smoother we're currently using incorporates the previous 7
@@ -99,17 +102,15 @@ def next_missing_day(source, signals):
99102
return day
100103

101104
def sensor_signal(metric, sensor, smoother):
102-
"""Generate the signal name for a particular configuration"""
105+
"""Generate the signal name for a particular configuration."""
103106
if smoother == "7dav":
104107
sensor_name = "_".join([smoother, sensor])
105108
else:
106109
sensor_name = sensor
107110
return sensor_name, "_".join([metric, sensor_name])
108111

109112
def configure(variants):
110-
"""
111-
Validate params file and set date range.
112-
"""
113+
"""Validate params file and set date range."""
113114
params = read_params()
114115
params['export_start_date'] = date(*params['export_start_date'])
115116
yesterday = date.today() - timedelta(days=1)
@@ -153,7 +154,7 @@ def configure(variants):
153154

154155

155156
def run_module():
156-
"""Produce a combined cases and deaths signal using data from JHU and USA Facts"""
157+
"""Produce a combined cases and deaths signal using data from JHU and USA Facts."""
157158
variants = [tuple((metric, geo_res)+sensor_signal(metric, sensor, smoother))
158159
for (metric, geo_res, sensor, smoother) in
159160
product(METRICS, GEO_RESOLUTIONS, SENSORS, SMOOTH_TYPES)]

0 commit comments

Comments
 (0)