Scenarios
AScenario is a dictionary containing a key/value pair that is used to add data or content to questions in an EDSL survey. Scenarios allow you create variations and versions of questions efficiently, and with data or content from different sources.
EDSL provides a variety of methods for automatically generating scenarios from PDFs, CSVs, docs, tables, lists, dicts – and images. In the steps below we demonstrate how to create a scenario for an image and use it in a survey.
Note:When using images with questions it is necessary to specify a vision model, and to ensure that the model is capable of viewing each image. Always run test questions to ensure that each image is actually readable by the selected models.
Creating a scenario
We start by creating aScenario for an image. For purposes of demonstration, we use the FileStore module to post a PNG image to Expected Parrot, and then retrieve it and pass it to a Scenario (this can be done by any user with an Expected Parrot account). Note that FileStore can be used to post and retrieve all types of files, and will automatically infer the file type.
Here we post a file to Expected Parrot:
Scenario by creating a key and passing the file as the value. We also (optionally) create a key/value for metadata about the file that we want to keep with the survey results (more on this below):
Creating questions using the image
Next we construct questions with the image scenario. Note that we use a{{ placeholder }} for the scenario key for the image file. This will cause the image to be automatically be inserted when the survey is run with the scenario. We also pipe the answer to one question into a follow-on question:
