rapids/docs/usage/installation.rst

167 lines
6.0 KiB
ReStructuredText
Raw Normal View History

.. _install-page:
2019-12-12 00:29:57 +01:00
Installation
===============
2020-05-18 18:21:21 +02:00
These instructions have been tested on macOS (Catalina and Mojave) and Ubuntu 16.04. If you find a problem, please create a GitHub issue or contact us.
2019-12-12 00:29:57 +01:00
2020-03-06 22:46:25 +01:00
macOS (tested on Catalina 10.15)
--------------------------------
2019-12-12 00:29:57 +01:00
2020-05-18 18:32:34 +02:00
#. Install dependencies (Homebrew if not installed):
- Install brew_ for Mac: ``/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"``
2019-12-18 23:13:37 +01:00
#. Install MySQL
2019-12-12 00:29:57 +01:00
2019-12-18 23:13:37 +01:00
- ``brew install mysql``
- ``brew services start mysql``
2019-12-12 00:29:57 +01:00
2020-05-18 18:21:21 +02:00
#. Install R and pandoc:
2019-12-12 00:29:57 +01:00
2019-12-18 23:13:37 +01:00
- ``brew install r``
- ``brew install pandoc``
2019-12-12 00:29:57 +01:00
2019-12-18 23:13:37 +01:00
#. Install miniconda:
2020-02-06 22:43:38 +01:00
2019-12-18 23:13:37 +01:00
- ``brew cask install miniconda``
- ``conda init zsh`` or ``conda init bash``
- Restart terminal if necessary
2019-12-18 21:23:58 +01:00
2019-12-18 23:13:37 +01:00
#. Clone our repo:
2019-12-12 00:29:57 +01:00
2020-02-06 22:43:38 +01:00
- ``git clone https://github.com/carissalow/rapids``
2019-12-12 00:29:57 +01:00
2019-12-18 23:13:37 +01:00
#. Create a python virtual environment:
2019-12-12 00:29:57 +01:00
- ``cd rapids``
2020-03-06 22:46:25 +01:00
- ``conda env create -f environment.yml -n rapids``
- ``conda activate rapids``
2019-12-12 00:29:57 +01:00
#. Install R packages and virtual environment:
2019-12-12 00:29:57 +01:00
2020-05-04 16:28:58 +02:00
- ``snakemake renv_install``
- ``snakemake renv_init``
- ``snakemake renv_restore``
2020-05-18 18:21:21 +02:00
- This step could take several minutes to complete. Please be patient and let it run until completion.
2019-12-12 00:29:57 +01:00
2020-03-06 22:46:25 +01:00
#. See Usage section below.
2019-12-18 23:13:37 +01:00
Linux (tested on Ubuntu 16.04)
------------------------------
2020-05-18 18:32:34 +02:00
#. Install dependencies (Homebrew - if not installed):
2020-02-06 22:43:38 +01:00
- ``sudo apt-get install libmariadb-client-lgpl-dev libxml2-dev libssl-dev``
- Install brew_ for linux and add the following line to ~/.bashrc: ``export PATH=$HOME/.linuxbrew/bin:$PATH``
- ``source ~/.bashrc``
2019-12-18 23:13:37 +01:00
#. Install MySQL
- ``brew install mysql``
- ``brew services start mysql``
#. Install R, pandoc and rmarkdown:
- ``brew install r``
- ``brew install gcc@6`` (needed due to this bug_)
- ``HOMEBREW_CC=gcc-6 brew install pandoc``
#. Install miniconda using these instructions_
#. Clone our repo:
2020-02-06 22:43:38 +01:00
- ``git clone https://github.com/carissalow/rapids``
2019-12-18 23:13:37 +01:00
#. Create a python virtual environment:
- ``cd rapids``
2019-12-18 23:13:37 +01:00
- ``conda env create -f environment.yml -n MY_ENV_NAME``
- ``conda activate MY_ENV_NAME``
#. Install R packages and virtual environment:
2019-12-18 23:13:37 +01:00
2020-05-04 16:28:58 +02:00
- ``snakemake renv_install``
- ``snakemake renv_init``
- ``snakemake renv_restore``
2020-05-18 18:21:21 +02:00
- This step could take several minutes to complete. Please be patient and let it run until completion.
2020-03-06 22:46:25 +01:00
#. See Usage section below.
2019-12-18 23:13:37 +01:00
2020-03-06 22:46:25 +01:00
Usage
======
2020-05-18 18:21:21 +02:00
Once RAPIDS is installed, follow these steps to start processing mobile data.
2019-12-18 23:13:37 +01:00
.. _db-configuration:
2019-12-18 23:13:37 +01:00
2020-03-06 22:46:25 +01:00
#. Configure the database connection:
- Create an empty file called `.env` in the root directory (``rapids/``)
2020-05-18 18:32:34 +02:00
- Add the following lines and replace your database-specific credentials (user, password, host, and database):
.. code-block:: bash
[MY_GROUP]
2020-05-18 18:21:21 +02:00
user=MY_USER
password=MY_PASSWORD
host=MY_HOST
port=3306
2020-05-18 18:21:21 +02:00
database=MY_DATABASE
.. note::
2020-05-18 18:21:21 +02:00
``MY_GROUP`` is a custom label for your credentials. It has to match ``DATABASE_GROUP`` in the ``config.yaml`` file_. It is not related to your database configuration.
2020-05-18 18:21:21 +02:00
#. Setup the participants' devices whose data you want to analyze:
2020-05-18 18:32:34 +02:00
- **Automatically**. You can automatically include all devices that are stored in the ``aware_device`` table. If you want to control what devices and dates are included, see the Manual configuration::
2020-05-18 18:21:21 +02:00
snakemake -j1 download_participants
2020-05-18 18:32:34 +02:00
- **Manually**. Create one file per participant in the ``rapids/data/external/`` directory. The file should NOT have an extension (i.e., no .txt). The name of the file will become the label for that participant in the pipeline.
- The first line of the file should be the Aware ``device_id`` for that participant. If one participant has multiple device_ids (i.e. Aware had to be re-installed), add all device_ids separated by commas.
- The second line should list the device's operating system (``android`` or ``ios``)
2020-05-18 18:32:34 +02:00
- The third line is an optional human-friendly label that will appear in any plots for that participant.
- The fourth line is optional and contains a start and end date separated by a comma ``YYYYMMDD,YYYYMMDD`` (e.g., ``20201301,20202505``). If these dates are specified, only data within this range will be processed, otherwise, all data from the device(s) will be used.
2020-05-18 18:32:34 +02:00
For example, let's say participant `p01` had two AWARE device_ids and they were running Android between February 1st 2020 and March 3rd 2020. Their participant file would be named ``p01`` and contain:
.. code-block:: bash
3a7b0d0a-a9ce-4059-ab98-93a7b189da8a,44f20139-50cc-4b13-bdde-0d5a3889e8f9
android
Participant01
2020/02/01,2020/03/03
#. Configure the sensors to process:
2020-05-18 18:21:21 +02:00
- The variable ``SENSORS`` in the ``config.yaml`` file_ should match existent sensor tables in your Aware database (See :ref:`rapids-structure` for more information). Each sensor in this list will be processed in RAPIDS.
2020-05-18 18:32:34 +02:00
.. note::
2019-12-18 23:13:37 +01:00
It is beneficial to list all collected sensors even if you don't plan to include them in a model later on in the pipeline. This is because we use all data available to estimate whether the phone was sensing data or not (i.e. to know if Aware crashed or the battery died). See :ref:`PHONE_VALID_SENSED_DAYS<phone-valid-sensed-days>` for more information.
#. Execute RAPIDS
2020-05-04 16:30:17 +02:00
- Standard execution over a single core::
2020-05-04 16:30:17 +02:00
snakemake -j1
- Standard execution over multiple cores::
2020-03-06 22:46:25 +01:00
2020-05-04 16:30:17 +02:00
snakemake -j8
- Force a rule (useful if you modify your code and want to update its results)::
2020-05-04 16:30:17 +02:00
snakemake -j1 -R RULE_NAME
2019-12-18 23:13:37 +01:00
.. _bug: https://github.com/Homebrew/linuxbrew-core/issues/17812
.. _instructions: https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html
.. _brew: https://docs.brew.sh/Homebrew-on-Linux
.. _AWARE: https://awareframework.com/what-is-aware/
2020-03-27 16:59:18 +01:00
.. _file: https://github.com/carissalow/rapids/blob/master/config.yaml#L22