biodiversitydata-se / SBDI4R

R package to search and access data made available through the Swedish biodiversity data infrastructure SBDI
https://biodiversitydata-se.github.io/SBDI4R/
GNU Affero General Public License v3.0
1 stars 2 forks source link

sbdi4r species list by traits (species attributes & facts) #23

Open DeboraArlt opened 3 years ago

DeboraArlt commented 3 years ago

function specific for Swedish data:

We want R functions dynamically creating species lists from Artfakta information (via Artfakta APIs) for use in bioatlas. We need to find out how we can use Artfakta APIs.

Artfakta = species facts i.e. information linked to species including: Swedish occurrence, landscape type, biotope, substrate, some traits, Red list information (categories)

Users want to be able to search for records of all species classed according to, e.g. a specific substrate. There are 2 ways to do this: 1) using species lists indexed in the LA portal (predefined, e.g. Red list, or can also import own lists), 2) dynamically create list in R using Artfakta API:s.

We want to create a user-defined species list based on species facts information so we can search for records for the species on that list. In order for the user to select a class or category they need to be presented with the values to choose from. Note that the current occurrence() in ALA4R does not support lists, only search for one taxon. But there are API web services that allow using species lists so it should be possible to add this to our wrapper package.

More information on API Species Information in attached pdf (in Swedish only): API-dokumentation_SpeciesDataService_1.1.pdf

DeboraArlt commented 3 years ago

There are API:s that expose artfakta.

Some information about Artdatabankens API:s: https://www.artdatabanken.se/sok-art-och-miljodata/oppna-data-och-apier/om-artdatabankens-apier/

The link to Adb's development portal with API:s: https://api-portal.artdatabanken.se/

The API:s that expose artfakta are called 'Species Information' and here one can see which calls one can make: https://api-portal.artdatabanken.se/docs/services/species-information/operations/5ad736a5dde6451334e9a004

These APIs are easy to use, what could be a problem is the restrictions they have in amount of request etc. Every user would need a key given by Artdatabankens API portal. Would it be possible to get one key for all "sbdi4r" generic user, so that the package is recognised as a user? We also have to think of how to track usage (for reporting to VR) when users access data directly from the Adb Artfakta API. (perhaps a secondary issue - we can only track downloads of data, and not just usage of portal or sbdi4r that are not resulting in a download)

DeboraArlt commented 3 years ago

Note! - Task not possible with the current REST API:s, i.e. the API:s currently do not allow to retrieve a list of species for a given attribute (can only retrieve list of attributes for a given species).

We decided to work with fixed speciesLists for now (option 1, see above). The LA portals provide various species lists (e.g. red list, species lists for areas, etc.) and also allow users to upload their own lists. For provided species lists they will be added to the SOLR field index and can then be searched (in NBN the are listed as 'species_list_uid'. Species lists can then be searched like other indexed fields)