From 14ca82dc10aed0e6a2a56420ce8d8876b8b94275 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Thu, 19 Sep 2024 09:49:17 +0300 Subject: Alphabetically sort the categories and pubmed_ids array. Signed-off-by: Munyoki Kilyungi --- gn3/db/rdf/wiki.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gn3/db') 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 -- cgit v1.2.3