Make sure feature rules of all sensors support both Python and R scripts

pull/103/head
Meng Li 2020-11-04 14:05:25 -05:00
parent 39632c66f5
commit 82873c285d
1 changed files with 187 additions and 5 deletions

View File

@ -19,6 +19,19 @@ rule phone_accelerometer_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule phone_accelerometer_r_features:
input:
sensor_data = "data/raw/{pid}/phone_accelerometer_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_ACCELEROMETER"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_accelerometer"
output:
"data/interim/{pid}/phone_accelerometer_features/phone_accelerometer_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule activity_recognition_episodes: rule activity_recognition_episodes:
input: input:
sensor_data = "data/raw/{pid}/phone_activity_recognition_with_datetime_unified.csv" sensor_data = "data/raw/{pid}/phone_activity_recognition_with_datetime_unified.csv"
@ -42,6 +55,19 @@ rule phone_activity_recognition_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule phone_activity_recognition_r_features:
input:
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:
provider = lambda wildcards: config["PHONE_ACTIVITY_RECOGNITION"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_activity_recognition"
output:
"data/interim/{pid}/phone_activity_recognition_features/phone_activity_recognition_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule phone_applications_foreground_python_features: rule phone_applications_foreground_python_features:
input: input:
sensor_data = "data/raw/{pid}/phone_applications_foreground_with_datetime_with_categories.csv", sensor_data = "data/raw/{pid}/phone_applications_foreground_with_datetime_with_categories.csv",
@ -55,6 +81,19 @@ rule phone_applications_foreground_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule phone_applications_foreground_r_features:
input:
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:
provider = lambda wildcards: config["PHONE_APPLICATIONS_FOREGROUND"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_applications_foreground"
output:
"data/interim/{pid}/phone_applications_foreground_features/phone_applications_foreground_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule battery_episodes: rule battery_episodes:
input: input:
"data/raw/{pid}/phone_battery_raw.csv" "data/raw/{pid}/phone_battery_raw.csv"
@ -78,6 +117,32 @@ rule phone_battery_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule phone_battery_r_features:
input:
sensor_episodes = "data/interim/{pid}/phone_battery_episodes_resampled_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_BATTERY"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_battery"
output:
"data/interim/{pid}/phone_battery_features/phone_battery_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule phone_bluetooth_python_features:
input:
sensor_data = "data/raw/{pid}/phone_bluetooth_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_BLUETOOTH"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_bluetooth"
output:
"data/interim/{pid}/phone_bluetooth_features/phone_bluetooth_python_{provider_key}.csv"
script:
"../src/features/entry.py"
rule phone_bluetooth_r_features: rule phone_bluetooth_r_features:
input: input:
sensor_data = "data/raw/{pid}/phone_bluetooth_with_datetime.csv", sensor_data = "data/raw/{pid}/phone_bluetooth_with_datetime.csv",
@ -91,6 +156,19 @@ rule phone_bluetooth_r_features:
script: script:
"../src/features/entry.R" "../src/features/entry.R"
rule calls_python_features:
input:
sensor_data = "data/raw/{pid}/phone_calls_with_datetime_unified.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_CALLS"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_calls"
output:
"data/interim/{pid}/phone_calls_features/phone_calls_python_{provider_key}.csv"
script:
"../src/features/entry.py"
rule calls_r_features: rule calls_r_features:
input: input:
sensor_data = "data/raw/{pid}/phone_calls_with_datetime_unified.csv", sensor_data = "data/raw/{pid}/phone_calls_with_datetime_unified.csv",
@ -117,6 +195,19 @@ rule conversation_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule conversation_r_features:
input:
sensor_data = "data/raw/{pid}/phone_conversation_with_datetime_unified.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_CONVERSATION"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_conversation"
output:
"data/interim/{pid}/phone_conversation_features/phone_conversation_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule phone_light_python_features: rule phone_light_python_features:
input: input:
sensor_data = "data/raw/{pid}/phone_light_with_datetime.csv", sensor_data = "data/raw/{pid}/phone_light_with_datetime.csv",
@ -130,6 +221,32 @@ rule phone_light_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule phone_light_r_features:
input:
sensor_data = "data/raw/{pid}/phone_light_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_LIGHT"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_light"
output:
"data/interim/{pid}/phone_light_features/phone_light_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule phone_locations_python_features:
input:
sensor_data = "data/interim/{pid}/phone_locations_processed_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_LOCATIONS"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_locations"
output:
"data/interim/{pid}/phone_locations_features/phone_locations_python_{provider_key}.csv"
script:
"../src/features/entry.py"
rule phone_locations_r_features: rule phone_locations_r_features:
input: input:
sensor_data = "data/interim/{pid}/phone_locations_processed_with_datetime.csv", sensor_data = "data/interim/{pid}/phone_locations_processed_with_datetime.csv",
@ -143,16 +260,16 @@ rule phone_locations_r_features:
script: script:
"../src/features/entry.R" "../src/features/entry.R"
rule phone_locations_python_features: rule phone_messages_python_features:
input: input:
sensor_data = "data/interim/{pid}/phone_locations_processed_with_datetime.csv", sensor_data = "data/raw/{pid}/phone_messages_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv" day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params: params:
provider = lambda wildcards: config["PHONE_LOCATIONS"]["PROVIDERS"][wildcards.provider_key.upper()], provider = lambda wildcards: config["PHONE_MESSAGES"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}", provider_key = "{provider_key}",
sensor_key = "phone_locations" sensor_key = "phone_messages"
output: output:
"data/interim/{pid}/phone_locations_features/phone_locations_python_{provider_key}.csv" "data/interim/{pid}/phone_messages_features/phone_messages_python_{provider_key}.csv"
script: script:
"../src/features/entry.py" "../src/features/entry.py"
@ -190,6 +307,32 @@ rule phone_screen_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule phone_screen_r_features:
input:
sensor_episodes = "data/interim/{pid}/phone_screen_episodes_resampled_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_SCREEN"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_screen"
output:
"data/interim/{pid}/phone_screen_features/phone_screen_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule phone_wifi_connected_python_features:
input:
sensor_data = "data/raw/{pid}/phone_wifi_connected_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_WIFI_CONNECTED"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_wifi_connected"
output:
"data/interim/{pid}/phone_wifi_connected_features/phone_wifi_connected_python_{provider_key}.csv"
script:
"../src/features/entry.py"
rule phone_wifi_connected_r_features: rule phone_wifi_connected_r_features:
input: input:
sensor_data = "data/raw/{pid}/phone_wifi_connected_with_datetime.csv", sensor_data = "data/raw/{pid}/phone_wifi_connected_with_datetime.csv",
@ -203,6 +346,19 @@ rule phone_wifi_connected_r_features:
script: script:
"../src/features/entry.R" "../src/features/entry.R"
rule phone_wifi_visible_python_features:
input:
sensor_data = "data/raw/{pid}/phone_wifi_visible_with_datetime.csv",
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["PHONE_WIFI_VISIBLE"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "phone_wifi_visible"
output:
"data/interim/{pid}/phone_wifi_visible_features/phone_wifi_visible_python_{provider_key}.csv"
script:
"../src/features/entry.py"
rule phone_wifi_visible_r_features: rule phone_wifi_visible_r_features:
input: input:
sensor_data = "data/raw/{pid}/phone_wifi_visible_with_datetime.csv", sensor_data = "data/raw/{pid}/phone_wifi_visible_with_datetime.csv",
@ -229,6 +385,19 @@ rule fitbit_heartrate_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule fitbit_heartrate_r_features:
input:
sensor_data = expand("data/raw/{{pid}}/fitbit_heartrate_{fitbit_data_type}_parsed_with_datetime.csv", fitbit_data_type=["summary", "intraday"]),
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["FITBIT_HEARTRATE"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "fitbit_heartrate"
output:
"data/interim/{pid}/fitbit_heartrate_features/fitbit_heartrate_r_{provider_key}.csv"
script:
"../src/features/entry.R"
rule fitbit_steps_python_features: rule fitbit_steps_python_features:
input: input:
sensor_data = expand("data/raw/{{pid}}/fitbit_steps_{fitbit_data_type}_parsed_with_datetime.csv", fitbit_data_type=["summary", "intraday"]), sensor_data = expand("data/raw/{{pid}}/fitbit_steps_{fitbit_data_type}_parsed_with_datetime.csv", fitbit_data_type=["summary", "intraday"]),
@ -242,6 +411,19 @@ rule fitbit_steps_python_features:
script: script:
"../src/features/entry.py" "../src/features/entry.py"
rule fitbit_steps_r_features:
input:
sensor_data = expand("data/raw/{{pid}}/fitbit_steps_{fitbit_data_type}_parsed_with_datetime.csv", fitbit_data_type=["summary", "intraday"]),
day_segments_labels = "data/interim/day_segments/{pid}_day_segments_labels.csv"
params:
provider = lambda wildcards: config["FITBIT_STEPS"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key = "{provider_key}",
sensor_key = "fitbit_steps"
output:
"data/interim/{pid}/fitbit_steps_features/fitbit_steps_r_{provider_key}.csv"
script:
"../src/features/entry.R"
# rule fitbit_heartrate_features: # rule fitbit_heartrate_features:
# input: # input:
# heartrate_summary_data = "data/raw/{pid}/fitbit_heartrate_summary_with_datetime.csv", # heartrate_summary_data = "data/raw/{pid}/fitbit_heartrate_summary_with_datetime.csv",