modilabs/formhub — pull request #1241 by vernondcole (2013-09-24 17:09:27+00:00)
Title: Submission-time validations

This feature adds the ability for a programmer to define a callback function which will be called when given forms (specified by a regular expression) are submitted. This callback function would normally be used to provide validation checks for the survey data that are beyond the capability of the ODK program itself. If the callback function determines that the data are unacceptable, it will return an Exception, and formhub will reject the data with a 406 error code. (I have submitted a feature request to OpenODK to preserve the Exception message on the device.)

In its present form, this capability is only useful on "private" formhub installations. It is possible that some useful generic routines could be written for the shared formhub server. That idea will be addressed separately.

I will add that the author intends to use these callbacks to update a GIS database in real time as submissions arrive, possibly triggering alarms if certain data (such as discovery of an infectious disease) are received.