Skip to content

Data Science Endpoints ( v1 datascience)

KSG edited this page Jan 26, 2015 · 1 revision

GET /pill/{query_date_local_utc}

  • requires access token
  • scope: OAuthScope.SENSORS_BASIC
  • query_date_local_utc is a String for the date format "yyyy-MM-dd"
  • result is a List of TrackerMotion

GET /light/{query_date_local_utc}

get light event data for a particular night, for testing

  • requires access token with scope: OAuthScope.SENSORS_BASIC
  • result is a list of Event

PUT /insights/{category}

generate test insights for a particular category

  • requires access token with scope: OAuthScope.ADMINISTRATION_WRITE
  • currently available categories:
    • 2: light
    • 4: temperature

GET /admin/pill/{email}/{query_date_local_utc}

get motion data for any user

  • requires access token with scope: OAuthScope.ADMINISTRATION_READ

POST /v1/datascience/label

  • requires access token
  • scope: OAuthScope.ADMINISTRATION_WRITE
  • app: admin-data-viewer (10)

Expects Content-Type: application/json as follows:

{
  "email":"[email protected]",
  "night":"2015-01-21",
  "ts_utc": 1422070761000,
  "tz_offset": -28800000,
  "label": "awake"}
  • email: user whose data is being displayed in the admin tool
  • night: the date of the night of sleep
  • ts_utc: timestamp (in utc) that is being displayed on the graph for the selected datapoint
  • tz_offset: timezone offset for the selected datapoint
  • label: the chosen label for the datapoint. Available labels include:
    • 'make_bed'
    • 'went_to_bed'
    • 'fall_asleep',
    • 'awake',
    • 'out_of_bed',
    • 'awake_in_bed',
    • 'sound_disturbance',
    • 'got_up_at_night',
    • 'other_disturbance'

Raw request:

curl -H 'Authorization:Bearer 10.d812154f46e641eeb70386155b977cb6' \
-H 'Content-Type: application/json' \
--data '{"email":"[email protected]", "night":"2015-01-21", 
  "ts_utc": 1422070761000, "tz_offset": -28800000, "label": "awake"}' \
http://0.0.0.0:9999/v1/datascience/label