basf / rfieldclimate

An R client for Fieldclimate API
GNU General Public License v3.0
2 stars 1 forks source link

Add the possibility to retrive data from iSCOUT #1

Open agronomofiorentini opened 1 year ago

agronomofiorentini commented 1 year ago

Dear creators, I would like to know if it is possible to use this package to be able to get the data derived from iSCOUT, and if it is not possible I would like to ask if you could tell me how.

I am only interested in receiving a dataframe with data and images directly inside of shinyapp.

Thanks

eduardszoecs commented 1 year ago

Thanks @agronomofiorentini for your request.

We don't have an iSCOUT device for testing and do not provide a wrapper function for this endpoint.

But with fc_request() we have a workhorse in the package that could be used (and takes care of authorisation, error handling and parsing ).

The endpoint you're interested in is https://api.fieldclimate.com/v2/docs/#cameras-get-last-photos

So you could write a wrapper function along these lines (untested! so consider it as pseudocode):

get_image_url <- function(station_id = NULL, amount = 1L, camera = 1L, ...) {
  stopifnot(!is.null(station_id))
  stopifnot(is.integer(amount) && amount >= 1)
  stopifnot(is.integer(camera) && camera %in% c(0L, 1L, 2L))

  path <- file.path('/camera', station_id, "photos/last", amount, camera)
  fc_request(method = "GET", path = path, verbose = TRUE, ...)
}

If you have a working function / wrapper, we are happy to review a pull request.

agronomofiorentini commented 1 year ago

I have tested your function and actually give me 404 error.

I have tried to use the /station/station-id and give me information about position and others informations.

Actually we can proceed by steps.

Firstly, i would get the data that contains:

  1. Date
  2. Number of insect

Then if it is possible get also the last image in order to be rendered in the web application.

agronomofiorentini commented 1 year ago

Any news about this issue?

eduardszoecs commented 1 year ago

No, as already mentioned we don't have an iSCOUT device for testing & development and cannot implement this without. We are happy to review a pull request . if you can develop this.