createStudyDeployment method
Future<StudyDeploymentStatus>
createStudyDeployment(
- StudyProtocol protocol, [
- List<
ParticipantInvitation> invitations = const [], - String? id,
- Map<
String, DeviceRegistration> ? connectedDevicePreregistrations,
override
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, an UUID v1 id
is generated.
connectedDevicePreregistrations
lists optional pre-registrations for
connected devices in the study protocol
.
Implementation
@override
Future<StudyDeploymentStatus> createStudyDeployment(
StudyProtocol protocol, [
List<ParticipantInvitation> invitations = const [],
String? id,
Map<String, DeviceRegistration>? connectedDevicePreregistrations,
]) async {
assert(protocol is SmartphoneStudyProtocol,
"$runtimeType only supports the deployment of protocols of type 'SmartphoneStudyProtocol'");
StudyDeployment deployment = StudyDeployment(protocol, id);
_repository[deployment.studyDeploymentId] = deployment;
// always register this phone as a primary device
deployment.registerDevice(thisPhone, SmartphoneDeviceRegistration());
// set the deployment status to "invited" as the initial status.
deployment.status.status = StudyDeploymentStatusTypes.Invited;
return deployment.status;
}