Skip to content

Commit 5515e6b

Browse files
committed
Update docs
1 parent 0a7865e commit 5515e6b

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
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/handle_wip_signal.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010

1111
def add_prefix(signal_names, wip_signal, prefix="wip_"):
12-
"""Adds prefix to signal if there is a WIP signal
12+
"""Add prefix to signal if there is a WIP signal.
13+
1314
Parameters
1415
----------
1516
signal_names: List[str]
@@ -25,7 +26,6 @@ def add_prefix(signal_names, wip_signal, prefix="wip_"):
2526
List of signal names
2627
wip/non wip signals for further computation
2728
"""
28-
2929
if wip_signal is True:
3030
return [prefix + signal for signal in signal_names]
3131
if isinstance(wip_signal, list):
@@ -44,7 +44,8 @@ def add_prefix(signal_names, wip_signal, prefix="wip_"):
4444

4545

4646
def public_signal(signal_):
47-
"""Checks if the signal name is already public using COVIDcast
47+
"""Check if the signal name is already public using COVIDcast.
48+
4849
Parameters
4950
----------
5051
signal_ : str

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
@@ -27,6 +28,8 @@ def check_none_data_frame(data_frame, label, date_range):
2728

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

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

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

110113
def configure(variants):
111-
"""
112-
Validate params file and set date range.
113-
"""
114+
"""Validate params file and set date range."""
114115
params = read_params()
115116
params['export_start_date'] = date(*params['export_start_date'])
116117
yesterday = date.today() - timedelta(days=1)
@@ -154,7 +155,7 @@ def configure(variants):
154155

155156

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

0 commit comments

Comments
 (0)