-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kobotoolbox: add job examples #633
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Hunter Achieng <[email protected]>
@@ -0,0 +1,6 @@ | |||
fn(state => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the value of the fn()
block in this example?
Signed-off-by: Hunter Achieng <[email protected]>
Signed-off-by: Hunter Achieng <[email protected]>
Signed-off-by: Hunter Achieng <[email protected]>
Ok that new example is great! I think it would be nice to have another example which uses http helpers to do something a bit more weird. Something we can't do with the other APIs. I don't know what that is. Maybe you can ask around the team for ideas? Or look at the APIs and see if you can invent something? I wouldn't spend ages on this. I agree with @aleksa-krolls that 2 or 3 examples is ideal. But as this is a small API and for our users the use-case is surely just "I want to download some/all form submissions", there might not be much value in that. I suppose the other thing I can think of (in the same example or a different one) is to download submissions after a certain date. You'd need to use the query strings for that which aren't well documented but I could probably help |
I can add the example with the date filters. Let me read the docs again and will ping you if I am stuck |
@hunterachieng maybe an example that uses cursor? Something like the below which gets all submissions greater or equal to the cursor date.
|
@josephjclark I have re-read the docs and the only other thing we can do is ordering the items such as |
@hunterachieng what about Aleksa's suggestion? You can pass a query on get submissions You could also use |
Signed-off-by: Hunter Achieng <[email protected]>
@josephjclark I have implemented the example but I used |
@hunterachieng why do we not have options in
|
I have added it back |
Signed-off-by: Hunter Achieng <[email protected]>
return state; | ||
}); | ||
|
||
getSubmissions($.formId, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool, but
- we ought to use
cursor()
to set up the cursor. This should simulate a whole job step - the fn block doesn't do anything
Maybe we can make this more interesting by doing:
getForms()
to pull down all formseach($.data, getSubmissions($.data.id, { query })
That then is a job that gets all submissions for all forms, using a cursor. Cool!
Also, please double check that kobo (and the template) exports cursor from common!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes cursor is exported in both
Signed-off-by: Hunter Achieng <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! Thanks @hunterachieng
@aleksa-krolls as you're a bit savvier with Kobo any comments?
I don't want to merge this until the update is out, so let's keep this open but approved for now.
@josephjclark made a small change to one of the comments, but otherwise looks good to merge whenever ready |
DO NOT MERGE UNTIL kobo 3.0 is released
Short Description
Implement job examples for
kobotoolbox
adaptorCloses #970
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to
know!):
You can read more details in our
Responsible AI Policy