Reputation: 358
I have a web application that have pre-defined set of questions as shown in the image below. A user is supposed to select a subset of the questions that he wants then click "Export Assessment". An XML should be created which will be imported into ODK Aggregate server which then becomes a Form which users in the field can get using ODK collect.
So far when a user clicks the Export I can only manage to create a json like below. Could someone point me to an easier way to end up with an ODK XForm.
[
{refField: null, label: "How many minutes does it take you to reach the nearest hospital from home?", hint: null, labelField: null, hintField: null,labelField: null, ref: "/data/group_ca7gs53/minutes_walk_hosp"}
{refField: null, label: "What mode of transport is your previous answer based on?", hint: null, labelField: null, hintField: null,labelField: null, ref: "/data/group_ca7gs53/mode_of_transport_prev_answe_0"}
{refField: null, label: "Specify other", hint: null, labelField: null, hintField: null,ref: "/data/group_ca7gs53/Specify_other_011"}
{refField: null, label: "How far is the river/dam from your house?", hint: null, labelField: null, hintField: null,ref: "/data/group_ca7gs53/minutes_walk_hosp"}
]
Upvotes: 0
Views: 295
Reputation: 1040
An easier way would be to use https://github.com/xlsform/pyxform, I think. If your UI can produce either a JSON format pyxform understands (or an xlsform), you can get a valid XForm from pyxform.
Note, KoBoToolbox has built a UI in front of pyxform as well.
Good luck!
Upvotes: 0