rapids/rules/features.smk

282 lines
12 KiB
Plaintext
Raw Normal View History

rule join_features_from_providers:
input:
location_features = find_features_files
output:
"data/processed/features/{pid}/{sensor_key}.csv"
script:
"../src/features/join_features_from_providers.R"
rule resample_episodes:
2020-08-31 19:34:15 +02:00
input:
"data/interim/{pid}/{sensor}_episodes.csv"
2019-10-24 22:27:43 +02:00
output:
"data/interim/{pid}/{sensor}_episodes_resampled.csv"
2019-10-24 22:27:43 +02:00
script:
"../src/features/utils/resample_episodes.R"
2019-10-25 16:21:09 +02:00
rule resample_episodes_with_datetime:
input:
sensor_input = "data/interim/{pid}/{sensor}_episodes_resampled.csv",
day_segments = "data/interim/day_segments/{pid}_day_segments.csv"
params:
timezones = None,
fixed_timezone = config["READABLE_DATETIME"]["FIXED_TIMEZONE"],
day_segments_type = config["DAY_SEGMENTS"]["TYPE"],
include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
output:
"data/interim/{pid}/{sensor}_episodes_resampled_with_datetime.csv"
script:
"../src/data/readable_datetime.R"
2020-10-19 21:07:12 +02:00
rule phone_accelerometer_python_features:
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_accelerometer_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
2019-10-25 16:21:09 +02:00
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_ACCELEROMETER"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_accelerometer"
2019-10-25 16:21:09 +02:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_accelerometer_features/phone_accelerometer_python_{provider_key}.csv"
script:
"../src/features/entry.py"
2019-11-05 16:47:55 +01:00
rule activity_recognition_episodes:
2019-11-05 16:47:55 +01:00
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_activity_recognition_with_datetime_unified.csv"
2019-11-05 16:47:55 +01:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_activity_recognition_episodes.csv"
2019-11-05 16:47:55 +01:00
script:
2020-10-19 21:07:12 +02:00
"../src/features/phone_activity_recognition/episodes/activity_recognition_episodes.R"
2019-11-05 21:17:20 +01:00
2020-10-19 21:07:12 +02:00
rule phone_activity_recognition_python_features:
2019-11-27 21:27:48 +01:00
input:
2020-10-19 21:07:12 +02:00
sensor_episodes = "data/interim/{pid}/phone_activity_recognition_episodes_resampled_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_ACTIVITY_RECOGNITION"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_activity_recognition"
2019-11-27 21:27:48 +01:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_activity_recognition_features/phone_activity_recognition_python_{provider_key}.csv"
script:
"../src/features/entry.py"
2020-10-19 21:07:12 +02:00
rule phone_applications_foreground_python_features:
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_applications_foreground_with_datetime_with_categories.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_APPLICATIONS_FOREGROUND"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_applications_foreground"
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_applications_foreground_features/phone_applications_foreground_python_{provider_key}.csv"
2019-11-27 21:53:37 +01:00
script:
"../src/features/entry.py"
rule battery_episodes:
input:
2020-10-19 21:07:12 +02:00
"data/raw/{pid}/phone_battery_raw.csv"
2019-11-05 21:17:20 +01:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_battery_episodes.csv"
2019-11-05 21:17:20 +01:00
script:
2020-10-19 21:07:12 +02:00
"../src/features/phone_battery/episodes/battery_episodes.R"
2019-11-06 18:19:30 +01:00
2020-10-19 21:07:12 +02:00
rule phone_battery_python_features:
input:
2020-10-19 21:07:12 +02:00
sensor_episodes = "data/interim/{pid}/phone_battery_episodes_resampled_with_datetime.csv",
2020-09-14 20:21:36 +02:00
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_BATTERY"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_battery"
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_battery_features/phone_battery_python_{provider_key}.csv"
script:
"../src/features/entry.py"
2020-10-19 21:07:12 +02:00
rule phone_bluetooth_r_features:
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_bluetooth_with_datetime.csv",
2020-09-14 20:21:36 +02:00
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_BLUETOOTH"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_bluetooth"
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_bluetooth_features/phone_bluetooth_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule calls_r_features:
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_calls_with_datetime_unified.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_CALLS"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_calls"
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_calls_features/phone_calls_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule conversation_python_features:
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_conversation_with_datetime_unified.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_CONVERSATION"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_conversation"
2019-11-27 20:25:17 +01:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_conversation_features/phone_conversation_python_{provider_key}.csv"
2019-11-27 20:25:17 +01:00
script:
"../src/features/entry.py"
2020-01-14 15:51:39 +01:00
2020-10-19 21:07:12 +02:00
rule phone_light_python_features:
2020-01-14 15:51:39 +01:00
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_light_with_datetime.csv",
2020-09-14 20:21:36 +02:00
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
2020-01-14 15:51:39 +01:00
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_LIGHT"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_light"
2020-09-01 18:01:24 +02:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_light_features/phone_light_python_{provider_key}.csv"
2020-01-14 15:51:39 +01:00
script:
"../src/features/entry.py"
2020-01-15 20:15:24 +01:00
2020-10-19 21:07:12 +02:00
rule phone_locations_r_features:
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/interim/{pid}/phone_locations_processed_with_datetime.csv",
2020-09-14 20:21:36 +02:00
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_LOCATIONS"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_locations"
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_locations_features/phone_locations_r_{provider_key}.csv"
script:
"../src/features/entry.R"
2020-10-19 21:07:12 +02:00
rule phone_locations_python_features:
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/interim/{pid}/phone_locations_processed_with_datetime.csv",
2020-09-14 20:21:36 +02:00
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_LOCATIONS"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_locations"
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_locations_features/phone_locations_python_{provider_key}.csv"
script:
"../src/features/entry.py"
2020-10-19 21:07:12 +02:00
rule phone_messages_r_features:
2020-01-15 20:15:24 +01:00
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_messages_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
2020-01-15 20:15:24 +01:00
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_MESSAGES"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_messages"
2020-01-15 20:15:24 +01:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_messages_features/phone_messages_r_{provider_key}.csv"
2020-01-15 20:15:24 +01:00
script:
"../src/features/entry.R"
2020-01-29 22:22:53 +01:00
rule screen_episodes:
input:
2020-10-19 21:07:12 +02:00
screen = "data/raw/{pid}/phone_screen_with_datetime_unified.csv"
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_screen_episodes.csv"
script:
2020-10-19 21:07:12 +02:00
"../src/features/phone_screen/episodes/screen_episodes.R"
2020-10-19 21:07:12 +02:00
rule phone_screen_python_features:
input:
2020-10-19 21:07:12 +02:00
sensor_episodes = "data/interim/{pid}/phone_screen_episodes_resampled_with_datetime.csv",
2020-09-14 20:21:36 +02:00
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_SCREEN"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_screen"
2020-02-07 17:52:55 +01:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_screen_features/phone_screen_python_{provider_key}.csv"
script:
"../src/features/entry.py"
2020-02-07 17:52:55 +01:00
2020-10-19 21:07:12 +02:00
rule phone_wifi_connected_r_features:
2020-09-01 00:51:06 +02:00
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_wifi_connected_with_datetime.csv",
2020-09-14 20:21:36 +02:00
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
2020-09-01 00:51:06 +02:00
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_WIFI_CONNECTED"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_wifi_connected"
2020-09-01 00:51:06 +02:00
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_wifi_connected_features/phone_wifi_connected_r_{provider_key}.csv"
2020-09-01 00:51:06 +02:00
script:
"../src/features/entry.R"
2020-09-01 00:51:06 +02:00
2020-10-19 21:07:12 +02:00
rule phone_wifi_visible_r_features:
2020-09-01 00:51:06 +02:00
input:
2020-10-19 21:07:12 +02:00
sensor_data = "data/raw/{pid}/phone_wifi_visible_with_datetime.csv",
2020-09-14 20:21:36 +02:00
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
2020-10-19 21:07:12 +02:00
provider = lambda wildcards: config["PHONE_WIFI_VISIBLE"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
2020-10-19 21:07:12 +02:00
sensor_key = "phone_wifi_visible"
output:
2020-10-19 21:07:12 +02:00
"data/interim/{pid}/phone_wifi_visible_features/phone_wifi_visible_r_{provider_key}.csv"
script:
2020-10-19 21:07:12 +02:00
"../src/features/entry.R"
rule fitbit_heartrate_features:
2020-02-07 17:35:15 +01:00
input:
heartrate_summary_data = "data/raw/{pid}/fitbit_heartrate_summary_with_datetime.csv",
heartrate_intraday_data = "data/raw/{pid}/fitbit_heartrate_intraday_with_datetime.csv"
2020-02-07 17:35:15 +01:00
params:
day_segment = "{day_segment}",
2020-06-12 22:04:03 +02:00
summary_features = config["HEARTRATE"]["SUMMARY_FEATURES"],
intraday_features = config["HEARTRATE"]["INTRADAY_FEATURES"]
2020-02-07 17:35:15 +01:00
output:
"data/processed/{pid}/fitbit_heartrate_{day_segment}.csv"
script:
"../src/features/fitbit_heartrate_features.py"
2020-02-07 17:35:15 +01:00
rule fitbit_step_features:
2020-01-29 22:22:53 +01:00
input:
step_data = "data/raw/{pid}/fitbit_step_intraday_with_datetime.csv",
sleep_data = optional_steps_sleep_input
2020-01-29 22:22:53 +01:00
params:
day_segment = "{day_segment}",
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"],
exclude_sleep = config["STEP"]["EXCLUDE_SLEEP"]["EXCLUDE"],
exclude_sleep_type = config["STEP"]["EXCLUDE_SLEEP"]["TYPE"],
exclude_sleep_fixed_start = config["STEP"]["EXCLUDE_SLEEP"]["FIXED"]["START"],
exclude_sleep_fixed_end = config["STEP"]["EXCLUDE_SLEEP"]["FIXED"]["END"],
2020-01-29 22:22:53 +01:00
output:
"data/processed/{pid}/fitbit_step_{day_segment}.csv"
script:
"../src/features/fitbit_step_features.py"
2020-04-13 19:24:52 +02:00
rule fitbit_sleep_features:
input:
sleep_summary_data = "data/raw/{pid}/fitbit_sleep_summary_with_datetime.csv",
sleep_intraday_data = "data/raw/{pid}/fitbit_sleep_intraday_with_datetime.csv"
2020-04-13 19:24:52 +02:00
params:
day_segment = "{day_segment}",
2020-06-13 00:44:05 +02:00
summary_features = config["SLEEP"]["SUMMARY_FEATURES"],
sleep_types = config["SLEEP"]["SLEEP_TYPES"]
2020-04-13 19:24:52 +02:00
output:
"data/processed/{pid}/fitbit_sleep_{day_segment}.csv"
2020-04-13 19:24:52 +02:00
script:
"../src/features/fitbit_sleep_features.py"