worldbank / iefieldkit

Stata commands designed for Impact Evaluations field work. These are tools that are used during/after a survey in the field for data quality monitoring.
MIT License
38 stars 18 forks source link

Ietestform - Suggestion: check for 'other' text field #117

Open stevenglover opened 4 years ago

stevenglover commented 4 years ago

Check that there is an associated text field whenever 'other' is listed as a choice in a select_one or _multiple fields. Generate warning if text field doesn't exist or relevance isn't coded correctly.

I suppose this would need users to define a standard value that 'other, specify' is coded as in the input to running iefieldkit.

kbjarkefur commented 4 years ago

Good suggestion! A few thoughts on how to implement.

I think it is not too difficult to implement a test for if specify other exist, once we have comprehensively laid out the case how that field can appear.

The most difficult part to code is to test if it is coded correctly, as there could be different styles, multiple conditions (e.g. only ask for specify other if two conditions apply) etc. That part I think is more difficult to implement. Unless we give a warning for all cases that is not coded like the most simple case, and then the user has to ignore the false positives.

stevenglover commented 4 years ago

Instead of testing on a string, I would test on a unique value assigned to all 'other' option choices. For example, the surveys I program always have -9 for 'other', -8: don't know, -7: refuse, etc... So in this case the test for whether the text specify other field exists could then be for whether the relevance expression exists in any text field for this value. This would require the survey to have a unique value for 'other' choices, and this value to be defined in the ietestform command by the user.

So my idea would be that if a select_one or _multiple has 'othervalue' as a potential choice, then a text field would have either ${question} = 'othervalue' or selected(${question}, 'othervalue') as the relevance. I think this would overcome the issues you mention about the text field not coming directly after.

As you mention, it will be difficult to account for all situations, so therefore best probably to flag as warnings for incorrect cases. Perhaps output like this would be informative:

  1. A list of select_one and _multiple fields that DO NOT have 'othervalue' as a choice option (for manual user checking)
  2. Of those select_one and _multiple fields that DO have an 'other' field as an option, list those that DO NOT have a linked text field with a relevance expression described above (again, to flag for user to check if it functions correctly).