Proposed feature: KoBo P-coding

Hi @hayttom_ocha, here’s a proposed workaround for this without making changes to the KoBo codebase to allow for external API requests.

  1. Create a simple form with a geopoint question and extra hidden question:
type name label
geopoint location Where are you?
hidden p_code
  1. Create a Cloudflare Worker that consumes POST data
  2. Copy the Worker URL and use it to set up a REST Service in KoBo
  3. Extend the Worker to parse the submission JSON for location coordinates and use the ITOS P-Code API to get the code
  4. Extend the Worker again to make a PATCH request to /api/v2/assets/<asset_uid>/data/bulk/ to update the p_code question value with the code returned from the API

This may however be more suitable to an AWS Lambda Function, following the same general workflow. We are currently using Lambda and API Gateway with SES to send messages to Zulip when submissions come in to a deployed form.

(Disclaimer: I haven’t had the opportunity to fully test this, but in theory it should work)

1 Like