PsychoPy Survey Component demo (embedding surveys in experiments)

As of PsychoPy 2023.1.1, surveys can be embedded in online PsychoPy experiments, which gives a step change in the level of functionality available.

I’ve just made my survey test public so you can try it and fork it.

Survey Test code | try it

Surveys can be selected using the Survey ID (so they always run the latest version) of Survey Model File (so they protected from changes to the online version). The results of each survey are saved to the PsychoPy data file. However, if you want to access the data during your experiment you should use code of the form surveyResponse = surveyComponentName.getResponse() which copies the data into a dictionary.

In my demo I check whether four consent items have been ticked using if len(surveyResponse['consent']) == 4: and then present the mean happiness score on screen using surveyResponse['OHQmean']

1 Like

An update on this.

Currently, if you want to embed surveys in your experiments, please install 2023.1.3. There are a couple of bugs in the survey component in 2023.2, the fixes for which missed the 2023.2.1 release.

I’ve just reinstalled the older version so I can use it for next week’s topic workshop.

I’ve just checked my test suite and this is solved in 2023.2.2 now available from Releases · psychopy/psychopy · GitHub

FYI @wakecarter: on mobile (iOS, Safari), I get an error after the participant info window is dismissed:

But after dismissing the error, the experiment seems to run fine.

Thank you. What version of iOS do you have? Are you able to try Chrome on the same device?

I’m on iOS 16.6.1 (the latest). The error also occurs with Chrome and Firefox.

1 Like