Difference between revisions of "SurveyCTO Coding Practices"

Jump to: navigation, search
(43 intermediate revisions by 8 users not shown)
Line 1: Line 1:
This article discuss solutions to common issues in the SurveyCTO programming language. For a general introduction to how to structure your approach to CAPI programming or best practices settings, see the [[Questionnaire Programming]] topic.
Thousands of users in more than 150 countries depend on '''SurveyCTO''' to conduct [[Computer-Assisted Personal Interviews (CAPI) | computer-assisted personal interviews (CAPI)]].  This article discusses solutions to common approaches to sophisticated [[Questionnaire Design | design]] and [[Questionnaire Programming | 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 [[Data Cleaning |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 [[SurveyCTO HTML Input|basic HTML commands]].


== Read First ==
All coding examples linked to in this section are stored in Google Drive. SurveyCTO also allows you to pull this code directly to your server, using the URL of the Google Sheet (alternatively, you can copy the code to Excel).


==Groups==
== Variable Names ==
Use a lot of groups but do not over use them. In general, groups are used to fulfill one of the purposes below:


*Apply a [[Relevance Condition to Multiple Fields|relevance condition to multiple fields]].
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.  
*If you have [[Multiple Questions Displayed at the Same Time |multiple questions displayed at the same time]].
*Frame all the questions on a module in group. Only do this at the highest level of the survey, i.e. do not use this for sub-levels of a module.


==Choice Lists==
The research assistant responsible for [[Data Management | 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"'''.
== Randomizing ==
In the field, the [[Randomization in SurveyCTO | best practice when randomizing anything]] is to prepare randomization before the field activities begin – ideally in [[Randomization in Stata | Stata]] and preload the assignments into the survey. Ways to randomly select survey participants in '''SurveyCTO''' include:
=== Random Draw of Beneficiaries - Method 1 ===
[[SurveyCTO Random Draw of Beneficiaries 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 [[ID Variable Properties | IDs]], which are then verified by the enumerator until a final group of 8 participants are registered.


Choice lists are the answer options an enumerator can choose from 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 [[SurveyCTO Choice Lists|choice list best practices]] that matter for data quality.
=== Random Draw of Beneficiaries - Method 2 ===
[[SurveyCTO Random Draw of Beneficiaries 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 [[Reproducible Research | replicable]] without adaptation.


It is possible to program [[SurveyCTO Dynamically Populated Choice Lists|dynamically populated]] choice lists using answers given by the respondents in a previous question.
== 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:
* [[SurveyCTO Repeat Group Using Previous Choices|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).
* [[SurveyCTO Select from Roster Age Order|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.
*  [[SurveyCTO Conditional Filtering|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.
* [[SurveyCTO Filtering in Repeated Questions|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.
* [[SurveyCTO Dealing with 'Other' Crops Over Different Repeat Group Levels |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:
*[[Relevance Condition to Multiple Fields|Apply a relevance condition to multiple fields]].
*[[Multiple Questions Displayed at the Same Time |Display multiple questions on the same screen]].
* Frame all the questions on a module in group: only do this at the highest level of the survey (i.e. do not use this for sub-levels of a module).
=== 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 [[SurveyCTO Choice Lists|choice list best practices]] that matter for data quality:
* [[SurveyCTO Dynamically Populated Choice Lists|Dynamically Populated Choice Lists - basic]]: it is possible to program dynamically populated choice lists using answers given by the respondents in a previous question.
* [[SurveyCTO Dynamically Populated Choice Lists From Select One|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 [[Personally Identifiable Information (PII) | PII]] doesn’t get captured in your [[Data Analysis | data analysis]]. [https://www.surveycto.com/blog/using-calculations/ 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 [[Data Quality Assurance Plan | 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 [[Research Ethics | ethical]] considerations of audio audits in [https://www.surveycto.com/blog/audio-audits-best-practices/ 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 [https://www.surveycto.com/blog/stata-sensor-data/ this article] and you can access the scto package [https://github.com/surveycto/scto here]. Visit [https://support.surveycto.com/hc/en-us/articles/360009552713-Using-sensor-meta-data?flash_digest=bc582e369a0560a8424218ec245209eefb41bfe4 this SurveyCTO help article] to learn more about sensor data.
 
== Related Pages ==
[[Special:WhatLinksHere/SurveyCTO_Coding_Practices|Click here to see pages that link to this topic]].


== Additional Resources ==
== Additional Resources ==
* list here other articles related to this topic, with a brief description and link
* Simrin Makhija (IFPRI), [https://www.surveycto.com/best-practices/pro-tips-for-agricultural-surveys-from-ifpri/ Pro tips for designing and deploying complex agricultural surveys in SurveyCTO]
 
*DIME Analytics (World Bank), [https://github.com/worldbank/DIME-Resources/blob/master/survey-cto.pdf Slides on SurveyCTO]
* SurveyCTO, [https://support.surveycto.com/hc/en-us/articles/360009552713-Using-sensor-meta-data Using sensor meta-data]
* Jan Schenk, [https://medium.com/@janschenk/variable-names-in-survey-research-a18429d2d4d8 Variable Names in Survey Research]
[[Category: SurveyCTO Coding Practices ]]
[[Category: SurveyCTO Coding Practices ]]
[[Category: Technical Tools]]

Revision as of 00:56, 19 July 2022

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".

Randomizing

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