Pulling participant survey responses thrrough to psychopy task

URL of experiment: Pavlovia

Description of the problem:

Hi, I’m developing an experiment where participants first complete a survey in which they score trivia questions to which the answers are not provided. They rank how curious they are about each of the 20 questions provided on a likert scale of 1-5. I need to pull through 5 instances of trivia quesrtions which have scored 1 and 5 instances of questions which have scored 5.

I’m struggling to work out how to set up a routine to do this dynamically. So as the participant fills out the survey on pavlovia, i’d like the psychopy routine to update. The experiment will be run online when finished.

To achieve this I’ve set up a routine after my survey routine called ‘dynamic_stimuli_routine’. I’ve added a code component into the ‘begin experiment’ section and created the inital code (below).

One of the issues is that as soon as I try to load the experiment it sits at the monitoring screen size stage which changes when I disable it.

Additionally, I’m not too sure what I should be including below to ensure that it pulls through the correct information. Any advice or pointers is appreciated.

import time

def monitor_survey_responses():
while True:
survey_responses = get_survey_responses()

    processed_responses = process_responses(survey_responses)
    
    update_stimuli(processed_responses)
    
    time.sleep(20) 

def get_survey_responses():
return [1, 3, 5, 2, 4, 1, 5]

def process_responses(responses):
filtered_responses = [response for response in responses if response in [1, 5]]
return filtered_responses

def update_stimuli(processed_responses):
print(“Updated stimuli based on processed responses:”, processed_responses)

monitor_survey_responses()

I don’t understand the code you’ve posted but if you use a survey routine then you can retrieve your survey responses.using survey.getResponse()

Have a look at my survey test online demo.