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

"category" field in /nlp/annotate/entities is always empty #387

Open
falquaddoomi opened this issue Feb 25, 2022 · 2 comments
Open

"category" field in /nlp/annotate/entities is always empty #387

falquaddoomi opened this issue Feb 25, 2022 · 2 comments

Comments

@falquaddoomi
Copy link
Collaborator

When querying against /nlp/annotate/entities, the returned "category" field for each token is always an empty list.

For example,

curl 'https://api.monarchinitiative.org/api/nlp/annotate/entities' \
  --data-raw 'content=Lewis+%281978%29+found+7+affected+males.'

results in (partial result):

{
  "content": "Lewis (1978) found 7 affected males.",
  "spans": [
    ...
    {
      "start": 30,
      "end": 36,
      "text": "males.",
      "token": [
        {
          "id": "UBERON:0003101",
          "category": [],
          "terms": [
            "male organism"
          ]
        }
      ]
    }
    ...
  ]
}

Querying directly against Scigraph Ontology's API, e.g. via:

curl 'https://scigraph-ontology.monarchinitiative.org/scigraph/annotations/entities' \
  --data-raw 'content=Lewis%20(1978)%20found%207%20affected%20males.'

produces (again, in part):

[
  ...
  {
    "token": {
      "id": "UBERON:0003101",
      "categories": [
        "anatomical entity"
      ],
      "terms": [
        "male organism"
      ]
    },
    "start": 30,
    "end": 36
  }
  ...
]

I'm not sure, but it seems likely that this is because the field in Token (https://github.com/biolink/ontobio/blob/31658ad37eb02f0e061ca5c4de36618cab6ea02b/ontobio/model/nlp.py#L14) is named category, not categories as SciGraph's API is returning.

To fix this, we'd need to modify the category field name in ontobio.model.nlp.Token to be categories, update biolink's ontobio dependency to this new version, then redeploy biolink.

@falquaddoomi
Copy link
Collaborator Author

In addition to renaming category to categories in ontobio.model.nlp.Token, the matching serializer class in biolink also needs to be updated in the same way: https://github.com/biolink/biolink-api/blob/master/biolink/datamodel/serializers.py#L336.

@vincerubinetti
Copy link

To add clarity why this is needed for the frontend:

image

It causes the annotations here to have (?) icons, because I dont know the category of each annotation, because that field is blank.

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

No branches or pull requests

2 participants