gbif / vocabulary

A simple registry of controlled vocabularies used for terms found in GBIF mediated data.
Apache License 2.0
5 stars 1 forks source link

Include parent labels in suggest #113

Open MortenHofft opened 2 years ago

MortenHofft commented 2 years ago

https://api.gbif-uat.org/v1/vocabularies/EventType/concepts/suggest?limit=100&q=Si&locale=en

I think it would be more informative for the end user if lineage was included in suggestions. Would it make sense to add that to the suggest? Possible as a param?

// So instead of just
[
  {
    "key": 156,
    "name": "SiteVisit",
    "label": {
      "en": "Site Visit"
    }
  }
]

// I would get
[
  {
    "key": 156,
    "name": "SiteVisit",
    "label": {
      "en": "Site Visit"
    },
    "lineage": [
      {
        "name": "Event",
        "label": {
          "en": "Event"
        }
      }
    ]
  }
]

That is what we do for e.g. species - which allows us to show the classification as part of the suggestion https://api.gbif-uat.org/v1/species/suggest?q=puma

An alternative is to do it as a graphql wrapper that expand the parents, but as a suggest that probably isn't ideal for performance.