diff --git a/HISTORY.rst b/HISTORY.rst index 4e3d6e228..f4fc44141 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -39,7 +39,8 @@ End-User Summary - Improving performance of case listing (#304) - Adding shortcut buttons to phenotype annotation (#289) - Fixing issue with multiple added variants (#283) -- Implementing several usability improvements for clinvar submission editor (#286). +- Implementing several usability improvements for clinvar submission editor (#286) +- Make clinvar UI work with many annotations (#302) Full Change List ================ @@ -81,6 +82,7 @@ Full Change List - Adding shortcut buttons to phenotype annotation (#289) - Fixing issue with multiple added variants (#283) - Implementing several usability improvements for clinvar submission editor (#286). +- Make clinvar UI work with many annotations by making it load them lazily for one case at a time (#302) - Adding CI builds for Python 3.10 in Github actions, bumping numpy/pandas dependencies. Dropping support for Python 3.7. diff --git a/clinvar_export/tests/test_permissions_ajax.py b/clinvar_export/tests/test_permissions_ajax.py index 8b5233542..97dcfca26 100644 --- a/clinvar_export/tests/test_permissions_ajax.py +++ b/clinvar_export/tests/test_permissions_ajax.py @@ -5,7 +5,7 @@ from projectroles.tests.test_permissions_api import TestProjectAPIPermissionBase from geneinfo.tests.factories import HpoNameFactory, HpoFactory -from variants.tests.factories import SmallVariantCommentFactory +from variants.tests.factories import CaseFactory, SmallVariantCommentFactory from .factories import ( SubmissionSetFactory, SubmissionFactory, @@ -18,6 +18,7 @@ SubmittingOrgFactory, SubmitterFactory, ) +from ..models import Family class TestOrganisationAjaxViews(TestProjectAPIPermissionBase): @@ -681,10 +682,16 @@ def test(self): class TestAnnotatedSmallVariantsAjaxViews(TestProjectAPIPermissionBase): """Permission tests for the AJAX views for querying user-annotated small variants.""" + def setUp(self): + super().setUp() + self.case = CaseFactory(project=self.project) + self.family = Family.objects.get_or_create_in_project(project=self.project, case=self.case) + def test(self): SmallVariantCommentFactory() url = reverse( - "clinvar_export:user-annotations", kwargs={"project": self.project.sodar_uuid,}, + "clinvar_export:user-annotations", + kwargs={"project": self.project.sodar_uuid, "family": self.family.sodar_uuid}, ) good_users = [ self.superuser, diff --git a/clinvar_export/tests/test_views_ajax.py b/clinvar_export/tests/test_views_ajax.py index deadb0239..d58b71ae7 100644 --- a/clinvar_export/tests/test_views_ajax.py +++ b/clinvar_export/tests/test_views_ajax.py @@ -876,6 +876,7 @@ class TestAnnotatedSmallVariantsAjaxViews(TestProjectAPIPermissionBase): def setUp(self): super().setUp() self.case = CaseFactory(project=self.project) + self.family = Family.objects.get_or_create_in_project(project=self.project, case=self.case) self.small_variant = SmallVariantFactory(case_id=self.case.id) kwargs = { key: getattr(self.small_variant, key) @@ -887,7 +888,8 @@ def setUp(self): def test_query(self): url = reverse( - "clinvar_export:user-annotations", kwargs={"project": self.project.sodar_uuid,}, + "clinvar_export:user-annotations", + kwargs={"project": self.project.sodar_uuid, "family": self.family.sodar_uuid}, ) with self.login(self.contributor_as.user): response = self.client.get(url) diff --git a/clinvar_export/urls.py b/clinvar_export/urls.py index 66a2414c6..d6059c068 100644 --- a/clinvar_export/urls.py +++ b/clinvar_export/urls.py @@ -102,7 +102,7 @@ name="query-hpo-term", ), url( - regex=r"^ajax/(?P[0-9a-f-]+)/user-annotations/?$", + regex=r"^ajax/(?P[0-9a-f-]+)/user-annotations/(?P[0-9a-f-]+)/?$", view=views_ajax.AnnotatedSmallVariantsApiView.as_view(), name="user-annotations", ), diff --git a/clinvar_export/views_ajax.py b/clinvar_export/views_ajax.py index b0cd9f761..210291b7a 100644 --- a/clinvar_export/views_ajax.py +++ b/clinvar_export/views_ajax.py @@ -31,6 +31,7 @@ from variants.queries import SmallVariantUserAnnotationQuery from .clinvar_xml import SubmissionXmlGenerator, XSD_URL_1_7 from .models import ( + Case, SubmissionSet, Submission, Organisation, @@ -424,8 +425,9 @@ class AnnotatedSmallVariantsApiView( permission_required = "clinvar_export.view_data" allowed_methods = ("GET",) - def get(self, *_args, **_kwargs): + def get(self, *_args, **kwargs): + family = Family.objects.get(project=self.get_project(), sodar_uuid=kwargs.get("family")) serializer = AnnotatedSmallVariantsSerializer( - SmallVariantUserAnnotationQuery(get_engine()).run(project=self.get_project()) + SmallVariantUserAnnotationQuery(get_engine()).run(case=family.case) ) return Response(serializer.data) diff --git a/varfish/static/js/variant_validator.js b/varfish/static/js/variant_validator.js index da554d0cb..e1c8a0284 100644 --- a/varfish/static/js/variant_validator.js +++ b/varfish/static/js/variant_validator.js @@ -4,7 +4,7 @@ function queryVariantValidatorApi(obj, release, chromosome, start, reference, al let box = button.closest('.modal-content').find('.variant-validator-results'); button.attr('disabled', true); icon.attr('src', '/icons/fa-solid/refresh.svg').addClass('spin'); - box.html('
'); + box.html('
'); $.ajax({ type: 'POST', url: variant_validator_url, diff --git a/varfish/vueapp/src/api/clinvarExport.js b/varfish/vueapp/src/api/clinvarExport.js index 27835a2a5..d768350bf 100644 --- a/varfish/vueapp/src/api/clinvarExport.js +++ b/varfish/vueapp/src/api/clinvarExport.js @@ -203,8 +203,8 @@ export default { return await apiDelete('submitting_org', submittingOrg.sodar_uuid, appContext) }, - async getUserAnnotations (appContext) { - const response = await fetch(`${appContext.baseUrl}/user-annotations/`, { + async getUserAnnotations (appContext, familyUuid) { + const response = await fetch(`${appContext.baseUrl}/user-annotations/${familyUuid}`, { method: 'GET', credentials: 'same-origin', headers: { diff --git a/varfish/vueapp/src/components/SubmissionList.vue b/varfish/vueapp/src/components/SubmissionList.vue index 7f78dceb9..9c39fcab1 100644 --- a/varfish/vueapp/src/components/SubmissionList.vue +++ b/varfish/vueapp/src/components/SubmissionList.vue @@ -47,12 +47,27 @@

  • +
    + +
    all: @@ -97,15 +112,12 @@ P5
    -
    - -
    -
    +
    affecteds only
    -
    +
    @@ -175,9 +187,33 @@
  • - There is no matching user annotation for variants in this project. + + + Please select a case to display the variant user annotations. + + + + + Fetching variants from case from server... + + + + + Ouch, an error occured while fetching the variants! + + + + + None of the {{ rawModalUserAnnotationsCount }} user annotations matched your selection criteria. + + + + + There is no matching user annotation for variants in this project. + +
@@ -185,15 +221,19 @@