Participant ID not saving in data file name

URL of experiment:
https://run.pavlovia.org/sokolhessnerlab/cgtgamblingspantasks

PsychoPy version: 2022.2.1
OS: MacOS 12.3.1

Description of the problem:
We are using daisy chaining to pass participant IDs throughout our study (Prolific ID gets passed to Qualtrics, then Pavlovia, then Qualtrics again).

The participant ID seems to successfully be passed from Qualtrics to Pavlovia as it shows up as a variable in the .csv data file at the end of the experiment but the participant ID is not saved in the .csv file name. Instead the filename is saved as “_studyName_dateAndtime.csv”.

It seems like the expInfo[‘participant’] variable is treated as empty when the data file name is created. However, this is odd because the expInfo[‘participant’] works fine when creating the redirect URL (the participant ID is successfully passed on from Pavlovia to Qualtrics).

In the .js script, the datafile name is created like this:

 psychoJS.experiment.dataFileName = (("." + "/") + `data/${expInfo["participant"]}_${expName}_${expInfo["date"]}`);

and then a few lines below that, the redirect URL is set:

  // add info from the URL:
  util.addInfoFromUrl(expInfo);
  psychoJS.setRedirectUrls(('https://udenver.qualtrics.com/jfe/form/SV_a4qaGzutOwOjcPk?PROLIFIC_PID=' + expInfo['participant']), 'https://app.prolific.co/submissions/complete?cc=C7B3UXTE');

Both of these blocks of code use the same variable expInfo[‘participant’] but for some reason the participant id is only showing up in the redirect URL but not the data file name.

The participant ID is included in both the .csv file and the .csv file name when I manually input a participant ID into the dialogue box at the start of the experiment, so the issue is only happening when trying to pass the participant ID using URL.

The experiment otherwise runs smoothly from start to finish, just having this one issue.
Thank you in advanced for any insight!

1 Like

Please could you paste your Qualtrics code and show your expInfo dialogue box. I’m wondering whether you’ve put Participant instead of participant somewhere.

Thanks for the reply @wakecarter. I’ve included those things below (is the screenshot showing what you meant by dialogue box?).

Qualtrics url
https://run.pavlovia.org/sokolhessnerlab/cgtgamblingspantasks/?participant=${e://Field/PROLIFIC_PID}

(For what its worth, I have tried unchecking “show info dialog” and that doesn’t seem to make a difference.)

Those both look correct. Are you setting the PROLIFIC_PID in embedded data in Qualtrics? Are you sending it as that variable name from Prolific? To test the Qualtrics / Pavlovia connection you could set PROLIFIC_PID as a fixed or random number in Qualtrics to check it’s coming though.

I’ve asked the same question before. The response was this is a bug. I don’t know if this has been fixed in the newest release 2022.2.4 though
Participant info not saved on filename.csv - Online experiments - PsychoPy

3 Likes

Thank you @Yiannis for sharing that!

Yes, PROLIFIC_PID is set as embedded data in Qualtrics. I can tell that the Prolific ID is getting passed along from Qualtrics to Pavlovia because it is getting saved inside of the data file and is saved under the column ‘participant’ in the data file, its just not getting saved in the file name itself. It looks like this is a bug (see reply above). Thank you @wakecarter for the help!

Hi @hrb and @Yiannis,

I have also encountered this issue ( Possible Bug: 2022.1.1 - 2022.1.3 URL Parameter not included in filename - Online experiments - PsychoPy).

Just wanted to let you know that the bug still seems to exist in 2022.2.4.

If you go back a year to 2021.2.3, I tested that version and it does not have the bug.

-shabkr

3 Likes

Seems like a quick manual fix on js files would solve the issue:

// add info from the URL first:
util.addInfoFromUrl(expInfo);

// then add filename to psychojs experiment
psychoJS.experiment.dataFileName = ((“.” + “/”) + data/${expInfo["participant"]}_${expName}_${expInfo["date"]});

I confirm that file saves well with URL params this way. I tested with recent psychopy version 2022.1.2

2 Likes

This is a great option. I tried adapting your suggested code to use a code component instead of manually modifying the JS files. I tested the below in version 2022.2.4.

I added a Javascript-only code component. In the Before Experiment section of the code component I added:

util.addInfoFromUrl(expInfo);

as you suggested (doesn’t seem to need the second line).

Using a code component means you hopefully won’t have to make manual adjustments to the js files.

2 Likes