carp_mobile_sensing library
This library contains the software architecture for the CARP Mobile Sensing (CAMS) framework implemented in Flutter. Supports cross-platform (iOS and Android) sensing.
The CAMS software architecture is a domain-drive design (DDD) model using an onion-based layout with the following onion layers:
- domain - contains the core domain model for CAMS which extends the domain model of the carp_core domain model.
- runtime - contains the business logic for executing a sensing study (normally called 'application services' in DDD).
- services - contains all services definitions used for sensing.
- infrastructure - contains specific implementation of the services used.
Domain-driven design (DDD) is a software design approach that focuses on modeling the software to match the domain, or the subject area, that the software is intended for. DDD helps developers create software that is aligned with the business needs and terminology of the domain experts, users, and stakeholders. From Domain-Driven Design (DDD): A Guide to Building Scalable, High-Performance Systems by Roman Glushach.
Classes
- AbstractDataManager
- An abstract DataManager implementation useful for extension.
-
AbstractExecutor<
TConfig> - An abstract implementation of a Executor to extend from.
- AccelerationFeatures
- A set of acceleration (non-gravitational) features collected over a specific sampling period.
- AccelerometerFeaturesProbe
- A probe collecting accelerometer data over a sampling period and calculates a set of features based on the samplings, as represented by a AccelerationFeatures data point.
- AccelerometerProbe
- A probe collecting raw data from the accelerometer.
-
AggregateExecutor<
TConfig> - An abstract class used to implement aggregated executors (i.e., executors with a set of underlying executors).
- AmbientLight
- Ambient light intensity in Lux. Typically collected from the light sensor on the front of the phone.
- AppTask
- A task that notifies the app when it is triggered.
- AppTaskControlExecutor
-
Responsible for handling the execution of a
TaskControl
which contains an AppTask. - AppTaskController
- A controller of UserTasks which is accessible in the userTaskQueue.
-
AppTaskExecutor<
TConfig extends AppTask> - Executes an AppTask.
- BackgroundSensingUserTask
- A non-UI sensing task that collects sensor data in the background. For example noise.
- BackgroundTaskExecutor
-
Executes a
BackgroundTask
. - BatteryProbe
- The BatteryProbe listens to the hardware battery and collect a BatteryState every time the battery state changes. For example, battery level or charging mode.
- BatteryState
- Holds battery level and charging status collected from the phone.
- BatteryStatus
- Runtime battery status of a device.
-
BTLEDeviceManager<
TDeviceConfiguration extends DeviceConfiguration< DeviceRegistration> > - A device manager for a connectable Bluetooth device.
- BufferingIntervalStreamProbe
- A type of probe which buffers data from an underlying stream and on a regular interval return a measurement based on this collected data.
- BufferingPeriodicProbe
- An type of probe which collects data for a period of time and then return a measurement from this collected data.
- BufferingPeriodicStreamProbe
- A type of probe which buffers data from an underlying stream for a period of time and then return a measurement from this collected data.
- CAMSDataType
-
Contains CAMS data type definitions similar to CARP Core
CarpDataTypes
. - CamsDataTypeMetaData
- Contains CAMS-specific meta data about a specific data type to be collected.
- CarpMobileSensing
- Base class for the carp_mobile_sensing library.
- CARPTransformerSchema
- A default DataTransformerSchema for CARP no-operation transformers
- CompletedAppTask
- Data about an AppTask that has been completed.
- ConditionalPeriodicTrigger
- A trigger that periodically checks if an application-specific triggering condition is met.
- ConditionalPeriodicTriggerExecutor
- Executes a ConditionalPeriodicTrigger.
- ConditionalSamplingEventTrigger
- A trigger that triggers when some (other) sampling event occurs and a application-specific condition is meet.
- ConditionalSamplingEventTriggerExecutor
- Executes a ConditionalSamplingEventTrigger.
- ConsoleDataManager
- A very simple data manager that just "uploads" the data to the console (i.e., prints it). Used mainly for testing and debugging purposes.
- ConsoleDataManagerFactory
- Cron
- CronScheduledTrigger
- A trigger that triggers based on a cron job specification.
- CronScheduledTriggerExecutor
- Executes a CronScheduledTrigger based on the specified cron job.
- DataEndPoint
- Specify an endpoint where a DataManager can upload data.
- DataEndPointTypes
- A enumeration of known (but not necessarily implemented) endpoint API types.
- DataManager
-
The DataManager interface is used to upload
Measurement
objects to any data manager that implements this interface. - DataManagerEvent
- An event for a data manager.
- DataManagerEventTypes
- An enumeration of data manager event types.
- DataManagerFactory
-
A factory which can create a DataManager based on the
type
of an DataEndPoint. - DataManagerRegistry
- A registry of DataManagerFactorys.
- DataTransformerFactory
- A factory which can create a DataTransformer.
- DataTransformerSchema
- An abstract class defining a transformer schema, which hold a set of DataTransformers that can map from the native CARP namespace to another namespace. A DataTransformerSchema must be implemented for each supported namespace.
- DataTransformerSchemaRegistry
- A registry of DataTransformerSchemas which hold a set of DataTransformers.
- DateTimeTrigger
- A trigger that triggers on a specific date and time.
- DateTimeTriggerExecutor
- Executes a DateTimeTrigger on the specified date and time.
- DelayedTrigger
- A trigger that triggers after delay from the (re)start of the app.
- DelayedTriggerExecutor
- Executes a DelayedTrigger, i.e. triggers after the specified delay.
- DeviceController
- A DeviceController handles runtime management of all devices and services available to this phone, including the phone itself.
- DeviceInfo
- Provides (static) information about the local device.
- DeviceInformation
- Holds basic information about the mobile device from where the data is collected.
-
DeviceManager<
TDeviceConfiguration extends DeviceConfiguration< DeviceRegistration> > - A DeviceManager handles a hardware device or online service on runtime.
- DeviceProbe
- A probe that collects the device info about this device.
- DeviceSamplingPackage
- ElapsedTimeTriggerExecutor
-
Executes a
ElapsedTimeTrigger
, i.e. triggers after the specified delay after deployment start on this phone. -
Executor<
TConfig> -
A Executor is responsible for executing data collection based on a
configuration
TConfig
. - ExecutorFactory
- A factory that can create a:
- FHIRTransformerSchema
- A default DataTransformerSchema for HL7 FHIR transformers
- FileData
-
A
Data
object holding a link to a file. - FileDataEndPoint
- Specify an endpoint where a file-based data manager can store JSON data as files on the local device.
- FileDataManager
-
Stores
Measurement
objects on the device's local storage media. Supports compression (zip) and encryption. - FileDataManagerEvent
- A status event for this file data manager. See FileDataManagerEventTypes for a list of possible event types.
- FileDataManagerEventTypes
- An enumeration of file data manager event types
- FileDataManagerFactory
- FileStudyProtocolManager
-
Retrieve and store
StudyProtocol
json definitions on the device's local file system. - FlutterLocalNotificationController
- A NotificationController based on the flutter_local_notifications Flutter plugin.
- FreeMemory
- Holds information about free memory on the phone.
- FunctionTask
- A task that can run a custom Dart function.
- FunctionTaskExecutor
- Executes a FunctionTask.
- GyroscopeProbe
- A probe collecting raw data from the gyroscope.
-
HardwareDeviceManager<
TDeviceConfiguration extends DeviceConfiguration< DeviceRegistration> > - A DeviceManager for a hardware device.
-
HasNext<
E> -
HasPrevious<
E> - Heartbeat
- Reflects a heart beat data send every period minute. Useful for calculating sampling coverage over time.
- HistoricSamplingConfiguration
- A sampling configuration which allows configuring the time back in the past and into the future to collect data.
- ImmediateTrigger
- A trigger that starts sampling immediately and never stops.
- ImmediateTriggerExecutor
- Executes an ImmediateTrigger, i.e. starts sampling immediately.
- IntervalProbe
- A probe which is triggered at regular intervals, specified by the interval property in an IntervalSamplingConfiguration. When triggered, the probe collect a measurement using the getMeasurement method.
- IntervalSamplingConfiguration
- A sampling configuration that allows configuring the time interval in between subsequent measurements.
- LightProbe
- The LightProbe listens to the phone's light sensor typically located near the front camera. Every value is in the SI unit Lux and is stored in a AmbientLight object.
- MagnetometerProbe
- A probe collecting raw data from the magnetometer.
- MeasurementProbe
-
This probe collects a single
Measurement
when started, send its to the measurements stream, and then stops. - MemoryProbe
-
A probe that collects free virtual memory on a regular basis
as specified in
PeriodicMeasure.frequency
. - NoOpNotificationController
- A no-operation notification controller that does nothing.
- NoOpTrigger
- A trigger that does nothing.
- NoOpTriggerExecutor
- Executes an NoOpTrigger, i.e. does nothing.
- NotificationController
- A controller of user notifications allow for creating, scheduling, and canceling user notifications.
- NoUserTaskTrigger
- A trigger that triggers only if a UserTask with taskName is NOT already on the task list.
- NoUserTaskTriggerExecutor
- Executes an NoUserTaskTrigger. Runs once pr minute.
- OMHTransformerSchema
- A default DataTransformerSchema for Open mHealth (OMH) transformers
- OneTimeTrigger
- A trigger that triggers only once during a deployment.
- OneTimeTriggerExecutor
- Executes a OneTimeTrigger, i.e. a trigger that only runs once during a study deployment.
-
OnlineService<
TRegistration extends DeviceRegistration> - An online service which works as a "software device" in a protocol.
-
OnlineServiceManager<
TDeviceConfiguration extends OnlineService< DeviceRegistration> > - A DeviceManager for an online service, like a weather service.
- PassiveTrigger
- A trigger that trigger when the trigger method is called from Dart code.
- PassiveTriggerExecutor
- Executes a PassiveTrigger.
- PedometerProbe
- The pedometer probe listens to the hardware step counter sensor.
- PeriodicSamplingConfiguration
- A sampling configuration specifying how to collect data on a regular basis for a specific period.
- PeriodicStreamProbe
-
A periodic probe listening on a stream. Listening is done periodically as
specified in a PeriodicSamplingConfiguration listening on intervals every
interval
for a period ofduration
. During this period, all data are forwarded to this probes measurements stream. - PeriodicTrigger
- A trigger that triggers every period.
- PeriodicTriggerExecutor
- Executes a PeriodicTrigger.
- Persistence
- A persistence layer that knows how to persistently store deployment and app task information across app restart.
- PersistentSamplingConfiguration
- A sampling configuration that saves the last time it was sampled.
- PrivacySchema
- A default DataTransformerSchema for privacy transformers
- Probe
-
A Probe is a specialized Executor responsible for collecting data from
the device sensors as configured in a
Measure
. - RandomRecurrentTrigger
- A daily trigger that triggers a random number of times within a defined period of time of the day.
- RandomRecurrentTriggerExecutor
- Executes a RandomRecurrentTrigger triggering N times per day within a defined period of time.
- RecurrentScheduledTrigger
- A trigger that triggers based on a recurrent scheduled date and time.
- RecurrentScheduledTriggerExecutor
- Executes a RecurrentScheduledTrigger.
- SamplingEventTrigger
- A trigger that triggers when some sampling event occurs.
- SamplingEventTriggerExecutor
- Executes a SamplingEventTrigger based on the specified SamplingEventTrigger.measureType and SamplingEventTrigger.triggerCondition.
- SamplingPackage
- Interface for a sampling package.
- SamplingPackageRegistry
- A registry of SamplingPackage packages.
-
SchedulableTriggerExecutor<
TConfig extends TriggerConfiguration> -
Abstract class for executors of triggers which can be scheduled
(i.e., implementing the
Schedulable
interface). - ScreenEvent
- Holds a screen event collected from the phone.
- ScreenProbe
- A probe collecting screen events:
- SensingUserTaskFactory
- A UserTaskFactory that can create a non-UI sensing task.
- SensorProbe
- An abstract sensor probe used by all sensor probes to get the samplingPeriod.
- SensorSamplingPackage
- Settings
- Misc. settings for CAMS.
- SmartphoneApplicationData
- Holds application-specific data for a SmartphoneStudyProtocol.
- SmartPhoneClientManager
- SmartphoneDeployment
- Contains the entire description and configuration for a study deployment on a smartphone.
- SmartphoneDeploymentController
- A SmartphoneDeploymentController controls the execution of a SmartphoneDeployment.
- SmartphoneDeploymentExecutor
- A SmartphoneDeploymentExecutor is responsible for executing a SmartphoneDeployment. For each task control in this deployment, it starts a TaskControlExecutor.
- SmartphoneDeploymentService
-
A local (in-memory) implementation of a
DeploymentService
useful in CAMS studies to be deployed locally on this phone. - SmartphoneDeviceManager
- A device manager for a smartphone.
- SmartphoneSamplingPackage
- An abstract class for all sampling packages that run on the phone itself.
- SmartphoneStudy
- A study configured to run on a smartphone (i.e., on a SmartPhoneClientManager).
- SmartphoneStudyProtocol
- A description of how a study is to be executed on a smartphone.
- SmartphoneTriggerFactory
- A TriggerFactory for all triggers coming with CAMS.
- SQLiteDataEndPoint
- Specify an endpoint for using the SQLiteDataManager to store JSON data in a SQLite database locally on the phone.
- SQLiteDataManager
-
Stores meta data about the running SmartphoneDeployment and all
collected
Measurement
json objects in an SQLite database on the device's local storage media. - SQLiteDataManagerFactory
- StreamProbe
-
An abstract class used to create a probe that listen continuously to events
from the stream of
Measurement
objects. - StubProbe
- A simple no-op probe that does nothing.
- StudyDescription
- StudyProtocolManager
- An interface defining a manger of SmartphoneStudyProtocols.
- StudyResponsible
-
A person who is responsible for a
StudyProtocol
. Typically the Principal Investigator (PI) who is responsible for the study. - TaskControlExecutor
-
Responsible for handling the execution of a
TaskControl
. -
TaskExecutor<
TConfig extends TaskConfiguration> -
The TaskExecutor is responsible for executing a
TaskConfiguration
. For each measure in the task, it looks up an appropriate Probe to collect data. - Timezone
- Holds timezone information about the mobile device.
- TimezoneProbe
- A probe that collects the device's current timezone.
- TriggerEvent
-
TriggerExecutor<
TConfig extends TriggerConfiguration> - Responsible for handling the execution of a trigger.
- TriggerFactory
-
A factory which can create a TriggerExecutor based on the runtime type
of an
TriggerConfiguration
. - UserAccelerometerProbe
- A probe collecting raw data from the user accelerometer.
- UserTask
- A task that the user of the app needs to attend to.
- UserTaskBufferItem
- UserTaskFactory
-
A factory which can create a UserTask based on the
type
of an AppTask. - UserTaskSnapshot
- A snapshot of a UserTask at any given time. Used for saving user tasks persistently across app restart.
- UserTaskTrigger
- A trigger that triggers based on the state of a UserTask.
- UserTaskTriggerExecutor
- Executes a UserTaskTrigger.
Enums
- ClientManagerState
- The possible states of the SmartPhoneClientManager.
- DataEventType
- Describes how a data type is collected (one-time or event-based).
- DebugLevel
- Debugging levels.
- DeviceStatus
- Runtime status for a DeviceManager.
- ExecutorState
- The state of an Executor.
- RecurrentType
- Type of recurrence for a RecurrentScheduledTrigger.
- UserTaskState
- The states of a UserTask.
Mixins
-
CronIterator<
E> - SmartphoneProtocolExtension
- A mixin holding smartphone-specific data for a SmartphoneStudyProtocol and SmartphoneDeployment.
Functions
-
debug(
String message) → void - Add a debug messages to the system log.
-
info(
String message) → void - Add an information messages to the system log.
-
noop(
Data data) → Data - A no-operation transformer.
-
onDidReceiveNotificationResponse(
NotificationResponse response) → void - Callback method called when a notification is clicked in the operating system.
-
warning(
String message) → void - Add a warning messages to the system log.
Typedefs
- ConditionalEvaluator = bool Function()
-
Evaluates if a ConditionalPeriodicTrigger should trigger.
Returns
true
if triggering should happen,false
otherwise. - ConditionalEventEvaluator = bool Function(Measurement measurement)
-
Takes a
Measurement
from a sampling stream and evaluates if an event has occurred. Returnstrue
if the event has occurred,false
otherwise. - DataTransformer = Data Function(Data)
- Signature of a data transformer.
- VoidFunction = void Function()
- Signature of Dart function that have no arguments and returns no data.
Exceptions / Errors
- SensingException
- Generic sensing exception.