Skip to content
CARP Docs
Ask AISystemLightDark
On this page

Data managers

Choose where CAMS stores or uploads collected measurements, and configure the data endpoint in a study protocol.

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

Set the dataEndPoint of a study protocol to choose where CAMS stores or uploads collected measurements. The available data managers and backends are:

Data manager or backendTypical use
ConsoleDataManagerDebug output to the Dart console.
FileDataManagerLocal file persistence as JSON, optionally zipped. Configured with a FileDataEndPoint.
SQLiteDataManagerLocal structured storage in SQLite. Configured with a SQLiteDataEndPoint.
FirebaseDataManagerUpload of JSON documents and files to Firebase services, through carp_firebase_backend.
CarpDataManagerStreaming and synchronization of study data with CARP Web Services (CAWS), through carp_backend.

To implement your own data manager, see Adding a new data manager.

Files

FileDataEndPoint saves measurements in a JSON file on the local device. Create the endpoint and add it to a study protocol:

var protocol = SmartphoneStudyProtocol(
    ownerId: 'AB',
    name: 'Track patient movement',
    dataEndPoint: FileDataEndPoint(bufferSize: 500 * 1000, zip: true));

CARP measurements are stored in this subfolder:

<local_application_path>/carp/deployments/<study_deployment_id>/data

local_application_path is the folder where an application can place files that are private to the application. Data files follow the naming schema carp-data-yyyy-mm-dd-hh-mm-ss-ms.json. If the JSON file is zipped, .zip is added.

AndroidiOS

Flutter files are stored in the AppData directory, located in the data/data/<<package_name>>/app_flutter folder. You can access the files through Android Studio.

Files are stored in the NSDocumentsDirectory, the app's document folder on the phone. You can access this folder and its files through the macOS Finder when the phone is plugged into a computer.

Note

To access app files through Finder, set UIFileSharingEnabled to true in Info.plist (see Installation).

SQLite

SQLiteDataEndPoint works like the file endpoint, except that data is stored in an SQLite database instead of a file. The endpoint takes no configuration:

var protocol = SmartphoneStudyProtocol(
    ownerId: 'AB',
    name: 'Track patient movement',
    dataEndPoint: SQLiteDataEndPoint());

You can access the database files like other files (see Files). On Android, the SQLite database file is located in the data/data/<<package_name>>/databases folder.

Firebase

carp_firebase_backend is a separate Flutter package that supports Google Firebase as a backend. It uploads data both as files in Storage and as raw JSON in Firestore. The package includes its full documentation.

Warning

The Firebase data manager has not yet been updated to API level 2.x.

CARP Web Services (CAWS)

carp_backend is a separate Flutter package that supports the CARP Web Services (CAWS) backend. It supports:

  • user authentication and setting up a connection to CAWS
  • download of a study deployment configuration from CAWS
  • streaming of sensing data from CAMS to CAWS
  • upload and download of data, such as files and JSON documents, to and from CAWS

The package includes its full documentation. The CAMS Demo App shows how to use it.

Add CAWS as the data endpoint of a CAMS study protocol and configure it with a CarpDataEndPoint:

// Add CAWS as the data endpoint using a stream (default)
protocol.dataEndPoint = CarpDataEndPoint(
    uploadMethod: CarpUploadMethod.stream,
    name: 'CARP Web Service (CAWS)',
    // Upload data every 10 min
    uploadInterval: 10,
    // Keep data on the phone even though it is uploaded
    deleteWhenUploaded: false,
);

For an overview of where CARP data can be stored, see Data storage.

Quick links

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