Refactor fitbit_step features: replace "metrics" with "features"

Co-authored-by: Meng Li <AnnieLM1996@gmail.com>
Co-authored-by: JulioV <juliovhz@gmail.com>
pull/95/head
Mingze Cao 2020-04-03 16:03:45 -05:00
parent 595bdd6f5b
commit 3986f4e185
4 changed files with 15 additions and 15 deletions

View File

@ -76,7 +76,7 @@ BARNETT_LOCATION:
BLUETOOTH:
DAY_SEGMENTS: *day_segments
METRICS: ["countscans", "uniquedevices", "countscansmostuniquedevice"]
FEATURES: ["countscans", "uniquedevices", "countscansmostuniquedevice"]
GOOGLE_ACTIVITY_RECOGNITION:
DAY_SEGMENTS: *day_segments
@ -117,7 +117,7 @@ HEARTRATE:
STEP:
DAY_SEGMENTS: *day_segments
METRICS:
FEATURES:
ALL_STEPS: ["sumallsteps", "maxallsteps", "minallsteps", "avgallsteps", "stdallsteps"]
SEDENTARY_BOUT: ["countsedentarybout", "maxdurationsedentarybout", "mindurationsedentarybout", "avgdurationsedentarybout", "stddurationsedentarybout", "sumdurationsedentarybout"]
ACTIVE_BOUT: ["countactivebout", "maxdurationactivebout", "mindurationactivebout", "avgdurationactivebout", "stddurationactivebout"]

View File

@ -1073,7 +1073,7 @@ See `Fitbit: Steps Config Code`_
| ``pid=config["PIDS"],``
| ``fitbit_sensor=config["FITBIT_SENSORS"]),``
- Extract Fitbit: Steps Metrics:
- Extract Fitbit: Steps Features:
| ``expand("data/processed/{pid}/fitbit_step_{day_segment}.csv",``
| ``pid=config["PIDS"],``
@ -1089,9 +1089,9 @@ See `Fitbit: Steps Config Code`_
- **Script:** ``src/data/fitbit_readable_datetime.py`` - See the fitbit_readable_datetime.py_ script.
- **Rule:** ``rules/features.snakefile/fitbit_step_metrics`` - See the fitbit_step_metrics.py_ rule.
- **Rule:** ``rules/features.snakefile/fitbit_step_features`` - See the fitbit_step_features.py_ rule.
- **Script:** ``src/features/fitbit_step_metrics.py`` - See the fitbit_step_metrics.py_ script.
- **Script:** ``src/features/fitbit_step_features.py`` - See the fitbit_step_features.py_ script.
.. _fitbit-steps-parameters:
@ -1195,8 +1195,8 @@ stddurationactivebout minutes Std duration active bout: The standard
.. _fitbit_heartrate_metrics: https://github.com/carissalow/rapids/blob/765bb462636d5029a05f54d4c558487e3786b90b/rules/features.snakefile#L151
.. _fitbit_heartrate_metrics.py: https://github.com/carissalow/rapids/blob/master/src/features/fitbit_heartrate_metrics.py
.. _`Fitbit: Steps Config Code`: https://github.com/carissalow/rapids/blob/765bb462636d5029a05f54d4c558487e3786b90b/config.yaml#L117
.. _fitbit_step_metrics: https://github.com/carissalow/rapids/blob/765bb462636d5029a05f54d4c558487e3786b90b/rules/features.snakefile#L162
.. _fitbit_step_metrics.py: https://github.com/carissalow/rapids/blob/master/src/features/fitbit_step_metrics.py
.. _fitbit_step_features: https://github.com/carissalow/rapids/blob/765bb462636d5029a05f54d4c558487e3786b90b/rules/features.snakefile#L162
.. _fitbit_step_features.py: https://github.com/carissalow/rapids/blob/master/src/features/fitbit_step_features.py
.. _`Fitbit documentation`: https://help.fitbit.com/articles/en_US/Help_article/1565
.. _`Custom Catalogue File`: https://github.com/carissalow/rapids/blob/master/data/external/stachl_application_genre_catalogue.csv
.. _top1global: https://github.com/carissalow/rapids/blob/765bb462636d5029a05f54d4c558487e3786b90b/config.yaml#L108

View File

@ -160,17 +160,17 @@ rule fitbit_heartrate_metrics:
script:
"../src/features/fitbit_heartrate_metrics.py"
rule fitbit_step_metrics:
rule fitbit_step_features:
input:
steps_data = "data/raw/{pid}/fitbit_steps_with_datetime.csv",
params:
day_segment = "{day_segment}",
metrics_all_steps = config["STEP"]["METRICS"]["ALL_STEPS"],
metrics_sedentary_bout = config["STEP"]["METRICS"]["SEDENTARY_BOUT"],
metrics_active_bout = config["STEP"]["METRICS"]["ACTIVE_BOUT"],
features_all_steps = config["STEP"]["FEATURES"]["ALL_STEPS"],
features_sedentary_bout = config["STEP"]["FEATURES"]["SEDENTARY_BOUT"],
features_active_bout = config["STEP"]["FEATURES"]["ACTIVE_BOUT"],
threshold_active_bout = config["STEP"]["THRESHOLD_ACTIVE_BOUT"],
include_zero_step_rows = config["STEP"]["INCLUDE_ZERO_STEP_ROWS"]
output:
"data/processed/{pid}/fitbit_step_{day_segment}.csv"
script:
"../src/features/fitbit_step_metrics.py"
"../src/features/fitbit_step_features.py"

View File

@ -4,9 +4,9 @@ import datetime as dt
from features_utils import splitOvernightEpisodes, splitMultiSegmentEpisodes
day_segment = snakemake.params["day_segment"]
all_steps = snakemake.params["metrics_all_steps"]
sedentary_bout = snakemake.params["metrics_sedentary_bout"]
active_bout = snakemake.params["metrics_active_bout"]
all_steps = snakemake.params["features_all_steps"]
sedentary_bout = snakemake.params["features_sedentary_bout"]
active_bout = snakemake.params["features_active_bout"]
threshold_active_bout = snakemake.params['threshold_active_bout']
include_zero_step_rows = snakemake.params["include_zero_step_rows"]