Skip to content
CARP Docs
Ask AISystemLightDark
On this page

Measure types

Measure types available in the built-in and external CAMS sampling packages, with platform availability.

Copy MarkdownOpen inOpen in GitHubView as MarkdownOpen in Scira AIOpen in ChatGPTOpen in ClaudeOpen in Cursor

This page lists the measure types available in sampling packages, both the packages built into the carp_mobile_sensing framework and the external ones. The list evolves as support for more measures is released.

Measure type format

The dataType property of a Measure specifies the type of data to collect. Its string form is typically a namespace plus a name. CAMS-native measure types use the namespace dk.cachet.carp, and the name is the measure type:

dk.cachet.carp.<type>

Legacy namespace

The cachet part of the namespace is a legacy. The original vision and design of CARP was done at the Copenhagen Center for Health Technology (CACHET), and the namespace dk.cachet.carp was adopted then. CACHET has since closed, and CARP is now maintained by the Section of Digital Health at the Department of Health Technology at the Technical University of Denmark.

The old namespace is kept for backward compatibility. It will be changed to carp.dk in the future.

Event-based and one-time measures

KindBehaviorExample
Event-based (EB)Once triggered and started, continuously samples data from its sensor until explicitly stopped. Most measures are event-based.A step event every time the phone detects a step.
One-time (OT)Samples one piece of data when triggered.Weather data from the Open Weather API.

The kind matters when you specify a study protocol: an event-based measure can be started and runs until stopped, whereas a one-time measure must be triggered to sample data. You can, for example, trigger it periodically with a PeriodicTrigger.

In this protocol, the first task contains a one-time measure (device information) that is triggered only once. The second task contains event-based measures that start immediately and keep sampling data based on events. The third task collects weather (a 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. All event-based measures.
  protocol.addTaskControl(
    ImmediateTrigger(),
    BackgroundTask(measures: [
      Measure(type: SensorSamplingPackage.STEP_EVENT),
      Measure(type: SensorSamplingPackage.AMBIENT_LIGHT),
      Measure(type: DeviceSamplingPackage.SCREEN_EVENT),
      Measure(type: DeviceSamplingPackage.BATTERY_STATE),
    ]),
    phone,
  );

  // Add a background task that collects weather every 5 minutes.
  protocol.addTaskControl(
      PeriodicTrigger(period: Duration(minutes: 5)),
      BackgroundTask(
          measures: [Measure(type: ContextSamplingPackage.WEATHER)]),
      weatherService);

Each SamplingPackage lists the measure types it supports in its dataTypes property, and provides a default sampling schema for each of its measure types.

Available measure types

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

For each measure, the tables list:

  • Type: all type names have the format dk.cachet.carp.<type>, where type is listed in the table.
  • Android and iOS: availability on each platform.
  • Package: the sampling package that contains the measure.
  • Description.

Types marked with * are one-time measures.

Built-in sampling packages

TypeAndroidiOSPackageDescription
accelerationYesYessensorsRate of change in velocity in x, y, z, including gravity
nongravitational accelerationYesYessensorsRate of change in velocity in x, y, z, excluding gravity
acceleration featuresYesYessensorsAcceleration events over a specific sampling period, with calculated higher-order features
rotationYesYessensorsRotation of the device in x, y, z (typically measured by a gyroscope)
magneticfieldYesYessensorsMagnetic field around the device in x, y, z (typically measured by a magnetometer)
stepeventYesYessensorsStep events from the device's onboard sensor
ambientlightYesNosensorsAmbient light from the phone's front light sensor
deviceinformation*YesYesdeviceBasic device information
application information*YesYesdeviceInformation about the app
batterystateYesYesdeviceBattery charging status and battery level
screeneventYesNodeviceScreen events (on/off/unlock)
applifecycleeventYesYesdeviceApp lifecycle state events (inactive, hidden, paused, resumed, detached)
freememoryYesNodeviceFree memory
timezone*YesYesdeviceTimezone of the device
heartbeatYesYesdeviceA heartbeat measurement every 15 minutes (default) telling whether the app is running (and not killed by the OS)

External sampling packages

TypeAndroidiOSPackageDescription
locationYesYescontextListens to the stream of location changes from the phone's OS
activityYesYescontextActivity as events from the OS's built-in activity recognition API
weather*YesYescontextDetailed weather information for the current location of the phone
airquality*YesYescontextAir quality of the current location of the phone (from land-based stations)
geofenceYesYescontextTracks entry, dwell and exit events in circular geofences
mobilityYesYescontextTracks location and calculates mobility features based on the mobility_features plugin
bluetoothYesYesconnectivityScans nearby BLE devices
wifiYesNoconnectivityCollects SSID and BSSID from connected Wi-Fi networks
connectivityYesYesconnectivityConnectivity status events
beaconYesYesconnectivityScans for nearby iBeacons
audio*YesYesaudioRecords audio from the device microphone
noiseYesYesaudioDetects ambient noise from the device microphone
apps*YesNoappsList of installed apps
appusage*YesNoappsList of app usage
phonelog*YesNocommunicationLog of incoming and outgoing phone calls
textmessagelog*YesNocommunicationLog of incoming and outgoing text messages (SMS)
textmessageYesNocommunicationText message (SMS) events when received
calendar*YesYescommunicationCalendar events from the calendars on the phone
survey*YesYessurveyData from surveys (questionnaires) through the Research Package, and cognitive assessments from the Cognition Package

Wearable device sampling packages

TypeAndroidiOSPackageDescription
healthYesYeshealthDifferent types of health data from Apple Health and Google Health Connect, which may come from connected wearable devices
movisensYesNomovisensActivity and heart rate monitoring using the Movisens Move4 and EcgMove4 devices
esenseYesYesesenseInertial measurement unit (IMU) sensor events and button press/release events from the eSense device
polarYesYespolarInertial measurement (accelerometer, gyroscope, magnetometer) and heart rate (ECG, PPI, PPG, HR) data from Polar devices
movesenseYesYesmovesenseState (tap), heart rate (HR), ECG and inertial measurement unit (IMU: accelerometer, gyroscope, magnetometer) data from Movesense devices
watch.awareNoYesawareMotion, heart rate, battery, location, heading, Bluetooth, ambient noise and sound classification collected on an Apple Watch using the AWARE watchOS framework. These measures use the dk.carp.watch.aware namespace; see Apple Watch Sensing.

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

Quick links

Page · DocumentationCARP DocumentationPage · DocumentationIntroductionPage · DocumentationQuickstartPage · DocumentationTerminologyPage · DocumentationArchitecture