If you'd like to follow along with this tutorial but don't have a Python development environment set up, consider using Google Collab, a free service from Google Research.
First install the package.
Then, import the library and connect to the server.
Methods native to the LAMP API can now be called to pull data from the platform.
For example, we can find all of the participants belonging to a Researcher:
The code below will make CSV files of all the 'lamp.gps.contextual' sensor events for all participants under a given researcher id:
Query sensor data with "all_by_participant"
Specify a sensor with "origin". If no origin is passed, it will try to query all sensors
Note that due to device or user specification, some spensors may not have data
Accelerometer data points are SensorEvents with the origin "lamp.accelerometer".
See LAMP-py documentation at https://github.com/BIDMCDigitalPsychiatry/LAMP-py for further API details.
Query responses are limtied to 1000 entries. In the event that there are more than 1000 events for a given sensor, the most recent 1000 events are returned. To access more data—or to query during a specific time range—you must use the "_to" and "from" parameters
Surveys are ActivityEvents, with each survey type defined as an Activity
'duration' is the survey completion time, in ms
'activity' is the Activity id
'temporal_slices' contains responses for each survey question
Details of the 'activity can be be viewed the following method