muting a plugin data saving protocol #1141
-
|
Hello everyone, In our experiment, there is one test trial and one feedback trial. I put them in a timeline like this: This is all good. But when it comes to saving to MySQL database, I see rows of feedback trials which are mostly “null”. This is normal because feedback is actually a trial and jspsych’s plugin defaults run its data-saving procedure. Please see the image attached here. Is there a common way to entirely stop a plugin trial from saving to the database? Something like a mute? 1- I tried to merge the feedback trial into the test-trial. I can edit the plugin by changing the This is how I do normally access trial parameters to be used used for feedback response. .. 2- Another way to do that would be doing it after on_finish: I also tried removing trial_data from the Any help in finding a direction is much appreciated! Gorkem |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hi Gorkem, Could you just remove all of the feedback trials from the jsPsych data before you send the data back to the server? For instance using jsPsych's data manipulation functions like filter or filterCustom? Otherwise your first option seems like it should work. You can edit the plugin so that it takes the correct response as a parameter (or any other information you need to score the response, like type and orientation). plugin.info = {
name: 'html-keyboard-response',
description: '',
parameters: {
// other parameters here...
stim_type: {
type: jsPsych.plugins.parameterType.STRING,
pretty_name: 'stim type',
default: null,
description: 'Stim type.'
},
stim_orientation: {
type: jsPsych.plugins.parameterType.STRING,
pretty_name: 'stim orientation',
default: null,
description: 'Stim orientation.'
},
}And then you can pass those values into the plugin when you set up the trial, so you'll be able to use that information in the after_response function to determine what the feedback text should be. You'll also want to change the plugin so that the end_trial function is only called after your feedback display is finished. var after_response = function(info) {
// after a valid response, the stimulus will have the CSS class 'responded'
// which can be used to provide visual feedback that a response was recorded
display_element.querySelector('#jspsych-html-keyboard-response-stimulus').className += ' responded';
// only record the first response
if (response.key == null) {
response = info;
}
// response.key tells you what key was pressed
// trial.stim_type and trial.stim_orientation give you the info that you need to score the response
// set up a variable to hold the feedback text, and use the response and condition info
// to store the appropriate feedback text in this variable
var feedback;
if (trial.stim_type == "x" & trial.stim_orientation == "y" & response.key == "a") {
feedback = "Correct!";
} else {
feedback = "Incorrect";
}
// display feedback
display_element.innerHTML = feedback;
// call the end_trial function after some delay, e.g. 3 seconds
jsPsych.pluginAPI.setTimeout(function() {
end_trial();
}, 3000);
}I don't think your second option will work because by the time the on_finish function is called, the trial is over, and there's really no way to get jsPsych to stop there while you show feedback on the screen (but I could be wrong!). |
Beta Was this translation helpful? Give feedback.
-
|
@becky-gilbert Thank you very much, Becky. The data manipulation function of filter() solved my problem very quickly, I should have known that but I thank you for the other solution as well. It would also work. Best, |
Beta Was this translation helpful? Give feedback.

Hi Gorkem,
Could you just remove all of the feedback trials from the jsPsych data before you send the data back to the server? For instance using jsPsych's data manipulation functions like filter or filterCustom?
Otherwise your first option seems like it should work. You can edit the plugin so that it takes the correct response as a parameter (or any other information you need to score the response, like type and orientation).