Skip to content

Commit

Permalink
Merge pull request #416 from UW-GAC/feature/is-sensitive-rename
Browse files Browse the repository at this point in the history
Rename is_sensitive field to gsr_restricted
  • Loading branch information
amstilp authored Jan 31, 2024
2 parents a448fa8 + 02d1e0f commit b6d1828
Show file tree
Hide file tree
Showing 20 changed files with 178 additions and 74 deletions.
4 changes: 2 additions & 2 deletions primed/cdsa/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Meta:
class CDSAWorkspaceForm(Bootstrap5MediaFormMixin, forms.ModelForm):
"""Form for `CDSAWorkspace` objects."""

is_sensitive = forms.TypedChoiceField(
gsr_restricted = forms.TypedChoiceField(
coerce=lambda x: x == "True",
choices=((True, "Primary"), (False, "Component")),
widget=forms.RadioSelect,
Expand All @@ -114,7 +114,7 @@ class Meta:
"data_use_modifiers",
"disease_term",
"data_use_limitations",
"is_sensitive",
"gsr_restricted",
"acknowledgments",
"available_data",
"disease_term",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.8 on 2024-01-31 21:12

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("cdsa", "0012_cdsaworkspace_is_sensitive_and_more"),
]

operations = [
migrations.RenameField(
model_name="cdsaworkspace",
old_name="is_sensitive",
new_name="gsr_restricted",
),
migrations.RenameField(
model_name="historicalcdsaworkspace",
old_name="is_sensitive",
new_name="gsr_restricted",
),
]
29 changes: 29 additions & 0 deletions primed/cdsa/migrations/0014_gsr_restricted_help_and_verbose.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.2.8 on 2024-01-31 21:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("cdsa", "0013_rename_is_sensitive_cdsaworkspace_gsr_sensitive_and_more"),
]

operations = [
migrations.AlterField(
model_name="cdsaworkspace",
name="gsr_restricted",
field=models.BooleanField(
help_text="Indicator of whether public posting of GSRs is restricted.",
verbose_name="GSR restricted?",
),
),
migrations.AlterField(
model_name="historicalcdsaworkspace",
name="gsr_restricted",
field=models.BooleanField(
help_text="Indicator of whether public posting of GSRs is restricted.",
verbose_name="GSR restricted?",
),
),
]
6 changes: 3 additions & 3 deletions primed/cdsa/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ class CDSAWorkspace(
help_text="Data available in this accession.",
blank=True,
)
is_sensitive = models.BooleanField(
verbose_name="Sensitive?",
help_text="Indicator of whether this workspace contains sensitive data.",
gsr_restricted = models.BooleanField(
verbose_name="GSR restricted?",
help_text="Indicator of whether public posting of GSRs is restricted.",
)

class Meta:
Expand Down
8 changes: 4 additions & 4 deletions primed/cdsa/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class CDSAWorkspaceStaffTable(tables.Table):
verbose_name="DUO modifiers",
linkify_item=True,
)
cdsaworkspace__is_sensitive = BooleanIconColumn(orderable=False)
cdsaworkspace__gsr_restricted = BooleanIconColumn(orderable=False)
is_shared = WorkspaceSharedWithConsortiumColumn()

class Meta:
Expand All @@ -321,7 +321,7 @@ class Meta:
"cdsaworkspace__study",
"cdsaworkspace__data_use_permission__abbreviation",
"cdsaworkspace__data_use_modifiers",
"cdsaworkspace__is_sensitive",
"cdsaworkspace__gsr_restricted",
)
order_by = ("name",)

Expand All @@ -339,7 +339,7 @@ class CDSAWorkspaceUserTable(tables.Table):
transform=lambda x: x.abbreviation,
verbose_name="DUO modifiers",
)
cdsaworkspace__is_sensitive = BooleanIconColumn(orderable=False)
cdsaworkspace__gsr_restricted = BooleanIconColumn(orderable=False)
is_shared = WorkspaceSharedWithConsortiumColumn()

class Meta:
Expand All @@ -350,6 +350,6 @@ class Meta:
"cdsaworkspace__study",
"cdsaworkspace__data_use_permission__abbreviation",
"cdsaworkspace__data_use_modifiers",
"cdsaworkspace__is_sensitive",
"cdsaworkspace__gsr_restricted",
)
order_by = ("name",)
2 changes: 1 addition & 1 deletion primed/cdsa/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class CDSAWorkspaceFactory(DjangoModelFactory):
requested_by = SubFactory(UserFactory)
data_use_permission = SubFactory(DataUsePermissionFactory)
workspace = SubFactory(WorkspaceFactory, workspace_type="cdsa")
is_sensitive = Faker("boolean")
gsr_restricted = Faker("boolean")

@post_generation
def authorization_domains(self, create, extracted, **kwargs):
Expand Down
36 changes: 18 additions & 18 deletions primed/cdsa/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def test_valid(self):
"data_use_permission": self.duo_permission,
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertTrue(form.is_valid())
Expand All @@ -528,7 +528,7 @@ def test_valid_with_one_data_use_modifier(self):
"data_use_modifier": DataUseModifier.objects.all(),
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertTrue(form.is_valid())
Expand All @@ -543,7 +543,7 @@ def test_valid_with_two_data_use_modifiers(self):
"data_use_modifier": DataUseModifier.objects.all(),
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertTrue(form.is_valid())
Expand All @@ -557,7 +557,7 @@ def test_invalid_missing_workspace(self):
"data_use_permission": self.duo_permission,
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertFalse(form.is_valid())
Expand All @@ -575,7 +575,7 @@ def test_invalid_missing_study(self):
"data_use_permission": self.duo_permission,
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertFalse(form.is_valid())
Expand All @@ -593,7 +593,7 @@ def test_invalid_missing_requested_by(self):
"data_use_permission": self.duo_permission,
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertFalse(form.is_valid())
Expand All @@ -611,7 +611,7 @@ def test_invalid_missing_data_use_permission(self):
# "data_use_permission": self.duo_permission,
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertFalse(form.is_valid())
Expand All @@ -629,7 +629,7 @@ def test_invalid_missing_data_use_limitations(self):
"data_use_permission": self.duo_permission,
# "data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertFalse(form.is_valid())
Expand All @@ -647,7 +647,7 @@ def test_invalid_missing_acknowledgments(self):
"data_use_permission": self.duo_permission,
"data_use_limitations": "test limitations",
# "acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertFalse(form.is_valid())
Expand All @@ -656,23 +656,23 @@ def test_invalid_missing_acknowledgments(self):
self.assertEqual(len(form.errors["acknowledgments"]), 1)
self.assertIn("required", form.errors["acknowledgments"][0])

def test_invalid_missing_is_sensitive(self):
"""Form is valid? when missing is_sensitive."""
def test_invalid_missing_gsr_restricted(self):
"""Form is valid? when missing gsr_restricted."""
form_data = {
"workspace": self.workspace,
"study": self.study,
"requested_by": self.requester,
"data_use_permission": self.duo_permission,
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
# "is_sensitive": False,
# "gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertFalse(form.is_valid())
self.assertEqual(len(form.errors), 1)
self.assertIn("is_sensitive", form.errors)
self.assertEqual(len(form.errors["is_sensitive"]), 1)
self.assertIn("required", form.errors["is_sensitive"][0])
self.assertIn("gsr_restricted", form.errors)
self.assertEqual(len(form.errors["gsr_restricted"]), 1)
self.assertIn("required", form.errors["gsr_restricted"][0])

def test_invalid_duplicate_workspace(self):
"""Form is invalid with a duplicated workspace."""
Expand All @@ -684,7 +684,7 @@ def test_invalid_duplicate_workspace(self):
"data_use_permission": self.duo_permission,
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertFalse(form.is_valid())
Expand All @@ -704,7 +704,7 @@ def test_valid_one_available_data(self):
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"available_data": [available_data],
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertTrue(form.is_valid())
Expand All @@ -720,7 +720,7 @@ def test_valid_two_available_data(self):
"data_use_limitations": "test limitations",
"acknowledgments": "test acknowledgmnts",
"available_data": available_data,
"is_sensitive": False,
"gsr_restricted": False,
}
form = self.form_class(data=form_data)
self.assertTrue(form.is_valid())
2 changes: 1 addition & 1 deletion primed/cdsa/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def test_model_saving(self):
acknowledgments="test acknowledgments",
requested_by=requester,
workspace=workspace,
is_sensitive=False,
gsr_restricted=False,
)
instance.save()
self.assertIsInstance(instance, models.CDSAWorkspace)
Expand Down
6 changes: 3 additions & 3 deletions primed/cdsa/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6188,7 +6188,7 @@ def test_creates_upload_workspace_without_duos(self):
"workspacedata-0-data_use_limitations": "test limitations",
"workspacedata-0-acknowledgments": "test acknowledgments",
"workspacedata-0-requested_by": self.requester.pk,
"workspacedata-0-is_sensitive": False,
"workspacedata-0-gsr_restricted": False,
},
)
self.assertEqual(response.status_code, 302)
Expand Down Expand Up @@ -6245,7 +6245,7 @@ def test_creates_upload_workspace_with_duo_modifiers(self):
data_use_modifier_2.pk,
],
"workspacedata-0-requested_by": self.requester.pk,
"workspacedata-0-is_sensitive": False,
"workspacedata-0-gsr_restricted": False,
},
)
self.assertEqual(response.status_code, 302)
Expand Down Expand Up @@ -6291,7 +6291,7 @@ def test_creates_upload_workspace_with_disease_term(self):
"workspacedata-0-data_use_permission": data_use_permission.pk,
"workspacedata-0-disease_term": "foo",
"workspacedata-0-requested_by": self.requester.pk,
"workspacedata-0-is_sensitive": False,
"workspacedata-0-gsr_restricted": False,
},
)
self.assertEqual(response.status_code, 302)
Expand Down
4 changes: 2 additions & 2 deletions primed/dbgap/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Meta:
class dbGaPWorkspaceForm(Bootstrap5MediaFormMixin, forms.ModelForm):
"""Form for a dbGaPWorkspace object."""

is_sensitive = forms.TypedChoiceField(
gsr_restricted = forms.TypedChoiceField(
coerce=lambda x: x == "True",
choices=((True, "Primary"), (False, "Component")),
widget=forms.RadioSelect,
Expand All @@ -46,7 +46,7 @@ class Meta:
"dbgap_consent_abbreviation",
"dbgap_consent_code",
"data_use_limitations",
"is_sensitive",
"gsr_restricted",
"acknowledgments",
"data_use_permission",
"disease_term",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.8 on 2024-01-31 21:12

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("dbgap", "0009_dbgapworkspace_is_sensitive_and_more"),
]

operations = [
migrations.RenameField(
model_name="dbgapworkspace",
old_name="is_sensitive",
new_name="gsr_restricted",
),
migrations.RenameField(
model_name="historicaldbgapworkspace",
old_name="is_sensitive",
new_name="gsr_restricted",
),
]
29 changes: 29 additions & 0 deletions primed/dbgap/migrations/0011_gsr_restricted_help_and_verbose.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.2.8 on 2024-01-31 21:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("dbgap", "0010_rename_is_sensitive_dbgapworkspace_gsr_sensitive_and_more"),
]

operations = [
migrations.AlterField(
model_name="dbgapworkspace",
name="gsr_restricted",
field=models.BooleanField(
help_text="Indicator of whether public posting of GSRs is restricted.",
verbose_name="GSR restricted?",
),
),
migrations.AlterField(
model_name="historicaldbgapworkspace",
name="gsr_restricted",
field=models.BooleanField(
help_text="Indicator of whether public posting of GSRs is restricted.",
verbose_name="GSR restricted?",
),
),
]
6 changes: 3 additions & 3 deletions primed/dbgap/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ class dbGaPWorkspace(
help_text="Data available in this accession.",
blank=True,
)
is_sensitive = models.BooleanField(
verbose_name="Sensitive?",
help_text="Indicator of whether this workspace contains sensitive data.",
gsr_restricted = models.BooleanField(
verbose_name="GSR restricted?",
help_text="Indicator of whether public posting of GSRs is restricted.",
)

class Meta:
Expand Down
Loading

0 comments on commit b6d1828

Please sign in to comment.