ibartomeus / traitbase

This repo manages the dynamic individual trait database www.traitbase.info via traitbaseR (https://github.com/metadevpro/traitbaser)
7 stars 1 forks source link

Column `_links`, what's in it? #27

Open KevCaz opened 5 years ago

KevCaz commented 5 years ago

My understanding is that it contains a part of URL that could be useful at some point. In the example below, to me, the only piece of information that we may re-use is 5b04107a2265c5000fab1b7a, am I right?

$`_links`
$`_links`$observation

$`_links`$observation[[1]]
$`_links`$observation[[1]]$href
[1] "/api/species/5b04107a2265c5000fab1b7a/observation"

$`_links`$observation[[2]]
$`_links`$observation[[2]]$href
[1] "/api/species/5b04107a2265c5000fab1b7a/observation"

$`_links`$observation[[2]]$verb
[1] "POST"

$`_links`$`action-delete`
$`_links`$`action-delete`$verb
[1] "DELETE"

$`_links`$`action-delete`$href
[1] "/api/species/5b04107a2265c5000fab1b7a"
ibartomeus commented 4 years ago

From KevCaz: When I retrieve the data base, all entries but a few have 12 columns, the few other have 11. Is that normal?

R> names(responseNA[[1]]) [1] "_links" "_id" "species" "order" "superfamily" "family" "subfamily" "tribe" "genus"

[10] "subgenus" "__v" "_createdAt" R> names(responseNA[[19699]]) [1] "_links" "_id" "genus" "species" "order" "superfamily" "family" "tribe" "subgenu s" [10] "__v" "_createdAt"

subfamily missing

R> table(val) val 11 12 344 19387

Regarding the to_dataframe() function, I think what we should do is: ensure all columns exist, sort all elements of the list and then use a do.call(rbind, list), that will be the output and if the user wants to remove metadata, it's up to him! Also, I think this function should also be part of auxiliar.R.

And I will remove the _links column and create a function that parse it. I cannot see how users can use it, but it may be useful for the development of the package.