New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use spatial-span to download response data online #113
Comments
The recommended approach for saving data server-side is to build your tasks into a Docker container. There's a bit of a learning curve if you haven't used Docker before, but once you're over that it's relatively quick to combine tasks into an online study. |
hey @KlokGorp ! Yes, +1 to what @earcanal said, if you deploy your experiment(s) via a Docker container you will generate a reproducible thing so others can replicate them exactly, and from the Docker container you can run any database that you wish (postgres, mysql, sqlite, and filesystem are your bread and butter). We did have one user that used the old version of expfactory to run a php+mysql+concerto setup, you can see the files here --> https://github.com/expfactory/expfactory-python/tree/master/server/mysql if that might be helpful, and if you have issues you should open them there. I'd be glad to help here, and I'm less help with the other version as I think the container-based reproducible way is the way to go :) Let me know if you have any questions! |
Thank you ever so much for your help @vsoch & @earcanal!!! That is, I have already constructed a long jspsych study comprising survey questions, presentation of videos and music as well as behavioural tasks etc. Using this jspsych study I collect the data online using my own website/server, in which according to jspsych the data for each participant is saved as a json file to my online server. Thanks a lot for your patience, |
I think you would want to do it the other way around - to package your experiment into one (or more than one) experiment factory experiment, and then build a container with all of them. You could equally just run the expfactory container with the spatial span task and then save to another database and combine based on a unique id. What you can't do is arbitrarily shove the two together, especially in terms of databases - I don't know what format / how (even in the file structure) your custom experiment is saving in, but it's unlikely to use the same table structure as expfactory. So! If you want help converting your experiments to expfactory (likely fairly easy) I'm happy to do this! If you want to keep them as is and just run the experiment isolated, that works too. |
Thank you @vsoch for you help.
(In terms of: "What you can't do is arbitrarily shove the two together, especially in terms of databases - I don't know what format / how (even in the file structure) your custom experiment is saving in, but it's unlikely to use the same table structure as expfactory" Thanks a lot for your help and patience! |
|
Thanks @earcanal this is so good! A few additional notes:
|
Version of Experiment Factory:
I want to use the spaital-span task online.
https://expfactory.github.io/experiments/e/spatial-span/
Expected behavior
I want the data to be downloaded to my online server using php-patch NOT locally to the user's computer as a file. That is, how do I change the saving function in the index file to not save a file locally but to an online server.
Actual behavior
The data is downloaded locally to the user's computer
Steps to reproduce behavior
I have an online experiment with several different tasks and then I use a php-patch to download the data responses to my online server using. I use these two different scripts that work for version 5 and version 6 of jspsych:
// Patch to save Participant data to website
function saveData(filename, filedata){
$.ajax({
type:'post',
cache: false,
url: 'save_data.php', // this is the path to the PHP script in the website folder
data: {filename: filename, filedata: filedata}
// complete: callback // https://groups.google.com/forum/#!searchin/jspsych/data$20not$20written$20/jspsych/JPocDlXtks0/s66dgjbsFQAJ
});
}
/* start the experiment */
jsPsych.init({
spatial_span_experiment,
display_element: "getDisplayElement",
fullscreen: true,
on_finish: function() {
//jsPsych.data.displayData();
},
});
OR THIS PATCH FOR VERSION
// Patch to save Participant data to website version 6
function saveData(name, data){
var xhr = new XMLHttpRequest();
xhr.open('POST', 'write_data.php'); // 'write_data.php' is the path to the php file described above.
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify({filename: name, filedata: data}));
}
//start the experiment
jsPsych.init({
timeline: timeline,
on_interaction_data_update: function(data) {
console.log(JSON.stringify(data))
},
// on_finish: function(){ jsPsych.data.displayData();},
show_progress_bar: true,
});
The text was updated successfully, but these errors were encountered: