- Forms are authored according to XLSForm standard (using Microsoft Excel)
- These forms are then uploaded to http://ona.io/ which converts them into XForm standard. All OpenSRP forms can be found at https://beta.ona.io/opensrp (this requires login)
- XForm is then converted to Enketo HTML form by running the following command with the <username> replaced by the account name & <form_id> replaced with the actual value
curl command
curl -X POST -d "server_url=https://api.ona.io/api/v1/<username>&form_id=<form_id>" https://enketo.org/transform/get_html_form
- This generates a xml document which contains two nodes, model and form, rest of the nodes can be ignored. model is the XForm Model instance, this is used by Enketo to do all the validations and calculations in the forms. form is the HTML DOM which Enketo uses to render the form
- model and form are saved as model.xml and form.xml. These files are then copied to the location <dristhi_app_root>/dristhi-app/assets/www/form/<form_name>/model.xml and <dristhi_app_root>/dristhi-app/assets/www/form/<form_name>/form.xml. When a form is launched, form_name is passed in the query parameter. Using this Enketo renders the form
- Another important part of form is form_definition.json file. This is a mapping file that is written for every form which maps the fields within the form to Dristhi database. More about form_definition.json later
- So model.xml, form.xml and form_definition.json comprise a Enketo Form
The model.xml would look like something similar to (this will be provided by a developer).
<model> <instance> <hh_reg id="hh_reg" version="201503231156"> <formhub> <uuid/> </formhub> <HH_ID/> <HH_Name/> <ec_repeat template=""> <woman_name/> <husband_name/> <EC_HH_ID/> <EC_HH_Name/> <note/> <raihan_text/> </ec_repeat> <meta> <instanceID/> </meta> </hh_reg> </instance> </model>
This is a sample of how a model.xml would look like. This form has a few questions and as well as a repeating group. Please note the repeating group lies in between the tags "<ec_repeat >".
0 Comments