[API-users] /species/suggest - higherClassificationMap question

Tim Robertson trobertson at gbif.org
Fri Mar 11 18:33:53 UTC 2022


Hi József

I am no guru or web developer but looking at the code [1] I think it is pulling out distinct the ranks in order from the suggest response [2]. I see the code has this:

  <span ng-repeat="taxa in ['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']"
     ng-if="match.model[taxa] && taxa != match.model.rank.toLowerCase()">
        {{match.model[taxa]}}
  </span>

Someone may correct me if I’m wrong, but since it’s the weekend here now it may be some time – I hope this helps for starters…

Thanks,
Tim

[1] https://github.com/gbif/portal16/blob/80aa008dcd9442c47e6d9ee5894f4e19de4000d8/app/views/components/filterTaxon/suggestTaxonTemplate.html#L6
[2] https://api.gbif.org/v1/species/suggest?datasetKey=d7dddbf4-2cf0-4f39-9b2a-bb099caae36c&limit=10&q=Iris%20pumila



From: API-users <api-users-bounces at lists.gbif.org> on behalf of Szlamka József <szlajozs at gmail.com>
Date: Friday, 11 March 2022 at 18.44
To: api-users at lists.gbif.org <api-users at lists.gbif.org>
Subject: [API-users] /species/suggest - higherClassificationMap question
Hi API gurus,

I assume, the search box functionality in the species page of gbif homepage (e.g.: https://www.gbif.org/species/5298708) is based on "suggest". There each result contains the scientific name and the full taxonomic hierarchy e.g. "Iris pumila subsp. attica (Boiss. & Heldr.) K.Richt. Subspecies  | Plantae > Tracheophyta >  Liliopsida > Asparagales >  Iridaceae >  Iris >  Iris pumila".

My question: how is the hierarchy implemented? Is it based on "higherClassificationMap"? How?

When I play with the suggest api, the XMLHttpRequest responseText in raw text format contains the taxonomic hierarchy correctly (i.e. the physical order of the entries in "higherClassificationMap" is correct). Unfortunately after JSON.parse the resulting javascript object does not hold any information about the physical order of the key/value pairs.

Is there any smart way to overcome this, or shall I hardcode the hierarchy manually?

Thanks in advance.

József Szlamka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gbif.org/pipermail/api-users/attachments/20220311/d2bf0989/attachment.html>


More information about the API-users mailing list