From 32879d23109338ee093fc2f364932d0c746c6f6d Mon Sep 17 00:00:00 2001 From: Estelle Da Date: Fri, 11 Sep 2026 16:47:02 +1000 Subject: [PATCH 1/4] Fix the outer source not found error in both Method sources and Threshold sources in creating a new score set and calibration. --- src/mavedb/lib/external_publications.py | 11 ++++++++++- src/mavedb/lib/identifiers.py | 10 ++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/mavedb/lib/external_publications.py b/src/mavedb/lib/external_publications.py index a48ff7185..96c4f8dd7 100644 --- a/src/mavedb/lib/external_publications.py +++ b/src/mavedb/lib/external_publications.py @@ -564,4 +564,13 @@ def _fetch(self, url: str, return_format: str = "json") -> Any: return [] response.raise_for_status() - return json.loads(response.text) if return_format == "json" else response.text + + if return_format == "json": + if not response.text or not response.text.strip(): + return [] + try: + return json.loads(response.text) + except json.JSONDecodeError: + return [] + + return response.text diff --git a/src/mavedb/lib/identifiers.py b/src/mavedb/lib/identifiers.py index d5bfdbd46..893442aff 100644 --- a/src/mavedb/lib/identifiers.py +++ b/src/mavedb/lib/identifiers.py @@ -216,7 +216,10 @@ async def fetch_biorxiv_article(identifier: str) -> Optional[RxivContentDetail]: Fetch an existing bioRxiv article from Rxiv """ fetch = Rxiv("https://api.biorxiv.org", "biorxiv") - articles = fetch.content_detail(identifier=identifier) + try: + articles = fetch.content_detail(identifier=identifier) + except Exception: + return None try: return articles[-1] except IndexError: @@ -228,7 +231,10 @@ async def fetch_medrxiv_article(identifier: str) -> Optional[RxivContentDetail]: Fetch an existing medRxiv article from Rxiv """ fetch = Rxiv("https://api.biorxiv.org", "medrxiv") - articles = fetch.content_detail(identifier=identifier) + try: + articles = fetch.content_detail(identifier=identifier) + except Exception: + return None try: return articles[-1] except IndexError: From 8a4b5e41d087dc2361bbd018f64fd4bcda424097 Mon Sep 17 00:00:00 2001 From: Estelle Da Date: Mon, 14 Sep 2026 15:57:49 +1000 Subject: [PATCH 2/4] Debug for test_create_experiment_rxiv_timeout. --- src/mavedb/lib/identifiers.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/mavedb/lib/identifiers.py b/src/mavedb/lib/identifiers.py index 893442aff..d5bfdbd46 100644 --- a/src/mavedb/lib/identifiers.py +++ b/src/mavedb/lib/identifiers.py @@ -216,10 +216,7 @@ async def fetch_biorxiv_article(identifier: str) -> Optional[RxivContentDetail]: Fetch an existing bioRxiv article from Rxiv """ fetch = Rxiv("https://api.biorxiv.org", "biorxiv") - try: - articles = fetch.content_detail(identifier=identifier) - except Exception: - return None + articles = fetch.content_detail(identifier=identifier) try: return articles[-1] except IndexError: @@ -231,10 +228,7 @@ async def fetch_medrxiv_article(identifier: str) -> Optional[RxivContentDetail]: Fetch an existing medRxiv article from Rxiv """ fetch = Rxiv("https://api.biorxiv.org", "medrxiv") - try: - articles = fetch.content_detail(identifier=identifier) - except Exception: - return None + articles = fetch.content_detail(identifier=identifier) try: return articles[-1] except IndexError: From 4138248ae6978d543b14a1660cc2dc33c4490ea2 Mon Sep 17 00:00:00 2001 From: Estelle Da Date: Wed, 23 Sep 2026 11:33:09 +1000 Subject: [PATCH 3/4] Modify the find_generic_article function. --- src/mavedb/lib/external_publications.py | 10 +--------- src/mavedb/lib/identifiers.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/mavedb/lib/external_publications.py b/src/mavedb/lib/external_publications.py index 96c4f8dd7..326102d77 100644 --- a/src/mavedb/lib/external_publications.py +++ b/src/mavedb/lib/external_publications.py @@ -565,12 +565,4 @@ def _fetch(self, url: str, return_format: str = "json") -> Any: response.raise_for_status() - if return_format == "json": - if not response.text or not response.text.strip(): - return [] - try: - return json.loads(response.text) - except json.JSONDecodeError: - return [] - - return response.text + return json.loads(response.text) if return_format == "json" else response.text diff --git a/src/mavedb/lib/identifiers.py b/src/mavedb/lib/identifiers.py index d5bfdbd46..d04fd3fae 100644 --- a/src/mavedb/lib/identifiers.py +++ b/src/mavedb/lib/identifiers.py @@ -1,3 +1,4 @@ +import logging import os from typing import Mapping, Optional, Union @@ -23,6 +24,8 @@ from mavedb.models.uniprot_identifier import UniprotIdentifier from mavedb.models.uniprot_offset import UniprotOffset +logger = logging.getLogger(__name__) + # XXX these classes all have an "identifier" attribute but there's no superclass # to unify them ... @@ -322,7 +325,17 @@ async def find_generic_article( ).scalar_one_or_none() if not existing_publication: - external_publication = await db_specific_fetches[publication_db](identifier) + try: + external_publication = await db_specific_fetches[publication_db](identifier) + except Exception: + logger.warning( + "Failed to fetch identifier %r from %s while fanning out over candidate databases.", + identifier, + publication_db, + exc_info=True, + ) + external_publication = None + found_articles[publication_db] = ( ExternalPublication(identifier, publication_db, external_publication) if external_publication From a068959831ffd3bdd4673550a7448a9a3903621a Mon Sep 17 00:00:00 2001 From: Estelle Da Date: Wed, 23 Sep 2026 12:14:50 +1000 Subject: [PATCH 4/4] Debug a test. --- src/mavedb/lib/identifiers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mavedb/lib/identifiers.py b/src/mavedb/lib/identifiers.py index d04fd3fae..c8d5d6acf 100644 --- a/src/mavedb/lib/identifiers.py +++ b/src/mavedb/lib/identifiers.py @@ -1,3 +1,4 @@ +import json import logging import os from typing import Mapping, Optional, Union @@ -327,7 +328,7 @@ async def find_generic_article( if not existing_publication: try: external_publication = await db_specific_fetches[publication_db](identifier) - except Exception: + except json.JSONDecodeError: logger.warning( "Failed to fetch identifier %r from %s while fanning out over candidate databases.", identifier,