Utility that exports and saves your Basis B1 device's uploaded sensor data. You can learn more about Basis at http://www.mybasis.com/
In order to use this script, you must already have a Basis account (and a Basis B1 band).
This script can be run several ways. You can (and should probably) first edit the BASIS_USERNAME
, BASIS_PASSWORD
, and BASIS_EXPORT_FORMAT
values under "Settings" in the file basisdataexport.php
so you don't have to specify those values every time the script is run. Make sure the data/
folder is writable!
- Open a terminal window and cd to this script's directory
- Type
php basisdataexport.php
- Follow the prompts (hit ENTER to use default values)
- Your data will be saved to
/data/basis-data-[YYYY-MM-DD].[format]
Usage php basisdataexport.php -h -u[username] -p[pass] -d[YYYY-MM-DD] -f[json|csv|html]
Options:
-u Basis username (if not used, defaults to BASIS_USERNAME)
-p Basis password (if not used, defaults to BASIS_PASSWORD)
-d Data export date (YYYY-MM-DD) (if not used, defaults to current date)
-f Data export format (json|csv|html) (if not used, defaults to json)
-h Show this help text
Make sure there are no spaces between any flags and values!
This requires that the scripts are in a location that is executable via a web server.
http://localhost/basis-data-export/basisdataexport.php?u=[basis_username]&p=[basis_password]&d=[YYYY-MM-DD]&f=[format]
If the script runs successfully, your data will be saved in the data/
folder. Files are saved in the format basis-data-[YYYY-MM-DD].[format]
(i.e., basis-data-2014-04-04.json
).
That's it! (for now).
Basis currently returns the following data points. They will represent an average (for heart rate) or sum (steps) over the previous 1-minute period:
- Time - time reading was taken
- Heart Rate - beats per minute
- Steps - number of steps taken
- Calories - number of calories burned
- GSR - Galvanic skin response (i.e., sweat/skin conductivity. Learn more about GSR here - http://en.wikipedia.org/wiki/Skin_conductance
- Skin Temperature - skin temperature (degrees F)
- Air Temperature - air temperatute (degrees F)
There are some other aggregate metrics included in the reponse such as min/max/average/standard deviation metrics for each set of data.
-
You can set up a cron to run once per day to automatically grab your previous day's data (assuming you are syncing your device each day)
-
If you want to archive data across a date range you can use curl's [ ] syntax to do it easily (thanks to @Edrabbit for the tip!). For example, to get all of May cached in /data:
curl http://localhost/basis-data-export/basisdataexport.php?date=2013-05-[01-31]