Skip to content

Multi-Phase Workflows

Build multi-stage annotation workflows in Potato with consent, pre-screening, instructions, training, and post-study surveys, plus conditional survey questions.

Potato runs the annotation task as one phase in a longer workflow, so consent, screening questions, instructions, training and an exit survey can sit around it without a separate survey tool.

A survey-flow annotation workflow — Sequential phases wrap the core annotation task; every phase but annotation is optionalA survey-flow annotation workflow

Available Phases

PhasePurposeRequired
consentCollect informed consentOptional
prestudyPre-screening questions and demographicsOptional
instructionsTask instructions and guidelinesOptional
trainingQualification with feedbackOptional
annotationThe main annotation taskRequired
poststudyPost-study survey and feedbackOptional

Annotators move through the enabled phases in the order you declare.

Basic Configuration

The phases block lists the order and points each phase at its file:

yaml
phases:
  order: [consent, prestudy, instructions, annotation, poststudy]
 
  consent:
    type: consent
    file: surveyflow/consent.json
 
  prestudy:
    type: prestudy
    file: surveyflow/prescreening.json
 
  instructions:
    type: instructions
    file: surveyflow/instructions.html
 
  poststudy:
    type: poststudy
    file: surveyflow/demographics.json

The annotation phase needs no file, because it uses the project's top-level annotation_schemes.

Phase Types

Each file-based phase declares a type saying which stage of the workflow it is. The valid values are consent, prestudy, instructions, training, annotation, and poststudy.

Set type explicitly. Potato infers it only when the phase name is itself one of those words, so a phase with a custom name has to declare one:

yaml
phases:
  order: [intro, consent, instructions, annotation, feedback]
 
  intro:
    type: prestudy          # custom name, so type is required
    file: surveyflow/intro.json
 
  consent:
    type: consent
    file: surveyflow/consent.json
 
  instructions:
    type: instructions
    file: surveyflow/instructions.html
 
  feedback:
    type: poststudy         # custom name, so type is required
    file: surveyflow/feedback.json

Back Navigation

The Back button is hidden when there is no previous page, which includes the first annotation instance. To let annotators move back across phase boundaries:

yaml
allow_phase_back_navigation: true

With it off, annotators can still move backward inside a phase, such as between annotation instances.

Survey Question Format

Survey phases read a JSON array. Each question needs a name, an annotation_type naming the widget, and a description shown to the annotator, plus the options of that type, such as labels for a radio question:

json
[
  {
    "name": "consent_1",
    "annotation_type": "radio",
    "description": "I certify that I am at least 18 years of age.",
    "labels": ["I agree", "I disagree"],
    "label_requirement": {"required_label": ["I agree"]}
  },
  {
    "name": "consent_2",
    "annotation_type": "radio",
    "description": "I have read and understood the information above.",
    "labels": ["Yes", "No"],
    "label_requirement": {"required_label": ["Yes"]}
  }
]

Potato refuses a question without name, annotation_type, and description at startup. Older survey files used id, text, schema, and choices, and Potato 2 no longer reads those keys.

Supported Question Types

radio for one choice, multiselect for several, text for free text, number for numeric input, likert for a rating scale, slider for a continuous scale, select for a dropdown, and pure_display for text with no answer. A survey page accepts any annotation type Potato knows, and refuses an unknown type at startup.

Label Requirements

label_requirement decides which answers let the annotator continue:

json
{
  "name": "age_check",
  "annotation_type": "radio",
  "description": "Are you at least 18 years old?",
  "labels": ["Yes", "No"],
  "label_requirement": {
    "required_label": ["Yes"],
    "required": true
  }
}

required_label lists the acceptable answers, and required: true says the question must be answered. A consent question that nobody can fail records nothing, so put the acceptable answer in required_label rather than relying on the wording. The server checks both keys from Potato 2.13.1, so a request that skips the browser cannot leave a required question blank. In earlier releases the server checked required_label only, so on an older release use required_label for any answer the study depends on, such as consent or a screener.

Pre-Screening Questions

Pre-screening runs before the main task, and is where eligibility and background questions belong:

yaml
phases:
  order: [prestudy, annotation]
  prestudy:
    type: prestudy
    file: surveyflow/prescreening.json
json
[
  {
    "name": "country",
    "annotation_type": "select",
    "description": "Which country do you live in?",
    "use_predefined_labels": "country",
    "label_requirement": {"required": true}
  },
  {
    "name": "familiarity",
    "annotation_type": "likert",
    "description": "How familiar are you with this topic?",
    "size": 5,
    "min_label": "Not at all",
    "max_label": "Extremely",
    "label_requirement": {"required": true}
  }
]

Post-Study Surveys

yaml
phases:
  order: [annotation, poststudy]
  poststudy:
    type: poststudy
    file: surveyflow/demographics.json
json
[
  {
    "name": "gender",
    "annotation_type": "radio",
    "description": "What gender do you most closely identify with?",
    "labels": ["Male", "Female", "Non-binary", "Prefer not to say"],
    "label_requirement": {"required": true}
  },
  {
    "name": "feedback",
    "annotation_type": "text",
    "description": "Please share any feedback about this study (optional)"
  }
]

Built-in Label Sets

Potato ships label sets for the questions most studies repeat, so a country list does not have to be pasted into the config:

json
{"name": "country", "annotation_type": "select", "description": "Select your country", "use_predefined_labels": "country"}

The available sets are country, ethnicity, and religion.

Free Response Fields

Add an optional text box to any question with has_free_response, which is what "Other" options need to be worth offering:

json
{
  "name": "gender",
  "annotation_type": "radio",
  "description": "What is your gender?",
  "labels": ["Woman", "Man", "Non-binary", "Prefer not to disclose", "Prefer to self-describe"],
  "has_free_response": {"instruction": "Please specify:"},
  "label_requirement": {"required": true}
}

Page Headers

A phase has no header setting. To put a heading or a short instruction at the top of a survey page, make the first question in the file a pure_display question:

json
{"name": "consent_intro", "annotation_type": "pure_display", "description": "<h3>Please answer all consent questions</h3>", "allow_html": true}

Conditional Questions

Survey questions can appear based on earlier answers, so a follow-up is asked only when it applies. Because survey questions run through the same pipeline as annotation schemes, a condition references another question by its name:

json
[
  {
    "name": "prior_experience",
    "annotation_type": "radio",
    "description": "Have you previously worked on a text-annotation task?",
    "labels": ["Yes", "No"],
    "label_requirement": {"required": true}
  },
  {
    "name": "experience_details",
    "annotation_type": "text",
    "description": "Please briefly describe your previous annotation experience.",
    "label_requirement": {"required": true},
    "display_logic": {
      "show_when": [
        {"schema": "prior_experience", "operator": "equals", "value": "Yes"}
      ]
    }
  }
]

A hidden question is excluded from required-field validation, so it never blocks the Continue button while it is not showing.

Three behaviors are worth knowing. A condition can reference a question on any phase, so a post-study question can depend on a pre-study answer. Invalid display_logic, such as an unknown operator or a reference to a question that exists nowhere, fails at server startup rather than at runtime. And an instructions phase pointing at a raw .html file bypasses the schema pipeline, so conditions do not apply there.

With export_include_phase_data: true, Potato re-evaluates each participant's answers server-side and leaves out answers to questions they never saw. See Conditional Logic for the full operator reference.

Complete Example

yaml
annotation_task_name: "Sentiment Analysis Study"
task_dir: "."
port: 8000
 
data_files:
  - "data/reviews.json"
 
item_properties:
  id_key: id
  text_key: text
 
annotation_schemes:
  - annotation_type: radio
    name: sentiment
    description: "What is the sentiment of this review?"
    labels:
      - Positive
      - Negative
      - Neutral
    sequential_key_binding: true
 
phases:
  order: [consent, prestudy, instructions, training, annotation, poststudy]
 
  consent:
    type: consent
    file: phases/consent.json
 
  prestudy:
    type: prestudy
    file: phases/demographics.json
 
  instructions:
    type: instructions
    file: phases/instructions.html
 
  training:
    type: training
    file: phases/training_questions.json
 
  poststudy:
    type: poststudy
    file: phases/exit_survey.json
 
training:
  enabled: true
  data_file: phases/training_questions.json
  passing_criteria:
    min_correct: 3
  allow_retry: true
 
allow_phase_back_navigation: false
 
output_annotation_dir: "output/"
export_annotation_format: "jsonl"
 
user_config:
  allow_all_users: true

The training phase takes its settings from the top-level training block, while the phases entry only places it in the order. See Training Phase for the passing criteria and the data format.

The Old surveyflow Block

Potato no longer reads the top-level surveyflow block. Potato 2.13.1 accepts the key and nothing acts on the block, so a config that still uses surveyflow shows no survey pages at all. potato validate warns that the block has no effect, and --strict fails on the warning. Older configs and tutorials used this form:

yaml
surveyflow:
  on: true
  order:
    - pre_annotation
    - post_annotation
  pre_annotation:
    - surveyflow/consent.jsonl
    - surveyflow/demographics.jsonl
  post_annotation:
    - surveyflow/exit_survey.jsonl

Migration

Move each part of the old block into phases:

Old surveyflow settingphases equivalent
surveyflow.on: trueA phases block
surveyflow.pre_annotationphases.consent or phases.prestudy
surveyflow.post_annotationphases.poststudy
surveyflow.testingtraining.data_file
.jsonl files.json files holding an array

Best Practices

Keep Surveys Short

Every extra question costs completion rate, and demographic questions that nothing in the analysis uses cost it for nothing.

Test the Whole Flow

Complete the workflow yourself, in a browser with no session, before sending the link anywhere. Consent and login are the two places a broken workflow fails first and most silently.

Mark Required Fields Carefully

Required questions that could have been optional produce answers people invented to get past the page.

Crowdsourcing

Completion codes are configured with the top-level completion_code key rather than on the post-study phase:

yaml
completion_code: "POTATO2024"
auto_redirect_on_completion: true
auto_redirect_delay: 5000

See Crowdsourcing for the platform setup.

Further Reading

For implementation details, see the source documentation.