SurveyCTO Programming Work Flow

Revision as of 13:55, 17 January 2017 by Admin (talk | contribs)
Jump to: navigation, search

While it is possible to code a SurveyCTO questionnaire in any different way, the time it will take and the quality of final product, depends a lot on how the work is planned. This article outlines an approach common among expereinced SurveyCTO programmers at DIME.

Paper First

Paper based survey. Test the way questions are asked. The questions are asked in a way that suits the programming, not other way araound. See Questionnaire Design.

Template Forms

SurveyCTO provides template forms that have the basic settings already in place. Always start by using them.

Pseudo Code

Writing pseudo code is a method that all computer scientist use to before starting to write code when they are not exactly sure how all details of that code will be in the end. It is very rare that anyone starting to code a SurveyCTO questionnaire knows how all modules will be coded, so writing pseudo code is the best place to start.

Writing pseudo code is simple to start by describing at a high level what the code will do (often in bullet points) in plain English. After all functions of the code is described at a high level, more details is added. As detail is added the language is also changes from plain English to something that resembles code more and more. Computer scientist very often write pseudo code with pen and paper or on a white board.

The next subsection gives a quick introduction on how to write pseudo code in relation to a SurveyCTO questionnaire.

Listing the modules

The highest level a questionnaire can be described on are the modules. So start by writing a list of the modules in your questionnaire. Write them in the order that you want them to be asked:

  • Employment
  • Household Roster
  • Savings
  • Maternal Health
Pseudo Code

Adding groups and repeat groups

The second highest level of detail is adding all the groups and repeat groups that will control the flow of the questionnaire. Some groups are used to change appearances of the questions, and those group does not need to be listed here. The groups important to list here are the groups that are used as skip patterns.

When you add a repeat group or a group used as a skip pattern, also add what will determine the number of repeats or what will cause the group to be skipped. We are still writing pseudo code so it is perfectly fine to write in plain English, although some code is also good.

  • Employment
    • repeat. One repeat for each household member over the age of 15
  • Household Roster
    • Ask how many people in the household then repeat over that number to ask about name, age etc.
  • Savings
    • Group. Ask if house hold have savings, if so ask savings question
  • Maternal Health
    • Group. If there is a female between the age of 16 and 45, then ask this module to the household head.

If you look at the pseudo code above, you will see that the repeat in the employment module depends on a variable that is not asked until the household roster. This is the purpose of writing pseudo code. We want to find anything in the intended high level structure of the questionnaire before we have spent any time working on any details. We need to re-write the of our pseudo code to put the employment module after the household roster, and while re-writing we can work restructure more of the detail we already have. For example introducing some variable names, add variables in that are needed in later modules:

  • Household Roster
    • hh_num_members: Ask how many people in the household
    • Repeat over hh_num_members
      • hhm_name: ask about household members name
      • hhm_age: ask about household members age
      • hhm_sex: ask about household members gender
  • Employment
    • Repeat over hh_num_members
      • Inside repeat, have a group restricted to (hhm_age > 15)
        • inside group, ask about employment
  • Savings
    • savings: Do you have any savings?
    • Group. skip if savings = no
      • savings questions
  • Maternal Health
    • Have a calculate that is yes if any household member is ()
    • Group. If there is a female between the age of 16 and 45, then ask this module to the household head.

Back to parent article

This article is a part of the chapter Questionnaire Programming.

See also

Further Reading