createStudyDeployment method

  1. @override
Future<StudyDeploymentStatus> createStudyDeployment(
  1. StudyProtocol protocol, [
  2. String? studyDeploymentId
])
override

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

Implementation

@override
Future<StudyDeploymentStatus> createStudyDeployment(
  StudyProtocol protocol, [
  String? studyDeploymentId,
]) async {
  assert(protocol is SmartphoneStudyProtocol,
      "$runtimeType only supports the deployment of protocols of type 'SmartphoneStudyProtocol'");

  StudyDeployment deployment = StudyDeployment(protocol, studyDeploymentId);
  _repository[deployment.studyDeploymentId] = deployment;

  // make sure to register this phone as a master device
  deployment.registerDevice(thisPhone, DeviceRegistration());

  // set the deployment status to "invited" as the initial status.
  deployment.status.status = StudyDeploymentStatusTypes.Invited;

  return deployment.status;
}