Project-ling proposal: Simple and extensible passing of flat lists to SurveyStack

Background: Greg and Kevin spoke on March 24th about the FarmOS field and planting questions that can be pulled into SurveyStack surveys. Kevin wanted to know if there was an easy way to copy the format of this exchange for LiteFarm locations and crop plans as well. Per Greg, this exchange is achieved by a shared authentication between FarmOS and SurveyStack. That is, a user logs into SurveyStack using their FarmOS credentials and based on this, SurveyStack can extract specific data from their FarmOS instance. This does NOT seem like a reasonable pattern to use for LiteFarm, since (currently) survey takers using LiteFarm will not be logged into SurveyStack.

 

Proposal: When generating the SurveyStack iFrame inside of LiteFarm, could we just pass a JSON payload describing any number of lists that would then populate in SurveyStack? For example, when creating a survey, could a user mark a multiple choice, checkbox, or dropdown as receiving a dynamic input rather than a static pre-defined input? Once defined, a user accessing that survey programmatically through LiteFarm or another tool could include a payload similar to what’s shown below:

 

"lf_locations": { "label": "Locations", "question_type": "dynamic_multiple_choice", "values": [ { "location": "Field 1" }, { "location": "Greenhouse" }, { "location": "Field 2" }, { "location": "Riparian buffer zone" } ] }, "lf_crops": { "label": "Crops", "question_type": "dynamic_multiple_choice", "values": [ { "crop": "Cosmic crunch (apple)" }, { "crop": "Honeycrisp (apple)" }, { "crop": "Red delicious (apple)" } ] }

 

The survey, when generated would do roughly the following:

  1. Check to see if it had any dynamic content

  2. If so, match the dynamic content labels with the payload - in this case “lf_crops” and “lf_locations”

  3. Populate those survey questions with the dynamic content, or handle any issues with those questions (e.g. missing or malformed content)

 

Other considerations: SurveyStack would need to define error handling in the case where dynamic inputs are missing or malformed.