-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #400 from UW-GAC/feature/collab-analysis-workspaces
Collaborative analysis workspaces
- Loading branch information
Showing
27 changed files
with
3,575 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
"""Temporary script to create some example data for the collaborative_analysis app. | ||
Run with: python manage.py shell < add_collaborative_analysis_example_data.py | ||
""" | ||
|
||
from anvil_consortium_manager.tests.factories import ( | ||
AccountFactory, | ||
BillingProjectFactory, | ||
GroupAccountMembershipFactory, | ||
GroupGroupMembershipFactory, | ||
ManagedGroupFactory, | ||
) | ||
|
||
from primed.cdsa.tests.factories import CDSAWorkspaceFactory | ||
from primed.collaborative_analysis.tests.factories import ( | ||
CollaborativeAnalysisWorkspaceFactory, | ||
) | ||
from primed.dbgap.tests.factories import dbGaPWorkspaceFactory | ||
from primed.miscellaneous_workspaces.tests.factories import OpenAccessWorkspaceFactory | ||
|
||
billing_project = BillingProjectFactory.create(name="test_collab") | ||
|
||
# Create some collaborative analysis workspace. | ||
# Workspace 1 | ||
collaborative_analysis_workspace_1 = CollaborativeAnalysisWorkspaceFactory.create( | ||
workspace__name="collab_1_open_access", workspace__billing_project=billing_project | ||
) | ||
source_workspace_1_1 = OpenAccessWorkspaceFactory.create( | ||
workspace__name="source_1_open_access", workspace__billing_project=billing_project | ||
) | ||
collaborative_analysis_workspace_1.source_workspaces.add(source_workspace_1_1.workspace) | ||
|
||
# Workspace 2 | ||
collaborative_analysis_workspace_2 = CollaborativeAnalysisWorkspaceFactory.create( | ||
workspace__name="collab_2_dbgap_and_cdsa", | ||
workspace__billing_project=billing_project, | ||
) | ||
source_workspace_2_1 = dbGaPWorkspaceFactory.create( | ||
workspace__name="source_2_dbgap", workspace__billing_project=billing_project | ||
) | ||
collaborative_analysis_workspace_2.source_workspaces.add(source_workspace_2_1.workspace) | ||
source_workspace_2_2 = CDSAWorkspaceFactory.create( | ||
workspace__name="source_2_cdsa", workspace__billing_project=billing_project | ||
) | ||
collaborative_analysis_workspace_2.source_workspaces.add(source_workspace_2_2.workspace) | ||
|
||
# Workspace 3 - with an error | ||
collaborative_analysis_workspace_3 = CollaborativeAnalysisWorkspaceFactory.create( | ||
workspace__name="collab_3_with_error", workspace__billing_project=billing_project | ||
) | ||
source_workspace_3_1 = OpenAccessWorkspaceFactory.create( | ||
workspace__name="source_3_open_access", workspace__billing_project=billing_project | ||
) | ||
collaborative_analysis_workspace_3.source_workspaces.add(source_workspace_3_1.workspace) | ||
|
||
|
||
# Add accounts to the auth domains. | ||
account_1 = AccountFactory.create( | ||
user__name="Adrienne", verified=True, email="[email protected]" | ||
) | ||
account_2 = AccountFactory.create( | ||
user__name="Ben", verified=True, email="[email protected]" | ||
) | ||
account_3 = AccountFactory.create( | ||
user__name="Matt", verified=True, email="[email protected]" | ||
) | ||
account_4 = AccountFactory.create( | ||
user__name="Stephanie", verified=True, email="[email protected]" | ||
) | ||
|
||
# Set up collab analysis workspace one | ||
# analyst group | ||
GroupAccountMembershipFactory.create( | ||
account=account_1, group=collaborative_analysis_workspace_1.analyst_group | ||
) | ||
GroupAccountMembershipFactory.create( | ||
account=account_2, group=collaborative_analysis_workspace_1.analyst_group | ||
) | ||
# auth domains | ||
GroupAccountMembershipFactory.create( | ||
account=account_1, | ||
group=collaborative_analysis_workspace_1.workspace.authorization_domains.first(), | ||
) | ||
|
||
# Set up collab analysis workspace two | ||
# analyst group | ||
GroupAccountMembershipFactory.create( | ||
account=account_3, group=collaborative_analysis_workspace_2.analyst_group | ||
) | ||
GroupAccountMembershipFactory.create( | ||
account=account_4, group=collaborative_analysis_workspace_2.analyst_group | ||
) | ||
# auth domains | ||
GroupAccountMembershipFactory.create( | ||
account=account_3, | ||
group=collaborative_analysis_workspace_2.workspace.authorization_domains.first(), | ||
) | ||
GroupAccountMembershipFactory.create( | ||
account=account_3, | ||
group=source_workspace_2_1.workspace.authorization_domains.first(), | ||
) | ||
GroupAccountMembershipFactory.create( | ||
account=account_3, | ||
group=source_workspace_2_2.workspace.authorization_domains.first(), | ||
) | ||
GroupAccountMembershipFactory.create( | ||
account=account_4, | ||
group=source_workspace_2_1.workspace.authorization_domains.first(), | ||
) | ||
|
||
# Set up collab analysis workspace three | ||
# Managed group to show an error | ||
managed_group = ManagedGroupFactory.create(name="test-error") | ||
GroupGroupMembershipFactory.create( | ||
parent_group=collaborative_analysis_workspace_3.workspace.authorization_domains.first(), | ||
child_group=managed_group, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from anvil_consortium_manager.adapters.workspace import BaseWorkspaceAdapter | ||
from anvil_consortium_manager.forms import WorkspaceForm | ||
|
||
from . import forms, models, tables | ||
|
||
|
||
class CollaborativeAnalysisWorkspaceAdapter(BaseWorkspaceAdapter): | ||
"""Adapter for CollaborativeAnalysisWorkspace.""" | ||
|
||
type = "collab_analysis" | ||
name = "Collaborative Analysis workspace" | ||
description = "Workspaces used for collaborative analyses" | ||
list_table_class_staff_view = tables.CollaborativeAnalysisWorkspaceStaffTable | ||
list_table_class_view = tables.CollaborativeAnalysisWorkspaceUserTable | ||
workspace_form_class = WorkspaceForm | ||
workspace_data_model = models.CollaborativeAnalysisWorkspace | ||
workspace_data_form_class = forms.CollaborativeAnalysisWorkspaceForm | ||
workspace_detail_template_name = ( | ||
"collaborative_analysis/collaborativeanalysisworkspace_detail.html" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.contrib import admin | ||
from simple_history.admin import SimpleHistoryAdmin | ||
|
||
from . import models | ||
|
||
|
||
@admin.register(models.CollaborativeAnalysisWorkspace) | ||
class CollaborativeAnalysisWorkspaceAdmin(SimpleHistoryAdmin): | ||
"""Admin class for the `CollaborativeAnalysisWorkspace` model.""" | ||
|
||
list_display = ( | ||
"id", | ||
"workspace", | ||
"custodian", | ||
) | ||
list_filter = ("proposal_id",) | ||
sortable_by = ( | ||
"id", | ||
"workspace", | ||
"custodian", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class CollabAnalysisConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "primed.collaborative_analysis" |
Oops, something went wrong.