StudyProtocol class

A description of 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.

Inheritance
Annotations
  • @JsonSerializable(includeIfNull: false, explicitToJson: true)

Constructors

StudyProtocol({required String ownerId, required String name, String? description})
Create a new protocol. ownerId and name must be specified.
StudyProtocol.fromJson(Map<String, dynamic> json)
factory

Properties

applicationData Map<String, dynamic>?
Application-specific data to be stored as part of the study protocol which will be included in all deployments of this study protocol.
getter/setter pair
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 pair
connectedDevices Set<DeviceConfiguration<DeviceRegistration>>?
The devices this device needs to connect to.
getter/setter pair
connections List<DeviceConnection>?
The connections between primaryDevices and connectedDevices.
getter/setter pair
createdOn DateTime
The date when the object represented by this snapshot was created.
getter/setter pairinherited
description String?
An optional description for the study protocol.
getter/setter pair
devices Set<DeviceConfiguration<DeviceRegistration>>
The full list of devices part of this configuration.
no setter
expectedParticipantData Set<ExpectedParticipantData>?
getter/setter pair
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 pair
ownerId String
The entity (e.g., person or group) that created this study pProtocol.
getter/setter pair
participantRoles Set<ParticipantRole>?
Roles which can be assigned to participants in the study and ParticipantAttributes can be linked to. If a ParticipantAttribute is not linked to any specific participant role, the participant data can be filled out by all participants in the study deployment.
getter/setter pair
primaryDevice PrimaryDeviceConfiguration<DeviceRegistration>
The first of all the primaryDevices.
no setter
primaryDevices Set<PrimaryDeviceConfiguration<DeviceRegistration>>
The set of devices which are responsible for aggregating and synchronizing incoming data.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
taskControls Set<TaskControl>
Stores which tasks need to be started or stopped when the conditions defined by triggers are met.
getter/setter pair
tasks Set<TaskConfiguration>
The tasks which measure data and/or present output on a device.
getter/setter pair
triggers Map<String, TriggerConfiguration>
The list of triggers with assigned IDs which can start or stop tasks in this study protocol.
getter/setter pair
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
Add any application-specific value with a key to this protocol.
addConnectedDevice(DeviceConfiguration<DeviceRegistration> device, PrimaryDeviceConfiguration<DeviceRegistration> primaryDevice) bool
Add a device which is connected to the primaryDevice. Its role name should be unique in the protocol.
addExpectedParticipantData(ExpectedParticipantData expectedData) bool
Add expected participant data to be input by users.
addParticipantRole(ParticipantRole role) bool
Add a participant role which can be assigned to participants in the study.
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.
addTask(TaskConfiguration task) → void
Add the task to this protocol.
addTaskControl(TriggerConfiguration trigger, TaskConfiguration task, DeviceConfiguration<DeviceRegistration> destinationDevice, [Control control = Control.Start]) bool
Add a task to be started or stopped (determined by control) on a destinationDevice once a trigger within this protocol is initiated. In case the trigger or task are not yet included in this study protocol, it will be added. The destinationDevice needs to be added prior to this call since it needs to be set up as either a primary device or connected device.
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 by control) on a destinationDevice once a trigger within this protocol is initiated. In case the trigger or tasks are not yet included in this study protocol, it will be added. The destinationDevice needs to be added prior to this call since it needs to be set up as either a primary device or connected device.
addTrigger(TriggerConfiguration trigger) → void
Add the trigger to this protocol.
changeDeviceAssignment(PrimaryDeviceConfiguration<DeviceRegistration> device, AssignedTo assignedTo) → void
Change who the primary device is assignedTo.
getApplicationData(String key) → dynamic
Get any application-specific data with a key.
getConnectedDevices(PrimaryDeviceConfiguration<DeviceRegistration> primaryDevice) List<DeviceConfiguration<DeviceRegistration>>
Gets all devices configured to be connected to primaryDevice.
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.
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.
getTasksForDevice(DeviceConfiguration<DeviceRegistration> device) Set<TaskConfiguration?>
Gets all the tasks triggered for the specified device. If device is not part of either primaryDevices or connectedDevices, an empty set is returned.
getTasksForDeviceRoleName(String deviceRoleName) Set<TaskConfiguration>
Gets all the tasks triggered for the specified deviceRoleName.
hasPrimaryDevice(String roleName) bool
Does this protocol have a primary device with role name roleName?
indexOfTrigger(TriggerConfiguration trigger) int
Returns the index of the trigger in the triggers. Returns -1 if not found.
isValidAssignment(AssignedTo assignment) bool
Determines whether all participant roles in assignment are part of the participantRoles in this protocol.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeApplicationData(String key) → dynamic
Remove any application-specific data with a key.
removeDeviceAssignment(PrimaryDeviceConfiguration<DeviceRegistration> device) → void
Remove the primary device assignments and hence make it assigned to all roles.
removeExpectedParticipantData(ExpectedParticipantData expectedData) bool
Remove expected participant data to be input by users.
removeTask(TaskConfiguration task) → void
Remove the task currently present in this configuration including removing it from any TaskControl's which initiate it.
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

PROTOCOL_NAMESPACE → const String