Pavlovia Export Guide
Overview
PRISM can export survey/questionnaire data to PsychoPy/Pavlovia format, enabling you to run your validated questionnaires as online experiments on Pavlovia.org.
Why Export to Pavlovia?
Online Data Collection: Host questionnaires on Pavlovia for remote participants
Integration with Experiments: Combine surveys with cognitive tasks in PsychoPy
Advanced Features: Reaction times, randomization, conditional logic
Data Management: Automatic data saving to Pavlovia servers or OSF
Architecture
From PRISM to Pavlovia
PRISM Survey JSON
↓
pavlovia.py converter
↓
PsychoPy .psyexp + conditions.csv
↓
PsychoPy Builder/Pavlovia
↓
Online Experiment
What Gets Converted
PRISM Feature |
Pavlovia Component |
|---|---|
Questions |
Form components or Text + Slider |
Levels (answer options) |
Choice lists / Scale parameters |
Items (array subquestions) |
Loop + spreadsheet conditions |
Condition (relevance) |
Code components with if-statements |
Position.GroupOrder |
Routines in Flow |
Mandatory |
Validation in code component |
Usage
Basic Conversion
# Convert single questionnaire
python src/converters/pavlovia.py task-bdi_beh.json
# Output: task-bdi/task-bdi.psyexp
With Customization
# Specify output directory and experiment name
python src/converters/pavlovia.py \
task-bdi_beh.json \
--output ./experiments/bdi_online \
--experiment-name "BDI-II Online"
Generated Structure
task-bdi/
├── task-bdi.psyexp # PsychoPy experiment definition
├── task-bdi.py # Python version (for local testing)
├── task-bdi.js # JavaScript version (auto-generated by PsychoPy)
├── index.html # Web hosting wrapper (auto-generated)
├── conditions.csv # Trial/question parameters
└── README.md # Instructions for uploading to Pavlovia
Question Type Mapping
Array Questions (Multiple Items)
PRISM:
{
"STAI": {
"Description": "State Anxiety",
"Items": {
"01": {"Description": "I feel calm", "Order": 1},
"02": {"Description": "I feel secure", "Order": 2}
},
"Levels": {
"1": "Not at all",
"2": "Somewhat",
"3": "Moderately so",
"4": "Very much so"
}
}
}
Pavlovia: Creates a loop with conditions spreadsheet where each row = one item.
Free Text
PRISM:
{
"COMMENTS": {
"Description": "Any additional comments?",
"QuestionType": "Long Free Text"
}
}
Pavlovia: Creates a Form component with textbox.
Advanced Features
Conditional Display
PRISM:
{
"PHQ9_10": {
"Description": "Suicide ideation follow-up",
"Condition": "PHQ9_09 > 0"
}
}
Pavlovia: Generates code component that checks previous response and conditionally shows question.
Randomization
Use PRISM groups with randomization:
PRISM:
{
"Position": {
"Group": "BlockA",
"RandomizeGroup": true
}
}
Pavlovia: Creates separate loops that can be randomized in the Flow.
Limitations
Not Currently Supported
Complex Logic: Nested conditions (e.g., “(Q1=1 OR Q2=2) AND Q3>5”)
Piping: Inserting previous answers into question text
Question Arrays with Multiple Scales: Dual-scale arrays
File Uploads: Not typical in surveys
Workarounds
Complex Logic: Manually edit the generated code component
Piping: Use PsychoPy’s variable substitution (
$variableName)Dual Scales: Create as two separate questions
Testing Before Upload
Open in PsychoPy Builder:
psychopy task-bdi.psyexpTest Locally: Click the green “Run” button
Export HTML: File → Export HTML → Check “Export to Pavlovia”
Upload to Pavlovia:
Create project on Pavlovia.org
Use git or Pavlovia sync to upload files
Integration with PRISM Workflow
Typical Workflow
Design in LimeSurvey or JSON Editor
Convert to PRISM:
python helpers/surveys/limesurvey_to_prism.pyValidate:
python prism.py --validate task-bdi_beh.jsonExport to Pavlovia:
python src/converters/pavlovia.py task-bdi_beh.jsonUpload to Pavlovia: Via PsychoPy or git
Collect Data: Participants complete online
Download Data: From Pavlovia.org
Convert Back to PRISM:
python src/converters/pavlovia.py --import data.csv task-bdi_beh.json
Data Round-Trip
PRISM TSV/JSON → Pavlovia → Online Data → CSV Download → PRISM TSV/JSON