carp_backend 0.10.0
carp_backend: ^0.10.0

Flutter Android iOS

CARP data backend for CARP mobile sensing. Supports uploading json to CARP as either zipped filed or as plain json in collections.

CARP Data Backend #

This package supports uploading of data from the CARP Mobile Sensing Framework to the CARP web service backend.

pub package

For Flutter plugins for other CARP products, see CARP Mobile Sensing in Flutter.

Upload of sensing data to the CARP web service can be done in four different ways:

  • as individual CARP data points
  • as a batch upload of a file with multiple CARP data points
  • as a CARP object in a collection
  • as a file to the CARP file store

Using the Plugin #

Add carp_backend as a dependency in your pubspec.yaml file and import the library along with the carp_core library.

import 'package:carp_core/carp_core.dart';
import 'package:carp_backend/carp_backend.dart';

Using the library takes three steps.

1. Register the Data Manager #

First you should register the data manager in the DataManagerRegistry.

DataManagerRegistry().register(DataEndPointType.CARP, new CarpDataManager());

2. Create a CARP Data Endpoint #

Create a CarpDataEndPoint that specify which method to use for uploading data, and the details. Upload methods are defined in the CarpUploadMethod class.

For example, a CarpDataEndPoint that upload data points directly looks like this:

  CarpDataEndPoint cdep = CarpDataEndPoint(CarpUploadMethod.DATA_POINT,
      name: 'CARP Staging Server',
      uri: 'http://staging.carp.cachet.dk:8080',
      clientId: 'carp',
      clientSecret: 'a_secret',
      email: 'username@cachet.dk',
      password: 'password');

A CarpDataEndPoint that uploads data as zipped files and keeps the file on the phone, looks like this:

  CarpDataEndPoint cdep = CarpDataEndPoint(CarpUploadMethod.FILE,
      name: 'CARP Staging Server',
      uri: 'http://staging.carp.cachet.dk:8080',
      clientId: 'carp',
      clientSecret: 'a_secret',
      email: 'username@cachet.dk',
      password: 'password',
      bufferSize: 500 * 1000,
      zip: true);

And a CarpDataEndPoint that batch uploads data points in a json file (which is deleted when uploaded) looks like this:

  CarpDataEndPoint cdep = CarpDataEndPoint(
    CarpUploadMethod.BATCH_DATA_POINT,
    name: 'CARP Staging Server',
    uri: 'http://staging.carp.cachet.dk:8080',
    clientId: 'carp',
    clientSecret: 'a_secret',
    email: 'username@cachet.dk',
    password: 'password',
    bufferSize: 500 * 1000,
    deleteWhenUploaded: true,
  );

3. Assign the CARP Data Endpoint to your Study #

To use the CARP Data Endpoint in you study, assign it to the study. And then start the study.

  Study study = new Study(
    '1234',
    'username@cachet.dk',
    name: 'Test study #1234',
  );
  study.dataEndPoint = cdep;
  
  // create a new executor, initialize it, and start it
  executor = new StudyExecutor(study);
  executor.initialize();
  executor.resume();

Features and bugs #

Please file feature requests and bug reports at the issue tracker.

License #

This software is copyright (c) Copenhagen Center for Health Technology (CACHET) at the Technical University of Denmark (DTU). This software is made available 'as-is' in a MIT license.

0
likes
100
pub points
42%
popularity

Publisher

cachet.dk

CARP data backend for CARP mobile sensing. Supports uploading json to CARP as either zipped filed or as plain json in collections.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

carp_mobile_sensing, carp_webservices, flutter, json_annotation

More

Packages that depend on carp_backend