From 3986f4e18544316f34416fa373f36179a6862735 Mon Sep 17 00:00:00 2001 From: Mingze Cao <29229557+Martinze@users.noreply.github.com> Date: Fri, 3 Apr 2020 16:03:45 -0500 Subject: [PATCH] Refactor fitbit_step features: replace "metrics" with "features" Co-authored-by: Meng Li Co-authored-by: JulioV --- config.yaml | 4 ++-- docs/features/extracted.rst | 10 +++++----- rules/features.snakefile | 10 +++++----- ...{fitbit_step_metrics.py => fitbit_step_features.py} | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) rename src/features/{fitbit_step_metrics.py => fitbit_step_features.py} (97%) diff --git a/config.yaml b/config.yaml index bd32770b..ecd9ec3d 100644 --- a/config.yaml +++ b/config.yaml @@ -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"] diff --git a/docs/features/extracted.rst b/docs/features/extracted.rst index 24247260..e47d9211 100644 --- a/docs/features/extracted.rst +++ b/docs/features/extracted.rst @@ -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 diff --git a/rules/features.snakefile b/rules/features.snakefile index 816d91bf..37a8cb40 100644 --- a/rules/features.snakefile +++ b/rules/features.snakefile @@ -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" diff --git a/src/features/fitbit_step_metrics.py b/src/features/fitbit_step_features.py similarity index 97% rename from src/features/fitbit_step_metrics.py rename to src/features/fitbit_step_features.py index 8e3b94c4..82194f3d 100644 --- a/src/features/fitbit_step_metrics.py +++ b/src/features/fitbit_step_features.py @@ -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"]