Can ODK help me survey users about randomly generated images?

Hello Everyone,

I'm a graduate student at the University of Texas studying Global Policy and Data Science. A data scientist from the R4DS community recommended that I get involved with ODK for my project, but I'm really new and don't know how to proceed with the resources you all offer. Here's a breakdown of what I'm trying to do:

This summer I'm working with a professor at Princeton that conducts a massive survey in the Middle East (25,000+ respondents) called the Arab Barometer. We're trying to determine how people evaluate what makes something fake news. The idea is to create an algorithm to randomly assign features of a Facebook page image, such as in the picture attached. Features like publication source, location, news story subjects, number of shares etc. would change randomly each time someone takes the survey. Also, it's important to note that the survey is going to be conducted on a tablet in areas that wont have internet access, so everything has to be stored on the device.

I know R, and I'm pretty good at Python as well, so I know that I can create the image processing algorithm, but I don't know how I would integrate that with survey software. Is this something I can do with ODK products?

Thank you. I really appreciate all help and advice.

Ethan Tenison

1 Like

Hi @ethantenison, and welcome to the ODK forum!

At some point after you collect the data, you'll get the data off the tablets. There are multiple ways to do so, but one common approach is to submit the data to a server (ODK Aggregate or ODK Central) once the device is back in an area with Internet access.

Once the data is on the server, you can download it as a CSV file, which you can load using R or Python. If you're using ODK Central as your server, you can also access your data using OData or using the REST API. If you're using R, you might also want to take a look at ruODK.

Hope that helps!

1 Like

Hi @ethantenison and welcome. @Matthew_White has provided an overview of how to do data analysis. I believe that you are asking more about the survey design and how to show different random images to survey takers, is that right?

I would generate all of the different image permutations by some external process with your tool of choice (R, Python, etc). Then I would create many different questions with media, one for each generated image. If there are huge numbers, I'd use a script to generate the XLSForm rows.

I'd then have a single calculate with a call on once(random()) * number_of_images to select one of the images at the start of the survey. I'd use a relevant expression for each image question to only show the one that matches the provided number. That is, the first image would have a relevant expression like ${random_num} = 1, the second ${random_num} = 2, etc. That would ensure only one of the images would be shown.

Hopefully this gives you one possible general strategy. Let us know if you have additional questions.


That's definitely what we had in mind. This is all very exciting!

This is fantastic! We're looking at upwards of 100,000 possible combinations. I don't think the devices will have enough storage space to store all of them, so I will definitely be writing a script. The image elements we're looking to manipulate are the following:

  1. Publication source
  2. Author name and or location (West, same country, other Arab country)
  3. Subject of the news story
  4. Short summary of story
  5. Shared by
  6. Number of shares
  7. Number of comments

I'll read through the documentation and get back with you. Thank you!

You may also want to look into external application integration. You could write a small external application that generates the random image, shows it to the user, and sends Collect information about which element combination the user was shown. You could consider using the Android split screen feature so that the image and the survey can be shown at the same time.


Do you think external application integration would be complicated for the surveyors to operate? For it to work I think surveyors would need as few steps as possible to get it running.

Once the question with the external app integration is reached, the data collector would see a button to launch the app. In your case, I imagine that custom app would show a random image each time it is launched by Collect with no options or a specific image if launched by Collect with an image identifier. Then the surveyor would need to use the back button to return to Collect.