diff --git a/README.md b/README.md index 04da5ae1..f887b3a9 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,6 @@ **R**eproducible **A**nalysis **Pi**peline for **D**ata **S**treams -For more information refer to our [documentation](https://www.rapids.science) +For more information refer to our [documentation](http://www.rapids.science) By [MoSHI](https://www.moshi.pitt.edu/), [University of Pittsburgh](https://www.pitt.edu/) diff --git a/Snakefile b/Snakefile index 04882a79..d9ab9c1b 100644 --- a/Snakefile +++ b/Snakefile @@ -100,6 +100,15 @@ for provider in config["PHONE_LIGHT"]["PROVIDERS"].keys(): files_to_compute.extend(expand("data/processed/features/{pid}/all_sensor_features.csv", pid=config["PIDS"])) files_to_compute.append("data/processed/features/all_participants/all_sensor_features.csv") +for provider in config["PHONE_KEYBOARD"]["PROVIDERS"].keys(): + if config["PHONE_KEYBOARD"]["PROVIDERS"][provider]["COMPUTE"]: + files_to_compute.extend(expand("data/raw/{pid}/phone_keyboard_raw.csv", pid=config["PIDS"])) + files_to_compute.extend(expand("data/raw/{pid}/phone_keyboard_with_datetime.csv", pid=config["PIDS"])) + files_to_compute.extend(expand("data/interim/{pid}/phone_keyboard_features/phone_keyboard_{language}_{provider_key}.csv", pid=config["PIDS"], language=config["PHONE_KEYBOARD"]["PROVIDERS"][provider]["SRC_LANGUAGE"].lower(), provider_key=provider.lower())) + files_to_compute.extend(expand("data/processed/features/{pid}/phone_keyboard.csv", pid=config["PIDS"],)) + files_to_compute.extend(expand("data/processed/features/{pid}/all_sensor_features.csv", pid=config["PIDS"])) + files_to_compute.append("data/processed/features/all_participants/all_sensor_features.csv") + for provider in config["PHONE_ACCELEROMETER"]["PROVIDERS"].keys(): if config["PHONE_ACCELEROMETER"]["PROVIDERS"][provider]["COMPUTE"]: files_to_compute.extend(expand("data/raw/{pid}/phone_accelerometer_raw.csv", pid=config["PIDS"])) diff --git a/config.yaml b/config.yaml index 014881b4..dabf5b2c 100644 --- a/config.yaml +++ b/config.yaml @@ -127,6 +127,23 @@ PHONE_BLUETOOTH: FEATURES: ["countscans", "uniquedevices", "countscansmostuniquedevice"] SRC_FOLDER: "rapids" # inside src/features/phone_bluetooth SRC_LANGUAGE: "r" + DORYAB: + COMPUTE: FALSE + FEATURES: + ALL: + DEVICES: ["countscans", "uniquedevices", "meanscans", "stdscans"] + SCANS_MOST_FREQUENT_DEVICE: ["withinsegments", "acrosssegments", "acrossdataset"] + SCANS_LEAST_FREQUENT_DEVICE: ["withinsegments", "acrosssegments", "acrossdataset"] + OWN: + DEVICES: ["countscans", "uniquedevices", "meanscans", "stdscans"] + SCANS_MOST_FREQUENT_DEVICE: ["withinsegments", "acrosssegments", "acrossdataset"] + SCANS_LEAST_FREQUENT_DEVICE: ["withinsegments", "acrosssegments", "acrossdataset"] + OTHERS: + DEVICES: ["countscans", "uniquedevices", "meanscans", "stdscans"] + SCANS_MOST_FREQUENT_DEVICE: ["withinsegments", "acrosssegments", "acrossdataset"] + SCANS_LEAST_FREQUENT_DEVICE: ["withinsegments", "acrosssegments", "acrossdataset"] + SRC_FOLDER: "doryab" # inside src/features/phone_bluetooth + SRC_LANGUAGE: "python" # See https://www.rapids.science/latest/features/phone-calls/ PHONE_CALLS: @@ -172,6 +189,15 @@ PHONE_DATA_YIELD: SRC_LANGUAGE: "r" SRC_FOLDER: "rapids" # inside src/features/phone_data_yield +PHONE_KEYBOARD: + TABLE: keyboard + PROVIDERS: + RAPIDS: + COMPUTE: True + FEATURES: [] + SRC_FOLDER: "rapids" # inside src/features/phone_keyboard + SRC_LANGUAGE: "python" + # See https://www.rapids.science/latest/features/phone-light/ PHONE_LIGHT: TABLE: light diff --git a/docs/change-log.md b/docs/change-log.md index 749be5ef..9a707c0e 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,6 +1,14 @@ # Change Log -## Release in progress +## v0.2.2 +- Fix readme link to docs +## v0.2.1 +- FIx link to the most recent version in the old version banner + +## v0.2.0 +- Add new `PHONE_BLUETOOTH` `DORYAB` provider +- Deprecate `PHONE_BLUETOOTH` `RAPIDS` provider +- Fix bug in `filter_data_by_segment` for Python when dataset was empty - Minor doc updates - New FAQ item diff --git a/docs/citation.md b/docs/citation.md index 30d5988f..94cae21d 100644 --- a/docs/citation.md +++ b/docs/citation.md @@ -28,6 +28,13 @@ If you computed applications foreground features using the app category (genre) !!! cite "Stachl et al. citation" Clemens Stachl, Quay Au, Ramona Schoedel, Samuel D. Gosling, Gabriella M. Harari, Daniel Buschek, Sarah Theres Völkel, Tobias Schuwerk, Michelle Oldemeier, Theresa Ullmann, Heinrich Hussmann, Bernd Bischl, Markus Bühner. Proceedings of the National Academy of Sciences Jul 2020, 117 (30) 17680-17687; DOI: 10.1073/pnas.1920484117 +## Doryab (bluetooth) + +If you computed bluetooth features using the provider `[PHONE_BLUETOOTH][DORYAB]` cite [this paper](https://arxiv.org/abs/1812.10394) in addition to RAPIDS. + +!!! cite "Doryab et al. citation" + Doryab, A., Chikarsel, P., Liu, X., & Dey, A. K. (2019). Extraction of Behavioral Features from Smartphone and Wearable Data. ArXiv:1812.10394 [Cs, Stat]. http://arxiv.org/abs/1812.10394 + ## Barnett (locations) If you computed locations features using the provider `[PHONE_LOCATIONS][BARNETT]` cite [this paper](https://doi.org/10.1093/biostatistics/kxy059) and [this paper](https://doi.org/10.1145/2750858.2805845) in addition to RAPIDS. diff --git a/docs/developers/git-flow.md b/docs/developers/git-flow.md index 0e1ef808..8f75ab08 100644 --- a/docs/developers/git-flow.md +++ b/docs/developers/git-flow.md @@ -15,6 +15,7 @@ git pull git checkout -b feature/feature1 ``` 1. Add, modify or delete the necessary files to add your new feature +1. Update the [change log](../../change-log) (`docs/change-log.md`) 2. Stage and commit your changes using VS Code git GUI or the following commands ```bash git add modified-file1 modified-file2 @@ -29,6 +30,7 @@ git commit -m "Add my new feature" # use a concise description ```bash git checkout feature/feature1 + git pull origin develop git rebase -i develop git checkout develop git merge --no-ff feature/feature1 # (use the default merge message) @@ -88,6 +90,7 @@ git describe --abbrev=0 --tags # Bump the hotfix (0.1.0 to 0.1.1 => NEW_HOTFIX) git checkout -b hotfix/v[NEW_HOTFIX] master ``` 1. Fix whatever needs to be fixed +1. Update the change log 1. Tag and merge the hotfix ```bash git tag v[NEW_HOTFIX] diff --git a/docs/features/phone-bluetooth.md b/docs/features/phone-bluetooth.md index e37b2628..765676e3 100644 --- a/docs/features/phone-bluetooth.md +++ b/docs/features/phone-bluetooth.md @@ -8,6 +8,9 @@ Sensor parameters description for `[PHONE_BLUETOOTH]`: ## RAPIDS provider +!!! warning + The features of this provider are deprecated in favor of `DORYAB` provider (see below). + !!! info "Available time segments and platforms" - Available for all time segments - Available for Android only @@ -33,9 +36,125 @@ Features description for `[PHONE_BLUETOOTH][PROVIDERS][RAPIDS]`: |Feature |Units |Description| |-------------------------- |---------- |---------------------------| -| countscans | devices | Number of scanned devices during a `time_segment`, a device can be detected multiple times over time and these appearances are counted separately | -| uniquedevices | devices | Number of unique devices during a `time_segment` as identified by their hardware (`bt_address`) address | -| countscansmostuniquedevice | scans | Number of scans of the most scanned device during a `time_segment` across the whole monitoring period | +| {--countscans--} | devices | Number of scanned devices during a time segment, a device can be detected multiple times over time and these appearances are counted separately | +| {--uniquedevices--} | devices | Number of unique devices during a time segment as identified by their hardware (`bt_address`) address | +| {--countscansmostuniquedevice--} | scans | Number of scans of the most sensed device within each time segment instance | !!! note "Assumptions/Observations" - NA + - From `v0.2.0` `countscans`, `uniquedevices`, `countscansmostuniquedevice` were deprecated because they overlap with the respective features for `ALL` devices of the `PHONE_BLUETOOTH` `DORYAB` provider + +## DORYAB provider +This provider is adapted from the work by [Doryab et al](../../citation#doryab-bluetooth). + +!!! info "Available time segments and platforms" + - Available for all time segments + - Available for Android only + +!!! info "File Sequence" + ```bash + - data/raw/{pid}/phone_bluetooth_raw.csv + - data/raw/{pid}/phone_bluetooth_with_datetime.csv + - data/interim/{pid}/phone_bluetooth_features/phone_bluetooth_{language}_{provider_key}.csv + - data/processed/features/{pid}/phone_bluetooth.csv" + ``` + + +Parameters description for `[PHONE_BLUETOOTH][PROVIDERS][DORYAB]`: + +|Key | Description | +|----------------|----------------------------------------------------------------------------------------------------------------------------------- +|`[COMPUTE]`| Set to `True` to extract `PHONE_BLUETOOTH` features from the `DORYAB` provider| +|`[FEATURES]` | Features to be computed, see table below. These features are computed for three device categories: `all` devices, `own` devices and `other` devices. + + +Features description for `[PHONE_BLUETOOTH][PROVIDERS][DORYAB]`: + +|Feature |Units |Description| +|-------------------------- |---------- |---------------------------| +| countscans | scans | Number of scans (rows) from the devices sensed during a time segment instance. The more scans a bluetooth device has the longer it remained within range of the participant's phone | +| uniquedevices | devices | Number of unique bluetooth devices sensed during a time segment instance as identified by their hardware addresses (`bt_address`) | +| meanscans | scans| Mean of the scans of every sensed device within each time segment instance| +| stdscans | scans| Standard deviation of the scans of every sensed device within each time segment instance| +| countscans{==most==}frequentdevice{==within==}segments | scans | Number of scans of the **most** sensed device **within** each time segment instance| +| countscans{==least==}frequentdevice{==within==}segments| scans| Number of scans of the **least** sensed device **within** each time segment instance | +| countscans{==most==}frequentdevice{==across==}segments | scans | Number of scans of the **most** sensed device **across** time segment instances of the same type| +| countscans{==least==}frequentdevice{==across==}segments| scans| Number of scans of the **least** sensed device **across** time segment instances of the same type per device| +| countscans{==most==}frequentdevice{==acrossdataset==} | scans | Number of scans of the **most** sensed device **across** the entire dataset of every participant| +| countscans{==least==}frequentdevice{==acrossdataset==}| scans| Number of scans of the **least** sensed device **across** the entire dataset of every participant | + + +!!! note "Assumptions/Observations" + - Devices are classified as belonging to the participant (`own`) or to other people (`others`) using k-means based on the number of times and the number of days each device was detected across each participant's dataset. See [Doryab et al](../../citation#doryab-bluetooth) for more details. + - If ownership cannot be computed because all devices were detected on only one day, they are all considered as `other`. Thus `all` and `other` features will be equal. The likelihood of this scenario decreases the more days of data you have. + - The most and least frequent devices will be the same across time segment instances and across the entire dataset when every time segment instance covers every hour of a dataset. For example, daily segments (00:00 to 23:59) fall in this category but morning segments (06:00am to 11:59am) or periodic 30-minute segments don't. + + ??? info "Example" + + ??? example "Simplified raw bluetooth data" + The following is a simplified example with bluetooth data from three days and two time segments: morning and afternoon. There are two `own` devices: `5C836F5-487E-405F-8E28-21DBD40FA4FF` detected seven times across two days and `499A1EAF-DDF1-4657-986C-EA5032104448` detected eight times on a single day. + ```csv + local_date segment bt_address own_device + 2016-11-29 morning 55C836F5-487E-405F-8E28-21DBD40FA4FF 1 + 2016-11-29 morning 55C836F5-487E-405F-8E28-21DBD40FA4FF 1 + 2016-11-29 morning 55C836F5-487E-405F-8E28-21DBD40FA4FF 1 + 2016-11-29 morning 55C836F5-487E-405F-8E28-21DBD40FA4FF 1 + 2016-11-29 morning 48872A52-68DE-420D-98DA-73339A1C4685 0 + 2016-11-29 afternoon 55C836F5-487E-405F-8E28-21DBD40FA4FF 1 + 2016-11-29 afternoon 48872A52-68DE-420D-98DA-73339A1C4685 0 + 2016-11-30 morning 55C836F5-487E-405F-8E28-21DBD40FA4FF 1 + 2016-11-30 morning 48872A52-68DE-420D-98DA-73339A1C4685 0 + 2016-11-30 morning 25262DC7-780C-4AD5-AD3A-D9776AEF7FC1 0 + 2016-11-30 morning 5B1E6981-2E50-4D9A-99D8-67AED430C5A8 0 + 2016-11-30 morning 5B1E6981-2E50-4D9A-99D8-67AED430C5A8 0 + 2016-11-30 afternoon 55C836F5-487E-405F-8E28-21DBD40FA4FF 1 + 2017-05-07 morning 5C5A9C41-2F68-4CEB-96D0-77DE3729B729 0 + 2017-05-07 morning 25262DC7-780C-4AD5-AD3A-D9776AEF7FC1 0 + 2017-05-07 morning 5B1E6981-2E50-4D9A-99D8-67AED430C5A8 0 + 2017-05-07 morning 6C444841-FE64-4375-BC3F-FA410CDC0AC7 0 + 2017-05-07 morning 4DC7A22D-9F1F-4DEF-8576-086910AABCB5 0 + 2017-05-07 afternoon 5B1E6981-2E50-4D9A-99D8-67AED430C5A8 0 + 2017-05-07 afternoon 499A1EAF-DDF1-4657-986C-EA5032104448 1 + 2017-05-07 afternoon 499A1EAF-DDF1-4657-986C-EA5032104448 1 + 2017-05-07 afternoon 499A1EAF-DDF1-4657-986C-EA5032104448 1 + 2017-05-07 afternoon 499A1EAF-DDF1-4657-986C-EA5032104448 1 + 2017-05-07 afternoon 499A1EAF-DDF1-4657-986C-EA5032104448 1 + 2017-05-07 afternoon 499A1EAF-DDF1-4657-986C-EA5032104448 1 + 2017-05-07 afternoon 499A1EAF-DDF1-4657-986C-EA5032104448 1 + 2017-05-07 afternoon 499A1EAF-DDF1-4657-986C-EA5032104448 1 + ``` + + + + + ??? example "The most and least frequent `OTHER` devices (`own_device == 0`) during morning segments" + The most and least frequent `ALL`|`OWN`|`OTHER` devices are computed within each time segment instance, across time segment instances of the same type and across the entire dataset of each person. These are the most and least frequent devices for `OTHER` devices during morning segments. + ```csv + most frequent device across 2016-11-29 morning: '48872A52-68DE-420D-98DA-73339A1C4685' (this device is the only one in this instance) + least frequent device across 2016-11-29 morning: '48872A52-68DE-420D-98DA-73339A1C4685' (this device is the only one in this instance) + most frequent device across 2016-11-30 morning: '5B1E6981-2E50-4D9A-99D8-67AED430C5A8' + least frequent device across 2016-11-30 morning: '25262DC7-780C-4AD5-AD3A-D9776AEF7FC1' (when tied, the first occurance is chosen) + most frequent device across 2017-05-07 morning: '25262DC7-780C-4AD5-AD3A-D9776AEF7FC1' (when tied, the first occurance is chosen) + least frequent device across 2017-05-07 morning: '25262DC7-780C-4AD5-AD3A-D9776AEF7FC1' (when tied, the first occurance is chosen) + + most frequent across morning segments: '5B1E6981-2E50-4D9A-99D8-67AED430C5A8' + least frequent across morning segments: '6C444841-FE64-4375-BC3F-FA410CDC0AC7' (when tied, the first occurance is chosen) + + most frequent across dataset: '499A1EAF-DDF1-4657-986C-EA5032104448' (only taking into account "morning" segments) + least frequent across dataset: '4DC7A22D-9F1F-4DEF-8576-086910AABCB5' (when tied, the first occurance is chosen) + ``` + + ??? example "Bluetooth features for `OTHER` devices and morning segments" + For brevity we only show the following features for morning segments: + ```yaml + OTHER: + DEVICES: ["countscans", "uniquedevices", "meanscans", "stdscans"] + SCANS_MOST_FREQUENT_DEVICE: ["withinsegments", "acrosssegments", "acrossdataset"] + ``` + + Note that `countscansmostfrequentdeviceacrossdatasetothers` is all `0`s because `499A1EAF-DDF1-4657-986C-EA5032104448` is excluded from the count as is labelled as an `own` device (not `other`). + ```csv + local_segment countscansothers uniquedevicesothers meanscansothers stdscansothers countscansmostfrequentdevicewithinsegmentsothers countscansmostfrequentdeviceacrosssegmentsothers countscansmostfrequentdeviceacrossdatasetothers + 2016-11-29-morning 1 1 1.000000 NaN 1 0.0 0.0 + 2016-11-30-morning 4 3 1.333333 0.57735 2 2.0 2.0 + 2017-05-07-morning 5 5 1.000000 0.00000 1 1.0 1.0 + ``` diff --git a/docs/javascripts/extra.js b/docs/javascripts/extra.js index 10faee99..47b2f759 100644 --- a/docs/javascripts/extra.js +++ b/docs/javascripts/extra.js @@ -8,7 +8,7 @@ window.addEventListener("DOMContentLoaded", function() { if(versions[id]["aliases"].length > 0 && versions[id]["aliases"].includes("latest")) latest_version = "/" + versions[id].version + "/" if(!window.location.pathname.includes("/latest/") && (latest_version.length > 0 && !window.location.pathname.includes(latest_version))) - document.querySelector("div[data-md-component=announce]").innerHTML = "