biolink / ontobio

python library for working with ontologies and ontology associations
https://ontobio.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
119 stars 30 forks source link

Adds _taxon_map subkey to GolrSearchQuery result #618

Closed falquaddoomi closed 2 years ago

falquaddoomi commented 2 years ago

Currently, the biolink-api endpoint /search/entity/{term} returns just taxon labels in the facet_counts. taxon_label subkey, but other endpoints' filtering arguments require taxon IDs, not labels. Because of this, the Monarch frontend requires a map from taxon label to taxon ID, but ideally this data would come from the backend.

This PR adds an optional, but by default enabled facet to the results of ontobio.golr.GolrSearchQuery, specifically a subkey called _taxon_map with the following form:

"_taxon_map": [
  {
    "id": <taxon ID:str>,
    "label": <taxon label:str>,
    "count": <count:int>
  },
  ...
]

The extra facet can be disabled by passing taxon_map=False to ontobio.golr.GolrSearchQuery's constructor.

Addresses https://github.com/biolink/biolink-api/issues/386.

putmantime commented 2 years ago

@cmungall Can you look at this PR in support of Monarch UI development?