Skip to content

Commit

Permalink
initial data upload agreement
Browse files Browse the repository at this point in the history
  • Loading branch information
lamawmouk committed Nov 15, 2022
1 parent c1c6c04 commit 60c61e9
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 17 deletions.
15 changes: 15 additions & 0 deletions physionet-django/project/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
Topic,
exists_project_slug,
UploadedDocument,
DataUseAgreement
)
from project.projectfiles import ProjectFiles
from user.models import User, TrainingType
Expand Down Expand Up @@ -1147,3 +1148,17 @@ def __init__(self, *args, **kwargs):
"Statements on ethics approval should appear here. "
"Your statement will be included in the public project description."
)
class UploadedAgreementDataForm(forms.ModelForm):
class Meta:
model = DataUseAgreement
fields = (
'has_copy_right_permission',
'has_human_subject_data',
'has_phi'
)
labels = {'has_copy_right_permission': 'Are you the original creator, or copyright holder, or have permission from the creators and copyright holders to share these files?',
'has_human_subject_data':'Does this project contain data collected from human subjects?',
'has_phi':'Do these files contain any personally identifiable information (information that could identify individual human subjects)?'}
def __init__(self, project, *args, **kwargs):
super().__init__(*args, **kwargs)
self.project = project
17 changes: 11 additions & 6 deletions physionet-django/project/modelcomponents/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,18 @@ def quota_manager(self):

class DataUseAgreement(models.Model):
"""This model is used to store the responses from the data use agreement for the project."""
RESPONSE_CHOICES = (
(0, 'No'),
(1, 'Yes'),
RESPONSE_CHOICES_1_and_2= (
(0, 'Yes'),
(1, 'No'),
)
RESPONSE_CHOICES_3 = (
(0, 'Yes'),
(1, 'No'),
(2, 'NA'),
)


project = models.OneToOneField('project.ActiveProject', on_delete=models.CASCADE)
has_copy_right_permission = models.PositiveSmallIntegerField(choices = RESPONSE_CHOICES)
has_human_subject_data = models.PositiveSmallIntegerField(choices = RESPONSE_CHOICES)
has_phi = models.PositiveSmallIntegerField(choices = RESPONSE_CHOICES)
has_copy_right_permission = models.PositiveSmallIntegerField(choices = RESPONSE_CHOICES_1_and_2)
has_human_subject_data = models.PositiveSmallIntegerField(choices = RESPONSE_CHOICES_1_and_2)
has_phi = models.PositiveSmallIntegerField(choices = RESPONSE_CHOICES_3)
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ <h2 class="form-signin-heading">6. Project Files</h2>
{{ maintenance_message }}
</div>
{% endif %}
{% include "project/upload_data_agreement.html" %}
<div class="card">
<div class="card-body">
{% include "project/project_storage_allowance.html" %}
Expand Down
13 changes: 13 additions & 0 deletions physionet-django/project/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,15 @@ def project_files(request, project_slug, subdir='', **kwargs):
if storage_request:
storage_request.get().delete()
messages.success(request, 'Your storage request has been cancelled.')
elif 'submit_upload_agreement' in request.POST:
upload_agreement_form = forms.UploadedAgreementDataForm(project=project,
data=request.POST)
if upload_agreement_form.is_valid():
upload_agreement_form.instance.project = project
upload_agreement_form.save()
messages.success(request, 'Your upload agreement has been received.')
else:
messages.error(request, utility.get_form_errors(upload_agreement_form))
else:
# process the file manipulation post
subdir = process_files_post(request, project)
Expand All @@ -1039,6 +1048,9 @@ def project_files(request, project_slug, subdir='', **kwargs):
storage_request_form = (
forms.StorageRequestForm(project=project) if (not storage_request and is_submitting) else None
)
upload_agreement_form = (
forms.UploadedAgreementDataForm(project=project)
)

(display_files, display_dirs, dir_breadcrumbs, parent_dir,
file_error) = get_project_file_info(project=project, subdir=subdir)
Expand Down Expand Up @@ -1074,6 +1086,7 @@ def project_files(request, project_slug, subdir='', **kwargs):
'maintenance_message': maintenance_message,
'is_lightwave_supported': ProjectFiles().is_lightwave_supported(),
'storage_type': settings.STORAGE_TYPE,
'upload_agreement_form': upload_agreement_form,
},
)

Expand Down
11 changes: 0 additions & 11 deletions physionet-django/templates/about/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,3 @@
<li>Provide a tab delimited list of all WFDB format annotation files, named <em>ANNOTATORS</em>. <a href="{% static 'published-projects/mitdb/1.0.0/ANNOTATORS' %}" target="_blank">Example file</a>.</li>
</ul>

<strong>PhysioNet Data Upload and Sharing Agreement</strong>
<ul>
<li>Please fill in the project agreement form.
</li>
<br>
<p>
<button id="dua-button" type="button" class="btn btn-primary">
Data Agreement
</button>
</p>
</ul>
1 change: 1 addition & 0 deletions physionet-django/user/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ def __init__(self, user, *args, **kwargs):
super(AddEventForm, self).__init__(*args, **kwargs)

def save(self):
breakpoint()
Event.objects.create(title=self.cleaned_data['title'],
category=self.cleaned_data['category'],
host=self.host,
Expand Down

0 comments on commit 60c61e9

Please sign in to comment.