Skip to content

B. Sampling Data Formats

Jakob E. Bardram edited this page Aug 16, 2021 · 27 revisions

This page describes the CARP data format for the data being sampled, i.e. the dk.cachet.carp namespace and how it looks in JSON.

Note that all timestamps in CAMS is in UTC (zulu) time following this format: 2019-01-21T19:59:40.437443Z

DataPoint

In general, a CARP DataPoint consists of two parts; a header and a body. For example, a dk.cachet.carp.location json data object would look like:

{
 "carp_header":{
  "study_id":"18aa6750-f494-11eb-a614-d9cf1100a924",
  "device_role_name":"masterphone",
  "trigger_id":"2",
  "user_id":"41b93331-c13c-4bae-801f-d1667fc5dcca",
  "start_time":"2021-08-03T19:51:42.002620Z",
  "data_format":{
   "namespace":"dk.cachet.carp",
   "name":"location"
  }
 },
 "carp_body":{
  "id":"39626920-f494-11eb-a614-d9cf1100a924",
  "time":"2021-08-03T19:51:43.999Z",
  "latitude":55.7943675,
  "longitude":12.4462652,
  "altitude":81.73887167361109,
  "accuracy":13.515999794006348,
  "speed":0.00003816556272795424,
  "speed_accuracy":0.44027945399284363,
  "heading":254.6099395751953
 }
}

DataPoint Header

The DataPointHeader contains meta-information for each data point. This includes:

  • study_id - the id of the study, typically the study deployment id.
  • device_role_name - the role name of the master device which collected this data point.
  • trigger_id - the id of the trigger in the study protocol that triggered the sampling of this data point.
  • user_id - the user id that this data point belongs to (note that this might be different from who uploaded the data)
  • start_time - the (start) timestamp of this data point.
  • end_time - the end timestamp, if this data point covers a time period.
  • data_format - the format of this data point - e.g. dk.cachet.carp.location.

DataPoint Body Formats

All data point body format are of the type Datum. Each datum always have a unique UUID (id) and a timestamp (timestamp) in UTC time format.

carp.accelerometer

Accelerometer data are reported as a MultiDatum and hence returns a list of AccelerometerDatum.

"body":{  
   "id":"169ba2f0-0b50-11e9-85bc-73acf4045ef9",
   "timestamp":"2019-01-21T19:59:40.700676Z",
   "data":[  
      {  
         "timestamp":"2019-01-21T19:59:41.624280Z",
         "x":1.3982137441635132,
         "y":6.97430944442749,
         "z":6.8378400802612305
      },
      {  
         "timestamp":"2019-01-21T19:59:41.624587Z",
         "x":1.3024457693099976,
         "y":6.950367450714111,
         "z":7.062894821166992
      },
      {  
         "timestamp":"2019-01-21T19:59:41.624699Z",
         "x":1.2090718746185303,
         "y":7.015010833740234,
         "z":6.710947513580322
      }
   ]
}

carp.gyroscope

Gyroscope data are reported as a MultiDatum and hence returns a list of GyroscopeDatum.

"body":{  
   "id":"185bf090-0b50-11e9-e418-f709bd0e06a9",
   "timestamp":"2019-01-21T19:59:43.640638Z",
   "data":[  
      {  
         "timestamp":"2019-01-21T19:59:43.641656Z",
         "x":-0.039706241339445114,
         "y":0.04092797264456749,
         "z":0.03848451003432274
      },
      {  
         "timestamp":"2019-01-21T19:59:43.641746Z",
         "x":0.08429940044879913,
         "y":-0.08368854224681854,
         "z":0.08124507963657379
      }
   ]
}

carp.pedometer

PedometerDatum

"body":{  
   "id":"b5d1b7d0-0b50-11e9-bbec-a1bdb411d91a",
   "timestamp":"2019-01-21T21:01:23.785896Z",
   "step_count":10131
}

carp.light

LightDatum

"body":{  
   "id":"da01a250-0b50-11e9-964e-e99b40033314",
   "timestamp":"2019-01-21T21:02:24.499780Z",
   "mean_lux":10.0,
   "std_lux":0.0,
   "min_lux":10,
   "max_lux":10
}

carp.device

DeviceDatum

"body":{  
   "id":"b593eb80-0b50-11e9-f578-d166c3ba5f3b",
   "timestamp":"2019-01-21T21:01:23.365699Z",
   "platform":"Android",
   "device_id":"R16NW",
   "hardware":"samsungexynos7870",
   "device_name":"a3y17lte",
   "device_manufacturer":"samsung",
   "device_model":"SM-A320FL",
   "operating_system":""
}

carp.battery

BatteryDatum

"body":{  
   "id":"1b2808e0-0b50-11e9-981f-cbd4cfcb7638",
   "timestamp":"2019-01-21T19:59:48.333966Z",
   "battery_level":60,
   "battery_status":"charging"
}

carp.screen

ScreenDatum

"body":{  
   "id":"cad20a80-0b50-11e9-e0e6-5588a66a9c01",
   "timestamp":"2019-01-21T21:09:08.520178Z",
   "screen_event":"SCREEN_OFF"
}

carp.memory

FreeMemoryDatum

"body":{  
   "id":"d3b91800-0b50-11e9-e90a-cd9dbffc94c8",
   "timestamp":"2019-01-21T21:09:23.455748Z",
   "free_physical_memory":80412672,
   "free_virtual_memory":1306255360
}

carp.location

LocationDatum

"body":{  
   "id":"162dc5f0-0b50-11e9-dca5-d7e8cedf9560",
   "timestamp":"2019-01-21T19:59:39.979340Z",
   "latitude":55.7837952,
   "longitude":12.5181839,
   "altitude":0.0,
   "accuracy":33.340999603271484,
   "speed":0.0
}

carp.geofence

"body":{  
  "id": "81b95900-5970-11e9-ff4f-bd7f37ca2b09",
  "timestamp": "2019-04-29T11:18:25.679758Z",
  "name": "DTU",
  "type": "ENTER"
}

carp.connectivity

ConnectivityDatum

"body":{  
   "id":"162ba310-0b50-11e9-84b1-f1e86774c60c",
   "timestamp":"2019-01-21T19:59:39.963692Z",
   "connectivity_status":"wifi"
}

carp.bluetooth

BluetoothDatum

"body":{  
   "id":"16984790-0b50-11e9-9b86-27fd69181bda",
   "timestamp":"2019-01-21T19:59:40.680530Z",
   "scan_result":[
     {"advertisement_name":"",
      "bluetooth_device_id":"62:3E:D2:2B:F3:4D",
      "bluetooth_device_name":"",
      "bluetooth_device_type":"unknown",
      "connectable":true,
      "rssi":-37
     },
     {"advertisement_name":"eSense-0332",
      "bluetooth_device_id":"00:04:79:00:0D:04",
      "bluetooth_device_name":"eSense-0332",
      "bluetooth_device_type":"dual",
      "connectable":true,
      "rssi":-34
     }
   ]
}

carp.apps

carp.app_usage

carp.audio

AudioDatum

carp.noise

NoiseDatum

"body":{  
   "id":"dabf4d00-0b50-11e9-f6ae-df91cec3f4e8",
   "timestamp":"2019-01-21T21:02:25.743592Z",
   "mean_decibel":43.24516129032258,
   "std_decibel":11.845424833669513,
   "min_decibel":0,
   "max_decibel":90
}

carp.activity

ActivityDatum

"body":{  
   "id":"16733360-0b50-11e9-d9ea-3b7d72eb49cf",
   "timestamp":"2019-01-21T19:59:40.437443Z",
   "confidence":100,
   "type":"STILL"
}

carp.phone_log

carp.telephony

carp.text_message_log

carp.text_message

carp.calendar

"body":{
  "id":"bd1c69d0-5970-11e9-aac4-2dc2f5f59293",
  "timestamp":"2019-05-08T19:23:20.173255Z",
  "calendar_events":[           
     {"event_id":"327",
      "calendar_id":"2", 
      "title":"Jakob", 
      "description":"", 
      "start":"2019-04-30T17:00:00.000Z", 
      "end":"2019-04-30T18:00:00.000Z", 
      "all_day":false, 
      "location":"", 
      "attendees":[]
     },
     {"event_id":"279", 
      "calendar_id":"2", 
      "title":"Work out", 
      "description":"This event was added from Goals in Google Calendar. Changes made to it here may not be saved. Use the Google Calendar app to edit and view Goal details.", 
      "start":"2019-05-05T16:00:00.000Z", 
      "end":"2019-05-05T16:15:00.000Z", 
      "all_day":false, 
      "location":"", 
      "attendees":[""]
     }
   ]
}

Clone this wiki locally