api/participant_administration.py
def create_new_participant():
    """
    Creates a new user, generates a password and keys, pushes data to s3 and user database, adds
    user to the study they are supposed to be attached to and returns a string containing
    password and patient id.
    """

    study_id = request.values['study_id']
    patient_id, password = Participant.create_with_password(study_id=study_id)
    participant = Participant.objects.get(patient_id=patient_id)
    study = Study.objects.get(id=study_id)
    add_fields_and_interventions(participant, study)

    # Create an empty file on S3 indicating that this user exists
    study_object_id = Study.objects.filter(pk=study_id).values_list('object_id', flat=True).get()
    s3_upload(patient_id, b"", study_object_id)
    create_client_key_pair(patient_id, study_object_id)
    repopulate_all_survey_scheduled_events(study, participant)

    response_string = 'Created a new patient\npatient_id: {:s}\npassword: {:s}'.format(patient_id, password)
    flash(response_string, 'success')

    return redirect('/view_study/{:s}'.format(study_id))

    Creates a new user, generates a password and keys, pushes data to s3 and user database, adds
    user to the study they are supposed to be attached to and returns a string containing
    password and patient id.
    
Creates a new user, generates a password and keys, pushes data to s3 and user database, adds
user to the study they are supposed to be attached to and returns a string containing
password and patient id.
Creates a new user generates a password and keys pushes data to s3 and user database adds user to the study they are supposed to be attached to and returns a string containing password and patient id .
def create_new_participant():
    study_id = request.values['study_id']
    patient_id, password = Participant.create_with_password(study_id=study_id)
    participant = Participant.objects.get(patient_id=patient_id)
    study = Study.objects.get(id=study_id)
    add_fields_and_interventions(participant, study)
    study_object_id = Study.objects.filter(pk=study_id).values_list('object_id', flat=True).get()
    s3_upload(patient_id, b"", study_object_id)
    create_client_key_pair(patient_id, study_object_id)
    repopulate_all_survey_scheduled_events(study, participant)
    response_string = 'Created a new patient\npatient_id: {:s}\npassword: {:s}'.format(patient_id, password)
    flash(response_string, 'success')
    return redirect('/view_study/{:s}'.format(study_id))
def create_new_participant ( ) : study_id = request . values [ 'study_id' ] patient_id , password = Participant . create_with_password ( study_id = study_id ) participant = Participant . objects . get ( patient_id = patient_id ) study = Study . objects . get ( id = study_id ) add_fields_and_interventions ( participant , study ) study_object_id = Study . objects . filter ( pk = study_id ) . values_list ( 'object_id' , flat = True ) . get ( ) s3_upload ( patient_id , b"" , study_object_id ) create_client_key_pair ( patient_id , study_object_id ) repopulate_all_survey_scheduled_events ( study , participant ) response_string = 'Created a new patient\npatient_id: {:s}\npassword: {:s}' . format ( patient_id , password ) flash ( response_string , 'success' ) return redirect ( '/view_study/{:s}' . format ( study_id ) )
Creates a new user, generates a password and keys, pushes data to s3 and user database, adds
user to the study they are supposed to be attached to and returns a string containing
password and patient id.
Creates a new user generates a password and keys pushes data to s3 and user database adds user to the study they are supposed to be attached to and returns a string containing password and patient id .
"""
    Creates a new user, generates a password and keys, pushes data to s3 and user database, adds
    user to the study they are supposed to be attached to and returns a string containing
    password and patient id.
    """ # Create an empty file on S3 indicating that this user exists