diff options
author | Munyoki Kilyungi | 2024-09-19 09:49:17 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-09-23 12:32:51 +0300 |
commit | 14ca82dc10aed0e6a2a56420ce8d8876b8b94275 (patch) | |
tree | 65f377761b7fea6e651368858325d8f3399cb73d | |
parent | 6a603988e611ead57039e32f9e8a9b89d9d0f373 (diff) | |
download | genenetwork3-14ca82dc10aed0e6a2a56420ce8d8876b8b94275.tar.gz |
Alphabetically sort the categories and pubmed_ids array.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r-- | gn3/db/rdf/wiki.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gn3/db/rdf/wiki.py b/gn3/db/rdf/wiki.py index 67bc194..5c69083 100644 --- a/gn3/db/rdf/wiki.py +++ b/gn3/db/rdf/wiki.py @@ -43,6 +43,7 @@ def __sanitize_result(result: dict) -> dict: categories = result.get("categories") if isinstance(categories, str): result["categories"] = [categories] if categories else [] + result["categories"] = sorted(result["categories"]) pmids = result.get("pubmed_ids") if isinstance(pmids, str): result["pubmed_ids"] = [pmids] if pmids else [] @@ -52,6 +53,7 @@ def __sanitize_result(result: dict) -> dict: int(pmid.split("/")[-1]) if isinstance(pmid, str) else pmid for pmid in result["pubmed_ids"] ] + result["pubmed_ids"] = sorted(result["pubmed_ids"]) return result |