We could have a shortcut filter query. Like you can pass { $filter: <date> } today, but maybe we could have openfn-specific query keys, like since (returns submissions since that date). $ query params would map to odk directly, while others would be utilities provided by openfn. We may have to support multiple filters in this approach (if that's even possible)
We could provide shortcuts to fields, so maybe $filter=submissionDate gt 2020-01-31T23:59:59.999Z could "expand" to $filter=$root/Submissions/__system/submissionDate gt 2020-01-31T23:59:59.999Z. I don't know if we can automatically just prefix all fields with the $root path or if we need to provide explicit mappings
This would certainly be a lovely API:
getSubmissions(66, form2, { since: $.cursor })
Where cursor is set on input state or the last cron job.
The solution would like require the common cursor so probably needs an example or two somewhere (overview, readme or jsdoc)
In ODK, when fetching submissions, it's often useful to get by date - particularly when running a cron job.
Users need to build a query like:
Which is a lot of typing for a common use case!
A couple of thoughts:
{ $filter: <date> }
today, but maybe we could have openfn-specific query keys, likesince
(returns submissions since that date).$
query params would map to odk directly, while others would be utilities provided by openfn. We may have to support multiple filters in this approach (if that's even possible)$filter=submissionDate gt 2020-01-31T23:59:59.999Z
could "expand" to$filter=$root/Submissions/__system/submissionDate gt 2020-01-31T23:59:59.999Z
. I don't know if we can automatically just prefix all fields with the $root path or if we need to provide explicit mappingsThis would certainly be a lovely API:
Where cursor is set on input state or the last cron job.
The solution would like require the common
cursor
so probably needs an example or two somewhere (overview, readme or jsdoc)