From dd25508fe50635c0b82248f64cd27d51f7a13a21 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Thu, 23 Nov 2023 09:37:16 +0100 Subject: [PATCH] Simplify loading of converter in CurieService --- backend/src/monarch_py/service/curie_service.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/monarch_py/service/curie_service.py b/backend/src/monarch_py/service/curie_service.py index cd62ebe22..888ac9eaa 100644 --- a/backend/src/monarch_py/service/curie_service.py +++ b/backend/src/monarch_py/service/curie_service.py @@ -1,7 +1,7 @@ ### make a singleton class that uses prefixmap and curies to expand curies from curies import Converter -from prefixmaps.io.parser import load_multi_context +from prefixmaps import load_converter class CurieService: @@ -17,9 +17,7 @@ def __new__(cls): def initialize(self): # this is a magic keyword that represents the "merged" context from Chris M's algorithm # (https://github.com/linkml/prefixmaps/blob/main/src/prefixmaps/data/merged.csv) - context = load_multi_context(["merged"]) - extended_prefix_map = context.as_extended_prefix_map() - self.converter = Converter.from_extended_prefix_map(extended_prefix_map) + self.converter = load_converter(["merged"]) def expand(self, curie: str) -> str: return self.converter.expand(curie)