I am currently experiencing issues with my jsPsych experiment on Pavlovia. I am using nearly the same setup in another experiment which is working fine.
Either the data is not stored and a token is consumed and/or reserved, or only the header of the data file is stored and no token is consumed. I opted for storing the data as a csv and I am also saving incomplete trials. The data is neither available in the git repository, nor by downloading it via the dashboard.
Is this currently a known issue, or does anyone experience similar issues?
I’m not sure if it’s a known issue, but it might be handy to take a peek at the network panel in your browser’s devtools to see if the data gets sent to the server (or not). Here are two learning materials about that:
Thanks a lot! I think I have identified the problem, but I don’t know how to deal with it.
The data file which is generated has a size of around 2MB, so it can easily take 15 seconds to upload the data to the server.
I am redirecting the participant to Prolific at the end of the experiment. Due to that the upload result POST seems to stay pending and in the end is not finished at all.
Removing window.location.replace() to Prolific isn’t a problem, but the data is also not stored when the participant closes the browser tab directly after the experiment.
The solution maybe would be something like sending an event at the end of the upload to tell the participant that he can now close the experiment.
Do you see any other solutions?
At least we’re a step closer to a solution! If I remember right, Pavlovia sends a receipt confirmation once all the data is in, so I guess you could fire a callback when this happens, even do your redirect at that point.
If you’ve got trouble figuring out how to achieve this, give a shout. I’ve got a couple of jsPsych-related tasks on my list, so I could add this one as well.
Hi @thomas_pronk , thank you very much for sending me to this post! I took a look at my three tasks and found that the one with data loss is the one that generates the largest data file (around 110 KB, still small compared to other’s data in MB). I did save the data successfully once when I did it without any redirecting afterward. Don’t know if redirecting plus large data size is the cause?
After reading all these posts, here’s my action plan:
Try to get Pavlovia’s receipt confirmation before or during redirecting.
Try to insert a delay before redirecting (if the first method does not work).
One question: is there any information on how we can get Pavlovia receipt confirmation? Thank you!
Hi, @thomas_pronk I added you to my project, you should be able to see it now and hopefully get some idea where the problem is coming from, so I can prevent it in the future.
Best and thanks again for your fast replies, I really appreciate it
Mila
@DonShirley, I wonder where in your code the redirect to Pavlovia takes place. Could you share your jsPsych experiment with me? (tpronk). Hmmm, actually same question for @Lillian_XU
Also, I’m getting a bit confused which thread is about what
@Lillian_XU, shall we use this thread to cover the jsPsych topics?
@DonShirley and @Lillian_XU, I went ahead and added a little feature to our jsPsych Pavlovia plugin, updating it to version 2020.3. It now offers a completedCallback which is called once the data is in. The demo below contains the updated plugin and an illustration on how to use it.
This is how I tested it: the demo task only sends a tiny bit of data, but via the Network Panel in your browser’s Developer Tool, you can simulate an extremely slow internet connection. While simulating a low connection, this happened:
After completing the task I saw the text Please wait a moment while the data are uploaded to the pavlovia.org server... for a couple of seconds
Then the alert that says data successfully submitted! appeared. In the Network Panel I could see that this happened after all the network requests had resolved.
If you put your redirect in completedCallback, that should fix the data issues.
Hello @thomas_pronk. I think I am running into a similar issue. I tried following the steps that worked for the others, but I am not sure where to add the extra lines of code. Could I share my jsPsych experiment with you as well? Thanks in advance!
@thomas_pronk, thank you so much for your fast response!
I updated the version of my pavlovia plugin to 2020.4. As for the pavlovia_finish, I have that in my UrnUpdate.js script here. Does this work? Where should I put the completedCallback function?
I see the indentation on gitlab is a bit confusing, so I copy-pasted it here. Note that the pavlovia_finish command has a bunch more options for checking whether the data is in. Redirect your participants to another website in completedCallback
/* finish connection with pavlovia.org */
var pavlovia_finish = {
type: "pavlovia",
command: "finish",
participantId: "JSPSYCH-DEMO",
// Thomas Pronk; your filter function here
dataFilter: function(data) {
// Printing the data received from jsPsych.data.get().csv(); a CSV data structure
console.log(data);
// You can also access the data directly, for instance getting it as JSON
console.log(jsPsych.data.get().json());
// Return whatever data you'd like to store
return data;
},
// Thomas Pronk; call this function when we're done with the experiment and data reception has been confirmed by Pavlovia
completedCallback: function() {
alert('data successfully submitted!');
}
};