Metadata-Version: 2.1
Name: lamp-cortex
Version: 2021.5.21
Summary: The Cortex data analysis toolkit for the LAMP Platform.
Home-page: https://docs.lamp.digital
License: BSD-3-Clause
Keywords: LAMP Cortex
Author: Division of Digital Psychiatry at Beth Israel Deaconess Medical Center
Author-email: team@digitalpsych.org
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: DateTime (>=4.3,<5.0)
Requires-Dist: LAMP-core (>=2021.5.18,<2022.0.0)
Requires-Dist: altair (>=4.1.0,<5.0.0)
Requires-Dist: compress-pickle (>=2.0.1,<3.0.0)
Requires-Dist: fastdtw (>=0.3.4,<0.4.0)
Requires-Dist: geopy (>=2.1.0,<3.0.0)
Requires-Dist: numpy (>=1.20.3,<2.0.0)
Requires-Dist: pandas (>=1.2.4,<2.0.0)
Requires-Dist: pytz (>=2021.1,<2022.0)
Requires-Dist: pyyaml (>=5.4.1,<6.0.0)
Requires-Dist: similaritymeasures (>=0.4.4,<0.5.0)
Requires-Dist: sklearn (>=0.0,<0.1)
Requires-Dist: tzwhere (>=3.0.3,<4.0.0)
Project-URL: Bug Tracker, https://github.com/BIDMCDigitalPsychiatry/LAMP-platform/issues
Project-URL: Documentation, https://docs.lamp.digital
Project-URL: Repository, https://github.com/BIDMCDigitalPsychiatry/LAMP-cortex
Description-Content-Type: text/markdown

# Cortex data analysis pipeline for the LAMP Platform.

## Overview

This API client is used to process and featurize data collected in LAMP. [Visit our documentation for more information about the LAMP Platform.](https://docs.lamp.digital/)

## Installation
### Prerequisites

Python 3.4+ and `pip`. 
  - You may need root permissions, using `sudo`.
  - Alternatively, to install locally, use `pip --user`.
  - If `pip` is not recognized as a command, use `python3 -m pip`.

### Installation

```sh
pip install git+https://github.com/BIDMCDigitalPsychiatry/LAMP-cortex.git@master
```

Alternatively, instead of `pip install`, you may need to use `python3 -m pip install --user`.

### Configuration

Ensure your `server_address` is set correctly. If using the default server, it will be `api.lamp.digital`. Keep your `access_key` (sometimes an email address) and `secret_key` (sometimes a password) private and do not share them with others. While you are able to set these parameters as arguments to the `cortex` executable, it is preferred to set them as session-wide environment variables. You can also run the script from the command line:

```bash
LAMP_SERVER_ADDRESS=api.lamp.digital LAMP_ACCESS_KEY=XXX LAMP_SECRET_KEY=XXX python3 -m \
  cortex significant_locations \
    --id=U26468383 \
    --start=1583532346000 \
    --end=1583618746000 \
    --k_max=9
```

Or another example using the CLI arguments instead of environment variables (and outputting to a file):

```bash
python3 -m \
  cortex --format=csv --server-address=api.lamp.digital --access-key=XXX --secret-key=XXX \
    survey --id=U26468383 --start=1583532346000 --end=1583618746000 \
    2>/dev/null 1>./my_cortex_output.csv
```

### Example

```python
# environment variables must already contain LAMP configuration info
from pprint import pprint
from cortex import all_features, significant_locations, trips
pprint(all_features())
for i in range(1583532346000, 1585363115000, 86400000):
    pprint(significant_locations(id="U26468383", start=i, end=i + 86400000))
```

