2020-08-03 19:09:16 +02:00
|
|
|
rule restore_sql_file:
|
|
|
|
input:
|
|
|
|
sql_file = "data/external/rapids_example.sql",
|
|
|
|
db_credentials = ".env"
|
|
|
|
params:
|
2020-10-21 01:12:01 +02:00
|
|
|
group = config["DATABASE_GROUP"]
|
2020-08-03 19:09:16 +02:00
|
|
|
output:
|
|
|
|
touch("data/interim/restore_sql_file.done")
|
|
|
|
script:
|
|
|
|
"../src/data/restore_sql_file.py"
|
|
|
|
|
2020-08-03 23:30:15 +02:00
|
|
|
rule create_example_participant_files:
|
|
|
|
output:
|
2020-12-03 18:48:32 +01:00
|
|
|
expand("data/external/participant_files/{pid}.yaml", pid = ["example01", "example02"])
|
2020-08-03 23:30:15 +02:00
|
|
|
shell:
|
2020-12-18 17:27:04 +01:00
|
|
|
"echo 'PHONE:\n DEVICE_IDS: [a748ee1a-1d0b-4ae9-9074-279a2b6ba524]\n PLATFORMS: [android]\n LABEL: test-01\n START_DATE: 2020-04-23\n END_DATE: 2020-05-04\nFITBIT:\n DEVICE_IDS: [a748ee1a-1d0b-4ae9-9074-279a2b6ba524]\n LABEL: test-01\n START_DATE: 2020-04-23\n END_DATE: 2020-05-04\n' >> ./data/external/participant_files/example01.yaml && echo 'PHONE:\n DEVICE_IDS: [13dbc8a3-dae3-4834-823a-4bc96a7d459d]\n PLATFORMS: [ios]\n LABEL: test-02\n START_DATE: 2020-04-23\n END_DATE: 2020-05-04\nFITBIT:\n DEVICE_IDS: [13dbc8a3-dae3-4834-823a-4bc96a7d459d]\n LABEL: test-02\n START_DATE: 2020-04-23\n END_DATE: 2020-05-04\n' >> ./data/external/participant_files/example02.yaml"
|
2020-08-03 23:30:15 +02:00
|
|
|
|
2020-10-27 22:13:16 +01:00
|
|
|
rule create_participants_files:
|
|
|
|
input:
|
|
|
|
participants_file = [] if config["CREATE_PARTICIPANT_FILES"]["SOURCE"]["TYPE"] == "AWARE_DEVICE_TABLE" else config["CREATE_PARTICIPANT_FILES"]["SOURCE"]["CSV_FILE_PATH"]
|
|
|
|
params:
|
|
|
|
config = config["CREATE_PARTICIPANT_FILES"]
|
|
|
|
script:
|
|
|
|
"../src/data/create_participants_files.R"
|
2020-10-21 01:12:01 +02:00
|
|
|
|
|
|
|
rule download_phone_data:
|
|
|
|
input:
|
|
|
|
"data/external/participant_files/{pid}.yaml"
|
2020-02-10 22:45:34 +01:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
source = config["PHONE_DATA_CONFIGURATION"]["SOURCE"],
|
2020-10-21 01:12:01 +02:00
|
|
|
sensor = "phone_" + "{sensor}",
|
|
|
|
table = lambda wildcards: config["PHONE_" + str(wildcards.sensor).upper()]["TABLE"],
|
2020-11-26 01:42:11 +01:00
|
|
|
timezone = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-10-21 01:12:01 +02:00
|
|
|
aware_multiplatform_tables = config["PHONE_ACTIVITY_RECOGNITION"]["TABLE"]["ANDROID"] + "," + config["PHONE_ACTIVITY_RECOGNITION"]["TABLE"]["IOS"] + "," + config["PHONE_CONVERSATION"]["TABLE"]["ANDROID"] + "," + config["PHONE_CONVERSATION"]["TABLE"]["IOS"],
|
|
|
|
output:
|
|
|
|
"data/raw/{pid}/phone_{sensor}_raw.csv"
|
2020-02-10 22:45:34 +01:00
|
|
|
script:
|
2020-10-21 01:12:01 +02:00
|
|
|
"../src/data/download_phone_data.R"
|
2020-02-10 22:45:34 +01:00
|
|
|
|
2020-10-21 01:12:01 +02:00
|
|
|
rule download_fitbit_data:
|
2019-10-24 18:11:24 +02:00
|
|
|
input:
|
2020-10-26 22:17:53 +01:00
|
|
|
participant_file = "data/external/participant_files/{pid}.yaml",
|
2020-11-26 01:42:11 +01:00
|
|
|
input_file = [] if config["FITBIT_DATA_CONFIGURATION"]["SOURCE"]["TYPE"] == "DATABASE" else lambda wildcards: config["FITBIT_" + str(wildcards.sensor).upper()]["TABLE"]
|
2019-10-24 18:11:24 +02:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
data_configuration = config["FITBIT_DATA_CONFIGURATION"],
|
2020-10-21 01:12:01 +02:00
|
|
|
sensor = "fitbit_" + "{sensor}",
|
|
|
|
table = lambda wildcards: config["FITBIT_" + str(wildcards.sensor).upper()]["TABLE"],
|
2019-10-24 18:11:24 +02:00
|
|
|
output:
|
2020-11-11 23:27:46 +01:00
|
|
|
"data/raw/{pid}/fitbit_{sensor}_raw.csv"
|
2019-10-24 18:11:24 +02:00
|
|
|
script:
|
2020-10-21 01:12:01 +02:00
|
|
|
"../src/data/download_fitbit_data.R"
|
2019-10-24 22:08:05 +02:00
|
|
|
|
2020-12-03 00:41:03 +01:00
|
|
|
rule compute_time_segments:
|
2020-07-23 03:54:19 +02:00
|
|
|
input:
|
2020-12-03 00:41:03 +01:00
|
|
|
config["TIME_SEGMENTS"]["FILE"],
|
2020-10-23 18:15:26 +02:00
|
|
|
"data/external/participant_files/{pid}.yaml"
|
2020-08-26 18:09:53 +02:00
|
|
|
params:
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments_type = config["TIME_SEGMENTS"]["TYPE"],
|
2020-09-14 20:21:36 +02:00
|
|
|
pid = "{pid}"
|
2020-07-23 03:54:19 +02:00
|
|
|
output:
|
2020-12-03 00:41:03 +01:00
|
|
|
segments_file = "data/interim/time_segments/{pid}_time_segments.csv",
|
|
|
|
segments_labels_file = "data/interim/time_segments/{pid}_time_segments_labels.csv",
|
2020-07-23 03:54:19 +02:00
|
|
|
script:
|
2020-12-03 00:41:03 +01:00
|
|
|
"../src/data/compute_time_segments.py"
|
2020-07-23 03:54:19 +02:00
|
|
|
|
2020-10-19 21:07:12 +02:00
|
|
|
rule phone_readable_datetime:
|
2019-10-24 22:08:05 +02:00
|
|
|
input:
|
2020-10-19 21:07:12 +02:00
|
|
|
sensor_input = "data/raw/{pid}/phone_{sensor}_raw.csv",
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments = "data/interim/time_segments/{pid}_time_segments.csv"
|
2019-10-24 22:08:05 +02:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
timezones = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["TYPE"],
|
|
|
|
fixed_timezone = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments_type = config["TIME_SEGMENTS"]["TYPE"],
|
|
|
|
include_past_periodic_segments = config["TIME_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
|
2019-10-24 22:08:05 +02:00
|
|
|
output:
|
2020-10-19 21:07:12 +02:00
|
|
|
"data/raw/{pid}/phone_{sensor}_with_datetime.csv"
|
2019-10-24 22:08:05 +02:00
|
|
|
script:
|
2019-11-05 18:34:22 +01:00
|
|
|
"../src/data/readable_datetime.R"
|
|
|
|
|
2020-11-25 01:12:16 +01:00
|
|
|
rule phone_yielded_timestamps:
|
2019-11-05 18:34:22 +01:00
|
|
|
input:
|
2020-11-25 01:12:16 +01:00
|
|
|
all_sensors = expand("data/raw/{{pid}}/{sensor}_raw.csv", sensor = map(str.lower, config["PHONE_DATA_YIELD"]["SENSORS"]))
|
2020-11-25 20:49:42 +01:00
|
|
|
params:
|
|
|
|
sensors = config["PHONE_DATA_YIELD"]["SENSORS"] # not used but needed so the rule is triggered if this array changes
|
2019-11-05 18:34:22 +01:00
|
|
|
output:
|
2020-11-25 01:12:16 +01:00
|
|
|
"data/interim/{pid}/phone_yielded_timestamps.csv"
|
2019-11-05 18:34:22 +01:00
|
|
|
script:
|
2020-11-25 01:12:16 +01:00
|
|
|
"../src/data/phone_yielded_timestamps.R"
|
2019-11-12 20:57:27 +01:00
|
|
|
|
2020-11-25 01:12:16 +01:00
|
|
|
rule phone_yielded_timestamps_with_datetime:
|
2020-10-07 17:51:31 +02:00
|
|
|
input:
|
2020-11-25 01:12:16 +01:00
|
|
|
sensor_input = "data/interim/{pid}/phone_yielded_timestamps.csv",
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments = "data/interim/time_segments/{pid}_time_segments.csv"
|
2020-11-25 01:12:16 +01:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
timezones = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["TYPE"],
|
|
|
|
fixed_timezone = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments_type = config["TIME_SEGMENTS"]["TYPE"],
|
|
|
|
include_past_periodic_segments = config["TIME_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
|
2020-10-07 17:51:31 +02:00
|
|
|
output:
|
2020-11-25 01:12:16 +01:00
|
|
|
"data/interim/{pid}/phone_yielded_timestamps_with_datetime.csv"
|
2020-10-07 17:51:31 +02:00
|
|
|
script:
|
2020-11-25 01:12:16 +01:00
|
|
|
"../src/data/readable_datetime.R"
|
2020-10-07 17:51:31 +02:00
|
|
|
|
2019-11-12 20:57:27 +01:00
|
|
|
rule unify_ios_android:
|
|
|
|
input:
|
|
|
|
sensor_data = "data/raw/{pid}/{sensor}_with_datetime.csv",
|
2020-10-21 01:12:01 +02:00
|
|
|
participant_info = "data/external/participant_files/{pid}.yaml"
|
2019-11-12 20:57:27 +01:00
|
|
|
params:
|
2020-06-30 23:34:18 +02:00
|
|
|
sensor = "{sensor}",
|
2019-11-12 20:57:27 +01:00
|
|
|
output:
|
|
|
|
"data/raw/{pid}/{sensor}_with_datetime_unified.csv"
|
|
|
|
script:
|
2019-12-10 00:23:00 +01:00
|
|
|
"../src/data/unify_ios_android.R"
|
|
|
|
|
2020-10-21 01:12:01 +02:00
|
|
|
rule process_phone_locations_types:
|
2019-12-10 00:23:00 +01:00
|
|
|
input:
|
2020-10-19 21:07:12 +02:00
|
|
|
locations = "data/raw/{pid}/phone_locations_raw.csv",
|
2020-11-25 20:49:42 +01:00
|
|
|
phone_sensed_timestamps = "data/interim/{pid}/phone_yielded_timestamps.csv",
|
2019-12-10 00:23:00 +01:00
|
|
|
params:
|
2020-10-19 21:07:12 +02:00
|
|
|
consecutive_threshold = config["PHONE_LOCATIONS"]["FUSED_RESAMPLED_CONSECUTIVE_THRESHOLD"],
|
|
|
|
time_since_valid_location = config["PHONE_LOCATIONS"]["FUSED_RESAMPLED_TIME_SINCE_VALID_LOCATION"],
|
|
|
|
locations_to_use = config["PHONE_LOCATIONS"]["LOCATIONS_TO_USE"]
|
2019-12-10 00:23:00 +01:00
|
|
|
output:
|
2020-10-19 21:07:12 +02:00
|
|
|
"data/interim/{pid}/phone_locations_processed.csv"
|
2019-12-10 00:23:00 +01:00
|
|
|
script:
|
2020-08-28 19:53:00 +02:00
|
|
|
"../src/data/process_location_types.R"
|
2020-01-15 23:18:10 +01:00
|
|
|
|
2020-10-21 01:12:01 +02:00
|
|
|
rule phone_locations_processed_with_datetime:
|
2020-10-07 17:51:31 +02:00
|
|
|
input:
|
2020-10-19 21:07:12 +02:00
|
|
|
sensor_input = "data/interim/{pid}/phone_locations_processed.csv",
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments = "data/interim/time_segments/{pid}_time_segments.csv"
|
2020-10-07 17:51:31 +02:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
timezones = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["TYPE"],
|
|
|
|
fixed_timezone = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments_type = config["TIME_SEGMENTS"]["TYPE"],
|
|
|
|
include_past_periodic_segments = config["TIME_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
|
2020-10-07 17:51:31 +02:00
|
|
|
output:
|
2020-10-19 21:07:12 +02:00
|
|
|
"data/interim/{pid}/phone_locations_processed_with_datetime.csv"
|
2020-10-07 17:51:31 +02:00
|
|
|
script:
|
|
|
|
"../src/data/readable_datetime.R"
|
|
|
|
|
2020-10-21 01:12:01 +02:00
|
|
|
rule resample_episodes:
|
2020-01-16 00:28:56 +01:00
|
|
|
input:
|
2020-10-21 01:12:01 +02:00
|
|
|
"data/interim/{pid}/{sensor}_episodes.csv"
|
2020-01-16 00:28:56 +01:00
|
|
|
output:
|
2020-10-21 01:12:01 +02:00
|
|
|
"data/interim/{pid}/{sensor}_episodes_resampled.csv"
|
2020-01-16 00:28:56 +01:00
|
|
|
script:
|
2020-10-21 01:12:01 +02:00
|
|
|
"../src/features/utils/resample_episodes.R"
|
2020-01-16 00:28:56 +01:00
|
|
|
|
2020-10-21 01:12:01 +02:00
|
|
|
rule resample_episodes_with_datetime:
|
2020-01-15 23:18:10 +01:00
|
|
|
input:
|
2020-10-21 01:12:01 +02:00
|
|
|
sensor_input = "data/interim/{pid}/{sensor}_episodes_resampled.csv",
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments = "data/interim/time_segments/{pid}_time_segments.csv"
|
2020-01-15 23:18:10 +01:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
timezones = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["TYPE"],
|
|
|
|
fixed_timezone = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments_type = config["TIME_SEGMENTS"]["TYPE"],
|
|
|
|
include_past_periodic_segments = config["TIME_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
|
2020-01-15 23:18:10 +01:00
|
|
|
output:
|
2020-10-21 01:12:01 +02:00
|
|
|
"data/interim/{pid}/{sensor}_episodes_resampled_with_datetime.csv"
|
2020-01-15 23:18:10 +01:00
|
|
|
script:
|
2020-10-21 01:12:01 +02:00
|
|
|
"../src/data/readable_datetime.R"
|
2020-01-16 00:28:56 +01:00
|
|
|
|
2020-10-21 01:12:01 +02:00
|
|
|
rule phone_application_categories:
|
2020-06-23 17:33:34 +02:00
|
|
|
input:
|
2021-01-14 01:05:36 +01:00
|
|
|
"data/raw/{pid}/phone_applications_{type}_with_datetime.csv"
|
2020-06-23 17:33:34 +02:00
|
|
|
params:
|
2021-01-14 01:05:36 +01:00
|
|
|
catalogue_source = lambda wildcards: config["PHONE_APPLICATIONS_" + str(wildcards.type).upper()]["APPLICATION_CATEGORIES"]["CATALOGUE_SOURCE"],
|
|
|
|
catalogue_file = lambda wildcards: config["PHONE_APPLICATIONS_" + str(wildcards.type).upper()]["APPLICATION_CATEGORIES"]["CATALOGUE_FILE"],
|
|
|
|
update_catalogue_file = lambda wildcards: config["PHONE_APPLICATIONS_" + str(wildcards.type).upper()]["APPLICATION_CATEGORIES"]["UPDATE_CATALOGUE_FILE"],
|
|
|
|
scrape_missing_genres = lambda wildcards: config["PHONE_APPLICATIONS_" + str(wildcards.type).upper()]["APPLICATION_CATEGORIES"]["SCRAPE_MISSING_CATEGORIES"]
|
2020-06-23 17:33:34 +02:00
|
|
|
output:
|
2021-01-14 01:05:36 +01:00
|
|
|
"data/raw/{pid}/phone_applications_{type}_with_datetime_with_categories.csv"
|
2020-06-23 17:33:34 +02:00
|
|
|
script:
|
2020-10-21 01:12:01 +02:00
|
|
|
"../src/data/application_categories.R"
|
2020-06-23 17:33:34 +02:00
|
|
|
|
2020-10-22 19:08:52 +02:00
|
|
|
rule fitbit_parse_heartrate:
|
|
|
|
input:
|
2020-11-30 18:34:14 +01:00
|
|
|
participant_file = "data/external/participant_files/{pid}.yaml",
|
|
|
|
raw_data = "data/raw/{pid}/fitbit_heartrate_{fitbit_data_type}_raw.csv"
|
2020-10-22 19:08:52 +02:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
timezone = config["FITBIT_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-11-12 02:23:41 +01:00
|
|
|
table = lambda wildcards: config["FITBIT_HEARTRATE_"+str(wildcards.fitbit_data_type).upper()]["TABLE"],
|
2020-11-26 01:42:11 +01:00
|
|
|
column_format = config["FITBIT_DATA_CONFIGURATION"]["SOURCE"]["COLUMN_FORMAT"],
|
2020-11-11 23:27:46 +01:00
|
|
|
fitbit_data_type = "{fitbit_data_type}"
|
2020-10-22 19:08:52 +02:00
|
|
|
output:
|
2020-11-11 23:27:46 +01:00
|
|
|
"data/raw/{pid}/fitbit_heartrate_{fitbit_data_type}_parsed.csv"
|
2020-10-22 19:08:52 +02:00
|
|
|
script:
|
|
|
|
"../src/data/fitbit_parse_heartrate.py"
|
2020-10-21 01:12:01 +02:00
|
|
|
|
2020-10-22 19:08:52 +02:00
|
|
|
rule fitbit_parse_steps:
|
|
|
|
input:
|
2020-11-30 18:34:14 +01:00
|
|
|
participant_file = "data/external/participant_files/{pid}.yaml",
|
|
|
|
raw_data = "data/raw/{pid}/fitbit_steps_{fitbit_data_type}_raw.csv"
|
2020-10-22 19:08:52 +02:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
timezone = config["FITBIT_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-11-12 03:16:48 +01:00
|
|
|
table = lambda wildcards: config["FITBIT_STEPS_"+str(wildcards.fitbit_data_type).upper()]["TABLE"],
|
2020-11-26 01:42:11 +01:00
|
|
|
column_format = config["FITBIT_DATA_CONFIGURATION"]["SOURCE"]["COLUMN_FORMAT"],
|
2020-11-12 03:16:48 +01:00
|
|
|
fitbit_data_type = "{fitbit_data_type}"
|
2020-10-22 19:08:52 +02:00
|
|
|
output:
|
2020-11-12 03:16:48 +01:00
|
|
|
"data/raw/{pid}/fitbit_steps_{fitbit_data_type}_parsed.csv"
|
2020-10-22 19:08:52 +02:00
|
|
|
script:
|
|
|
|
"../src/data/fitbit_parse_steps.py"
|
2020-10-21 01:12:01 +02:00
|
|
|
|
2020-11-23 18:01:00 +01:00
|
|
|
rule fitbit_parse_sleep:
|
|
|
|
input:
|
2020-11-30 18:34:14 +01:00
|
|
|
participant_file = "data/external/participant_files/{pid}.yaml",
|
|
|
|
raw_data = "data/raw/{pid}/fitbit_sleep_{fitbit_data_type}_raw.csv"
|
2020-11-23 18:01:00 +01:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
timezone = config["FITBIT_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-11-23 18:01:00 +01:00
|
|
|
table = lambda wildcards: config["FITBIT_SLEEP_"+str(wildcards.fitbit_data_type).upper()]["TABLE"],
|
2020-11-26 01:42:11 +01:00
|
|
|
column_format = config["FITBIT_DATA_CONFIGURATION"]["SOURCE"]["COLUMN_FORMAT"],
|
2020-11-23 18:01:00 +01:00
|
|
|
fitbit_data_type = "{fitbit_data_type}",
|
|
|
|
sleep_episode_timestamp = config["FITBIT_SLEEP_SUMMARY"]["SLEEP_EPISODE_TIMESTAMP"]
|
|
|
|
output:
|
|
|
|
"data/raw/{pid}/fitbit_sleep_{fitbit_data_type}_parsed.csv"
|
|
|
|
script:
|
|
|
|
"../src/data/fitbit_parse_sleep.py"
|
|
|
|
|
2020-11-26 01:42:11 +01:00
|
|
|
# rule fitbit_parse_calories:
|
|
|
|
# input:
|
|
|
|
# data = expand("data/raw/{{pid}}/fitbit_calories_{fitbit_data_type}_raw.csv", fitbit_data_type = (["json"] if config["FITBIT_CALORIES"]["TABLE_FORMAT"] == "JSON" else ["summary", "intraday"]))
|
|
|
|
# params:
|
|
|
|
# timezone = config["FITBIT_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
|
|
|
# table = config["FITBIT_CALORIES"]["TABLE"],
|
|
|
|
# table_format = config["FITBIT_CALORIES"]["TABLE_FORMAT"]
|
|
|
|
# output:
|
|
|
|
# summary_data = "data/raw/{pid}/fitbit_calories_summary_parsed.csv",
|
|
|
|
# intraday_data = "data/raw/{pid}/fitbit_calories_intraday_parsed.csv"
|
|
|
|
# script:
|
|
|
|
# "../src/data/fitbit_parse_calories.py"
|
2020-10-22 19:08:52 +02:00
|
|
|
|
|
|
|
rule fitbit_readable_datetime:
|
|
|
|
input:
|
|
|
|
sensor_input = "data/raw/{pid}/fitbit_{sensor}_{fitbit_data_type}_parsed.csv",
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments = "data/interim/time_segments/{pid}_time_segments.csv"
|
2020-10-22 19:08:52 +02:00
|
|
|
params:
|
2020-11-26 01:42:11 +01:00
|
|
|
fixed_timezone = config["FITBIT_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
2020-12-03 00:41:03 +01:00
|
|
|
time_segments_type = config["TIME_SEGMENTS"]["TYPE"],
|
|
|
|
include_past_periodic_segments = config["TIME_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
|
2020-10-22 19:08:52 +02:00
|
|
|
output:
|
|
|
|
"data/raw/{pid}/fitbit_{sensor}_{fitbit_data_type}_parsed_with_datetime.csv"
|
|
|
|
script:
|
|
|
|
"../src/data/readable_datetime.R"
|
2020-12-15 02:30:34 +01:00
|
|
|
|
2020-12-16 00:19:11 +01:00
|
|
|
from pathlib import Path
|
|
|
|
rule unzip_empatica_data:
|
|
|
|
input:
|
|
|
|
input_file = Path(config["EMPATICA_DATA_CONFIGURATION"]["SOURCE"]["FOLDER"]) / Path("{pid}{suffix}.zip"),
|
|
|
|
participant_file = "data/external/participant_files/{pid}.yaml"
|
|
|
|
params:
|
|
|
|
sensor = "{sensor}"
|
|
|
|
output:
|
|
|
|
sensor_output = "data/raw/{pid}/empatica_{sensor}_unzipped_{suffix}.csv"
|
|
|
|
script:
|
|
|
|
"../src/data/empatica/unzip_empatica_data.py"
|
2020-12-15 02:30:34 +01:00
|
|
|
|
|
|
|
rule extract_empatica_data:
|
|
|
|
input:
|
2020-12-16 00:19:11 +01:00
|
|
|
input_file = "data/raw/{pid}/empatica_{sensor}_unzipped_{suffix}.csv",
|
2020-12-15 02:30:34 +01:00
|
|
|
participant_file = "data/external/participant_files/{pid}.yaml"
|
|
|
|
params:
|
|
|
|
data_configuration = config["EMPATICA_DATA_CONFIGURATION"],
|
|
|
|
sensor = "{sensor}",
|
|
|
|
table = lambda wildcards: config["EMPATICA_" + str(wildcards.sensor).upper()]["TABLE"],
|
|
|
|
output:
|
2020-12-16 00:19:11 +01:00
|
|
|
sensor_output = "data/raw/{pid}/empatica_{sensor}_raw_{suffix}.csv"
|
2020-12-15 02:30:34 +01:00
|
|
|
script:
|
|
|
|
"../src/data/empatica/extract_empatica_data.py"
|
|
|
|
|
|
|
|
|
2020-12-16 00:19:11 +01:00
|
|
|
rule join_empatica_data:
|
|
|
|
input:
|
|
|
|
input_files = get_all_raw_empatica_sensor_files,
|
|
|
|
output:
|
|
|
|
sensor_output = "data/raw/{pid}/empatica_{sensor}_joined.csv"
|
|
|
|
script:
|
|
|
|
"../src/data/empatica/join_empatica_data.R"
|
|
|
|
|
2020-12-15 02:30:34 +01:00
|
|
|
rule empatica_readable_datetime:
|
|
|
|
input:
|
2020-12-16 00:19:11 +01:00
|
|
|
sensor_input = "data/raw/{pid}/empatica_{sensor}_joined.csv",
|
2020-12-15 02:30:34 +01:00
|
|
|
time_segments = "data/interim/time_segments/{pid}_time_segments.csv"
|
|
|
|
params:
|
|
|
|
timezones = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["TYPE"],
|
|
|
|
fixed_timezone = config["PHONE_DATA_CONFIGURATION"]["TIMEZONE"]["VALUE"],
|
|
|
|
time_segments_type = config["TIME_SEGMENTS"]["TYPE"],
|
|
|
|
include_past_periodic_segments = config["TIME_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
|
|
|
|
output:
|
|
|
|
"data/raw/{pid}/empatica_{sensor}_with_datetime.csv"
|
|
|
|
script:
|
|
|
|
"../src/data/readable_datetime.R"
|