Major data loss from Pavlovia / jspsych

URL of experiment: Effect of Frame of Reference on Biological Motion [jsPsych]

Description of the problem: About 50% of participant data is not saving - despite “save incomplete results” being on. Can’t replicate the issue with despite trying with five other people using various browser combinations. Both complete experiments and incomplete experiments were saved during testing. The participants are are funneled from SONA for credits and they are completing the experiment (confirmed through contact) but no data file is created. My data files that do save are 99kb so it is unlikely an internet connection problem. I notice that this is a recurring problem that many Pavlovia/ jspsych users have to varying degrees (there are many others but I can only post two link as a new forum user:

  1. Three other experiments - one with 40% data loss - Issues with data - missing or lost

Any help would be appreciated

      Cheers
                    Sean

Here is some of my code:

Plugin version

Pavlovia init and username creation

	/* create timeline */
	var timeline = [];


	/* init connection with pavlovia.org */
	var pavlovia_init = {
		type: "pavlovia",
		command: "init"
	};
	timeline.push(pavlovia_init);
	
	/* generate a random subject ID that contains 8 alphanumeric characters*/
    var rand_subject_id = jsPsych.randomization.randomID(8);
    
    /* add the ID to the data for all trials */
    jsPsych.data.addProperties({ID: rand_subject_id});
    
    /* get SONA is from URL*/
    let sona_id = jsPsych.data.urlVariables()['sona_id']
    
    /* add the SONA ID to the data for all trials */
    jsPsych.data.addProperties({SONA_ID: sona_id});

Pavlovia finish

// exit fullscreen mode
timeline.push({
type: ‘fullscreen’,
fullscreen_mode: false
});

var debrief_block = {
  type: "html-keyboard-response",
  stimulus: function() {

    var trials = jsPsych.data.get().filter({task: 'response'});
    var correct_trials = trials.filter({correct: true});
    var accuracy = Math.round(correct_trials.count() / trials.count() * 100);
    var rt = Math.round(correct_trials.select('rt').mean());

    return `<p>You responded correctly on ${accuracy}% of the trials.</p>
      <p>Your average response time was ${rt}ms.</p>
      <p>Press any key to complete the experiment. Thank you!</p>`;
    }
};
	timeline.push(debrief_block);

	/* finish connection with pavlovia.org */
	var pavlovia_finish = {
		type: "pavlovia",
		command: "finish"
	};
	timeline.push(pavlovia_finish);


	/* start the experiment */
	jsPsych.init({
		timeline: timeline,

		on_finish: 
		
		function (data) {
            window.location.assign("hxxxx://uws.sona-systems.com/webstudy_credit.aspx?experiment_id=1513&credit_token=91266d13e0d142c0b046b13ec4c88b91&survey_code="+sona_id)
        },
        
	});

</script>

Hi There,

I’ve been kindly informed that some users encountered an issue with the older jspsych-pavlovia plugin when participants were redirected to another website after the experiment (is this the case in your study?). A possible quick fix might be to update the plug in you are using to a newer version (thanks @thomas_pronk !) jsPsych Pavlovia plugin · Discussion #1738 · jspsych/jsPsych · GitHub

Hope this helps,
Becca

1 Like

Thanks Becca - will try these out.