domain library

The CAMS domain model: what a study runs, on which devices, and where data goes.

Extends the carp_core domain model with smartphone-specific classes, like the protocol (SmartphoneStudyProtocol), devices (Smartphone, BLEHeartRateDevice), triggers (PeriodicTrigger, RecurrentScheduledTrigger), tasks (AppTask, FunctionTask), and data endpoints (SQLiteDataEndPoint). It also defines the service interfaces that the runtime and infrastructure layers implement: DataManager, NotificationManager, StudyProtocolManager, and SamplingPackage. All domain classes can be serialized to and from JSON.

Classes

AbstractDataManager
A base DataManager to extend when you write your own data manager.
AppLifecycleTrigger
A trigger that triggers when the life cycle of an app changes.
AppTask
A task that the user does in the app, like filling in a survey.
BLEDevice<TRegistration extends BLEDeviceRegistration>
A connected device that talks to the phone over Bluetooth Low Energy (BLE).
BLEDeviceRegistration
A DeviceRegistration for Bluetooth Low Energy (BLE) devices which can connect to the smartphone via BLE, e.g., a heart rate monitor or a BLE beacon.
BLEHeartRateDevice
A BLEDevice that implements the standard GATT Heart Rate service (https://www.bluetooth.com/specifications/gatt/services/).
CamsDataTypeMetaData
CAMS metadata about a data type: how it is collected and which permissions it needs.
CamsDataTypes
The data types that CAMS adds to carp_core CarpDataTypes.
CamsDevice<TRegistration extends DeviceRegistration>
Base class for CAMS connected-device configurations.
CamsDeviceRegistration
Base class for CAMS device registrations.
CARPTransformerSchema
The default DataTransformerSchema for the CARP namespace, with no transformers (data is kept as collected).
CompletedAppTask
The measurement collected when the user completes an AppTask.
ConditionalPeriodicTrigger
A trigger that checks an app-specific condition every period and triggers when it is met.
ConditionalSamplingEventTrigger
A trigger that triggers when a measurement of measureType is collected and an app-specific condition is met.
CronScheduledTrigger
A trigger that triggers based on a cron job specification.
DataEndPoint
Says where and how the measurements of a study are stored or uploaded.
DataEndPointTypes
The known DataEndPoint.type values (not all are implemented).
DataManager
Stores or uploads the Measurements collected in a study deployment.
DataManagerEvent
An event from a DataManager, emitted on DataManager.events.
DataManagerEventTypes
The known DataManagerEvent.type values.
DataManagerFactory
Creates the DataManager for one DataEndPoint.type.
DataManagerRegistry
The registry of DataManagerFactorys, used to create a DataManager for a DataEndPoint.
DataTransformerFactory
A marker interface for Data classes that can be made by a DataTransformer, e.g. an OMH data point.
DataTransformerSchema
A set of DataTransformers that map data from the CARP namespace to another namespace, indexed by data type.
DataTransformerSchemaRegistry
The registry of all DataTransformerSchemas, looked up by namespace.
DateTimeTrigger
A trigger that triggers once at a specific date and time.
DelayedTrigger
A trigger that triggers after delay from the (re)start of sampling.
DeviceInfoService
Provides static hardware and operating system information about this phone.
FHIRTransformerSchema
The default DataTransformerSchema for HL7 FHIR transformers.
FileData
A Data object holding a link to a file, e.g. an audio recording or image.
FileDataEndPoint
A DataEndPoint that stores measurements as JSON files on the phone.
FunctionTask
A task that can run a custom Dart function.
HardwareDeviceRegistration
A DeviceRegistration for a hardware device, with its name and battery state.
HistoricSamplingConfiguration
A PersistentSamplingConfiguration that collects data from a time window past and future relative to now.
ImmediateTrigger
A trigger that triggers immediately each time the study is resumed.
IntervalSamplingConfiguration
A SamplingConfiguration that sets the time interval between measurements.
MonitoringSamplingPackage
The built-in SamplingPackage that monitors data sampling itself.
NoOpNotificationManager
A NotificationManager that does nothing.
NoOpTrigger
A trigger that never triggers.
NotificationManager
Manages user notifications, including creating, scheduling, and canceling notifications.
NoUserTaskTrigger
A trigger that triggers only if a UserTask with taskName is NOT already on the task list.
OMHTransformerSchema
The default DataTransformerSchema for Open mHealth (OMH) transformers.
OneTimeTrigger
A trigger that triggers only once during a deployment.
PassiveTrigger
A trigger that triggers when the app calls trigger.
PeriodicSamplingConfiguration
A sampling configuration specifying how to collect data on a regular basis for a specific period.
PeriodicTrigger
A trigger that triggers every period.
PersistentSamplingConfiguration
A SamplingConfiguration that remembers when its measure was last collected.
PrimaryDevice<TRegistration extends DeviceRegistration>
Base class for CAMS primary device configurations.
PrivacySchema
The default DataTransformerSchema for privacy transformers.
RandomRecurrentTrigger
A daily trigger that triggers a random number of times within a defined period of time of the day.
RecurrentScheduledTrigger
A trigger that triggers based on a recurrent scheduled date and time.
SamplingEventTrigger
A trigger that triggers when a measurement of measureType is collected.
SamplingPackage
A plug-in that adds a set of measure types, and the probes that collect them, to CAMS.
ServiceConfiguration<TRegistration extends ServiceRegistration>
A connected device that is a software service rather than hardware.
ServiceRegistration
A DeviceRegistration for a ServiceConfiguration.
Smartphone
The smartphone that runs a CAMS study: the primary device of a protocol.
SmartphoneApplicationData
The CAMS-specific data of a SmartphoneStudyProtocol or SmartphoneDeployment.
SmartphoneDeployment
Everything a smartphone needs to run its part of a study deployment.
SmartphoneRegistration
A DeviceRegistration for a Smartphone specifying details of the phone.
SmartphoneSamplingPackage
Base class for sampling packages that collect data from the phone itself.
SmartphoneStudy
A study that this phone takes part in, as seen by the SmartPhoneClientManager.
SmartphoneStudyProtocol
A study protocol that runs on a smartphone.
SmartphoneStudyStatusEvent
A status event for a SmartphoneStudy, including its sampling state.
SQLiteDataEndPoint
A DataEndPoint that stores measurements in a local SQLite database.
StudyDescription
A human-readable description of a study: title, purpose, and who runs it.
StudyProtocolManager
Gets and saves SmartphoneStudyProtocols, e.g. from local files or a server.
StudyResponsible
A person who is responsible for a StudyProtocol. Typically the Principal Investigator (PI) who is responsible for the study.
UserTaskTrigger
A trigger that triggers when a UserTask reaches a given state.

Enums

BatteryChargingState
The battery level of a HardwareDeviceRegistration, as a coarse state.
DataEventType
Describes how a data type is collected (one-time or event-based).
RecurrentType
Type of recurrence for a RecurrentScheduledTrigger. Yearly is not supported.

Mixins

SmartphoneProtocolExtension
Adds the CAMS-specific fields to a SmartphoneStudyProtocol and a SmartphoneDeployment.

Functions

noop(Data data) → Data
A no-operation transformer that returns data unchanged.

Typedefs

ConditionalEvaluator = bool Function()
Evaluates if a ConditionalPeriodicTrigger should trigger.
ConditionalEventEvaluator = bool Function(Measurement measurement)
Evaluates if a measurement should fire a ConditionalSamplingEventTrigger.
DataTransformer = Data Function(Data data)
Signature of a data transformer, which maps one Data object to another.
VoidFunction = void Function()
Signature of a Dart function with no arguments and no return value.