Skip to content

StudyDeployment

A single instantiation of a StudyProtocol, taking care of common concerns related to devices when 'running' a study.

I.e., a StudyDeployment is responsible for registering the physical devices described in the StudyProtocol, building the PrimaryDeviceDeployment for each primary device, and tracking device registration and deployment status. Connection monitoring and data-quality assessment (part of the Kotlin CARP Core) are not implemented here. It lives on the deployment side, i.e. in a DeploymentService implementation; a client only sees its status and the PrimaryDeviceDeployment it creates.

Key points:

Constructors

StudyDeployment

StudyDeployment(
  1. StudyProtocol protocol, [
  2. String? studyDeploymentId
])

Create a new StudyDeployment based on a StudyProtocol. studyDeploymentId specifies the study deployment id. If not specified, a UUID v4 id is generated.

Properties

creationDate

DateTime get creationDate

deployedDevices

Set<String?> get deployedDevices

The set of devices (role names) which have been deployed correctly.

deviceRegistrationHistory

Per device, a list of all device registrations (included old registrations) in the order they were registered.

invalidatedDeployedDevices

Set<DeviceConfiguration<DeviceRegistration>> get invalidatedDeployedDevices

isStopped

bool get isStopped

Whether stop has been called. This is only a flag: later calls can still modify the deployment.

protocol

StudyProtocol get protocol

registeredDevices

The set of devices which are currently registered for this study deployment.

requiredDataStreams

DataStreamsConfiguration get requiredDataStreams

All the data streams which are required to run this study deployment.

startTime

DateTime? get startTime

The time when the study deployment was ready for the first time (all devices deployed); null otherwise.

status

Get the status of this StudyDeployment, with the current status of all primary and connected devices.

studyDeploymentId

String get studyDeploymentId

Methods

deviceDeployed

void deviceDeployed(
  1. PrimaryDeviceConfiguration<DeviceRegistration> device,
  2. DateTime deviceDeploymentLastUpdateDate
)

Indicate that the specified primary device was deployed successfully using the deployment with the specified deviceDeploymentLastUpdateDate.

Sets the status to StudyDeploymentStatusTypes.Running and startTime to deviceDeploymentLastUpdateDate.

getDeviceDeploymentFor

Get the deployment configuration for the specified primary device in this study deployment.

The device must be part of the protocol and registered. Marks all registered devices as deployed and sets the status to StudyDeploymentStatusTypes.Running. The returned deployment holds the tasks of device and all connected devices, and all triggers and task controls of the protocol.

getDeviceStatus

Get the status of a device in this StudyDeployment.

registerDevice

void registerDevice(
  1. DeviceConfiguration<DeviceRegistration> device,
  2. DeviceRegistration registration
)

Register the specified device for this deployment using the registration options.

Moves the status from StudyDeploymentStatusTypes.Invited to StudyDeploymentStatusTypes.DeployingDevices. A new registration replaces the current one and is added to deviceRegistrationHistory.

stop

void stop()

Mark this study deployment as stopped; no more data should be collected. This does not block further changes to the deployment.

unregisterDevice

void unregisterDevice(
  1. DeviceConfiguration<DeviceRegistration> device
)

Remove the current device registration for the device in this deployment.