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

View File

@ -1073,7 +1073,7 @@ See `Fitbit: Steps Config Code`_
| ``pid=config["PIDS"],`` | ``pid=config["PIDS"],``
| ``fitbit_sensor=config["FITBIT_SENSORS"]),`` | ``fitbit_sensor=config["FITBIT_SENSORS"]),``
- Extract Fitbit: Steps Metrics: - Extract Fitbit: Steps Features:
| ``expand("data/processed/{pid}/fitbit_step_{day_segment}.csv",`` | ``expand("data/processed/{pid}/fitbit_step_{day_segment}.csv",``
| ``pid=config["PIDS"],`` | ``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. - **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: .. _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: 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_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: 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_features: 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.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 .. _`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 .. _`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 .. _top1global: https://github.com/carissalow/rapids/blob/765bb462636d5029a05f54d4c558487e3786b90b/config.yaml#L108

View File

@ -160,17 +160,17 @@ rule fitbit_heartrate_metrics:
script: script:
"../src/features/fitbit_heartrate_metrics.py" "../src/features/fitbit_heartrate_metrics.py"
rule fitbit_step_metrics: rule fitbit_step_features:
input: input:
steps_data = "data/raw/{pid}/fitbit_steps_with_datetime.csv", steps_data = "data/raw/{pid}/fitbit_steps_with_datetime.csv",
params: params:
day_segment = "{day_segment}", day_segment = "{day_segment}",
metrics_all_steps = config["STEP"]["METRICS"]["ALL_STEPS"], features_all_steps = config["STEP"]["FEATURES"]["ALL_STEPS"],
metrics_sedentary_bout = config["STEP"]["METRICS"]["SEDENTARY_BOUT"], features_sedentary_bout = config["STEP"]["FEATURES"]["SEDENTARY_BOUT"],
metrics_active_bout = config["STEP"]["METRICS"]["ACTIVE_BOUT"], features_active_bout = config["STEP"]["FEATURES"]["ACTIVE_BOUT"],
threshold_active_bout = config["STEP"]["THRESHOLD_ACTIVE_BOUT"], threshold_active_bout = config["STEP"]["THRESHOLD_ACTIVE_BOUT"],
include_zero_step_rows = config["STEP"]["INCLUDE_ZERO_STEP_ROWS"] include_zero_step_rows = config["STEP"]["INCLUDE_ZERO_STEP_ROWS"]
output: output:
"data/processed/{pid}/fitbit_step_{day_segment}.csv" "data/processed/{pid}/fitbit_step_{day_segment}.csv"
script: 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 from features_utils import splitOvernightEpisodes, splitMultiSegmentEpisodes
day_segment = snakemake.params["day_segment"] day_segment = snakemake.params["day_segment"]
all_steps = snakemake.params["metrics_all_steps"] all_steps = snakemake.params["features_all_steps"]
sedentary_bout = snakemake.params["metrics_sedentary_bout"] sedentary_bout = snakemake.params["features_sedentary_bout"]
active_bout = snakemake.params["metrics_active_bout"] active_bout = snakemake.params["features_active_bout"]
threshold_active_bout = snakemake.params['threshold_active_bout'] threshold_active_bout = snakemake.params['threshold_active_bout']
include_zero_step_rows = snakemake.params["include_zero_step_rows"] include_zero_step_rows = snakemake.params["include_zero_step_rows"]