Export trial-by-trial data from an online OSweb exp running in JATOS
Hi,
We are looking for a way to export the data collected on each trial of our Opensesame exp run in JATOS to a dififerent web site in which we can perform online analysis using Python libraries, and then feedback the output of this online analysis back to our Opensesame experiment in JATOS trial by trial, any thoughts on this would be much appreciated.
cheers
david
Comments
Hi David,
I think I understand what you want to do: The analysis would run on a different host in Python and you would somehow send data via an HTTP request to this host. So the process would look like: trial in OpenSesame -> HTTP request to different host -> analysis in Python -> HTTP response -> next trail in OpenSesame ...
It's possible, although I probably wouldn't recommend it. You introduce another point that can fail: the host where you run your Python. Before it was only the JATOS server - now it's JATOS and the Python host. Another point is latency: those HTTP requests have to go via Internet which can take time depending on how good your participant's internet is. Is it feasible in your experiment that your participant waits for those requests to be responded between each trial? What if the response does not come?
I would recommend to try doing this analysis in your participant's browser, in JavaScript. This way you skip the external host. But I don't know how difficult it is to reimplement those Python libraries in JavaScript.
But if this is not possible you have to consider the latency of your requests and test your study thoroughly in the environment your participants might be in, sitting at home with a bad internet connection and a slow laptop. You cannot assume that just because it runs in your fast local network it will run similar in the outside world. What if Internet is slow or breaks: can your experiment continue from where it stopped (JATOS' batch session can help here).
Best,
Kristian
Hi Kristian, thanks a lot, the type of analysis we want to do can not be done using JavaScript, so the only way of doing it would be as you said:
OpenSesame -> HTTP request to different host -> analysis in Python -> HTTP response -> next trail in OpenSesame
My question is how to send the HTTP request to a different host from Opensesame, is there any documentation on this?
cheers
david
You better ask this question over in the OSWeb forum. There are the experts.
And for that, you should ask @Daniel
Hi @dsoto
You can achieve what you would like to do using ajax requests: https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX/Getting_Started
This brings you in the realm of asynchronous programming though, so you will have to deal with some extra complexity. The biggest challenge you will face is letting osweb pause until a response has been received from the remote host and I sadly don't have a readily available solution for you to do so. Sadly we haven't built osweb with these asynchronous operations in mind, so it will be quite difficult to make it pause.
hi, thanks for the response!
best,
david