SmartphoneStudyProtocol class
A description of how a study is to be executed on a smartphone.
A study protocol defines how a study is to be executed, defining the type(s) of
primary device(s) (PrimaryDeviceConfiguration
) responsible for
aggregating data, the optional devices (DeviceConfiguration
) connected
to them, and the TaskControl
's which lead to data collection on
said devices.
A simple study protocol can be specified like this:
// Create a study protocol storing data in a local SQLite database.
SmartphoneStudyProtocol protocol = SmartphoneStudyProtocol(
ownerId: 'abc@dtu.dk',
name: 'Track patient movement',
dataEndPoint: SQLiteDataEndPoint(),
);
// Define which devices are used for data collection.
// In this case, its only this smartphone.
Smartphone phone = Smartphone();
protocol.addPrimaryDevice(phone);
// Automatically collect step count, ambient light, screen activity, and
// battery level. Sampling is delaying by 10 seconds.
protocol.addTaskControl(
ImmediateTrigger(),
BackgroundTask(measures: [
Measure(type: SensorSamplingPackage.STEP_COUNT),
Measure(type: SensorSamplingPackage.AMBIENT_LIGHT),
Measure(type: DeviceSamplingPackage.SCREEN_EVENT),
Measure(type: DeviceSamplingPackage.BATTERY_STATE),
]),
phone,
);
- Inheritance
-
- Object
- Snapshot
- StudyProtocol
- SmartphoneStudyProtocol
- Mixed-in types
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
- SmartphoneStudyProtocol({String? ownerId, required String name, StudyDescription? studyDescription, DataEndPoint? dataEndPoint, String? privacySchemaName})
- Create a new SmartphoneStudyProtocol.
-
SmartphoneStudyProtocol.fromJson(Map<
String, dynamic> json) -
factory
Properties
-
applicationData
↔ Map<
String, dynamic> ? -
getter/setter pairinherited
-
assignedDevices
↔ Map<
String, Set< ?String> > -
Per device role, the participant roles to which the device is assigned.
Unassigned device are assigned to "anyone".
getter/setter pairinherited
-
connectedDevices
↔ Set<
DeviceConfiguration< ?DeviceRegistration> > -
The devices this device needs to connect to.
getter/setter pairinherited
-
connections
↔ List<
DeviceConnection> ? -
The connections between
primaryDevices
andconnectedDevices
.getter/setter pairinherited - createdOn ↔ DateTime
-
The date when the object represented by this snapshot was created.
getter/setter pairinherited
- dataEndPoint ↔ DataEndPoint?
-
Specifies where and how to stored or upload the data collected from this
deployment. If
null
, the sensed data is not stored, but may still be used in the app.getter/setter pairinherited - description ↔ String
-
getter/setter pairinherited
-
devices
→ Set<
DeviceConfiguration< DeviceRegistration> > -
The full list of devices part of this configuration.
no setterinherited
-
expectedParticipantData
↔ Set<
ExpectedParticipantData> ? -
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id ↔ String
-
Unique id for this object.
getter/setter pairinherited
- name ↔ String
-
A unique descriptive name for the protocol assigned by the protocol owner.
getter/setter pairinherited
- ownerId ↔ String
-
The entity (e.g., person or group) that created this study pProtocol.
getter/setter pairinherited
-
participantRoles
↔ Set<
ParticipantRole> ? -
Roles which can be assigned to participants in the study and
ParticipantAttribute
s can be linked to. If aParticipantAttribute
is not linked to any specific participant role, the participant data can be filled out by all participants in the study deployment.getter/setter pairinherited -
primaryDevice
→ PrimaryDeviceConfiguration<
DeviceRegistration> -
The first of all the
primaryDevices
.no setterinherited -
primaryDevices
↔ Set<
PrimaryDeviceConfiguration< DeviceRegistration> > -
The set of devices which are responsible for aggregating and synchronizing
incoming data.
getter/setter pairinherited
- privacySchemaName ↔ String?
-
The name of a PrivacySchema to be used for protecting sensitive data.
getter/setter pairinherited
- responsible → StudyResponsible?
-
The PI responsible for this protocol.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- studyDescription ↔ StudyDescription?
-
The description of this study protocol containing the title, description,
purpose, and the responsible researcher for this study.
getter/setter pairinherited
-
taskControls
↔ Set<
TaskControl> -
Stores which tasks need to be started or stopped when the conditions
defined by
triggers
are met.getter/setter pairinherited -
tasks
↔ Set<
TaskConfiguration> -
The tasks which measure data and/or present output on a device.
getter/setter pairinherited
-
triggers
↔ Map<
String, TriggerConfiguration> -
The list of triggers with assigned IDs which can start or stop tasks in
this study protocol.
getter/setter pairinherited
- version ↔ int
-
The number of edits made to the object represented by this snapshot,
indicating its version number.
getter/setter pairinherited
Methods
-
addApplicationData(
String key, dynamic value) → void -
inherited
-
addConnectedDevice(
DeviceConfiguration< DeviceRegistration> device, PrimaryDeviceConfiguration<DeviceRegistration> primaryDevice) → bool -
Add a
device
which is connected to theprimaryDevice
. Its role name should be unique in the protocol.override -
addExpectedParticipantData(
ExpectedParticipantData expectedData) → bool -
Add expected participant data to be input by users.
inherited
-
addParticipantRole(
ParticipantRole role) → bool -
Add a participant role which can be assigned to participants in the study.
inherited
-
addPrimaryDevice(
PrimaryDeviceConfiguration< DeviceRegistration> primaryDevice) → bool -
Add a primary device (e.g., a phone) which is responsible for aggregating
and synchronizing incoming data.
Its role name should be unique in the protocol.
override
-
addTask(
TaskConfiguration task) → void -
Add the
task
to this protocol.inherited -
addTaskControl(
TriggerConfiguration trigger, TaskConfiguration task, DeviceConfiguration< DeviceRegistration> destinationDevice, [Control control = Control.Start]) → bool -
Add a
task
to be started or stopped (determined bycontrol
) on adestinationDevice
once atrigger
within this protocol is initiated. In case thetrigger
ortask
are not yet included in this study protocol, it will be added. ThedestinationDevice
needs to be added prior to this call since it needs to be set up as either a primary device or connected device.inherited -
addTaskControls(
TriggerConfiguration trigger, List< TaskConfiguration> tasks, DeviceConfiguration<DeviceRegistration> destinationDevice, [Control control = Control.Start]) → void -
Add a list of
tasks
to be started or stopped (determined bycontrol
) on adestinationDevice
once atrigger
within this protocol is initiated. In case thetrigger
ortasks
are not yet included in this study protocol, it will be added. ThedestinationDevice
needs to be added prior to this call since it needs to be set up as either a primary device or connected device.inherited -
addTrigger(
TriggerConfiguration trigger) → void -
Add the
trigger
to this protocol.inherited -
changeDeviceAssignment(
PrimaryDeviceConfiguration< DeviceRegistration> device, AssignedTo assignedTo) → void -
Change who the primary
device
isassignedTo
.inherited -
getApplicationData(
String key) → dynamic -
inherited
-
getConnectedDevices(
PrimaryDeviceConfiguration< DeviceRegistration> primaryDevice) → List<DeviceConfiguration< DeviceRegistration> > -
Gets all devices configured to be connected to
primaryDevice
.inherited -
getTaskControls(
TriggerConfiguration trigger) → Set< TaskControl> -
Gets all conditions which control that tasks get started or stopped on
devices in this protocol by the specified
trigger
.inherited -
getTaskControlsByTriggerId(
int triggerId) → Set< TaskControl> -
Gets all conditions which control that tasks get started or stopped on devices
in this protocol by the trigger with
triggerId
.inherited -
getTasksForDevice(
DeviceConfiguration< DeviceRegistration> device) → Set<TaskConfiguration?> -
Gets all the tasks triggered for the specified
device
. Ifdevice
is not part of eitherprimaryDevices
orconnectedDevices
, an empty set is returned.inherited -
getTasksForDeviceRoleName(
String deviceRoleName) → Set< TaskConfiguration> -
Gets all the tasks triggered for the specified
deviceRoleName
.inherited -
hasPrimaryDevice(
String roleName) → bool -
Does this protocol have a primary device with role name
roleName
?inherited -
indexOfTrigger(
TriggerConfiguration trigger) → int -
Returns the index of the
trigger
in thetriggers
. Returns-1
if not found.inherited -
isValidAssignment(
AssignedTo assignment) → bool -
Determines whether all participant roles in
assignment
are part of theparticipantRoles
in this protocol.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeApplicationData(
String key) → void -
inherited
-
removeDeviceAssignment(
PrimaryDeviceConfiguration< DeviceRegistration> device) → void -
Remove the primary
device
assignments and hence make it assigned to all roles.inherited -
removeExpectedParticipantData(
ExpectedParticipantData expectedData) → bool -
Remove expected participant data to be input by users.
inherited
-
removeTask(
TaskConfiguration task) → void -
Remove the
task
currently present in this configuration including removing it from anyTaskControl
's which initiate it.inherited -
toJson(
) → Map< String, dynamic> -
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited