psychopy.org | Reference | Downloads | Github

Failure in writing CSV files on Pavlovia

URL of experiment: https://run.pavlovia.org/QxF/swimtask2
URL of scripts: https://gitlab.pavlovia.org/QxF/swimtask2

Description of the problem
My task was developed with JavaScript and PsychoPy libraries for data saving. My recent pilot on April 23rd resulted in a failure of writing CSV data files on the Pavlovia server. My task was distributed on Prolific, and subjects must complete the task in order to complete the a second part survey. All survey results were saved correctly but I failed to locate corresponding behavioral data files on Pavlovia.

Prior to releasing the task, I tested the whole pipeline myself and my behavioral data was saved (pilot_test.csv). However, after I released it online, only 2 files were written, plus a bunch of empty csv and missing files for subjects.

This data saving pipeline was developed by sotiri with help from agnesnorbury for implementation. My previous 3 pilots used the same framework and all worked well.

I am not sure which step has gone wrong, and I have limited knowledge in terms of server and PsychoJS libraries.

Any suggestions or help is appreciated.

Best,
QN

In addition, 3 subjects (out of 29 subjects) messaged me and said they had some sort of problem with the behavioral task.

In my data file, there are two nested long lists (binary coded response and timestamps), I am not sure whether this two may create issues for crushing the data saving process.

Hi @XXXiV-QN, sorry to hear Pavlovia is giving you data saving headaches. When you say binary coded response do you mean that there were only two options to choose from? I’d love to take a look at the code, would it be possible to give me developer access? Thanks, x

Dear Sotiri,

Just granted you access (@thewhodidthis) to my project. Thank you so much for your help. The binary parts are coded in the JS/elements/player.js line 95-115.

Many thanks,
QN

Dear Sotiri,

I saw I have been added to a support version of my task. I would love to follow-up regarding this issues and whether there is anything I can do on my side to help this process.

Best,
QN

Hi @XXXiV-QN, sorry I got caught up working on the upcoming release, but I should be able to have an answer for you very soon. Many thanks for your patience, x

Hi @XXXiV-QN, sorry was the trial study you ran, the one which did yield back data as expected, set to pilot or running mode in Pavlovia? Thanks, x

Dear Sotiri,

I am following up regarding this issue. I am planning to test another mini pilot towards the end of this week to see whether the problem persists.

Best,
QN

Hi Sotiri, thank you for getting back to me. I am not sure I understood you correctly. My task has been on running mode since January, and my personal pilot run before releasing was also done under the running mode.

OK yes that’s what I was wondering about, on it still, thanks for confirming, x

Dear Sotiri,

I tried running the task again today without making any changes. Unfortunately, my data has not been written into Pavlovia. My data was logging correctly in the console, but the dictionary has failed to be written into a csv on Pavlovia data folder.

I am not sure what next step I should take to debug. In addition, I have another task which will also rely on this data saving pipeline.

Thank you for your advise and support.

Best,
QN

Update:

I forgot to change the expName from a template I was using (but this haven’t been a problem before?). After I changed it to my task name “swimtask2”, data files seems to be written on Pavlovia. I tested myself and with another person in the lab on a couple trials, which both saved. However, at the same time, several empty csv files were also created (may due to refreshing browser etc). However, I has been having a hard time to understand the auto-naming of data files on Pavlovia.

(async function startPsychoJS() {
       // The experiment handler needed to save our data would
       // be inaccessible before this call resolves. Because of
       // a bug in PsychoJS, please make `expInfo` an empty object
       // instead of skipping if not required
       await psychoJS.start({ expName: 'study-game-1', expInfo: {} })
       })();

Would still appreciate if you have time to take a look and let me know any other malpractice I may have been doing with my code. :slight_smile:

Best,
QN

Hi @XXXiV-QN, OK glad to hear you were able to sort this one out on your own, I was just about to message you back, you beat me to it! That part of the code is normally added when you export for HTML from PsychoPy, but because the project is running a different front end (Phaser), one needs to manually initialize PsychoJS in order to interact with Pavlovia. It sounds like we should at some point look into creating a proper template for this type of use case.

Malpractice is a heavy word, but tools such as ESLint can analyze your scripts and make suggestions based on best practices to help improve your code.

The data file naming pattern is: participant name + experiment name + timestamp for when the upload is started. I’m curious about the empty .csv files though, have you chosen to save incomplete results? x

Hi Sotiri, thank you for your explanation. I did choose to save incomplete results. Is there anyway to convert the timestamp “16h02.23.634” into something more understandable?

I will continue to monitor this situation, and if there is any further question I will reach out again.

Many thanks.
QN

Do you mean understandable by a computer (like a UNIX time stamp) 16h02.23.636 means 2 minutes,23 seconds and 636 milliseconds past 4pm.

No problem @XXXiV-QN, it’s possible, but you would need to edit PsychoJS internals. Having the file names include a timestamp is one way of making them unique, but is also telling you something about when each participant completed their run of the study, which may come in handy as you analyse the data. What type of file naming pattern do you have in mind? x

Thanks for explaining. This is exactly what I am trying to understand. :slight_smile:

As for right now, I don’t have a particular preference. My previous task used subject ID naming (eg. date_sub_1.csv), but I figured out that may not work well for an online system with multiple people doing it at the same time.

If you want unique participant numbers online you can use one of my apps.

https://moryscarter.com/vespr/portal/

https://moryscarter.com/vespr/pavlovia.php