JsPsych Saving Options on Pavlovia

Ahaaa, maybe make them separate jsPsych Tasks and chain those together?

1 Like

Also, inspired on issues reported in the thread below, I updated our Palovia plugin. It now offers a completedCallback which is called once the data is in. jsPsych experiment, token randomly consumed, no data stored - #9 by thomas_pronk

1 Like

Edit: I had forgotten to include completedCallback as an argument to the definition of my pavlovia finish trial, which is what was causing an error. The argument seems mandatory, although not sure if it should be.

Thanks for your work on this @thomas_pronk ! Another interesting pondering I have is why only the main data object from jsPsych is saved. For instance, I would like to save the interaction data but I am struggling to get it to work properly. My central attempt consists of adding a _save() call within the plugin trial method (in the case: ‘finish’ block, before await _finish) and data do get end up saved but I am getting an error on the screen to the participant.

I am attaching the file I am using (this is essentially a modified version of your script). Any help would be greatly appreciated! NB: The file is saved as .py but is actually a .js file – the forum does not let me upload .js files.
jspsych-pavlovia-2020.4-custom.py (16.7 KB)

I love it when people build on my code! :slight_smile: Here are some thoughts:

  • My hunch is that my dataFilter filter implementation would already solve it. It receives some data but you could interact with all kinds of jsPsych objects in there? However, I’m actually now that knowledgeable of jsPsych, so I might be wrong. Which takes me to…
  • Shall we chat about it on the jsPsych forum? (got a thread there). We might get some nice input from their devs.
  • And maybe move this the Pavlovia-plugin to a GitHub repo, then it’s easier for me to track your edits, file PRs etc.

How does this sound?

Thanks for your reply @thomas_pronk. I think I will do a PR for the plugin soon. I really want to try and figure out how to most effectively and efficiently also implement a case for the ‘command’ parameter of ‘save’ that sends a request to the pavlovia in the middle of the experiment.

In my current lab, we have to pause in the middle of experiments to save data to pavlovia which is just annoying. Why do we need to pause? Because pavlovia has been troublesome in the past with data not saving randomly and 1 experiment losing about 10% of PPs’ data, resulting in overall costs in the hundreds (which is substantial for a psychology lab).

Essentially, I want to be able to send a data save request to pavlovia in the middle of the experiment asynchronously without closing/reopening the connection sessions. That should be a sufficient solution for multiple data saves.

Will let you know when I have something to push to GitHub.

Thanks for your work!

About the issue you report: I guess we could tackle this on multiple levels. An earlier version of the plugin had the issue that redirecting a participant to another website at the end of a jsPsych task could result in the data not being saved properly. This particular issue should be fixed since version 2020.3 of the jsPsych Pavlovia plugin, in which you can specify a callback that’s triggered once Pavlovia confirms it received the data. By putting your redirect in this callback you can ensure that the participant is only sent on if the data is in.

Regardless, I’m all up for updates and improvements! Are you thinking of a PR via gitlab.pavlovia.org?

Hi there,
I’m at the moment integrating task with Pavlovia. As we also have a lot of data, I’m making use of your completedCallback function.
It works with showing the ‘alert’, as in your original code. Do you know whether it’s possible to instead show a div, like so:


When I use this code anywhere else in my script, it shows the div as expected. But when I put it within the callback, it doesn’t work. (I can manage to hide: $(’.jspsych-content-wrapper’).hide(), but not to then show my own div)

I’d be very grateful for any pointers.

Hey @JacquieS,

I’ve got two pointers for you:

  1. Perhaps the callback isn’t called? You could test this by adding a console.log statement in the callback. See Thomas Pronk / tutorial_js_console_log · GitLab
  2. Perhaps the #endExperiment div is inside of another div that’s hidden? You could test this by running your experiment to the end, check if the debug info at point 1 shows up in the console, and then manually execute the $("#endExperiment").show(); statement in the console.

Hope this helps!

Hi, I’m a user of jsPsych with Pavlovia (which has been fantastic so far!!)

However, we’ve had some recent issues with data saving and credits not being used in studies we’re running on Pavlovia with jsPsych 6.3.0. Is that version still supported on Pavlovia?

Are there other users having any issues with data saving and jsPsych / anyone with tips on resolving the data saving issues (no data is saved)? I’ve posted about the issue here as well: Credits not being used, and data not saving, for "Running" mode in jsPsych? - #10 by katiecollins