Category Archives: Smap Hints

Hints for using Smap

Limits on the number of questions per form

Recently a Smap customer, who are conducting a hospital audit, encountered problems loading a survey that had just under 2,000 questions.  The problem was caused by a limit in the Postgres database. There can be no more than 1,600 columns per table.  In a survey you can reach this limit either by specifying:

  • 1,600 questions
  • or 160 multiple choice questions with 10 options in each, since a separate column is used for each option in a multiple choice question
  • or a combination of the above

The solution to the problem is to enclose some questions within a repeat group with a “repeat_count” of “1”.  These questions will be written to a separate table in the database.

While the data collector is filling in the survey they will not be aware of this repeat group as it is set to automatically repeat just once.

When you export the survey results, if you select the “pivot” option, then the records from this “begin repeat” subform will be combined with the records from the main form.  However you will also have the option of exporting the main form and its sub form(s) separately.  I’ve seen exports of surveys to spreadsheets with over 3,000 columns and I’m not aware of any constraints on this.

I was able to load the large hospital audit survey after adding this begin repeat, end repeat solution. A future release of Smap will check that the maximum number of questions per form is not exceeded. If it is an error message will be shown.

Assign a task and export the results to Openstreetmap

This article demonstrates how to assign a task that will tell a user what data to collect and where to collect it.  The data will replace previously collected data and will then be loaded into Openstreetmap. An ODK compatible tool called fieldTask will be used.

Step 1. Create one or more tasks for someone to go and update the previously collected data.  This is done with the “Create Task” function in Smap. In this case I selected the previous address survey as the starting point and checked “Update existing results” which means that the old results will be replaced by the new. After creating the tasks they show up as red lines on the map on the “Assign” page. Red meaning “not yet allocated to anyone”.

assign task

Step 2. Assign the task. I assigned the longer survey containing odd addresses to myself.

Step 3. Download the task to the phone. On my phone I selected Menu then “Refresh Task List” which downloads the task and displays it in the task list and task map.

Step 4. Collect the new data. When I got to the location shown on the map I opened the survey and proceeded to record the missing addresses.

complete odk type survey in fieldTask

Step 5. Upload the results. After submitting the results, the dashboard shows that there are still two “good” records of address data, record 1 having been replaced by record 3.

Survey Analysis - Existing Record Replaced by new Record

I then exported the results in OSM format. This time I did not select any “ways” to be generated as I just wanted the address points. In JOSM I deleted the old address points that include an interpolation way, slightly adjusted the locations using Bing imagery and uploaded to the server. Click here to view the new addresses in Openstreetmap.

This technique could be useful during a response to a rapid onset emergency although it is unlikely that odk type surveys would be used to collect data that is loaded unchanged into Openstreetmap as it was here.  Instead there might be a need to take a subset of a complex survey and load only the tags relevant to OSM.  This would either be quite intensive manual work in JOSM or a filtering and transformation function could be added to the OSM export.

Testing a long survey

When creating long surveys for fieldTask you may want to try out a newly created, or modified section, that is a long way from the start. Its time consuming having to swipe past a lot of early questions and even worse if these have been set as “required”.  To quickly get to the right section you can use the “Go To Prompt” feature. Figure 1.

Start the survey in fieldTask or, odkCollect, select “menu” then “Go To Prompt”. A list of questions will be displayed which you can scroll through to find the question you want.

If you have repeating groups in your survey then this list of questions will initially stop at the repeat group.  To go further press on the downward arrow at the left of the repeat group name. Figure 2.

 

end2

Figure 3

Then press on the name that will appear at the bottom of the screen. The questions in the repeating group will be shown and you can continue to scroll down to find the section that you want to test.