SurveyCTO Coding Practices

Jump to: navigation, search

Thousands of users in more than 150 countries depend on SurveyCTO to conduct computer-assisted personal interviews (CAPI). This article discusses solutions to common approaches to sophisticated design and programming in the SurveyCTO. For a general introduction to how to structure your approach to CAPI programming, see Questionnaire Programming.

Read First

  • Add labels to the SurveyCTO form to speed up data import and cleaning.
  • Repeat groups/rosters for households, crops, activities, or otherwise, can be filtered, based on previous choices, and more.
  • Use question groups to apply a relevant condition to multiple fields, display multiple questions on the same screen, or frame all questions on a module in a group.
  • Employ dynamically populated choice lists to list choices contingent upon previous responses.
  • Gather additional data via audio audits and sensor data to improve data quality, monitoring, and precision.
  • SurveyCTO also lets users change the format of question text using basic HTML commands.

Variable Names

To speed up data import, all SurveyCTO surveys should have a language labeling column in both the questionnaire and the value labeling tab called "label:stata." This will be used to download and process the data. These labels should be in English, no longer than 32 characters, and use no special characters.

The research assistant responsible for data management helps to prepare this. For detailed instructions on how to use multiple languages on SurveyCTO, go to your SurveyCTO server, open up the documentation pages and search for "Translating a form into multiple languages".


In the field, the best practice when randomizing anything is to prepare randomization before the field activities begin – ideally in Stata and preload the assignments into the survey. Ways to randomly select survey participants in SurveyCTO include:

Random Draw of Beneficiaries - Method 1

Randomly drawing beneficiaries from a large pool without knowing if the potential beneficiaries are valid participants: this form randomly prioritizes participation over a group of IDs, which are then verified by the enumerator until a final group of 8 participants are registered.

Random Draw of Beneficiaries - Method 2

Randomly drawing of any number of beneficiaries using repeat group: this form randomly prioritize a group of IDs using an elegant and concise repeat group solution. However, this is not recommended for use in the field as it's not replicable without adaptation.

Managing Repeat Groups / Rosters

This sections lists code examples that fulfill special requirements related to rosters and repeat groups. These can be used to develop interesting functionalities within forms, particularly with responses from a household, plot or crop roster. Here are some examples:

  • Setting Up Repeat Group Using Previous Choices: this form shows two main ways of coding to repeat a set of questions over previously selected responses (i.e. a set of crops cultivated or activities performed).
  • Select Member in Roster Based on Criteria: in this example we have a roster over children and then we want the respondent to be asked to select the youngest child if the mother is present, if she is not present, we ask the respondent to select the second youngest child if the mother of the child is present, and so fourth.
  • Filtering on Conditions of Repeat Group Questions: this form utilizes responses found inside a repeat group roster as conditions upon which to filter choices for questions further down in a form.
  • Filtering in Repeated Choice Questions - this form shows how to code a repeating question where the list of choices is reduced if an option was previously selected.
  • Dealing with 'Other' Crops Over Different Repeat Group Levels: this form presents a solution for introducing new crops in different repeats and being able to recall them at other points in the survey. In general, many challenges arise when coding agriculture sections of household surveys. There is a lot of data to capture at different and changing levels: per season, per plot, per crop, etc. Sometimes you might want to change the level of questions from crop within plot within season to, for example, just the crop level. It's important that the respondents are able to recall harvest and sales information as accurately as possible, therefore we must structure surveys well to account for this. This form presents useful information for doing so.

Using Question Groups

Use a lot of question groups but do not overuse them. In general, use question groups to:

Applying Choice Lists

Choice lists are the answer options from which an enumerator chooses in a select_one or select_multiple question. They are listed in the choices tab in the SurveyCTO questionnaire. Open Data Kit, the programming language of SurveyCTO, has very few restrictions on how you can code your options. However, there are choice list best practices that matter for data quality:

  • Dynamically Populated Choice Lists - basic: it is possible to program dynamically populated choice lists using answers given by the respondents in a previous question.
  • Dynamically Populated Choice Lists - from repeated select_one: a specific example of dynamically populated choice list is when you populate a select_multiple question with answers from a select_one asked in a repeat group. For example, say that you list crops grown in a repeat group where each repeat is a crop, and later you want to be able to ask "which crop did you grow the most?" and only the crops already selected in the repeat group should display.

Integrating Calculations

SurveyCTO has developed a great best practices guide for using calculations, which help with the design of smarter surveys. For example, you can use calculations to find out how long it takes respondents to reach a certain point in your survey, to monitor your respondents’ observance of suggested response times for skill assessments or to ensure that PII doesn’t get captured in your data analysis. This guide provides tips and examples for using calculations in SurveyCTO.

Conducting Audio Audits

SurveyCTO supports random audio audits as a part of the survey meta-data. Audio audits are audio recordings that occur during an interview without an indication that the recording has been initiated. They are one of several tools that research teams can use to ensure that they are collecting the highest possible quality of data. They also provide a cost-effective way for research teams to better understand how enumerators are conducting surveys in the field. You can learn more about best practices, logistical and ethical considerations of audio audits in this SurveyCTO article.

Collecting Sensor Data

SurveyCTO can collect sensor meta-data using built-in Android device sensors. Android devices can come with a number of sensors beyond GPS including an accelerometer, gyroscope, light sensor, microphone, among others. The sensor data field types on SurveyCTO use these sensors to capture data during the survey that can provide users with an idea of:

  • The light conditions around the device.
  • How much the device moved.
  • How loud the sounds were around the device.
  • The pitch of the sounds around the device.
  • An estimate of whether a conversation was taking place around the device.

SurveyCTO has built Stata commands to help users easily analyze large volumes of sensor data streams. Sensor streams can be time-consuming to work with because for every submission, a sensor stream records a stream of observations (potentially thousands) and stores it as an additional .csv file attached to the submission. You can learn about these commands in this article and you can access the scto package here. Visit this SurveyCTO help article to learn more about sensor data.

Related Pages

Click here to see pages that link to this topic.

Additional Resources