Skip to content

Commit

Permalink
revert source priority (do in new issue)
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Sep 27, 2023
1 parent 11bbc56 commit 894d319
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions disease/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
RefType,
SearchService,
ServiceMeta,
SourcePriority,
SourceName,
)

from .version import __version__
Expand Down Expand Up @@ -371,11 +371,19 @@ def _record_order(self, record: Dict) -> Tuple[int, str]:
:return: tuple with rank value and concept ID
"""
src = record["src_name"]
try:
source_rank = SourcePriority[src].value
except KeyError:
if src == SourceName.NCIT.value:
source_rank = 1
elif src == SourceName.MONDO.value:
source_rank = 2
elif src == SourceName.ONCOTREE.value:
source_rank = 3
elif src == SourceName.OMIM.value:
source_rank = 4
elif src == SourceName.DO.value:
source_rank = 5
else:
logger.warning(f"query.record_order: Invalid source name for " f"{record}")
source_rank = len(SourcePriority) + 1
source_rank = 4
return source_rank, record["concept_id"]

def _handle_failed_merge_ref(self, record, response, query) -> NormalizationService:
Expand Down

0 comments on commit 894d319

Please sign in to comment.