Resuming within a component (jsPsych and JATOS)
Hello! I'm helping a professor set up an annotation task, in which his research assistants will read a series of text-based prompts and categorize them (first with a multiple-choice question, then by typing descriptive text). I have the actual task inelegantly but functionally coded in jsPsych, and now I'd like to improve the task flow, but I'm not sure how to implement the ideal version of this (other than a vague impression that using batches might be helpful).
There are 100 prompts in the list as it is now, and I imagine the professor will add to this list. It's long, so the RA's won't be doing the whole task in one session. Right now I've split the existing prompts into blocks of 10, and saved each block of 10 as its own component; there's also an initial component that allows RA's to say which block they have next, and then skips to the relevant set. It works, but it relies on the RA's to remember their block, it uses a lot of unneccessarily duplicated information in each component, and it means extra data processing in order to make the results files manageable.
Does JATOS have a built-in functionality that would let this all be one big component, and save progress to let RA's leave and come back at will?
Thanks in advance for your advice!
Comments
Hi,
There's no built-in functionality but in your case it seems like it will be rather straightforward.
You're right that the batch session is the way to go, because it's a data structure that outlives any study run. And given that your participants are RAs, and not real volunteers, I'm guessing that you don't need to keep the data anonymous. In that case, you can ask the RAs to input their name, and in the batch session store their name along with the last prompt they completed.
This is what you will probably need:
Hope this helps (sorry for the first preliminary answer, I clicked Save before I was done)
Elisa
Hi Elisa,
Thanks for your response! I'm sorry to say that I've gotten pretty confused about how to implement it, though it was clearly laid out. I have the two components (A: where RA's select their ID from a jsPsych html-button-response list, and B: the actual task, now with 1000 rows of data), but I don't know how to appropriately query/set the data I need.
Right now in component A I have the following in the jatos.onLoad() chunk at the end:
which sets the RA ID appropriately, I think. (?)
That brings us to component B. Right now I have the following in the jatos.onLoad() chunk:
But I don't really trust that I'm saving the prompt/record info in a way where it's associated with a specific RA. More importantly, I'm not really sure how to use the study session data to tell the second component which prompt/record to start from. Does it go in an on_start function? My list of records is just saved as jsPsych.timelineVariables, is that accessible from this part of the code?
Thanks again for your help!
-Elise
Hi Elise,
I'm a little bit lost in your code because I don't see where you use the
ra_num
value in component B. I'll respond to a few different points, they won't be a fully worked out solution but I think it will help you get closer at least.First, in component A you use
jatos.setStudySessionData
. That's not actually what you need, you should be doing:See the docs here: https://www.jatos.org/jatos.js-Reference.html#jatossetstudysessiondata
Second point: I think you should have something along these lines in component B.
(But I'm guessing a bit, maybe @kri can double-check)
On to your last question, how to make jsPsych start from a given point: I don't know, that's something you'd have to ask in the jsPsych forum. But maybe the way to go is to create the timeline based on the number of remaining trials.
Hope this helps
Elisa
Hi again, one thing I just noticed:
jatos.submitResultData
will replace (overwrite) any existing data on the component. You probably should be usingjatos.appendResultData
instead.Hi Elisa,
Thanks again for your help with this. The code you've provided gave me a good start! Quick question--for batch data, is it sufficient to be testing it on my local JATOS or will it work differently on my public-facing server?
I'm just asking because I've been doing all my work locally, but it's not working as I expected it to--that said, I haven't worked with batches before so my expectations may be the issue! Specifically, jatos.batchSession.add doesn't seem to do anything at all; I've been running it in the console as well as in my code, but if I print it using jatos.batchSession.getAll, the only value that shows up is the ID number for the second record in the list. There's no ra_num, and it doesn't update to be the record I'm actually on if I move past the 2nd record.
ETA: this is the code in my jatos.onload chunk of component B:
Hi, yes, the batch should behave exactly in the same way locally as in the server. You've got a typo though:
it's
jatos.onLoad
, not.onload
. Maybe this already explains why your code chunk doesn't run?Best
Hi Elisa,
Thanks for catching that, and for the speedy answer! I think it actually was running, though--in the period since I sent that message, I tried a very stupid solution which actually does seem to have worked. There's something about the the batchSession.add() function that isn't working, but batchSession.set() is indeed working (which was how I had that persistent "ID for the second record in the list" mentioned above), so I just threw a bunch of if/else statements in there.
Here's what it looks like now, which actually does seem to be doing the trick:
Since this is basically working, I'm focusing on the problem of editing the timeline_variables in the jsPsych forum now, but if you have suggestions for why jatos.batchSession.add() is being strange, please let me know! Thanks again for all your advice. :)