DeploymentService
Application service which deploys study protocols to participants and hands out the PrimaryDeviceDeployment for each primary device.
This is the service a client talks to when it joins a study deployment. A client (see ClientManager and StudyDeploymentProxy) uses it in this order: getStudyDeploymentStatus -> registerDevice -> getDeviceDeploymentFor -> deviceDeployed; and stop to end the study.
Key points:
- Most methods return null instead of throwing when the deployment does not exist.
- Implemented by the CARP web services client (
carp_webservices) and, for local studies, bySmartphoneDeploymentServicein CARP Mobile Sensing.
Constructors
DeploymentService
Constants
API_VERSION
Methods
createStudyDeployment
- StudyProtocol protocol, [
- List<
ParticipantInvitation> invitations = const [], - String? id,
- Map<
String, DeviceRegistration> ? connectedDevicePreregistrations,
Instantiate a study deployment for a given StudyProtocol with participants defined in invitations.
The identities specified in the invitations are used to invite and authenticate the participants. In case no account is associated to an identity, a new account is created for it. An invitation (and account details) is delivered to the person managing the identity, or should be handed out manually to the relevant participant by the person managing the identity.
id specifies the study deployment id. If not specified, a UUID v4 id is generated. connectedDevicePreregistrations lists optional pre-registrations for connected devices in the study protocol.
deviceDeployed
Indicate to stakeholders in the study deployment with studyDeploymentId that the device with primaryDeviceRoleName was deployed successfully, using the deployment with the specified deviceDeploymentLastUpdatedOn, i.e., that the study deployment was loaded on the device and that the necessary runtime is available to run it.
Returns null when:
- a deployment with
studyDeploymentIddoes not exist primaryDeviceRoleNameis not present in the deployment- the
deviceDeploymentLastUpdatedOndoes not match the expected date. The deployment might be outdated. - the deployment cannot be deployed yet, or the deployment has stopped.
getDeviceDeploymentFor
Get the deployment configuration for the primary device with primaryDeviceRoleName in the study deployment with studyDeploymentId. Returns null if studyDeploymentId is not found.
getStudyDeploymentStatus
- String studyDeploymentId
Get the status for a study deployment with the given studyDeploymentId. Returns null if studyDeploymentId is not found.
getStudyDeploymentStatusList
Get the statuses for a set of deployments with the specified studyDeploymentIds. Returns null for IDs in studyDeploymentIds for which no deployment exists.
registerDevice
- String studyDeploymentId,
- String deviceRoleName,
- DeviceRegistration registration
Register the device with the specified deviceRoleName for the study deployment with studyDeploymentId.
registration is a matching configuration for the device with deviceRoleName. Returns null if studyDeploymentId is not found.
removeStudyDeployments
Remove study deployments with the given studyDeploymentIds. This also removes all data related to the study deployments.
Returns the IDs of study deployments which were removed (empty set if none were removed). IDs for which no study deployment exists are ignored.
stop
- String studyDeploymentId
Permanently stop the study deployment with the specified studyDeploymentId.
No further changes to this deployment will be allowed and no more data can be collected and uploaded to a DataStreamService. Returns null if studyDeploymentId is not found.
unregisterDevice
Unregister the device with the specified deviceRoleName for the study deployment with studyDeploymentId. Returns null if studyDeploymentId is not found.