Skip to content

A. Measure Types

Jakob E. Bardram edited this page Apr 23, 2024 · 98 revisions

This page contains an overview of the measure types available in sampling packages; both packages that are are built-in to the carp_mobile_sensing framework, as well as the external ones. This list is constantly evolving as we release more and more support.

Measure Type Format

The dataType of a Measure specify what type of data to collect. This string version of this DataType is typically on the "namespace" + "name" format, where the namespace typically is dk.cachet.carp and the name is the measure type:

  dk.cachet.carp.<type>

The type is specified in the tables below.

Event-based vs. One-Time Measures

Most measures are event-based (EB), i.e., once triggered they continuously sample data from its sensor. For example, collecting a step count event every time a step is detected on the phone. However, some measures are one-time (OT), i.e. sampling one piece of data when triggered. For example, collecting location data.

It is important to know the type (EB vs. OT) of a measure since an event-based measure can be started and run until stopped, whereas a one-time measure needs to be triggered in order to sample data. This can, for example, be done periodically using appropriate triggers, like the PeriodicTrigger.

The difference when specifying the study protocol is illustrated below. The first task added to the protocol contains a one-time measure (device info) which is triggered only once. The second task contains a set of event-based measures that are triggered to start immediately and keep sampling data based on events. The third task collects location (one-time measure) periodically every 5 minutes.

  // Collect device info only once, when this study is deployed.
  protocol.addTaskControl(
    OneTimeTrigger(),
    BackgroundTask(
        measures: [Measure(type: DeviceSamplingPackage.DEVICE_INFORMATION)]),
    phone,
  );

  // Immediately start collecting step count, ambient light, screen activity, and
  // battery level events. Alle event-based measures.
  protocol.addTaskControl(
    ImmediateTrigger(),
    BackgroundTask(measures: [
      Measure(type: SensorSamplingPackage.STEP_COUNT),
      Measure(type: SensorSamplingPackage.AMBIENT_LIGHT),
      Measure(type: DeviceSamplingPackage.SCREEN_EVENT),
      Measure(type: DeviceSamplingPackage.BATTERY_STATE),
    ]),
    phone,
  );

  // Add a background task that collects location regularly
  protocol.addTaskControl(
    PeriodicTrigger(period: Duration(minutes: 5)),
    BackgroundTask(measures: [
      (Measure(type: ContextSamplingPackage.CURRENT_LOCATION)),
    ]),
    locationService);

Each SamplingPackage provides a list of what types of measures it supports using the dataTypes property. Each sampling package also comes with a default sampling schema for each of its measure types (if needed).

Available Measure Types

CAMS comes with a large set of predefined measure types, each available in different sampling packages. Some measures are part of CAMS, others are available in separate sampling packages, and some are part of device-specific sampling packages.

The tables below describe for each measure:

  • Type Name - all type names are of the format dk.cachet.carp.<type>, where type is listed below
  • Availability on Android and/or iOS
  • The sampling package containing the measure
  • Type of measure - event-based or one-time
  • The Data type collected from this measure
  • A description

Built-in Sampling Packages

Type Android iOS Package OT/EB Data Description
acceleration + + sensors EB Acceleration Rate of change in velocity in x, y, z - including gravity.
nongravitational acceleration + + sensors EB Acceleration Rate of change in velocity in x, y, z, - excluding gravity,.
acceleration features + + sensors EB Acceleration Features Acceleration events over a specific sampling period and calculates higher-order features.
rotation + + sensors EB Rotation Rotation of the device in x, y, z (typically measured by a gyroscope).
magneticfield + + sensors EB MagneticField Magnetic field around the device in x,y,z (typically measured by a magnetometer).
stepcount + + sensors EB StepCount Step count events since last system reboot from the device on-board sensor.
ambientlight + - sensors EB AmbientLight Ambient light from the phone's front light sensor.
device information + + device OT Device Information Basic device information.
batterystate + + device EB BatteryState  Battery charging status and battery level.
screenevent + - device EB ScreenEvent Screen events (on/off/unlock).
freememory + - device EB FreeMemory Free memory.
timezone + + device OT Timezone Timezone of the device.

External Sampling Packages

Type Android iOS Package OT/EB Description
currentlocation + + context OT Request the current location of the phone.
location + + context EB Listens to the stream of location changes from the phone's OS.
activity + + context EB Activity as recognized by OS.
weather + + context OT Local weather and weather forecast of the current location of the phone
air_quality + + context OT Air quality of the current location of the phone (from land-based stations)
geofence + + context EB Tracking entry, dwell, and exit event in circular geofences
mobility + + context EB Track location and calculates mobility features based on the mobility_features plugin.
bluetooth + + connectivity EB Scanning nearby bluetooth devices.
wifi + +* connectivity EB Collects SSID and BSSID from connected wifi networks.
connectivity + + connectivity EB Connectivity status events.
audio + + media OT Records audio from the device microphone.
noise + + media EB Detects ambient noise from the device microphone.
phonelog + - communication OT Log of phone calls in/out.
textmessagelog + - communication OT Log of text messages (sms) in/out.
textmessage + - communication EB Text message (sms) events when received.
calendar + + communication OT Collects all calendar events from the calendars on the phone.
survey + + survey OT Collects data from surveys (questionnaires) via the Research Package including cognitive assessments from the Cognition Package.
apps + - apps OT List of installed apps.
appusage + - apps OT List of app usage.
Notes:
 * : not available on iOS >= 13

Wearable Device Sampling Packages

Type Android iOS Package OT/EB Description
health + + health OT Collects different types of health data from Apple Health or Google Fit that may come from wearable devices.
movisens + - movisens EB Activity and Heart Rate Monitoring using the Movisens Move4 and EcgMove4 devices.
esense + + esense EB Inertial measurement unit (IMU) sensor events and button press/release events from the eSense device.
polar + + polar EB Inertial measurement (accelerometer, gyroscope, magnetometer) and heart rate (ECG, PPI, PPG, HR) data from the Polar devices.
movesense + + movesense EB State (tap), heart rate (HR), ECG, and Inertial Movement Unit (IMU - accelerometer, gyroscope, magnetometer) data from the Movesense devices.

Note that each of these device measures has sub-types, such as dk.cachet.carp.movisens.hr for heart rate (HR) measures from the Movisens device.