Closed mjwestgate closed 4 months ago
Decision on 17-01-2024:
collapse()
will now return a query
object, which by default has slots type
and url
compute()
collapse()
also gains a new .expand
(?) argument
TRUE
, this appends the query_set
to an additional slot (possible called calls
?) to support debuggingcompute()
has reduced functionality under this model
collapse()
and compute()
compute()
is still critical for type = "occurrences"
, where it submits the query (but doesn't wait for a response)Implemented in v 2.0.1
As of version 2.0, you can use
collapse()
to convert adata_request
into aquery_set
. Aquery_set
often contains >1query
, with the finalquery
being the one requested by the user, and earlierquery
s being needed to check that it is valid. Finally, callingcompute()
evaluates thequery_set
into a single, valid URL:For occurrence queries, however,
compute()
is actually doing three things:This is not ideal, because it means that for occurrence queries, it is impossible to interrogate the URL before sending, or to see it once it has been sent. Fundamentally, this problem occurs because of a conflict between the principle that
collapse()
shouldn't ping an API, and the need ingalah
to run checks before building a URL. I see two possible solutions:collapse()
to not hit any APIs; thencollapse()
would always return a validquery
(or error if needed), but would also run checkscollapse()
andcompute()
(perhapsprecompute()
?) to build a single URL, but not push the request to the selected atlasMy instinct is that the former is neater, though it does change some behaviour from version 2.0. For context, this is what
dplyr
says about these functions: