Pavlovia error while saving data

Dear all,

I am running into an issue at the end of experiments built with lab.js – Pavlovia’s integration appears to be failing, and loses all experimental data. This is observable with arbitrary experiments, that run fine on other platforms. Here’s the error message:

[labjs-pavlovia plugin 3.2.5] Error

  • when uploading participant’ results for experiment: felixhenninger/stroop-demo
  • when saving data from a previously opened session on the server
  • unable to JSON decode the value: Expecting value: line 1 column 1 (char 0)

It looks like the server infrastructure is expecting a different data format from the one that the Pavlovia JS plugin is sending?

Any hints would be much appreciated. Many thanks,

-Felix

(also, for the record, the value is JSON-encoded, as filename/contents pair)

@apitiot could you kindly take a look at this? Many thanks -Felix

Hello @felixhenninger,

The issue here is that lab.js experiment produce results that are not in JSON format and, consequently, cannot be saved in the database.

If you change the Saving Format of your experiment to CSV, rather than DATABASE, you should be able to save your results. Certainly it works on my end.

I have modified the pavlovia.org front end to warn experiment designers when they change the saving format to DATABASE for experiments labelled as lab.js one that there will be an issue with the saving of results. I have also updated the documentation and added a warning at https://pavlovia.org/docs/experiments/create-labjs:

“Note that lab.js experiments should use CSV as Saving Format : it is not possible to save lab.js results in the database.”

Alain

Hej @apitiot, and thanks for your reply! (apologies also for the late follow-up)

From a lab.js perspective, we can provide both CSV and JSON outputs of experimental data, and the choice of format is yours to make in the Pavlovia plugin. Specifically, on line 60 of the Pavlovia plugin, the command reads context.options.datastore.exportCsv(); if you change that to exportJson(), you’ll get raw JSON-encoded data.

I hope that makes sense, and would love to help you make the change – from what I can tell, that’s all that needs to be changed, but I couldn’t find a place to submit a pull request :slight_smile: .

Please let me know if I can be of any assistance in this, I’d be glad to! Kind regards, and keep up the great work,

-Felix

Hello @felixhenninger,

Thank you for the tip!
I’ve just updated the latest version of the plugin: 2020.2 to make it possible to save to either a .csv file and into the database.
Would you like to give it a whirl?

Incidentally, is it possible for me to get the session name (if there is one) and the participant name (if there is one). At the moment I use: SESSION, and PARTICIPANT. Any thoughts on the matter?

Alain

Hi @apitiot,

I’m currently trying to deploy my lab.js experiment on Pavlovia and had a few questions regarding data capture in GitLab. I’ve followed the Pavlovia documentation and made edits to my html & javascript code - but is it the case that we can only have data saved on the server and automatically uploaded to GitLab when the experiment is in “run” versus “pilot” mode (I’m currently awaiting approval for run status so unsure if the data will be captured)?

I also wanted to remove the option for participants to download their data on their local machine and have the experiment end and automatically capture their data, is the documentation as per the Stroop example the best way to go about this (https://pavlovia.org/docs/experiments/create-labjs )? Thanks for your help! :slightly_smiling_face:

@Prisca_Han The change to the data being saved automatically is what happens in run mode rather than pilot mode

Thanks @jon!

Hi @jon,

Is that possible for a jsPsych experiment to save data with json format on pavlovia ? Because I made some debrief trials as the one on the tutorial but when I save the csv file just put [object Object] to these lines and I don’t know how to make it correct for csv.