Saving data to Pavlovia server

My experiment is not written in PsychoPy due to problems I had with the builder and my specific needs, but I don’t know where else to ask. Sorry if this is irrelevant, but I hope somebody can help me.

My code collects participant demographics and stores it in a Javascript object, which can be converted to JSON.
My code also collects data for each trial as an object, which is put in an array that is appended each trial. This can also be converted to JSON

My question is, how do I save this information to the data folder of my Gitlab at the end of the experiment?
Is there simple code I can implement for this?
Or do I need to implement PsychoJS into my code? If so, is that possible without converting my whole project to PsychoJS?

Any help would be greatly appreciated. If more information is needed, please let me know.

Example JSON of participant info:
“{“initials”:“EMR”,“age”:“24”,“gender”:“F”,“percent mammo”:“25”,“years experience”:“12”,“cases per year”:“1400”,“screen size”:68.58,“image_pixels”:562}”

Example JSON of participant data:

1 Like

I have a very similar issue, having developed a Javascript (using p5.js), I need to save the data it generates into the Pavlovia data folder, but cannot discover how to do this. Any guidance or example code would be much appreciated.

Did you figure this out? I need help with this too!

1 Like

any luck?

1 Like

I have not found a solution, so I had to abandon Pavlovia and host my experiment elsewhere, sorry…

where did you end up hosting it?

I hosted a database (sql) and database manager (written in python) on an EC2 instance of AWS and used POST and GET requests to the server URL put data there and request block orders respectively.

Code snippet of the POST to give you an idea:
this.completeExperiment = {
“uuid”: this.uuid,
fetch(this.serverUrl + ‘/session/complete’, {
method: ‘POST’,
body: JSON.stringify(completeExperiment),
.then((response) => response.json())
.then((result) => {
console.log(‘Success:’, result);
// show end text and anything you want to happen on success


        .catch((error) => {
            console.error('Error:', error);

//put here how to deal with error from the post request