AtlasOfLivingAustralia / ALA4R

Access data and resources hosted by the Atlas of Living Australia (ALA)
https://atlasoflivingaustralia.github.io/ALA4R/
41 stars 8 forks source link

Fetching data with ALA4R from Atlas instances in Europe fails when sourceTypeId parameter is provided through occurrences() function, succeeds when not #23

Closed mskyttner closed 7 years ago

mskyttner commented 7 years ago

We use ALA4R to retrieve occurrence data from Atlas instances in Europe. The request for fetching the occurrences appear to follow this form:

/occurrences/index/download?
q=Circus%20macrourus&reasonTypeId=10&sourceTypeId=2001&esc=%5C&sep=%09&
file=data

However, these kind of requests fails for all the instances except the one in Australia. When we change the request to not use the sourceTypeId=2001 parameter and value, it succeeds for all instances of biocache-service..

Can this be a configuration issue where the European instances of the Atlas do not support the sourceTypeId parameter? Or is it some data missing in that service?

To replicate please use this R code:

library(ALA4R)

ala_config(verbose=TRUE)
ala_config(caching="off")
server_config <- getOption("ALA4R_server_config")

#ws1 <- "http://records-ws.als.scot/"
#ws1 <- "http://recherche-ws.gbif.fr/"
#ws1 <- "http://datos.gbif.es/biocache-service/"
ws1 <- "http://biocache.ala.org.au/ws/"

ws2 <- "http://logger.ala.org.au/service/logger/"

server_config$base_url_biocache <- ws1
server_config$base_url_logger <- ws2

options(ALA4R_server_config = server_config)

occurrences(
  taxon = "Apus apus", 
  #record_count_only = TRUE, 
  download_reason_id = 10
)
djtfmartin commented 7 years ago

I suspect this is instances using an old version of the biocache service.

mskyttner commented 7 years ago

We are on 1.8.1... https://github.com/mskyttner/ala-docker/blob/master/Makefile#L17 there seems to be a 1.8.2-SNAPSHOT too, should we aim for that one?

djtfmartin commented 7 years ago

I'd stick with 1.8.1 for now.

raymondben commented 7 years ago

The github ALA4R now has an additional server_config field for the biocache server version. This works for me:

devtools::install_github("AtlasOfLivingAustralia/ALA4R")
ala_config(verbose=TRUE)
ala_config(caching="off")
server_config <- getOption("ALA4R_server_config")
ws1 <- "http://datos.gbif.es/biocache-service/"
server_config$base_url_biocache <- ws1
options(ALA4R_server_config = server_config)
x1 <- occurrences(taxon = "Apus apus",download_reason_id = 10) ## fails, as in your example

server_config$biocache_version <- "1.8.1"
options(ALA4R_server_config = server_config)
x1 <- occurrences(taxon = "Apus apus",download_reason_id = 10) ## ok

Does that seem like a reasonable solution?

mskyttner commented 7 years ago

Yes, thank you, very reasonable!

We have installed ALA4R with devtools and we confirm that it works for us to get data from some European instances now....

I think this issue can be closed now.

raymondben commented 7 years ago

@mskyttner - this is now in the CRAN version of ALA4R (v1.5.6)