Skip to content

Commit e371a88

Browse files
authored
Merge pull request #118 from SCAI-BIO/fix-ols-import-null-description
fix: handle null descriptions in OLS import ask
2 parents 37d7ffd + 56671c9 commit e371a88

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

datastew/process/ols.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ def __process_page(self, page: int) -> Tuple[List[Concept], List[Mapping]]:
5454
labels = [term["label"] for term in terms]
5555
descriptions = []
5656
for term in terms:
57-
if "description" in term and len(term["description"]) > 0:
58-
if isinstance(term["description"], list):
59-
descriptions.append(term["description"][0])
60-
else:
61-
descriptions.append(term["description"])
57+
description = term.get("description")
58+
if isinstance(description, list) and description:
59+
descriptions.append(description[0])
60+
elif isinstance(description, str) and description:
61+
descriptions.append(description)
6262
else:
6363
descriptions.append(term["label"])
6464
if not self.use_weaviate_vectorizer:

0 commit comments

Comments
 (0)