From 6b1db4eeaff75bd46c43945f6eeb7599747fc9f2 Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Tue, 20 Sep 2022 10:57:33 +0200 Subject: [PATCH] Fixing ClinVar submission XML generation (#677) Closes: #677 Related-Issue: #677 Projected-Results-Impact: none --- HISTORY.rst | 2 ++ clinvar_export/clinvar_xml.py | 3 +++ clinvar_export/views_ajax.py | 18 ++++++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 96b20f6ab..b2510d862 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -57,6 +57,7 @@ End-User Summary - Improving Clinvar filter performance (#635). - Warning in the case of truncated displayed results (#641). - Improving Clinvar record aggregation (#640). +- Fixing ClinVar submission XML generation (#677). Full Change List ================ @@ -112,6 +113,7 @@ Full Change List - Warning in the case of truncated displayed results (#641). - Improving Clinvar record aggregation (#640). - Fixing Docker builds (#660). +- Fixing ClinVar submission XML generation (#677). ------ v1.2.0 diff --git a/clinvar_export/clinvar_xml.py b/clinvar_export/clinvar_xml.py index edf8aa146..f965ebbaa 100644 --- a/clinvar_export/clinvar_xml.py +++ b/clinvar_export/clinvar_xml.py @@ -260,6 +260,9 @@ def build_xref(term_id): "id": phenotype["term_id"], }, ), + **{ + "ClinicalFeaturesAffectedStatus": "present", + }, ) for phenotype in submission_individual.phenotypes ], diff --git a/clinvar_export/views_ajax.py b/clinvar_export/views_ajax.py index 7da164a38..1b915d1ac 100644 --- a/clinvar_export/views_ajax.py +++ b/clinvar_export/views_ajax.py @@ -254,10 +254,20 @@ def get(self, request, *args, **kwargs): "valid": True, } else: - result = { - "valid": False, - "details": "\n".join(e.message for e in schema.error_log), - } + ignored_message = ( + "Element 'Trait', attribute 'ClinicalFeaturesAffectedStatus': The attribute " + "'ClinicalFeaturesAffectedStatus' is not allowed." + ) + filtered_es = [e for e in schema.error_log if e.message != ignored_message] + if filtered_es: + result = { + "valid": False, + "details": "\n".join(e.message for e in filtered_es), + } + else: + result = { + "valid": True, + } return JsonResponse(result) def _get_schema(self, root):