The CARP Mobile Sensing (CAMS) Flutter package carp_mobile_sensing is a programming framework for adding digital phenotyping capabilities to your mobile (health) app. CAMS is designed to collect research-quality sensor data from the smartphone on-board sensors and attached off-board wearable devices.

Aim and Purpose

Similar to other platforms, CAMS is a state-of-the-art mobile sensing platform with support for collection of a wide range of data types (see this table for an overview), and with support for various non-functional features like privacy protection and adaptive sensing. CAMS has a set of unique design goals and novel technological contributions:

  • Reactive application programming interface – The CAMS programming API is designed to be simple, yet expressive for the programmer. It supports a modern reactive, stream-based programming model allowing for non-blocking sensing and data processing.
  • Unified sensing – CAMS has a unified sensing concept for both on-board and off-board (e.g. wearable) sensing. This allows for a unified way to set up and use data sampling in the app without the need to consider differences in the underlying operating system (OS) or device.
  • Cross-platform – by using Flutter, CAMS supports a unified programming API and programming language for both Android and iOS programming. Hence, the same code base and programming API is used to develop apps for both Android and iOS.
  • Data Management – CAMS has extensive support for different data sampling, transformation, storage, and upload methods. A uniform approach to data transformation is adopted, which supports both privacy-enabling transformations as well as transforming data to make it comply with official data standards.
  • Extensible – Most importantly, CAMS is highly extensible in a number of ways: it allows for implementing new data sampling methods (including both phone sensing, external wearable devices, and cloud-based services); it supports creation of new data transformers (both for privacy reasons and data standards), and it allows for creating custom data managers, which can upload data in a specific format to specific servers (or other kinds of data offloading).
  • Maintainable – CAMS and all its sub-components are available at pub.dev, which is the Flutter dependency management system that allow for easy access to CAMS libraries and for sharing custom libraries amongst a CAMS programming community.

The basic scenario CAMS seeks to support is to;

… allow programmers to design and implement a custom cross-platform mHealth app, which focuses primarily on providing functionality to the patient.

To this end, CAMS enables programmers to add mobile sensing capabilities in a flexible and simple manner to application-specific code bases. This includes configuring collection of health and behavioral data like ECG, location, activity, and step count; formatting this data according to different health data formats; using this data in the app (e.g. showing it to the user); and uploading it to a specific server, using a specific API (e.g. REST), in a custom format.

Fig. 1 – The CAMS layered architecture which collects data from onboard sensors, wearable devices, and online web services.

Overall Architecture

Fig. 1 shows the overall layered software architecture of CAMS. The CAMS runtime model consists of three main layers: the core runtime, data managers, and the sampling packages, which again build on top of a set of Flutter plugins which access processes and services in the underlying OS, external wearable devices, and cloud-based services. This runtime architecture is designed to achieve the non-functional software architecture goals of being highly extensible, cross-platform, and maintainable.

Documentation

The CAMS wiki pages contain an overall documentation of the main domain models, and how to use and extend CAMS.

Articles

  1. Software Architecture – the overall picture.
  2. Domain Model – the detailed picture of the data model(s).
  3. Using CARP Mobile Sensing – how to use the framework in your app.
  4. Extending CARP Mobile Sensing – how to extend the framework, with a focus on new sensing capabilities and external (wearable) devices.
  5. Best Practice – tips and tricks, especially related to differences between Android and iOS.

Appendices

Each of the different components and packages contain their own documentation, which is available as part of the Flutter README file and the Dart API documentation.

Academic Documentation

More scientific documentations of CAMS is available in:

  • Bardram, Jakob E. (2020) The CARP Mobile Sensing Framework–A Cross-platform, Reactive, Programming Framework and Runtime Environment for Digital Phenotyping. arXiv preprint arXiv:2006.11904. [pdf]
  • Bardram, Jakob E. (2022). Software Architecture Patterns for Extending Sensing Capabilities and Data Formatting in Mobile Sensing. Sensors22(7), 2813. [pdf]

Please use these as a reference in any scientific papers using CAMS.

Components and Packages

The main CAMS Github page provides an overview of all components.

CAMS consists of the main carp_moble_sensing Flutter package plus a list of sampling packages and data backend packages.

In addition, the CARP team maintains a set of Flutter plugins (mainly) for sensing purposes. Flutter plugins enable access to platform-specific APIs. The CACHET pub.dev account contains all these plugins and components.

These are the available CAMS Flutter components.

ComponentDescriptionpub.dev
CoreBasic components
carp_mobile_sensingThe main CARP Mobile Sensing Framework
PackagesData sampling packages
carp_apps_packageApp sampling package (installed apps, app usage)
carp_connectivity_packageConnectivity sampling package (bluetooth, wifi, connectivity)
carp_communication_packageCommunication sampling package (phone, sms)
carp_context_packageContext sampling package (location, activity, weather)
carp_audio_packageAudio sampling package (audio, noise)
carp_movisens_packageMovisens Move & ECG sampling package (movement, MET-level, ECG)
carp_esense_packageSampling package for the eSense ear plug device (button pressed & movement)
carp_survey_packageSampling package for collecting survey data from ResearchPackage
carp_health_packageSampling package for collecting health data from Apple Health and Google Fit
BackendsBackend data upload components
carp_webservicesFlutter API for CARP web services
carp_backendSupport for uploading data to a CARP data backend as JSON.
carp_firebase_backendSupport for uploading data to Firebase as both zipped files and JSON data

Example Apps

There are two example apps available, which illustrates how to use CAMS in the design of a Flutter app. In addition, this tutorial explain how to create your 1st CAMS Flutter app.

CARP Mobile Sensing Demo app – this app demonstrates how to use CAMS in an app according to the BLoC architecture. This app demonstrates how to implement background sensing, handling probes, and uploading data.

Pulmonary Monitor app – this app demonstrates how user tasks (aka. AppTask) are supported in CAMS. A user task is a task which are added to a list of tasks which the user can “click” and execute. This is typically used for issuing surveys (using the carp_survery_package) but can also be used for basic sensing tasks (like the collection of weather and air quality, shown as the bottom task).