rapids/1.5/setup/configuration/index.html

3063 lines
115 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="canonical" href="https://www.rapids.science/1.5/setup/configuration/">
<link rel="icon" href="../../img/logo.png">
<meta name="generator" content="mkdocs-1.2.2, mkdocs-material-7.1.6+insiders-2.9.1">
<title>Configuration - RAPIDS</title>
<link rel="stylesheet" href="../../assets/stylesheets/main.92048cb8.min.css">
<link rel="stylesheet" href="../../assets/stylesheets/palette.73e53a79.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>:root{--md-text-font-family:"Roboto";--md-code-font-family:"Roboto Mono"}</style>
<link rel="stylesheet" href="../../stylesheets/extra.css">
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="blue" data-md-color-accent="blue">
<script>function __scope(t,e="../.."){return new URL(e,location).pathname+"."+t}function __get(t,e=localStorage,n){return JSON.parse(e.getItem(__scope(t,n)))}function __set(t,e,n=localStorage,o){try{n.setItem(__scope(t,o),JSON.stringify(e))}catch(t){}}</script>
<script>var palette=__get("__palette");if(palette&&"object"==typeof palette.color)for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)</script>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#configuration" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<div data-md-component="outdated" hidden>
<aside class="md-banner md-banner--warning">
<div class="md-banner__inner md-grid md-typeset">
You're not viewing the latest stable version of RAPIDS.
<a href="https://rapids.science/latest">
<strong> Click here to go to latest. </strong>
</a>
</div>
<script>var el=document.querySelector("[data-md-component=outdated]"),outdated=__get("__outdated",sessionStorage);!0===outdated&&el&&(el.hidden=!1)</script>
</aside>
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../.." title="RAPIDS" class="md-header__button md-logo" aria-label="RAPIDS" data-md-component="logo">
<img src="../../img/logo.png" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
RAPIDS
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Configuration
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="blue" data-md-color-accent="blue" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_2" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h10a5 5 0 0 0 5-5 5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3 3 3 0 0 1-3 3z"/></svg>
</label>
<input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="blue" data-md-color-accent="blue" type="radio" name="__palette" id="__palette_2">
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 10a2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2 2 2 0 0 1 2-2m10-3a5 5 0 0 1 5 5 5 5 0 0 1-5 5H7a5 5 0 0 1-5-5 5 5 0 0 1 5-5h10M7 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3h10a3 3 0 0 0 3-3 3 3 0 0 0-3-3H7z"/></svg>
</label>
</form>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</nav>
<div class="md-search__suggest" data-md-component="search-suggest"></div>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/carissalow/rapids/" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
carissalow/rapids
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../.." title="RAPIDS" class="md-nav__button md-logo" aria-label="RAPIDS" data-md-component="logo">
<img src="../../img/logo.png" alt="logo">
</a>
RAPIDS
</label>
<div class="md-nav__source">
<a href="https://github.com/carissalow/rapids/" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
carissalow/rapids
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." class="md-nav__link">
Home
</a>
</li>
<li class="md-nav__item">
<a href="../overview/" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="../../workflow-examples/minimal/" class="md-nav__link">
Minimal Example
</a>
</li>
<li class="md-nav__item">
<a href="../../citation/" class="md-nav__link">
Citation
</a>
</li>
<li class="md-nav__item">
<a href="../../contributing/" class="md-nav__link">
Contributing
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" checked>
<label class="md-nav__link" for="__nav_6">
Setup
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Setup" data-md-level="1">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
Setup
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../installation/" class="md-nav__link">
Installation
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Configuration
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
Configuration
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#supported-data-streams" class="md-nav__link">
Supported data streams
</a>
</li>
<li class="md-nav__item">
<a href="#participant-files" class="md-nav__link">
Participant files
</a>
<nav class="md-nav" aria-label="Participant files">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#structure-of-participants-files" class="md-nav__link">
Structure of participants files
</a>
</li>
<li class="md-nav__item">
<a href="#automatic-creation-of-participant-files" class="md-nav__link">
Automatic creation of participant files
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#time-segments" class="md-nav__link">
Time Segments
</a>
<nav class="md-nav" aria-label="Time Segments">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#segment-examples" class="md-nav__link">
Segment Examples
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#timezone-of-your-study" class="md-nav__link">
Timezone of your study
</a>
<nav class="md-nav" aria-label="Timezone of your study">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#single-timezone" class="md-nav__link">
Single timezone
</a>
</li>
<li class="md-nav__item">
<a href="#multiple-timezones" class="md-nav__link">
Multiple timezones
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#data-stream-configuration" class="md-nav__link">
Data Stream Configuration
</a>
</li>
<li class="md-nav__item">
<a href="#sensor-and-features-to-process" class="md-nav__link">
Sensor and Features to Process
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../execution/" class="md-nav__link">
Execution
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" >
<label class="md-nav__link" for="__nav_7">
Data Streams
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Data Streams" data-md-level="1">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Data Streams
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../datastreams/data-streams-introduction/" class="md-nav__link">
Introduction
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7_2" type="checkbox" id="__nav_7_2" >
<label class="md-nav__link" for="__nav_7_2">
Phone
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Phone" data-md-level="2">
<label class="md-nav__title" for="__nav_7_2">
<span class="md-nav__icon md-icon"></span>
Phone
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../datastreams/aware-mysql/" class="md-nav__link">
aware_mysql
</a>
</li>
<li class="md-nav__item">
<a href="../../datastreams/aware-csv/" class="md-nav__link">
aware_csv
</a>
</li>
<li class="md-nav__item">
<a href="../../datastreams/aware-influxdb/" class="md-nav__link">
aware_influxdb (beta)
</a>
</li>
<li class="md-nav__item">
<a href="../../datastreams/mandatory-phone-format/" class="md-nav__link">
Mandatory Phone Format
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7_3" type="checkbox" id="__nav_7_3" >
<label class="md-nav__link" for="__nav_7_3">
Fitbit
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Fitbit" data-md-level="2">
<label class="md-nav__title" for="__nav_7_3">
<span class="md-nav__icon md-icon"></span>
Fitbit
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../datastreams/fitbitjson-mysql/" class="md-nav__link">
fitbitjson_mysql
</a>
</li>
<li class="md-nav__item">
<a href="../../datastreams/fitbitjson-csv/" class="md-nav__link">
fitbitjson_csv
</a>
</li>
<li class="md-nav__item">
<a href="../../datastreams/fitbitparsed-mysql/" class="md-nav__link">
fitbitparsed_mysql
</a>
</li>
<li class="md-nav__item">
<a href="../../datastreams/fitbitparsed-csv/" class="md-nav__link">
fitbitparsed_csv
</a>
</li>
<li class="md-nav__item">
<a href="../../datastreams/mandatory-fitbit-format/" class="md-nav__link">
Mandatory Fitbit Format
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7_4" type="checkbox" id="__nav_7_4" >
<label class="md-nav__link" for="__nav_7_4">
Empatica
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Empatica" data-md-level="2">
<label class="md-nav__title" for="__nav_7_4">
<span class="md-nav__icon md-icon"></span>
Empatica
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../datastreams/empatica-zip/" class="md-nav__link">
empatica_zip
</a>
</li>
<li class="md-nav__item">
<a href="../../datastreams/mandatory-empatica-format/" class="md-nav__link">
Mandatory Empatica Format
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../datastreams/add-new-data-streams/" class="md-nav__link">
Add New Data Streams
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8" type="checkbox" id="__nav_8" >
<label class="md-nav__link" for="__nav_8">
Behavioral Features
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Behavioral Features" data-md-level="1">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Behavioral Features
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../features/feature-introduction/" class="md-nav__link">
Introduction
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8_2" type="checkbox" id="__nav_8_2" >
<label class="md-nav__link" for="__nav_8_2">
Phone
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Phone" data-md-level="2">
<label class="md-nav__title" for="__nav_8_2">
<span class="md-nav__icon md-icon"></span>
Phone
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../features/phone-accelerometer/" class="md-nav__link">
Phone Accelerometer
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-activity-recognition/" class="md-nav__link">
Phone Activity Recognition
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-applications-crashes/" class="md-nav__link">
Phone Applications Crashes
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-applications-foreground/" class="md-nav__link">
Phone Applications Foreground
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-applications-notifications/" class="md-nav__link">
Phone Applications Notifications
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-battery/" class="md-nav__link">
Phone Battery
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-bluetooth/" class="md-nav__link">
Phone Bluetooth
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-calls/" class="md-nav__link">
Phone Calls
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-conversation/" class="md-nav__link">
Phone Conversation
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-data-yield/" class="md-nav__link">
Phone Data Yield
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-keyboard/" class="md-nav__link">
Phone Keyboard
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-light/" class="md-nav__link">
Phone Light
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-locations/" class="md-nav__link">
Phone Locations
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-log/" class="md-nav__link">
Phone Log
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-messages/" class="md-nav__link">
Phone Messages
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-screen/" class="md-nav__link">
Phone Screen
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-wifi-connected/" class="md-nav__link">
Phone WiFI Connected
</a>
</li>
<li class="md-nav__item">
<a href="../../features/phone-wifi-visible/" class="md-nav__link">
Phone WiFI Visible
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8_3" type="checkbox" id="__nav_8_3" >
<label class="md-nav__link" for="__nav_8_3">
Fitbit
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Fitbit" data-md-level="2">
<label class="md-nav__title" for="__nav_8_3">
<span class="md-nav__icon md-icon"></span>
Fitbit
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../features/fitbit-calories-intraday/" class="md-nav__link">
Fitbit Calories Intraday
</a>
</li>
<li class="md-nav__item">
<a href="../../features/fitbit-data-yield/" class="md-nav__link">
Fitbit Data Yield
</a>
</li>
<li class="md-nav__item">
<a href="../../features/fitbit-heartrate-summary/" class="md-nav__link">
Fitbit Heart Rate Summary
</a>
</li>
<li class="md-nav__item">
<a href="../../features/fitbit-heartrate-intraday/" class="md-nav__link">
Fitbit Heart Rate Intraday
</a>
</li>
<li class="md-nav__item">
<a href="../../features/fitbit-sleep-summary/" class="md-nav__link">
Fitbit Sleep Summary
</a>
</li>
<li class="md-nav__item">
<a href="../../features/fitbit-sleep-intraday/" class="md-nav__link">
Fitbit Sleep Intraday
</a>
</li>
<li class="md-nav__item">
<a href="../../features/fitbit-steps-summary/" class="md-nav__link">
Fitbit Steps Summary
</a>
</li>
<li class="md-nav__item">
<a href="../../features/fitbit-steps-intraday/" class="md-nav__link">
Fitbit Steps Intraday
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8_4" type="checkbox" id="__nav_8_4" >
<label class="md-nav__link" for="__nav_8_4">
Empatica
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Empatica" data-md-level="2">
<label class="md-nav__title" for="__nav_8_4">
<span class="md-nav__icon md-icon"></span>
Empatica
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../features/empatica-accelerometer/" class="md-nav__link">
Empatica Accelerometer
</a>
</li>
<li class="md-nav__item">
<a href="../../features/empatica-heartrate/" class="md-nav__link">
Empatica Heart Rate
</a>
</li>
<li class="md-nav__item">
<a href="../../features/empatica-temperature/" class="md-nav__link">
Empatica Temperature
</a>
</li>
<li class="md-nav__item">
<a href="../../features/empatica-electrodermal-activity/" class="md-nav__link">
Empatica Electrodermal Activity
</a>
</li>
<li class="md-nav__item">
<a href="../../features/empatica-blood-volume-pulse/" class="md-nav__link">
Empatica Blood Volume Pulse
</a>
</li>
<li class="md-nav__item">
<a href="../../features/empatica-inter-beat-interval/" class="md-nav__link">
Empatica Inter Beat Interval
</a>
</li>
<li class="md-nav__item">
<a href="../../features/empatica-tags/" class="md-nav__link">
Empatica Tags
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../features/add-new-features/" class="md-nav__link">
Add New Features
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9" type="checkbox" id="__nav_9" >
<label class="md-nav__link" for="__nav_9">
Visualizations
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Visualizations" data-md-level="1">
<label class="md-nav__title" for="__nav_9">
<span class="md-nav__icon md-icon"></span>
Visualizations
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../visualizations/data-quality-visualizations/" class="md-nav__link">
Data Quality
</a>
</li>
<li class="md-nav__item">
<a href="../../visualizations/feature-visualizations/" class="md-nav__link">
Features
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_10" type="checkbox" id="__nav_10" >
<label class="md-nav__link" for="__nav_10">
Analysis Workflows
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Analysis Workflows" data-md-level="1">
<label class="md-nav__title" for="__nav_10">
<span class="md-nav__icon md-icon"></span>
Analysis Workflows
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../workflow-examples/analysis/" class="md-nav__link">
Complete Example
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_11" type="checkbox" id="__nav_11" >
<label class="md-nav__link" for="__nav_11">
Developers
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Developers" data-md-level="1">
<label class="md-nav__title" for="__nav_11">
<span class="md-nav__icon md-icon"></span>
Developers
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../developers/git-flow/" class="md-nav__link">
Git Flow
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/remote-support/" class="md-nav__link">
Remote Support
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/virtual-environments/" class="md-nav__link">
Virtual Environments
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/documentation/" class="md-nav__link">
Documentation
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/testing/" class="md-nav__link">
Testing
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/test-cases/" class="md-nav__link">
Test cases
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/validation-schema-config/" class="md-nav__link">
Validation schema of config.yaml
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_12" type="checkbox" id="__nav_12" >
<label class="md-nav__link" for="__nav_12">
Others
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Others" data-md-level="1">
<label class="md-nav__title" for="__nav_12">
<span class="md-nav__icon md-icon"></span>
Others
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../migrating-from-old-versions/" class="md-nav__link">
Migrating from an old version
</a>
</li>
<li class="md-nav__item">
<a href="../../code_of_conduct/" class="md-nav__link">
Code of Conduct
</a>
</li>
<li class="md-nav__item">
<a href="../../common-errors/" class="md-nav__link">
Common Errors
</a>
</li>
<li class="md-nav__item">
<a href="../../team/" class="md-nav__link">
Team
</a>
</li>
<li class="md-nav__item">
<a href="../../change-log/" class="md-nav__link">
Change Log
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#supported-data-streams" class="md-nav__link">
Supported data streams
</a>
</li>
<li class="md-nav__item">
<a href="#participant-files" class="md-nav__link">
Participant files
</a>
<nav class="md-nav" aria-label="Participant files">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#structure-of-participants-files" class="md-nav__link">
Structure of participants files
</a>
</li>
<li class="md-nav__item">
<a href="#automatic-creation-of-participant-files" class="md-nav__link">
Automatic creation of participant files
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#time-segments" class="md-nav__link">
Time Segments
</a>
<nav class="md-nav" aria-label="Time Segments">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#segment-examples" class="md-nav__link">
Segment Examples
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#timezone-of-your-study" class="md-nav__link">
Timezone of your study
</a>
<nav class="md-nav" aria-label="Timezone of your study">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#single-timezone" class="md-nav__link">
Single timezone
</a>
</li>
<li class="md-nav__item">
<a href="#multiple-timezones" class="md-nav__link">
Multiple timezones
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#data-stream-configuration" class="md-nav__link">
Data Stream Configuration
</a>
</li>
<li class="md-nav__item">
<a href="#sensor-and-features-to-process" class="md-nav__link">
Sensor and Features to Process
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/carissalow/rapids/edit/master/docs/setup/configuration.md" title="Edit this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
</a>
<h1 id="configuration">Configuration<a class="headerlink" href="#configuration" title="Permanent link">&para;</a></h1>
<p>You need to follow these steps to configure your RAPIDS deployment before you can extract behavioral features.</p>
<ol>
<li>Verify RAPIDS can process your <a href="#supported-data-streams">data streams</a></li>
<li>Create your <a href="#participant-files">participants files</a></li>
<li>Select what <a href="#time-segments">time segments</a> you want to extract features on</li>
<li>Select the <a href="#timezone-of-your-study">timezone of your study</a></li>
<li>Configure your <a href="#data-stream-configuration">data streams</a></li>
<li>Select what <a href="#sensor-and-features-to-process">sensors and features</a> you want to process</li>
</ol>
<p>When you are done with this configuration, go to <a href="../execution">executing RAPIDS</a>.</p>
<div class="admonition hint">
<p class="admonition-title">Hint</p>
<p>Every time you see <code>config["KEY"]</code> or <code>[KEY]</code> in these docs, we are referring to the corresponding key in the <code>config.yaml</code> file.</p>
</div>
<hr />
<h2 id="supported-data-streams">Supported data streams<a class="headerlink" href="#supported-data-streams" title="Permanent link">&para;</a></h2>
<p>A data stream refers to sensor data collected using a specific <strong>device</strong> with a specific <strong>format</strong> and stored in a specific <strong>container</strong>. For example, the <code>aware_mysql</code> data stream handles smartphone data (<strong>device</strong>) collected with the <a href="https://awareframework.com/">AWARE Framework</a> (<strong>format</strong>) stored in a MySQL database (<strong>container</strong>).</p>
<p>Check the table in <a href="../../datastreams/data-streams-introduction">introduction to data streams</a> to know what data streams we support. If your data stream is supported, continue to the next configuration section, <strong>you will use its label later in this guide</strong> (e.g. <code>aware_mysql</code>). If your steam is not supported, but you want to implement it, follow the tutorial to <a href="../../datastreams/add-new-data-streams">add support for new data streams</a> and <a href="https://github.com/carissalow/rapids/discussions">open a new discussion</a> in Github with any questions.</p>
<hr />
<h2 id="participant-files">Participant files<a class="headerlink" href="#participant-files" title="Permanent link">&para;</a></h2>
<p>Participant files link together multiple devices (smartphones and wearables) to specific participants and identify them throughout RAPIDS. You can create these files manually or <a href="#automatic-creation-of-participant-files">automatically</a>. Participant files are stored in <code>data/external/participant_files/pxx.yaml</code> and follow a unified <a href="#structure-of-participants-files">structure</a>.</p>
<details class="important"><summary>Remember to modify the <code>config.yaml</code> file with your PIDS</summary><p>The list <code>PIDS</code> in <code>config.yaml</code> needs to have the participant file names of the people you want to process. For example, if you created <code>p01.yaml</code>, <code>p02.yaml</code> and <code>p03.yaml</code> files in <code>/data/external/participant_files/</code>, then <code>PIDS</code> should be:
<div class="highlight"><pre><span></span><code><span class="nt">PIDS</span><span class="p">:</span> <span class="p p-Indicator">[</span><span class="nv">p01</span><span class="p p-Indicator">,</span> <span class="nv">p02</span><span class="p p-Indicator">,</span> <span class="nv">p03</span><span class="p p-Indicator">]</span>
</code></pre></div></p>
</details>
<details class="info"><summary>Optional: Migrating participants files with the old format</summary><p>If you were using the pre-release version of RAPIDS with participant files in plain text (as opposed to yaml), you could run the following command, and your old files will be converted into yaml files stored in <code>data/external/participant_files/</code></p>
<div class="highlight"><pre><span></span><code>python tools/update_format_participant_files.py
</code></pre></div>
</details>
<h3 id="structure-of-participants-files">Structure of participants files<a class="headerlink" href="#structure-of-participants-files" title="Permanent link">&para;</a></h3>
<details class="example"><summary>Example of the structure of a participant file</summary><p>In this example, the participant used an android phone, an ios phone, a Fitbit device, and an Empatica device throughout the study between April 23<sup>rd</sup>, 2020, and October 28<sup>th</sup>, 2020</p>
<p>If your participants didn&rsquo;t use a <code>[PHONE]</code>, <code>[FITBIT]</code> or <code>[EMPATICA]</code> device, it is not necessary to include that section in their participant file. In other words, you can analyze data from 1 or more devices per participant.</p>
<div class="highlight"><pre><span></span><code><span class="nt">PHONE</span><span class="p">:</span>
<span class="nt">DEVICE_IDS</span><span class="p">:</span> <span class="p p-Indicator">[</span><span class="nv">a748ee1a-1d0b-4ae9-9074-279a2b6ba524</span><span class="p p-Indicator">,</span> <span class="nv">dsadas-2324-fgsf-sdwr-gdfgs4rfsdf43</span><span class="p p-Indicator">]</span>
<span class="nt">PLATFORMS</span><span class="p">:</span> <span class="p p-Indicator">[</span><span class="nv">android</span><span class="p p-Indicator">,</span><span class="nv">ios</span><span class="p p-Indicator">]</span>
<span class="nt">LABEL</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">test01</span>
<span class="nt">START_DATE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">2020-04-23</span>
<span class="nt">END_DATE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">2020-10-28</span>
<span class="nt">FITBIT</span><span class="p">:</span>
<span class="nt">DEVICE_IDS</span><span class="p">:</span> <span class="p p-Indicator">[</span><span class="nv">fitbit1</span><span class="p p-Indicator">]</span>
<span class="nt">LABEL</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">test01</span>
<span class="nt">START_DATE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">2020-04-23</span>
<span class="nt">END_DATE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">2020-10-28</span>
<span class="nt">EMPATICA</span><span class="p">:</span>
<span class="nt">DEVICE_IDS</span><span class="p">:</span> <span class="p p-Indicator">[</span><span class="nv">empatica1</span><span class="p p-Indicator">]</span>
<span class="nt">LABEL</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">test01</span>
<span class="nt">START_DATE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">2020-04-23</span>
<span class="nt">END_DATE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">2020-10-28</span>
</code></pre></div>
</details>
<div class="tabbed-set" data-tabs="1:3"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><label for="__tabbed_1_1">[PHONE]</label><div class="tabbed-content">
<table>
<thead>
<tr>
<th>Key&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[DEVICE_IDS]</code></td>
<td>An array of the strings that uniquely identify each smartphone, you can have more than one for when participants changed phones in the middle of the study.</td>
</tr>
<tr>
<td><code>[PLATFORMS]</code></td>
<td>An array that specifies the OS of each smartphone in <code>[DEVICE_IDS]</code> , use a combination of <code>android</code> or <code>ios</code> (we support participants that changed platforms in the middle of your study!). You can set <code>[PLATFORMS]: [infer]</code>, and RAPIDS will infer them automatically (each phone data stream infer this differently, e.g., <code>aware_mysql</code> uses the <code>aware_device</code> table).</td>
</tr>
<tr>
<td><code>[LABEL]</code></td>
<td>A string that is used in reports and visualizations.</td>
</tr>
<tr>
<td><code>[START_DATE]</code></td>
<td>A string with format <code>YYYY-MM-DD</code> or <code>YYYY-MM-DD HH:MM:SS</code>. Only data collected <em>after</em> this date-time will be included in the analysis. By default, <code>YYYY-MM-DD</code> is interpreted as <code>YYYY-MM-DD 00:00:00</code>.</td>
</tr>
<tr>
<td><code>[END_DATE]</code></td>
<td>A string with format <code>YYYY-MM-DD</code> or <code>YYYY-MM-DD HH:MM:SS</code>. Only data collected <em>before</em> this date-time will be included in the analysis. By default, <code>YYYY-MM-DD</code> is interpreted as <code>YYYY-MM-DD 00:00:00</code>.</td>
</tr>
</tbody>
</table>
</div>
<input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><label for="__tabbed_1_2">[FITBIT]</label><div class="tabbed-content">
<table>
<thead>
<tr>
<th>Key&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[DEVICE_IDS]</code></td>
<td>An array of the strings that uniquely identify each Fitbit, you can have more than one in case the participant changed devices in the middle of the study.</td>
</tr>
<tr>
<td><code>[LABEL]</code></td>
<td>A string that is used in reports and visualizations.</td>
</tr>
<tr>
<td><code>[START_DATE]</code></td>
<td>A string with format <code>YYYY-MM-DD</code> or <code>YYYY-MM-DD HH:MM:SS</code>. Only data collected <em>after</em> this date-time will be included in the analysis. By default, <code>YYYY-MM-DD</code> is interpreted as <code>YYYY-MM-DD 00:00:00</code>.</td>
</tr>
<tr>
<td><code>[END_DATE]</code></td>
<td>A string with format <code>YYYY-MM-DD</code> or <code>YYYY-MM-DD HH:MM:SS</code>. Only data collected <em>before</em> this date-time will be included in the analysis. By default, <code>YYYY-MM-DD</code> is interpreted as <code>YYYY-MM-DD 00:00:00</code>.</td>
</tr>
</tbody>
</table>
</div>
<input id="__tabbed_1_3" name="__tabbed_1" type="radio" /><label for="__tabbed_1_3">[EMPATICA]</label><div class="tabbed-content">
<table>
<thead>
<tr>
<th>Key&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[DEVICE_IDS]</code></td>
<td>An array of the strings that uniquely identify each Empatica device used by this participant. Since the most common use case involves having multiple zip files from a single device for each person, set this device id to an arbitrary string (we usually use their <code>pid</code>)</td>
</tr>
<tr>
<td><code>[LABEL]</code></td>
<td>A string that is used in reports and visualizations.</td>
</tr>
<tr>
<td><code>[START_DATE]</code></td>
<td>A string with format <code>YYYY-MM-DD</code> or <code>YYYY-MM-DD HH:MM:SS</code>. Only data collected <em>after</em> this date-time will be included in the analysis. By default, <code>YYYY-MM-DD</code> is interpreted as <code>YYYY-MM-DD 00:00:00</code>.</td>
</tr>
<tr>
<td><code>[END_DATE]</code></td>
<td>A string with format <code>YYYY-MM-DD</code> or <code>YYYY-MM-DD HH:MM:SS</code>. Only data collected <em>before</em> this date-time will be included in the analysis. By default, <code>YYYY-MM-DD</code> is interpreted as <code>YYYY-MM-DD 00:00:00</code>.</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 id="automatic-creation-of-participant-files">Automatic creation of participant files<a class="headerlink" href="#automatic-creation-of-participant-files" title="Permanent link">&para;</a></h3>
<p>You can use a CSV file with a row per participant to automatically create participant files. </p>
<details><summary><code>AWARE_DEVICE_TABLE</code> was deprecated</summary><p>In previous versions of RAPIDS, you could create participant files automatically using the <code>aware_device</code> table. We deprecated this option, but you can still achieve the same results if you export the output of the following SQL query as a CSV file and follow the instructions below:</p>
<div class="highlight"><pre><span></span><code><span class="k">SELECT</span> <span class="n">device_id</span><span class="p">,</span> <span class="n">device_id</span> <span class="k">as</span> <span class="n">fitbit_id</span><span class="p">,</span> <span class="n">CONCAT</span><span class="p">(</span><span class="ss">&quot;p&quot;</span><span class="p">,</span> <span class="n">_id</span><span class="p">)</span> <span class="k">as</span> <span class="n">empatica_id</span><span class="p">,</span> <span class="n">CONCAT</span><span class="p">(</span><span class="ss">&quot;p&quot;</span><span class="p">,</span> <span class="n">_id</span><span class="p">)</span> <span class="k">as</span> <span class="n">pid</span><span class="p">,</span> <span class="k">if</span><span class="p">(</span><span class="n">brand</span> <span class="o">=</span> <span class="ss">&quot;iPhone&quot;</span><span class="p">,</span> <span class="ss">&quot;ios&quot;</span><span class="p">,</span> <span class="ss">&quot;android&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">platform</span><span class="p">,</span> <span class="n">CONCAT</span><span class="p">(</span><span class="ss">&quot;p&quot;</span><span class="p">,</span> <span class="n">_id</span><span class="p">)</span> <span class="k">as</span> <span class="n">label</span><span class="p">,</span> <span class="n">DATE_FORMAT</span><span class="p">(</span><span class="n">FROM_UNIXTIME</span><span class="p">((</span><span class="k">timestamp</span><span class="o">/</span><span class="mi">1000</span><span class="p">)</span><span class="o">-</span> <span class="mi">86400</span><span class="p">),</span> <span class="ss">&quot;%Y-%m-%d&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">start_date</span><span class="p">,</span> <span class="k">CURRENT_DATE</span> <span class="k">as</span> <span class="n">end_date</span> <span class="k">from</span> <span class="n">aware_device</span> <span class="k">order</span> <span class="k">by</span> <span class="n">_id</span><span class="p">;</span>
</code></pre></div>
</details>
<p>In your <code>config.yaml</code>:</p>
<ol>
<li>Set <code>CSV_FILE_PATH</code> to a CSV file path that complies with the specs described below</li>
<li>Set the devices (<code>PHONE</code>, <code>FITBIT</code>, <code>EMPATICA</code>) <code>[ADD]</code> flag to <code>TRUE</code> depending on what devices you used in your study.</li>
</ol>
<div class="highlight"><pre><span></span><code><span class="nt">CREATE_PARTICIPANT_FILES</span><span class="p">:</span>
<span class="nt">CSV_FILE_PATH</span><span class="p">:</span> <span class="s">&quot;your_path/to_your.csv&quot;</span>
<span class="nt">PHONE_SECTION</span><span class="p">:</span>
<span class="nt">ADD</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">TRUE</span> <span class="c1"># or FALSE</span>
<span class="nt">IGNORED_DEVICE_IDS</span><span class="p">:</span> <span class="p p-Indicator">[]</span>
<span class="nt">FITBIT_SECTION</span><span class="p">:</span>
<span class="nt">ADD</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">TRUE</span> <span class="c1"># or FALSE</span>
<span class="nt">IGNORED_DEVICE_IDS</span><span class="p">:</span> <span class="p p-Indicator">[]</span>
<span class="nt">EMPATICA_SECTION</span><span class="p">:</span>
<span class="nt">ADD</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">TRUE</span> <span class="c1"># or FALSE</span>
<span class="nt">IGNORED_DEVICE_IDS</span><span class="p">:</span> <span class="p p-Indicator">[]</span>
</code></pre></div>
<p>Your CSV file (<code>[CSV_FILE_PATH]</code>) should have the following columns (headers), but the values within each column can be empty:</p>
<table>
<thead>
<tr>
<th>Column</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>device_id</td>
<td>Phone device id. Separate multiple ids with <code>;</code></td>
</tr>
<tr>
<td>fitbit_id</td>
<td>Fitbit device id. Separate multiple ids with <code>;</code></td>
</tr>
<tr>
<td>empatica_id</td>
<td>Empatica device id. Since the most common use case involves having various zip files from a single device for each person, set this device id to an arbitrary string (we usually use their <code>pid</code>)</td>
</tr>
<tr>
<td>pid</td>
<td>Unique identifiers with the format pXXX (your participant files will be named with this string)</td>
</tr>
<tr>
<td>platform</td>
<td>Use <code>android</code>, <code>ios</code> or <code>infer</code> as explained above, separate values with <code>;</code></td>
</tr>
<tr>
<td>label</td>
<td>A human-readable string that is used in reports and visualizations.</td>
</tr>
<tr>
<td>start_date</td>
<td>A string with format <code>YYY-MM-DD</code> or <code>YYYY-MM-DD HH:MM:SS</code>. By default, <code>YYYY-MM-DD</code> is interpreted as <code>YYYY-MM-DD 00:00:00</code>.</td>
</tr>
<tr>
<td>end_date</td>
<td>A string with format <code>YYY-MM-DD</code> or <code>YYYY-MM-DD HH:MM:SS</code>. By default, <code>YYYY-MM-DD</code> is interpreted as <code>YYYY-MM-DD 00:00:00</code>.</td>
</tr>
</tbody>
</table>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p>We added white spaces to this example to make it easy to read, but you don&rsquo;t have to.</p>
<div class="highlight"><pre><span></span><code>device_id ,fitbit_id, empatica_id ,pid ,label ,platform ,start_date ,end_date
a748ee1a-1d0b-4ae9-9074-279a2b6ba524;dsadas-2324-fgsf-sdwr-gdfgs4rfsdf43 ,fitbit1 , p01 ,p01 ,julio ,android;ios ,2020-01-01 ,2021-01-01
4c4cf7a1-0340-44bc-be0f-d5053bf7390c ,fitbit2 , p02 ,p02 ,meng ,ios ,2021-01-01 ,2022-01-01
</code></pre></div>
</div>
<p>Then run </p>
<div class="highlight"><pre><span></span><code>snakemake -j1 create_participants_files
</code></pre></div>
<hr />
<h2 id="time-segments">Time Segments<a class="headerlink" href="#time-segments" title="Permanent link">&para;</a></h2>
<p>Time segments (or epochs) are the time windows on which you want to extract behavioral features. For example, you might want to process data every day, every morning, or only during weekends. RAPIDS offers three categories of time segments that are flexible enough to cover most use cases: <strong>frequency</strong> (short time windows every day), <strong>periodic</strong> (arbitrary time windows on any day), and <strong>event</strong> (arbitrary time windows around events of interest). See also our <a href="#segment-examples">examples</a>.</p>
<div class="tabbed-set" data-tabs="2:3"><input checked="checked" id="__tabbed_2_1" name="__tabbed_2" type="radio" /><label for="__tabbed_2_1">Frequency Segments</label><div class="tabbed-content">
<p>These segments are computed every day, and all have the same duration (for example, 30 minutes). Set the following keys in your <code>config.yaml</code></p>
<div class="highlight"><pre><span></span><code><span class="nt">TIME_SEGMENTS</span><span class="p">:</span> <span class="nl">&amp;time_segments</span>
<span class="nt">TYPE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">FREQUENCY</span>
<span class="nt">FILE</span><span class="p">:</span> <span class="s">&quot;data/external/your_frequency_segments.csv&quot;</span>
<span class="nt">INCLUDE_PAST_PERIODIC_SEGMENTS</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">FALSE</span>
</code></pre></div>
<p>The file pointed by <code>[TIME_SEGMENTS][FILE]</code> should have the following format and only have 1 row.</p>
<table>
<thead>
<tr>
<th>Column</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>label</td>
<td>A string that is used as a prefix in the name of your time segments</td>
</tr>
<tr>
<td>length</td>
<td>An integer representing the duration of your time segments in minutes</td>
</tr>
</tbody>
</table>
<div class="admonition example">
<p class="admonition-title">Example</p>
<div class="highlight"><pre><span></span><code>label,length
thirtyminutes,30
</code></pre></div>
<p>This configuration will compute 48 time segments for every day when any data from any participant was sensed. For example:</p>
<div class="highlight"><pre><span></span><code>start_time,length,label
00:00,30,thirtyminutes0000
00:30,30,thirtyminutes0001
01:00,30,thirtyminutes0002
01:30,30,thirtyminutes0003
...
</code></pre></div>
</div>
</div>
<input id="__tabbed_2_2" name="__tabbed_2" type="radio" /><label for="__tabbed_2_2">Periodic Segments</label><div class="tabbed-content">
<p>These segments can be computed every day or on specific days of the week, month, quarter, and year. Their minimum duration is 1 minute, but they can be as long as you want. Set the following keys in your <code>config.yaml</code>.</p>
<div class="highlight"><pre><span></span><code><span class="nt">TIME_SEGMENTS</span><span class="p">:</span> <span class="nl">&amp;time_segments</span>
<span class="nt">TYPE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">PERIODIC</span>
<span class="nt">FILE</span><span class="p">:</span> <span class="s">&quot;data/external/your_periodic_segments.csv&quot;</span>
<span class="nt">INCLUDE_PAST_PERIODIC_SEGMENTS</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">FALSE</span> <span class="c1"># or TRUE</span>
</code></pre></div>
<p>If <code>[INCLUDE_PAST_PERIODIC_SEGMENTS]</code> is set to <code>TRUE</code>, RAPIDS will consider instances of your segments back enough in the past to include the first row of data of each participant. For example, if the first row of data from a participant happened on Saturday, March 7<sup>th</sup>, 2020, and the requested segment duration is 7 days starting on every Sunday, the first segment to be considered would begin on Sunday, March 1<sup>st</sup> if <code>[INCLUDE_PAST_PERIODIC_SEGMENTS]</code> is <code>TRUE</code> or on Sunday, March 8<sup>th</sup> if <code>FALSE</code>.</p>
<p>The file pointed by <code>[TIME_SEGMENTS][FILE]</code> should have the following format and can have multiple rows.</p>
<table>
<thead>
<tr>
<th>Column</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>label</td>
<td>A string that is used as a prefix in the name of your time segments. It has to be <strong>unique</strong> between rows</td>
</tr>
<tr>
<td>start_time</td>
<td>A string with format <code>HH:MM:SS</code> representing the starting time of this segment on any day</td>
</tr>
<tr>
<td>length</td>
<td>A string representing the length of this segment. It can have one or more of the following strings <strong><code>XXD XXH XXM XXS</code></strong> to represent days, hours, minutes, and seconds. For example, <code>7D 23H 59M 59S</code></td>
</tr>
<tr>
<td>repeats_on</td>
<td>One of the following options <code>every_day</code>, <code>wday</code>, <code>qday</code>, <code>mday</code>, and <code>yday</code>. The last four represent a week, quarter, month, and year day</td>
</tr>
<tr>
<td>repeats_value</td>
<td>An integer complementing <code>repeats_on</code>. If you set <code>repeats_on</code> to <code>every_day</code>, set this to <code>0</code>, otherwise <code>1-7</code> represent a <code>wday</code> starting from Mondays, <code>1-31</code> represent a <code>mday</code>, <code>1-91</code> represent a <code>qday</code>, and <code>1-366</code> represent a <code>yday</code></td>
</tr>
</tbody>
</table>
<div class="admonition example">
<p class="admonition-title">Example</p>
<div class="highlight"><pre><span></span><code>label,start_time,length,repeats_on,repeats_value
daily,00:00:00,23H 59M 59S,every_day,0
morning,06:00:00,5H 59M 59S,every_day,0
afternoon,12:00:00,5H 59M 59S,every_day,0
evening,18:00:00,5H 59M 59S,every_day,0
night,00:00:00,5H 59M 59S,every_day,0
</code></pre></div>
<p>This configuration will create five segment instances (<code>daily</code>, <code>morning</code>, <code>afternoon</code>, <code>evening</code>, <code>night</code>) on any given day (<code>every_day</code> set to 0). The <code>daily</code> segment will start at midnight and last <code>23:59:59</code>; the other four segments will begin at 6am, 12pm, 6pm, and 12am, respectively, and last for <code>05:59:59</code>. </p>
</div>
</div>
<input id="__tabbed_2_3" name="__tabbed_2" type="radio" /><label for="__tabbed_2_3">Event segments</label><div class="tabbed-content">
<p>These segments can be computed before or after an event of interest (defined as any UNIX timestamp). Their minimum duration is 1 minute, but they can be as long as you want. The start of each segment can be shifted backward or forwards from the specified timestamp. Set the following keys in your <code>config.yaml</code>.</p>
<div class="highlight"><pre><span></span><code><span class="nt">TIME_SEGMENTS</span><span class="p">:</span> <span class="nl">&amp;time_segments</span>
<span class="nt">TYPE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">EVENT</span>
<span class="nt">FILE</span><span class="p">:</span> <span class="s">&quot;data/external/your_event_segments.csv&quot;</span>
<span class="nt">INCLUDE_PAST_PERIODIC_SEGMENTS</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">FALSE</span> <span class="c1"># or TRUE</span>
</code></pre></div>
<p>The file pointed by <code>[TIME_SEGMENTS][FILE]</code> should have the following format and can have multiple rows.</p>
<table>
<thead>
<tr>
<th>Column</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>label</td>
<td>A string that is used as a prefix in the name of your time segments. If labels are unique, every segment is independent; if two or more segments have the same label, their data will be grouped when computing auxiliary data for features like the <code>most frequent contact</code> for calls (the most frequent contact will be calculated across all these segments). There cannot be two <em>overlapping</em> event segments with the same label (RAPIDS will throw an error)</td>
</tr>
<tr>
<td>event_timestamp</td>
<td>A UNIX timestamp that represents the moment an event of interest happened (clinical relapse, survey, readmission, etc.). The corresponding time segment will be computed around this moment using <code>length</code>, <code>shift</code>, and <code>shift_direction</code></td>
</tr>
<tr>
<td>length</td>
<td>A string representing the length of this segment. It can have one or more of the following keys <code>XXD XXH XXM XXS</code> to represent days, hours, minutes, and seconds. For example, <code>7D 23H 59M 59S</code></td>
</tr>
<tr>
<td>shift</td>
<td>A string representing the time shift from <code>event_timestamp</code>. It can have one or more of the following keys <code>XXD XXH XXM XXS</code> to represent days, hours, minutes, and seconds. For example, <code>7D 23H 59M 59S</code>. Use this value to change the start of a segment with respect to its <code>event_timestamp</code>. For example, set this variable to <code>1H</code> to create a segment that starts 1 hour from an event of interest (<code>shift_direction</code> determines if it&rsquo;s before or after).</td>
</tr>
<tr>
<td>shift_direction</td>
<td>An integer representing whether the <code>shift</code> is before (<code>-1</code>) or after (<code>1</code>) an <code>event_timestamp</code></td>
</tr>
<tr>
<td>device_id</td>
<td>The device id (smartphone or Fitbit) to whom this segment belongs to. You have to create a line in this event segment file for each event of a participant that you want to analyze. If you have participants with multiple device ids, you can choose any of them</td>
</tr>
</tbody>
</table>
<div class="admonition example">
<p class="admonition-title">Example</p>
<div class="highlight"><pre><span></span><code>label,event_timestamp,length,shift,shift_direction,device_id
stress1,1587661220000,1H,5M,1,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
stress2,1587747620000,4H,4H,-1,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
stress3,1587906020000,3H,5M,1,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
stress4,1584291600000,7H,4H,-1,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
stress5,1588172420000,9H,5M,-1,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
mood,1587661220000,1H,0,0,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
mood,1587747620000,1D,0,0,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
mood,1587906020000,7D,0,0,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
</code></pre></div>
<p>This example will create eight segments for a single participant (<code>a748ee1a...</code>), five independent <code>stressX</code> segments with various lengths (1,4,3,7, and 9 hours). Segments <code>stress1</code>, <code>stress3</code>, and <code>stress5</code> are shifted forwards by 5 minutes, and <code>stress2</code> and <code>stress4</code> are shifted backward by 4 hours (that is, if the <code>stress4</code> event happened on March 15<sup>th</sup> at 1pm EST (<code>1584291600000</code>), the time segment will start on that day at 9am and end at 4pm). </p>
<p>The three <code>mood</code> segments are 1 hour, 1 day, and 7 days long and have no shift. In addition, these <code>mood</code> segments are grouped together, meaning that although RAPIDS will compute features on each one of them, some information for such computation will be extracted from all three segments, for example, the phone contact that called a participant the most, or the location clusters visited by a participant.</p>
</div>
<details class="info"><summary>Date time labels of event segments</summary><p>In the final feature file, you will find a row per event segment. The <code>local_segment</code> column of each row has a <code>label</code>, a start date-time string, and an end date-time string.</p>
<div class="highlight"><pre><span></span><code>weeklysurvey2060#2020-09-12 <span class="m">01</span>:00:00,2020-09-18 <span class="m">23</span>:59:59
</code></pre></div>
<p>All sensor data is always segmented based on timestamps, and the date-time strings are attached for informative purposes. For example, you can plot your features based on these strings. </p>
<p>When you configure RAPIDS to work with a single time zone, such time zone code will be used to convert start/end timestamps (the ones you typed in the event segments file) into start/end date-time strings. However, when you configure RAPIDS to work with multiple time zones, RAPIDS will use the most common time zone across all devices of every participant to do the conversion. The most common time zone is the one in which a participant spent the most time.</p>
<p>In practical terms, this means that the date-time strings of event segments that happened in uncommon time zones will have shifted start/end date-time labels. However, the data within each segment was correctly filtered based on timestamps.</p>
</details>
</div>
</div>
<h3 id="segment-examples">Segment Examples<a class="headerlink" href="#segment-examples" title="Permanent link">&para;</a></h3>
<div class="tabbed-set" data-tabs="3:7"><input checked="checked" id="__tabbed_3_1" name="__tabbed_3" type="radio" /><label for="__tabbed_3_1">5-minutes</label><div class="tabbed-content">
<p>Use the following <code>Frequency</code> segment file to create 288 (12 * 60 * 24) 5-minute segments starting from midnight of every day in your study
<div class="highlight"><pre><span></span><code>label,length
fiveminutes,5
</code></pre></div></p>
</div>
<input id="__tabbed_3_2" name="__tabbed_3" type="radio" /><label for="__tabbed_3_2">Daily</label><div class="tabbed-content">
<p>Use the following <code>Periodic</code> segment file to create daily segments starting from midnight of every day in your study
<div class="highlight"><pre><span></span><code>label,start_time,length,repeats_on,repeats_value
daily,00:00:00,23H 59M 59S,every_day,0
</code></pre></div></p>
</div>
<input id="__tabbed_3_3" name="__tabbed_3" type="radio" /><label for="__tabbed_3_3">Morning</label><div class="tabbed-content">
<p>Use the following <code>Periodic</code> segment file to create morning segments starting at 06:00:00 and ending at 11:59:59 of every day in your study
<div class="highlight"><pre><span></span><code>label,start_time,length,repeats_on,repeats_value
morning,06:00:00,5H 59M 59S,every_day,0
</code></pre></div></p>
</div>
<input id="__tabbed_3_4" name="__tabbed_3" type="radio" /><label for="__tabbed_3_4">Overnight</label><div class="tabbed-content">
<p>Use the following <code>Periodic</code> segment file to create overnight segments starting at 20:00:00 and ending at 07:59:59 (next day) of every day in your study
<div class="highlight"><pre><span></span><code>label,start_time,length,repeats_on,repeats_value
morning,20:00:00,11H 59M 59S,every_day,0
</code></pre></div></p>
</div>
<input id="__tabbed_3_5" name="__tabbed_3" type="radio" /><label for="__tabbed_3_5">Weekly</label><div class="tabbed-content">
<p>Use the following <code>Periodic</code> segment file to create <strong>non-overlapping</strong> weekly segments starting at midnight of every <strong>Monday</strong> in your study
<div class="highlight"><pre><span></span><code>label,start_time,length,repeats_on,repeats_value
weekly,00:00:00,6D 23H 59M 59S,wday,1
</code></pre></div>
Use the following <code>Periodic</code> segment file to create <strong>overlapping</strong> weekly segments starting at midnight of <strong>every day</strong> in your study
<div class="highlight"><pre><span></span><code>label,start_time,length,repeats_on,repeats_value
weekly,00:00:00,6D 23H 59M 59S,every_day,0
</code></pre></div></p>
</div>
<input id="__tabbed_3_6" name="__tabbed_3" type="radio" /><label for="__tabbed_3_6">Week-ends</label><div class="tabbed-content">
<p>Use the following <code>Periodic</code> segment file to create week-end segments starting at midnight of every <strong>Saturday</strong> in your study
<div class="highlight"><pre><span></span><code>label,start_time,length,repeats_on,repeats_value
weekend,00:00:00,1D 23H 59M 59S,wday,6
</code></pre></div></p>
</div>
<input id="__tabbed_3_7" name="__tabbed_3" type="radio" /><label for="__tabbed_3_7">Around surveys</label><div class="tabbed-content">
<p>Use the following <code>Event</code> segment file to create two 2-hour segments that start 1 hour before surveys answered by 3 participants
<div class="highlight"><pre><span></span><code>label,event_timestamp,length,shift,shift_direction,device_id
survey1,1587661220000,2H,1H,-1,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
survey2,1587747620000,2H,1H,-1,a748ee1a-1d0b-4ae9-9074-279a2b6ba524
survey1,1587906020000,2H,1H,-1,rqtertsd-43ff-34fr-3eeg-efe4fergregr
survey2,1584291600000,2H,1H,-1,rqtertsd-43ff-34fr-3eeg-efe4fergregr
survey1,1588172420000,2H,1H,-1,klj34oi2-8frk-2343-21kk-324ljklewlr3
survey2,1584291600000,2H,1H,-1,klj34oi2-8frk-2343-21kk-324ljklewlr3
</code></pre></div></p>
</div>
</div>
<hr />
<h2 id="timezone-of-your-study">Timezone of your study<a class="headerlink" href="#timezone-of-your-study" title="Permanent link">&para;</a></h2>
<h3 id="single-timezone">Single timezone<a class="headerlink" href="#single-timezone" title="Permanent link">&para;</a></h3>
<p>If your study only happened in a single time zone or you want to ignore short trips of your participants to different time zones, select the appropriate code from this <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">list</a> and change the following config key. Double-check your timezone code pick; for example, US Eastern Time is <code>America/New_York</code>, not <code>EST</code>.</p>
<div class="highlight"><pre><span></span><code><span class="nt">TIMEZONE</span><span class="p">:</span>
<span class="nt">TYPE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">SINGLE</span>
<span class="nt">TZCODE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">America/New_York</span>
</code></pre></div>
<h3 id="multiple-timezones">Multiple timezones<a class="headerlink" href="#multiple-timezones" title="Permanent link">&para;</a></h3>
<p>If your participants lived in different time zones or they traveled across time zones, and you know when participants&rsquo; devices were in a specific time zone, RAPIDS can use this data to process your data streams with the correct date-time. You need to provide RAPIDS with the time zone data in a CSV file (<code>[TZCODES_FILE]</code>) in the format described below.</p>
<div class="highlight"><pre><span></span><code><span class="nt">TIMEZONE</span><span class="p">:</span>
<span class="nt">TYPE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MULTIPLE</span>
<span class="nt">SINGLE</span><span class="p">:</span>
<span class="nt">TZCODE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">America/New_York</span>
<span class="nt">MULTIPLE</span><span class="p">:</span>
<span class="nt">TZCODES_FILE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">path_to/time_zones_csv.file</span>
<span class="nt">IF_MISSING_TZCODE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">STOP</span>
<span class="nt">DEFAULT_TZCODE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">America/New_York</span>
<span class="nt">FITBIT</span><span class="p">:</span>
<span class="nt">ALLOW_MULTIPLE_TZ_PER_DEVICE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">False</span>
<span class="nt">INFER_FROM_SMARTPHONE_TZ</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">False</span>
</code></pre></div>
<p>Parameters for <code>[TIMEZONE]</code></p>
<table>
<thead>
<tr>
<th>Parameter &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[TYPE]</code></td>
<td>Either <code>SINGLE</code> or <code>MULTIPLE</code> as explained above</td>
</tr>
<tr>
<td><code>[SINGLE][TZCODE]</code></td>
<td>The time zone code from this <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">list</a> to be used across all devices</td>
</tr>
<tr>
<td><code>[MULTIPLE][TZCODES_FILE]</code></td>
<td>A CSV file containing the time zones in which participants&rsquo; devices sensed data (see the required format below). Multiple devices can be linked to the same person. Read more in <a href="#participant-files">Participants Files</a></td>
</tr>
<tr>
<td><code>[MULTIPLE][IF_MISSING_TZCODE]</code></td>
<td>When a device is missing from <code>[TZCODES_FILE]</code> Set this flag to <code>STOP</code> to stop RAPIDS execution and show an error, or to <code>USE_DEFAULT</code> to assign the time zone specified in <code>[DEFAULT_TZCODE]</code> to any such devices</td>
</tr>
<tr>
<td><code>[MULTIPLE][FITBIT][ALLOW_MULTIPLE_TZ_PER_DEVICE]</code></td>
<td>You only need to care about this flag if one or more Fitbit devices sensed data in one or more time zones, and you want RAPIDS to take into account this in its feature computation. Read more in &ldquo;How does RAPIDS handle Fitbit devices?&rdquo; below.</td>
</tr>
<tr>
<td><code>[MULTIPLE][FITBIT][INFER_FROM_SMARTPHONE_TZ]</code></td>
<td>You only need to care about this flag if one or more Fitbit devices sensed data in one or more time zones, and you want RAPIDS to take into account this in its feature computation. Read more in &ldquo;How does RAPIDS handle Fitbit devices?&rdquo; below.</td>
</tr>
</tbody>
</table>
<details class="info"><summary>Format of <code>TZCODES_FILE</code></summary><p><code>TZCODES_FILE</code> has three columns and a row for each time zone a device visited (a device can be a smartphone or wearable (Fitbit/Empatica)):</p>
<table>
<thead>
<tr>
<th>Column</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>device_id</code></td>
<td>A string that uniquely identifies a smartphone or wearable</td>
</tr>
<tr>
<td><code>tzcode</code></td>
<td>A string with the appropriate code from this <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">list</a> that represents the time zone where the <code>device</code> sensed data</td>
</tr>
<tr>
<td><code>timestamp</code></td>
<td>A UNIX timestamp indicating when was the first time this <code>device_id</code> sensed data in <code>tzcode</code></td>
</tr>
</tbody>
</table>
<div class="highlight"><pre><span></span><code>device_id, tzcode, timestamp
13dbc8a3-dae3-4834-823a-4bc96a7d459d, America/New_York, 1587500000000
13dbc8a3-dae3-4834-823a-4bc96a7d459d, America/Mexico_City, 1587600000000
13dbc8a3-dae3-4834-823a-4bc96a7d459d, America/Los_Angeles, 1587700000000
65sa66a5-2d2d-4524-946v-44ascbv4sad7, Europe/Amsterdam, 1587100000000
65sa66a5-2d2d-4524-946v-44ascbv4sad7, Europe/Berlin, 1587200000000
65sa66a5-2d2d-4524-946v-44ascbv4sad7, Europe/Amsterdam, 1587300000000
</code></pre></div>
<p>Using this file, RAPDIS will create time zone intervals per device, for example for <code>13dbc8a3-dae3-4834-823a-4bc96a7d459d</code>:</p>
<ul>
<li>Interval 1 <code>[1587500000000, 1587599999999]</code> for <code>America/New_York</code></li>
<li>Interval 2 <code>[1587600000000, 1587699999999]</code> for <code>America/Mexico_City</code></li>
<li>Interval 3 <code>[1587700000000, now]</code> for <code>America/Los_Angeles</code></li>
</ul>
<p>Any sensor data row from a device will be assigned a timezone if it falls within that interval, for example:</p>
<ul>
<li>A screen row sensed at <code>1587533333333</code> will be assigned to <code>America/New_York</code> because it falls within Interval 1</li>
<li>A screen row sensed at <code>1587400000000</code> will be discarded because it was logged outside any interval.</li>
</ul>
</details>
<details class="note"><summary>Can I get the <code>TZCODES_FILE</code> from the time zone table collected automatically by the AWARE app?</summary><p>Sure. You can put your timezone table (<code>timezone.csv</code>) collected by the AWARE app under <code>data/external</code> folder and run:
<div class="highlight"><pre><span></span><code>python tools/create_multi_timezones_file.py
</code></pre></div>
The <code>TZCODES_FILE</code> will be saved as <code>data/external/multiple_timezones.csv</code>.</p>
</details>
<details class="note"><summary>What happens if participant X lives in Los Angeles but participant Y lives in Amsterdam and they both stayed there during my study?</summary><p>Add a row per participant and set timestamp to <code>0</code>:
<div class="highlight"><pre><span></span><code>device_id, tzcode, timestamp
13dbc8a3-dae3-4834-823a-4bc96a7d459d, America/Los_Angeles, 0
65sa66a5-2d2d-4524-946v-44ascbv4sad7, Europe/Amsterdam, 0
</code></pre></div></p>
</details>
<details class="note"><summary>What happens if I forget to add a timezone for one or more devices?</summary><p>It depends on <code>[IF_MISSING_TZCODE]</code>. </p>
<p>If <code>[IF_MISSING_TZCODE]</code> is set to <code>STOP</code>, RAPIDS will stop its execution and show you an error message.</p>
<p>If <code>[IF_MISSING_TZCODE]</code> is set to <code>USE_DEFAULT</code>, it will assign the time zone specified in <code>[DEFAULT_TZCODE]</code> to any devices with missing time zone information in <code>[TZCODES_FILE]</code>. This is helpful if only a few of your participants had multiple timezones, and you don&rsquo;t want to specify the same time zone for the rest.</p>
</details>
<details class="note"><summary>How does RAPIDS handle Fitbit devices?</summary><p>Fitbit devices are not time zone aware, and they always log data with a local date-time string. </p>
<ul>
<li>
<p>When none of the Fitbit devices in your study changed time zones (e.g., <code>p01</code> was always in New York and <code>p02</code> was always in Amsterdam), you can set a single time zone per Fitbit device id along with a timestamp of 0 (you can still assign multiple time zones to smartphone device ids)
<div class="highlight"><pre><span></span><code>device_id, tzcode, timestamp
fitbit123, America/New_York, 0
fitbit999, Europe/Amsterdam, 0
</code></pre></div></p>
</li>
<li>
<p>On the other hand, when at least one of your Fitbit devices changed time zones <strong>AND</strong> you want RAPIDS to take into account these changes, you need to set <code>[ALLOW_MULTIPLE_TZ_PER_DEVICE]</code> to <code>True</code>. <strong>You have to manually allow this option because you need to be aware it can produce inaccurate features around the times when time zones changed</strong>. This is because we cannot know precisely when the Fitbit device detected and processed the time zone change.</p>
<p>If you want to <code>ALLOW_MULTIPLE_TZ_PER_DEVICE</code>, you will need to add any time zone changes per device in the <code>TZCODES_FILE</code> as explained above. You could obtain this data by hand, but if your participants also used a smartphone during your study, you can use their time zone logs. Recall that in RAPIDS, every participant is represented with a participant file <code>pXX.yaml</code>, this file links together multiple devices, and we will use it to know what smartphone time zone data should be applied to Fitbit devices. Thus set <code>INFER_FROM_SMARTPHONE_TZ</code> to <code>TRUE</code>, if you have included smartphone time zone data in your <code>TZCODE_FILE</code> and want to make a participant&rsquo;s Fitbit data time zone aware with their respective smartphone data.</p>
</li>
</ul>
</details>
<hr />
<h2 id="data-stream-configuration">Data Stream Configuration<a class="headerlink" href="#data-stream-configuration" title="Permanent link">&para;</a></h2>
<p>Modify the following keys in your <code>config.yaml</code> depending on the <a href="../../datastreams/data-streams-introduction">data stream</a> you want to process.</p>
<div class="tabbed-set" data-tabs="4:3"><input checked="checked" id="__tabbed_4_1" name="__tabbed_4" type="radio" /><label for="__tabbed_4_1">Phone</label><div class="tabbed-content">
<p>Set <code>[PHONE_DATA_STREAMS][TYPE]</code> to the smartphone data stream you want to process (e.g. <code>aware_mysql</code>) and configure its parameters (e.g. <code>[DATABASE_GROUP]</code>). Ignore the parameters of streams you are not using (e.g. <code>[FOLDER]</code> of <code>aware_csv</code>).</p>
<div class="highlight"><pre><span></span><code><span class="nt">PHONE_DATA_STREAMS</span><span class="p">:</span>
<span class="nt">USE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">aware_mysql</span>
<span class="c1"># AVAILABLE:</span>
<span class="nt">aware_mysql</span><span class="p">:</span>
<span class="nt">DATABASE_GROUP</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_GROUP</span>
<span class="nt">aware_csv</span><span class="p">:</span>
<span class="nt">FOLDER</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">data/external/aware_csv</span>
</code></pre></div>
<div class="tabbed-set" data-tabs="5:2"><input checked="checked" id="__tabbed_5_1" name="__tabbed_5" type="radio" /><label for="__tabbed_5_1">aware_mysql</label><div class="tabbed-content">
<table>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[DATABASE_GROUP]</code></td>
<td>A database credentials group. Read the instructions below to set it up</td>
</tr>
</tbody>
</table>
<details class="info"><summary>Setting up a DATABASE_GROUP and its connection credentials.</summary><ol>
<li>
<p>If you haven&rsquo;t done so, create an empty file called <code class="highlight">credentials.yaml</code> in your RAPIDS root directory: </p>
</li>
<li>
<p>Add the following lines to <code>credentials.yaml</code> and replace your database-specific credentials (user, password, host, and database):</p>
<div class="highlight"><pre><span></span><code><span class="nt">MY_GROUP</span><span class="p">:</span>
<span class="nt">database</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_DATABASE</span>
<span class="nt">host</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_HOST</span>
<span class="nt">password</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_PASSWORD</span>
<span class="nt">port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">3306</span>
<span class="nt">user</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_USER</span>
</code></pre></div>
</li>
<li>
<p>Notes</p>
<ol>
<li>
<p>The label <code>[MY_GROUP]</code> is arbitrary but it has to match the <code>[DATABASE_GROUP]</code> attribute of the data stream you choose to use.</p>
</li>
<li>
<p>Indentation matters</p>
</li>
<li>
<p>You can have more than one credentials group in <code>credentials.yaml</code></p>
</li>
</ol>
</li>
</ol>
<details class="hint"><summary>Upgrading from <code>./.env</code> from RAPIDS 0.x</summary><p>In RAPIDS versions 0.x, database credentials were stored in a <code>./.env</code> file. If you are migrating from that type of file, you have two options:</p>
<ol>
<li>
<p>Migrate your credentials by hand:</p>
<div class="tabbed-set" data-tabs="6:2"><input checked="checked" id="__tabbed_6_1" name="__tabbed_6" type="radio" /><label for="__tabbed_6_1">change .env format</label><div class="tabbed-content">
<div class="highlight"><pre><span></span><code><span class="p p-Indicator">[</span><span class="nv">MY_GROUP</span><span class="p p-Indicator">]</span>
<span class="l l-Scalar l-Scalar-Plain">user=MY_USER</span>
<span class="l l-Scalar l-Scalar-Plain">password=MY_PASSWORD</span>
<span class="l l-Scalar l-Scalar-Plain">host=MY_HOST</span>
<span class="l l-Scalar l-Scalar-Plain">port=3306</span>
<span class="l l-Scalar l-Scalar-Plain">database=MY_DATABASE</span>
</code></pre></div>
</div>
<input id="__tabbed_6_2" name="__tabbed_6" type="radio" /><label for="__tabbed_6_2">to credentials.yaml format</label><div class="tabbed-content">
<div class="highlight"><pre><span></span><code><span class="nt">MY_GROUP</span><span class="p">:</span>
<span class="nt">user</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_USER</span>
<span class="nt">password</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_PASSWORD</span>
<span class="nt">host</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_HOST</span>
<span class="nt">port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">3306</span>
<span class="nt">database</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_DATABASE</span>
</code></pre></div>
</div>
</div>
</li>
<li>
<p>Use the migration script we provide (make sure your conda environment is active):</p>
<div class="highlight"><pre><span></span><code><span class="n">python</span> <span class="n">tools</span><span class="o">/</span><span class="n">update_format_env</span><span class="o">.</span><span class="n">py</span>
</code></pre></div>
</li>
</ol>
</details>
<details class="hint"><summary>Connecting to localhost (host machine) from inside our docker container.</summary><p>If you are using RAPIDS&rsquo; docker container and Docker-for-mac or Docker-for-Windows 18.03+, you can connect to a MySQL database in your host machine using <code>host.docker.internal</code> instead of <code>127.0.0.1</code> or <code>localhost</code>. In a Linux host, you need to run our docker container using <code>docker run --network="host" -d moshiresearch/rapids:latest</code> and then <code>127.0.0.1</code> will point to your host machine.</p>
</details>
</details>
</div>
<input id="__tabbed_5_2" name="__tabbed_5" type="radio" /><label for="__tabbed_5_2">aware_csv</label><div class="tabbed-content">
<table>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[FOLDER]</code></td>
<td>Folder where you have to place a CSV file <strong>per</strong> phone sensor. Each file has to contain all the data from every participant you want to process.</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<input id="__tabbed_4_2" name="__tabbed_4" type="radio" /><label for="__tabbed_4_2">Fitbit</label><div class="tabbed-content">
<p>Set <code>[FITBIT_DATA_STREAMS][TYPE]</code> to the Fitbit data stream you want to process (e.g. <code>fitbitjson_mysql</code>) and configure its parameters (e.g. <code>[DATABASE_GROUP]</code>). Ignore the parameters of the other streams you are not using (e.g. <code>[FOLDER]</code> of <code>aware_csv</code>).</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>You will probably have to tell RAPIDS the name of the columns where you stored your Fitbit data. To do this, modify your chosen stream&rsquo;s <code>format.yaml</code> column mappings to match your raw data column names.</p>
</div>
<div class="highlight"><pre><span></span><code><span class="nt">FITBIT_DATA_STREAMS</span><span class="p">:</span>
<span class="nt">USE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">fitbitjson_mysql</span>
<span class="c1"># AVAILABLE:</span>
<span class="nt">fitbitjson_mysql</span><span class="p">:</span>
<span class="nt">DATABASE_GROUP</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_GROUP</span>
<span class="nt">SLEEP_SUMMARY_LAST_NIGHT_END</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">660</span>
<span class="nt">fitbitjson_csv</span><span class="p">:</span>
<span class="nt">FOLDER</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">data/external/fitbit_csv</span>
<span class="nt">SLEEP_SUMMARY_LAST_NIGHT_END</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">660</span>
<span class="nt">fitbitparsed_mysql</span><span class="p">:</span>
<span class="nt">DATABASE_GROUP</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_GROUP</span>
<span class="nt">SLEEP_SUMMARY_LAST_NIGHT_END</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">660</span>
<span class="nt">fitbitparsed_csv</span><span class="p">:</span>
<span class="nt">FOLDER</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">data/external/fitbit_csv</span>
<span class="nt">SLEEP_SUMMARY_LAST_NIGHT_END</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">660</span>
</code></pre></div>
<div class="tabbed-set" data-tabs="7:4"><input checked="checked" id="__tabbed_7_1" name="__tabbed_7" type="radio" /><label for="__tabbed_7_1">fitbitjson_mysql</label><div class="tabbed-content">
<p>This data stream processes Fitbit data inside a JSON column obtained from the Fitbit API and stored in a MySQL database. Read more about its column mappings and mutations in <a href="../../datastreams/fitbitjson-mysql#format"><code>fitbitjson_mysql</code></a>.</p>
<table>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[DATABASE_GROUP]</code></td>
<td>A database credentials group. Read the instructions below to set it up</td>
</tr>
<tr>
<td><code>[SLEEP_SUMMARY_LAST_NIGHT_END]</code></td>
<td>Segments are assigned based on this parameter. Any sleep episodes that start between today&rsquo;s SLEEP_SUMMARY_LAST_NIGHT_END (LNE) and tomorrow&rsquo;s LNE are regarded as today&rsquo;s sleep episodes. While today&rsquo;s bedtime is based on today&rsquo;s sleep episodes, today&rsquo;s wake time is based on yesterday&rsquo;s sleep episodes.</td>
</tr>
</tbody>
</table>
<details class="info"><summary>Setting up a DATABASE_GROUP and its connection credentials.</summary><ol>
<li>
<p>If you haven&rsquo;t done so, create an empty file called <code class="highlight">credentials.yaml</code> in your RAPIDS root directory: </p>
</li>
<li>
<p>Add the following lines to <code>credentials.yaml</code> and replace your database-specific credentials (user, password, host, and database):</p>
<div class="highlight"><pre><span></span><code><span class="nt">MY_GROUP</span><span class="p">:</span>
<span class="nt">database</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_DATABASE</span>
<span class="nt">host</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_HOST</span>
<span class="nt">password</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_PASSWORD</span>
<span class="nt">port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">3306</span>
<span class="nt">user</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_USER</span>
</code></pre></div>
</li>
<li>
<p>Notes</p>
<ol>
<li>
<p>The label <code>[MY_GROUP]</code> is arbitrary but it has to match the <code>[DATABASE_GROUP]</code> attribute of the data stream you choose to use.</p>
</li>
<li>
<p>Indentation matters</p>
</li>
<li>
<p>You can have more than one credentials group in <code>credentials.yaml</code></p>
</li>
</ol>
</li>
</ol>
<details class="hint"><summary>Upgrading from <code>./.env</code> from RAPIDS 0.x</summary><p>In RAPIDS versions 0.x, database credentials were stored in a <code>./.env</code> file. If you are migrating from that type of file, you have two options:</p>
<ol>
<li>
<p>Migrate your credentials by hand:</p>
<div class="tabbed-set" data-tabs="8:2"><input checked="checked" id="__tabbed_8_1" name="__tabbed_8" type="radio" /><label for="__tabbed_8_1">change .env format</label><div class="tabbed-content">
<div class="highlight"><pre><span></span><code><span class="p p-Indicator">[</span><span class="nv">MY_GROUP</span><span class="p p-Indicator">]</span>
<span class="l l-Scalar l-Scalar-Plain">user=MY_USER</span>
<span class="l l-Scalar l-Scalar-Plain">password=MY_PASSWORD</span>
<span class="l l-Scalar l-Scalar-Plain">host=MY_HOST</span>
<span class="l l-Scalar l-Scalar-Plain">port=3306</span>
<span class="l l-Scalar l-Scalar-Plain">database=MY_DATABASE</span>
</code></pre></div>
</div>
<input id="__tabbed_8_2" name="__tabbed_8" type="radio" /><label for="__tabbed_8_2">to credentials.yaml format</label><div class="tabbed-content">
<div class="highlight"><pre><span></span><code><span class="nt">MY_GROUP</span><span class="p">:</span>
<span class="nt">user</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_USER</span>
<span class="nt">password</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_PASSWORD</span>
<span class="nt">host</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_HOST</span>
<span class="nt">port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">3306</span>
<span class="nt">database</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_DATABASE</span>
</code></pre></div>
</div>
</div>
</li>
<li>
<p>Use the migration script we provide (make sure your conda environment is active):</p>
<div class="highlight"><pre><span></span><code><span class="n">python</span> <span class="n">tools</span><span class="o">/</span><span class="n">update_format_env</span><span class="o">.</span><span class="n">py</span>
</code></pre></div>
</li>
</ol>
</details>
<details class="hint"><summary>Connecting to localhost (host machine) from inside our docker container.</summary><p>If you are using RAPIDS&rsquo; docker container and Docker-for-mac or Docker-for-Windows 18.03+, you can connect to a MySQL database in your host machine using <code>host.docker.internal</code> instead of <code>127.0.0.1</code> or <code>localhost</code>. In a Linux host, you need to run our docker container using <code>docker run --network="host" -d moshiresearch/rapids:latest</code> and then <code>127.0.0.1</code> will point to your host machine.</p>
</details>
</details>
</div>
<input id="__tabbed_7_2" name="__tabbed_7" type="radio" /><label for="__tabbed_7_2">fitbitjson_csv</label><div class="tabbed-content">
<p>This data stream processes Fitbit data inside a JSON column obtained from the Fitbit API and stored in a CSV file. Read more about its column mappings and mutations in <a href="../../datastreams/fitbitjson-csv#format"><code>fitbitjson_csv</code></a>.</p>
<table>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[FOLDER]</code></td>
<td>Folder where you have to place a CSV file <strong>per</strong> Fitbit sensor. Each file has to contain all the data from every participant you want to process.</td>
</tr>
<tr>
<td><code>[SLEEP_SUMMARY_LAST_NIGHT_END]</code></td>
<td>Segments are assigned based on this parameter. Any sleep episodes that start between today&rsquo;s SLEEP_SUMMARY_LAST_NIGHT_END (LNE) and tomorrow&rsquo;s LNE are regarded as today&rsquo;s sleep episodes. While today&rsquo;s bedtime is based on today&rsquo;s sleep episodes, today&rsquo;s wake time is based on yesterday&rsquo;s sleep episodes.</td>
</tr>
</tbody>
</table>
</div>
<input id="__tabbed_7_3" name="__tabbed_7" type="radio" /><label for="__tabbed_7_3">fitbitparsed_mysql</label><div class="tabbed-content">
<p>This data stream process Fitbit data stored in multiple columns after being parsed from the JSON column returned by Fitbit API and stored in a MySQL database. Read more about its column mappings and mutations in <a href="../../datastreams/fitbitparsed-mysql#format"><code>fitbitparsed_mysql</code></a>.</p>
<table>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[DATABASE_GROUP]</code></td>
<td>A database credentials group. Read the instructions below to set it up</td>
</tr>
<tr>
<td><code>[SLEEP_SUMMARY_LAST_NIGHT_END]</code></td>
<td>Segments are assigned based on this parameter. Any sleep episodes that start between today&rsquo;s SLEEP_SUMMARY_LAST_NIGHT_END (LNE) and tomorrow&rsquo;s LNE are regarded as today&rsquo;s sleep episodes. While today&rsquo;s bedtime is based on today&rsquo;s sleep episodes, today&rsquo;s wake time is based on yesterday&rsquo;s sleep episodes.</td>
</tr>
</tbody>
</table>
<details class="info"><summary>Setting up a DATABASE_GROUP and its connection credentials.</summary><ol>
<li>
<p>If you haven&rsquo;t done so, create an empty file called <code class="highlight">credentials.yaml</code> in your RAPIDS root directory: </p>
</li>
<li>
<p>Add the following lines to <code>credentials.yaml</code> and replace your database-specific credentials (user, password, host, and database):</p>
<div class="highlight"><pre><span></span><code><span class="nt">MY_GROUP</span><span class="p">:</span>
<span class="nt">database</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_DATABASE</span>
<span class="nt">host</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_HOST</span>
<span class="nt">password</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_PASSWORD</span>
<span class="nt">port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">3306</span>
<span class="nt">user</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_USER</span>
</code></pre></div>
</li>
<li>
<p>Notes</p>
<ol>
<li>
<p>The label <code>[MY_GROUP]</code> is arbitrary but it has to match the <code>[DATABASE_GROUP]</code> attribute of the data stream you choose to use.</p>
</li>
<li>
<p>Indentation matters</p>
</li>
<li>
<p>You can have more than one credentials group in <code>credentials.yaml</code></p>
</li>
</ol>
</li>
</ol>
<details class="hint"><summary>Upgrading from <code>./.env</code> from RAPIDS 0.x</summary><p>In RAPIDS versions 0.x, database credentials were stored in a <code>./.env</code> file. If you are migrating from that type of file, you have two options:</p>
<ol>
<li>
<p>Migrate your credentials by hand:</p>
<div class="tabbed-set" data-tabs="9:2"><input checked="checked" id="__tabbed_9_1" name="__tabbed_9" type="radio" /><label for="__tabbed_9_1">change .env format</label><div class="tabbed-content">
<div class="highlight"><pre><span></span><code><span class="p p-Indicator">[</span><span class="nv">MY_GROUP</span><span class="p p-Indicator">]</span>
<span class="l l-Scalar l-Scalar-Plain">user=MY_USER</span>
<span class="l l-Scalar l-Scalar-Plain">password=MY_PASSWORD</span>
<span class="l l-Scalar l-Scalar-Plain">host=MY_HOST</span>
<span class="l l-Scalar l-Scalar-Plain">port=3306</span>
<span class="l l-Scalar l-Scalar-Plain">database=MY_DATABASE</span>
</code></pre></div>
</div>
<input id="__tabbed_9_2" name="__tabbed_9" type="radio" /><label for="__tabbed_9_2">to credentials.yaml format</label><div class="tabbed-content">
<div class="highlight"><pre><span></span><code><span class="nt">MY_GROUP</span><span class="p">:</span>
<span class="nt">user</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_USER</span>
<span class="nt">password</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_PASSWORD</span>
<span class="nt">host</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_HOST</span>
<span class="nt">port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">3306</span>
<span class="nt">database</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">MY_DATABASE</span>
</code></pre></div>
</div>
</div>
</li>
<li>
<p>Use the migration script we provide (make sure your conda environment is active):</p>
<div class="highlight"><pre><span></span><code><span class="n">python</span> <span class="n">tools</span><span class="o">/</span><span class="n">update_format_env</span><span class="o">.</span><span class="n">py</span>
</code></pre></div>
</li>
</ol>
</details>
<details class="hint"><summary>Connecting to localhost (host machine) from inside our docker container.</summary><p>If you are using RAPIDS&rsquo; docker container and Docker-for-mac or Docker-for-Windows 18.03+, you can connect to a MySQL database in your host machine using <code>host.docker.internal</code> instead of <code>127.0.0.1</code> or <code>localhost</code>. In a Linux host, you need to run our docker container using <code>docker run --network="host" -d moshiresearch/rapids:latest</code> and then <code>127.0.0.1</code> will point to your host machine.</p>
</details>
</details>
</div>
<input id="__tabbed_7_4" name="__tabbed_7" type="radio" /><label for="__tabbed_7_4">fitbitparsed_csv</label><div class="tabbed-content">
<p>This data stream process Fitbit data stored in multiple columns (plain text) after being parsed from the JSON column returned by Fitbit API and stored in a CSV file. Read more about its column mappings and mutations in <a href="../../datastreams/fitbitparsed-csv#format"><code>fitbitparsed_csv</code></a>.</p>
<table>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[FOLDER]</code></td>
<td>Folder where you have to place a CSV file <strong>per</strong> Fitbit sensor. Each file has to contain all the data from every participant you want to process.</td>
</tr>
<tr>
<td><code>[SLEEP_SUMMARY_LAST_NIGHT_END]</code></td>
<td>Segments are assigned based on this parameter. Any sleep episodes that start between today&rsquo;s SLEEP_SUMMARY_LAST_NIGHT_END (LNE) and tomorrow&rsquo;s LNE are regarded as today&rsquo;s sleep episodes. While today&rsquo;s bedtime is based on today&rsquo;s sleep episodes, today&rsquo;s wake time is based on yesterday&rsquo;s sleep episodes.</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<input id="__tabbed_4_3" name="__tabbed_4" type="radio" /><label for="__tabbed_4_3">Empatica</label><div class="tabbed-content">
<p>Set <code>[USE]</code> to the Empatica data stream you want to use; see the table in <a href="../../datastreams/data-streams-introduction">introduction to data streams</a>. Configure any parameters as indicated below.</p>
<div class="highlight"><pre><span></span><code><span class="nt">EMPATICA_DATA_STREAMS</span><span class="p">:</span>
<span class="nt">USE</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">empatica_zip</span>
<span class="c1"># AVAILABLE:</span>
<span class="nt">empatica_zip</span><span class="p">:</span>
<span class="nt">FOLDER</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">data/external/empatica</span>
</code></pre></div>
<div class="tabbed-set" data-tabs="10:1"><input checked="checked" id="__tabbed_10_1" name="__tabbed_10" type="radio" /><label for="__tabbed_10_1">empatica_zip</label><div class="tabbed-content">
<table>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>[FOLDER]</code></td>
<td>The relative path to a folder containing one subfolder per participant. The name of a participant folder should match their device_id assigned in their participant file. Each participant folder can have one or more zip files with any name; in other words, the sensor data in those zip files belong to a single participant. The zip files are <a href="https://support.empatica.com/hc/en-us/articles/201608896-Data-export-and-formatting-from-E4-connect-">automatically</a> generated by Empatica and have a CSV file per sensor (<code>ACC</code>, <code>HR</code>, <code>TEMP</code>, <code>EDA</code>, <code>BVP</code>, <code>TAGS</code>). All CSV files of the same type contained in one or more zip files are uncompressed, parsed, sorted by timestamp, and joined together.</td>
</tr>
</tbody>
</table>
<details class="example"><summary>Example of an EMPATICA FOLDER</summary><p>In the file tree below, we want to process three participants&rsquo; data: <code>p01</code>, <code>p02</code>, and <code>p03</code>. <code>p01</code> has two zip files, <code>p02</code> has only one zip file, and <code>p03</code> has three zip files. Each zip has a CSV file per sensor that is joined together and processed by RAPIDS.</p>
<div class="highlight"><pre><span></span><code>data/ <span class="c1"># this folder exists in the root RAPIDS folder</span>
external/
empatica/
p01/
file1.zip
file2.zip
p02/
aaaa.zip
p03/
t1.zip
t2.zip
t3.zip
</code></pre></div>
</details>
</div>
</div>
</div>
</div>
<hr />
<h2 id="sensor-and-features-to-process">Sensor and Features to Process<a class="headerlink" href="#sensor-and-features-to-process" title="Permanent link">&para;</a></h2>
<p>Finally, you need to modify the <code>config.yaml</code> section of the sensors you want to extract behavioral features from. All sensors follow the same naming nomenclature (<code>DEVICE_SENSOR</code>) and parameter structure which we explain in the <a href="../../features/feature-introduction/">Behavioral Features Introduction</a>. </p>
<div class="admonition done">
<p class="admonition-title">Done</p>
<p>Head over to <a href="../execution/">Execution</a> to learn how to execute RAPIDS.</p>
</div>
<!-- Add custom comment system integration here -->
<!-- Utterances integration -->
<h2 id="__comments">Comments</h2>
<script type="text/javascript">
var rapids_utterances_theme = false
document.onreadystatechange = function () {
if (document.readyState == "interactive") {
// wait for utterances to load and send it's first message.
addEventListener('message', event => {
if (event.origin !== 'https://utteranc.es' || rapids_utterances_theme == true) {
return;
}
rapids_utterances_theme = true
if(document.body.getAttribute("data-md-color-scheme") == "default")
document.querySelector("iframe.utterances-frame").contentWindow.postMessage({ type: "set-theme", theme: "github-light" },"https://utteranc.es/")
else
document.querySelector("iframe.utterances-frame").contentWindow.postMessage({ type: "set-theme", theme: "photon-dark" },"https://utteranc.es/")
});
document.getElementById('__palette_1').onclick = function(){
document.querySelector("iframe.utterances-frame").contentWindow.postMessage({ type: "set-theme", theme: "github-light" },"https://utteranc.es/")
}
document.getElementById('__palette_2').onclick = function(){
document.querySelector("iframe.utterances-frame").contentWindow.postMessage({ type: "set-theme", theme: "photon-dark" },"https://utteranc.es/")
}
}
}
</script>
<script src="https://utteranc.es/client.js"
repo="carissalow/rapids"
issue-term="pathname"
label="docs comments"
theme="github-light"
crossorigin="anonymous"
async>
</script>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<nav class="md-footer__inner md-grid" aria-label="Footer">
<a href="../installation/" class="md-footer__link md-footer__link--prev" rel="prev">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div>
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Previous
</span>
Installation
</div>
</div>
</a>
<a href="../execution/" class="md-footer__link md-footer__link--next" rel="next">
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Next
</span>
Execution
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
Released under AGPL
</div>
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs Insiders
</a>
</div>
<div class="md-footer-social">
<a href="https://twitter.com/RAPIDS_Science" target="_blank" rel="noopener" title="twitter.com" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg>
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "../..", "features": ["navigation.sections", "search.suggest", "search.highlight"], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing"}, "search": "../../assets/javascripts/workers/search.df8cae7d.min.js", "version": {"provider": "mike"}}</script>
<script src="../../assets/javascripts/bundle.0c4ae912.min.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</body>
</html>