Skip to content

Commit

Permalink
do not assume presensce of results[0]
Browse files Browse the repository at this point in the history
  • Loading branch information
turbomam committed Jan 14, 2025
1 parent b2c1c62 commit 961fc65
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sample_annotator/clients/gold_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def fetch_study(self, id: str, include_biosamples=False) -> StudyDict:
id = self._normalize_id(id)
logging.info(f"Fetching study: {id}")
results = self._call("studies", {"studyGoldId": id})

if not results:
logging.warning(f"No study found for ID: {id}")
return {} # Or handle differently depending on your needs

study = results[0]
if include_biosamples:
study["biosamples"] = self.fetch_biosamples_by_study(id)
Expand Down

0 comments on commit 961fc65

Please sign in to comment.