Skip to content

Commit

Permalink
Truncate overly verbose version texts
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed Sep 4, 2024
1 parent f2d8408 commit 5429b5c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/kg_bioportal/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def get_ontology_list(self) -> None:
"""Get the list of ontologies from BioPortal.
This includes the descriptive name and most recent version.
Some versions are not specified, while others are verbose.
In the latter case, they are truncated to the first three words.
Args:
None.
Expand Down Expand Up @@ -136,8 +138,14 @@ def get_ontology_list(self) -> None:

name = metadata["name"].replace("\n", " ").replace("\t", " ")
if len(latest_submission) > 0:
if current_version:
current_version = latest_submission["version"].replace("\n", " ").replace("\t", " ")
if latest_submission["version"]:
current_version = " ".join(
(
latest_submission["version"]
.replace("\n", " ")
.replace("\t", " ")
).split()[:3]
)
else:
current_version = "NA"
submission_id = latest_submission["submissionId"]
Expand Down

0 comments on commit 5429b5c

Please sign in to comment.