Change SENSOR_DATA to DEVICE_DATA

pull/103/head
JulioV 2020-11-04 17:16:46 -05:00
parent 231a5d4265
commit 2aa44fc504
7 changed files with 29 additions and 29 deletions

View File

@ -32,7 +32,7 @@ DAY_SEGMENTS: &day_segments
INCLUDE_PAST_PERIODIC_SEGMENTS: FALSE # Only relevant if TYPE=PERIODIC, see docs INCLUDE_PAST_PERIODIC_SEGMENTS: FALSE # Only relevant if TYPE=PERIODIC, see docs
# See https://www.rapids.science/setup/configuration/#device-data-source-configuration # See https://www.rapids.science/setup/configuration/#device-data-source-configuration
SENSOR_DATA: DEVICE_DATA:
PHONE: PHONE:
SOURCE: SOURCE:
TYPE: DATABASE TYPE: DATABASE
@ -259,7 +259,7 @@ PHONE_CONVERSATION:
################################################################################ ################################################################################
FITBIT_HEARTRATE: FITBIT_HEARTRATE:
TABLE_FORMAT: JSON # JSON or CSV. If your JSON or CSV data are files change [SENSOR_DATA][FITBIT][SOURCE][TYPE] to FILES TABLE_FORMAT: JSON # JSON or CSV. If your JSON or CSV data are files change [DEVICE_DATA][FITBIT][SOURCE][TYPE] to FILES
TABLE: TABLE:
JSON: fitbit_heartrate JSON: fitbit_heartrate
CSV: CSV:
@ -275,7 +275,7 @@ FITBIT_HEARTRATE:
SRC_LANGUAGE: "python" SRC_LANGUAGE: "python"
FITBIT_STEPS: FITBIT_STEPS:
TABLE_FORMAT: JSON # JSON or CSV. If your JSON or CSV data are files change [SENSOR_DATA][FITBIT][SOURCE][TYPE] to FILES TABLE_FORMAT: JSON # JSON or CSV. If your JSON or CSV data are files change [DEVICE_DATA][FITBIT][SOURCE][TYPE] to FILES
TABLE: TABLE:
JSON: fitbit_steps JSON: fitbit_steps
CSV: CSV:
@ -302,7 +302,7 @@ FITBIT_STEPS:
SRC_LANGUAGE: "python" SRC_LANGUAGE: "python"
FITBIT_SLEEP: FITBIT_SLEEP:
TABLE_FORMAT: JSON # JSON or CSV. If your JSON or CSV data are files change [SENSOR_DATA][FITBIT][SOURCE][TYPE] to FILES TABLE_FORMAT: JSON # JSON or CSV. If your JSON or CSV data are files change [DEVICE_DATA][FITBIT][SOURCE][TYPE] to FILES
TABLE: TABLE:
JSON: fitbit_sleep JSON: fitbit_sleep
CSV: CSV:
@ -315,7 +315,7 @@ FITBIT_SLEEP:
SUMMARY_FEATURES: ["sumdurationafterwakeup", "sumdurationasleep", "sumdurationawake", "sumdurationtofallasleep", "sumdurationinbed", "avgefficiency", "countepisode"] SUMMARY_FEATURES: ["sumdurationafterwakeup", "sumdurationasleep", "sumdurationawake", "sumdurationtofallasleep", "sumdurationinbed", "avgefficiency", "countepisode"]
FITBIT_CALORIES: FITBIT_CALORIES:
TABLE_FORMAT: JSON # JSON or CSV. If your JSON or CSV data are files change [SENSOR_DATA][FITBIT][SOURCE][TYPE] to FILES TABLE_FORMAT: JSON # JSON or CSV. If your JSON or CSV data are files change [DEVICE_DATA][FITBIT][SOURCE][TYPE] to FILES
TABLE: TABLE:
JSON: fitbit_calories JSON: fitbit_calories
CSV: CSV:

View File

@ -319,12 +319,12 @@ Day segments (or epochs) are the time windows on which you want to extract behav
You might need to modify the following config keys in your `config.yaml` depending on what devices your participants used and where you are storing your data. You might need to modify the following config keys in your `config.yaml` depending on what devices your participants used and where you are storing your data.
!!! hint !!! hint
You can ignore `[SENSOR_DATA][PHONE]` or `[SENSOR_DATA][FITBIT]` if you are not working with either devices. You can ignore `[DEVICE_DATA][PHONE]` or `[DEVICE_DATA][FITBIT]` if you are not working with either devices.
The relevant `config.yaml` section looks as follows by default: The relevant `config.yaml` section looks as follows by default:
```yaml ```yaml
SENSOR_DATA: DEVICE_DATA:
PHONE: PHONE:
SOURCE: SOURCE:
TYPE: DATABASE TYPE: DATABASE
@ -344,7 +344,7 @@ SENSOR_DATA:
``` ```
**For `[SENSOR_DATA][PHONE]`** **For `[DEVICE_DATA][PHONE]`**
| Key | Description | | Key | Description |
|---------------------|----------------------------------------------------------------------------------------------------------------------------| |---------------------|----------------------------------------------------------------------------------------------------------------------------|
@ -354,7 +354,7 @@ SENSOR_DATA:
| `[TIMEZONE] [TYPE]` | Only `SINGLE` is supported | | `[TIMEZONE] [TYPE]` | Only `SINGLE` is supported |
| `[TIMEZONE] [VALUE]` | `*timezone` points to the value defined before in [Timezone of your study](#timezone-of-your-study) | | `[TIMEZONE] [VALUE]` | `*timezone` points to the value defined before in [Timezone of your study](#timezone-of-your-study) |
**For `[SENSOR_DATA][FITBIT]`** **For `[DEVICE_DATA][FITBIT]`**
| Key | Description | | Key | Description |
|------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|

View File

@ -20,7 +20,7 @@ This is a quick guide for creating and running a simple pipeline to extract miss
night,00:00:00,5H 59M 59S,every_day,0 night,00:00:00,5H 59M 59S,every_day,0
``` ```
5\. If you collected data with AWARE you won't need to modify the attributes of `[SENSOR_DATA][PHONE]` 5\. If you collected data with AWARE you won't need to modify the attributes of `[DEVICE_DATA][PHONE]`
6\. Set `[PHONE_CALLS][PROVIDERS][RAPIDS][COMPUTE]` to `True` 6\. Set `[PHONE_CALLS][PROVIDERS][RAPIDS][COMPUTE]` to `True`
@ -43,7 +43,7 @@ This is a quick guide for creating and running a simple pipeline to extract miss
INCLUDE_PAST_PERIODIC_SEGMENTS: FALSE INCLUDE_PAST_PERIODIC_SEGMENTS: FALSE
# No need to change this if you collected AWARE data on a database and your credentials are grouped under `MY_GROUP` in `.env` # No need to change this if you collected AWARE data on a database and your credentials are grouped under `MY_GROUP` in `.env`
SENSOR_DATA: DEVICE_DATA:
PHONE: PHONE:
SOURCE: SOURCE:
TYPE: DATABASE TYPE: DATABASE

View File

@ -27,10 +27,10 @@ rule download_phone_data:
input: input:
"data/external/participant_files/{pid}.yaml" "data/external/participant_files/{pid}.yaml"
params: params:
source = config["SENSOR_DATA"]["PHONE"]["SOURCE"], source = config["DEVICE_DATA"]["PHONE"]["SOURCE"],
sensor = "phone_" + "{sensor}", sensor = "phone_" + "{sensor}",
table = lambda wildcards: config["PHONE_" + str(wildcards.sensor).upper()]["TABLE"], table = lambda wildcards: config["PHONE_" + str(wildcards.sensor).upper()]["TABLE"],
timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
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"], 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: output:
"data/raw/{pid}/phone_{sensor}_raw.csv" "data/raw/{pid}/phone_{sensor}_raw.csv"
@ -40,9 +40,9 @@ rule download_phone_data:
rule download_fitbit_data: rule download_fitbit_data:
input: input:
participant_file = "data/external/participant_files/{pid}.yaml", participant_file = "data/external/participant_files/{pid}.yaml",
input_file = [] if config["SENSOR_DATA"]["FITBIT"]["SOURCE"]["TYPE"] == "DATABASE" else lambda wildcards: config["FITBIT_" + str(wildcards.sensor).upper()]["TABLE"]["CSV"][str(wildcards.fitbit_data_type).upper()] input_file = [] if config["DEVICE_DATA"]["FITBIT"]["SOURCE"]["TYPE"] == "DATABASE" else lambda wildcards: config["FITBIT_" + str(wildcards.sensor).upper()]["TABLE"]["CSV"][str(wildcards.fitbit_data_type).upper()]
params: params:
source = config["SENSOR_DATA"]["FITBIT"]["SOURCE"], source = config["DEVICE_DATA"]["FITBIT"]["SOURCE"],
sensor = "fitbit_" + "{sensor}", sensor = "fitbit_" + "{sensor}",
fitbit_data_type = "{fitbit_data_type}", fitbit_data_type = "{fitbit_data_type}",
table = lambda wildcards: config["FITBIT_" + str(wildcards.sensor).upper()]["TABLE"], table = lambda wildcards: config["FITBIT_" + str(wildcards.sensor).upper()]["TABLE"],
@ -69,8 +69,8 @@ rule phone_readable_datetime:
sensor_input = "data/raw/{pid}/phone_{sensor}_raw.csv", sensor_input = "data/raw/{pid}/phone_{sensor}_raw.csv",
day_segments = "data/interim/day_segments/{pid}_day_segments.csv" day_segments = "data/interim/day_segments/{pid}_day_segments.csv"
params: params:
timezones = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["TYPE"], timezones = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["TYPE"],
fixed_timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], fixed_timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
day_segments_type = config["DAY_SEGMENTS"]["TYPE"], day_segments_type = config["DAY_SEGMENTS"]["TYPE"],
include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"] include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
output: output:
@ -137,8 +137,8 @@ rule phone_locations_processed_with_datetime:
sensor_input = "data/interim/{pid}/phone_locations_processed.csv", sensor_input = "data/interim/{pid}/phone_locations_processed.csv",
day_segments = "data/interim/day_segments/{pid}_day_segments.csv" day_segments = "data/interim/day_segments/{pid}_day_segments.csv"
params: params:
timezones = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["TYPE"], timezones = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["TYPE"],
fixed_timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], fixed_timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
day_segments_type = config["DAY_SEGMENTS"]["TYPE"], day_segments_type = config["DAY_SEGMENTS"]["TYPE"],
include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"] include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
output: output:
@ -159,8 +159,8 @@ rule resample_episodes_with_datetime:
sensor_input = "data/interim/{pid}/{sensor}_episodes_resampled.csv", sensor_input = "data/interim/{pid}/{sensor}_episodes_resampled.csv",
day_segments = "data/interim/day_segments/{pid}_day_segments.csv" day_segments = "data/interim/day_segments/{pid}_day_segments.csv"
params: params:
timezones = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["TYPE"], timezones = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["TYPE"],
fixed_timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], fixed_timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
day_segments_type = config["DAY_SEGMENTS"]["TYPE"], day_segments_type = config["DAY_SEGMENTS"]["TYPE"],
include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"] include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
output: output:
@ -185,7 +185,7 @@ rule fitbit_parse_heartrate:
input: input:
data = expand("data/raw/{{pid}}/fitbit_heartrate_{fitbit_data_type}_raw.csv", fitbit_data_type = (["json"] if config["FITBIT_HEARTRATE"]["TABLE_FORMAT"] == "JSON" else ["summary", "intraday"])) data = expand("data/raw/{{pid}}/fitbit_heartrate_{fitbit_data_type}_raw.csv", fitbit_data_type = (["json"] if config["FITBIT_HEARTRATE"]["TABLE_FORMAT"] == "JSON" else ["summary", "intraday"]))
params: params:
timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
table = config["FITBIT_HEARTRATE"]["TABLE"], table = config["FITBIT_HEARTRATE"]["TABLE"],
table_format = config["FITBIT_HEARTRATE"]["TABLE_FORMAT"] table_format = config["FITBIT_HEARTRATE"]["TABLE_FORMAT"]
output: output:
@ -198,7 +198,7 @@ rule fitbit_parse_steps:
input: input:
data = expand("data/raw/{{pid}}/fitbit_steps_{fitbit_data_type}_raw.csv", fitbit_data_type = (["json"] if config["FITBIT_STEPS"]["TABLE_FORMAT"] == "JSON" else ["summary", "intraday"])) data = expand("data/raw/{{pid}}/fitbit_steps_{fitbit_data_type}_raw.csv", fitbit_data_type = (["json"] if config["FITBIT_STEPS"]["TABLE_FORMAT"] == "JSON" else ["summary", "intraday"]))
params: params:
timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
table = config["FITBIT_STEPS"]["TABLE"], table = config["FITBIT_STEPS"]["TABLE"],
table_format = config["FITBIT_STEPS"]["TABLE_FORMAT"] table_format = config["FITBIT_STEPS"]["TABLE_FORMAT"]
output: output:
@ -211,7 +211,7 @@ rule fitbit_parse_calories:
input: 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"])) 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: params:
timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
table = config["FITBIT_CALORIES"]["TABLE"], table = config["FITBIT_CALORIES"]["TABLE"],
table_format = config["FITBIT_CALORIES"]["TABLE_FORMAT"] table_format = config["FITBIT_CALORIES"]["TABLE_FORMAT"]
output: output:
@ -224,7 +224,7 @@ rule fitbit_parse_sleep:
input: input:
data = expand("data/raw/{{pid}}/fitbit_sleep_{fitbit_data_type}_raw.csv", fitbit_data_type = (["json"] if config["FITBIT_SLEEP"]["TABLE_FORMAT"] == "JSON" else ["summary", "intraday"])) data = expand("data/raw/{{pid}}/fitbit_sleep_{fitbit_data_type}_raw.csv", fitbit_data_type = (["json"] if config["FITBIT_SLEEP"]["TABLE_FORMAT"] == "JSON" else ["summary", "intraday"]))
params: params:
timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
table = config["FITBIT_SLEEP"]["TABLE"], table = config["FITBIT_SLEEP"]["TABLE"],
table_format = config["FITBIT_SLEEP"]["TABLE_FORMAT"] table_format = config["FITBIT_SLEEP"]["TABLE_FORMAT"]
output: output:
@ -238,7 +238,7 @@ rule fitbit_readable_datetime:
sensor_input = "data/raw/{pid}/fitbit_{sensor}_{fitbit_data_type}_parsed.csv", sensor_input = "data/raw/{pid}/fitbit_{sensor}_{fitbit_data_type}_parsed.csv",
day_segments = "data/interim/day_segments/{pid}_day_segments.csv" day_segments = "data/interim/day_segments/{pid}_day_segments.csv"
params: params:
fixed_timezone = config["SENSOR_DATA"]["FITBIT"]["TIMEZONE"]["VALUE"], fixed_timezone = config["DEVICE_DATA"]["FITBIT"]["TIMEZONE"]["VALUE"],
day_segments_type = config["DAY_SEGMENTS"]["TYPE"], day_segments_type = config["DAY_SEGMENTS"]["TYPE"],
include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"] include_past_periodic_segments = config["DAY_SEGMENTS"]["INCLUDE_PAST_PERIODIC_SEGMENTS"]
output: output:

View File

@ -66,7 +66,7 @@ rule overall_compliance_heatmap:
pid_files = expand("data/external/{pid}", pid=config["PIDS"]) pid_files = expand("data/external/{pid}", pid=config["PIDS"])
params: params:
only_show_valid_days = config["OVERALL_COMPLIANCE_HEATMAP"]["ONLY_SHOW_VALID_DAYS"], only_show_valid_days = config["OVERALL_COMPLIANCE_HEATMAP"]["ONLY_SHOW_VALID_DAYS"],
local_timezone = config["SENSOR_DATA"]["PHONE"]["TIMEZONE"]["VALUE"], local_timezone = config["DEVICE_DATA"]["PHONE"]["TIMEZONE"]["VALUE"],
expected_num_of_days = config["OVERALL_COMPLIANCE_HEATMAP"]["EXPECTED_NUM_OF_DAYS"], expected_num_of_days = config["OVERALL_COMPLIANCE_HEATMAP"]["EXPECTED_NUM_OF_DAYS"],
bin_size = config["OVERALL_COMPLIANCE_HEATMAP"]["BIN_SIZE"], bin_size = config["OVERALL_COMPLIANCE_HEATMAP"]["BIN_SIZE"],
min_bins_per_hour = "{min_valid_bins_per_hour}" min_bins_per_hour = "{min_valid_bins_per_hour}"

View File

@ -28,7 +28,7 @@ PARTICIPANT_FILES: # run snakemake -j1 -R parse_participant_files
PARSED_FROM: CSV_FILE PARSED_FROM: CSV_FILE
PARSED_SOURCE: "external/my_fitbit_participants.csv" # CSV file should have: device_id, pid (optional), label (optional), start_date (optional), end_date (optional) PARSED_SOURCE: "external/my_fitbit_participants.csv" # CSV file should have: device_id, pid (optional), label (optional), start_date (optional), end_date (optional)
SENSOR_DATA: DEVICE_DATA:
PHONE: PHONE:
SOURCE: SOURCE:
TYPE: DATABASE # Phone only supports DATABASE for now TYPE: DATABASE # Phone only supports DATABASE for now

View File

@ -28,7 +28,7 @@ PARTICIPANT_FILES: # run snakemake -j1 -R parse_participant_files
PARSED_FROM: CSV_FILE PARSED_FROM: CSV_FILE
PARSED_SOURCE: "external/my_fitbit_participants.csv" # CSV file should have: device_id, pid (optional), label (optional), start_date (optional), end_date (optional) PARSED_SOURCE: "external/my_fitbit_participants.csv" # CSV file should have: device_id, pid (optional), label (optional), start_date (optional), end_date (optional)
SENSOR_DATA: DEVICE_DATA:
PHONE: PHONE:
SOURCE: SOURCE:
TYPE: DATABASE # Phone only supports DATABASE for now TYPE: DATABASE # Phone only supports DATABASE for now