ropensci / ruODK

ruODK: An R Client for the ODK Central API
https://docs.ropensci.org/ruODK/
GNU General Public License v3.0
41 stars 12 forks source link

Using filter parameters #109

Closed dmenne closed 3 years ago

dmenne commented 3 years ago

The filter parameters in https://github.com/getodk/central-backend/pull/305/commits/daa5e2606f52e8d596a548eb7f43163bab7920f9 will make it much easier to implement the warehouse approach. My current version to keep a local sqlite cache updated use hacky "skip count" logic.

I am sure you will implement this, I only post this to receive a reminder when it is active.

florianm commented 3 years ago

Reminder to self: Status quo: https://odkcentral.docs.apiary.io/#reference/odata-endpoints/odata-form-service/data-document

The $top and $skip querystring parameters, specified by OData, apply limit and offset operations to the data, respectively. The $count parameter, also an OData standard, will annotate the response data with the total row count, regardless of the scoping requested by $top and $skip. While paging is possible through these parameters, it will not greatly improve the performance of exporting data. ODK Central prefers to bulk-export all of its data at once if possible.

As of ODK Central v1.1, the $filter querystring parameter is partially supported. In OData, you can use $filter to filter by any data field in the schema. In ODK Central, the only fields you can reference are system/submitterId and system/submissionDate. These refer to the numeric actorId and the timestamp createdAt of the submission overall. The operators lt, lte, eq, neq, gte, gt, not, and, and or are supported. The built-in functions now, year, month, day, hour, minute, second are supported. These supported elements may be combined in any way, but all other $filter features will cause an error. Please see the OData documentation on $filter for more information.

In this release of Central, $expand is not yet supported. This will likely change in the future, once we can instate Navigation Properties.