Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError in TranslatorImplementation when using node normalizer endpoint #662

Closed
caufieldjh opened this issue Sep 28, 2023 · 1 comment · Fixed by #663
Closed

AttributeError in TranslatorImplementation when using node normalizer endpoint #662

caufieldjh opened this issue Sep 28, 2023 · 1 comment · Fixed by #663

Comments

@caufieldjh
Copy link
Collaborator

Discovered here in ontogpt: monarch-initiative/ontogpt#224

Calls to the node normalizer endpoint through TranslatorImplementation lead to an AttributeError as the response is valid JSON but appears to just be "detail: "Not Found"", even for cases where an input CURIE really should be found.
(and even if it wasn't found, I'd expect the error to be caught).

Example:

$ python
Python 3.9.18 (main, Aug 25 2023, 13:20:04) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from oaklib.implementations.translator.translator_implementation import TranslatorImplementation
>>> ti = TranslatorImplementation()
>>> maps = ti.sssom_mappings("HGNC:11148")
>>> for map in maps:
...   print(maps)
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/harry/ontogpt/.venv/lib/python3.9/site-packages/oaklib/implementations/translator/translator_implementation.py", line 62, in sssom_mappings
    equiv_identifiers = data.get("equivalent_identifiers", [])
AttributeError: 'str' object has no attribute 'get'
@caufieldjh
Copy link
Collaborator Author

I think there's a simple fix here:

NODE_NORMALIZER_ENDPOINT = "https://nodenormalization-sri.renci.org/1.3/get_normalized_nodes"

needs to be

NODE_NORMALIZER_ENDPOINT = "https://nodenormalization-sri.renci.org/1.4/get_normalized_nodes"

in
translator_implementation.py.

@caufieldjh caufieldjh linked a pull request Sep 28, 2023 that will close this issue
caufieldjh added a commit that referenced this issue Sep 29, 2023
Update address for node normalizer endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant