How to assign a new ID to each participant?

Yes, thank you again for everyhting.

Hello,

I have a similar question. I have used your web app. to count the participant IDs and use it for counterbalancing (super helpful, thank you for making that!). I’m going to be recruiting my participants through Prolific and want to record their Prolific ID too. My current url for the experiment which works is https://moryscarter.com/vespr/pavlovia.php?folder=lydiabrown&experiment=face_learning_online_part2/
To record the prolific IDs too, is this the correct adjustment? https://moryscarter.com/vespr/pavlovia.php?folder=lydiabrown&experiment=face_learning_online_part2&id={{%PROLIFIC_ID%}}/
I’ve added id as a field in the experiment settings in the PsychoPy experiment.
Thank you for your help,
Lydia

That looks nearly right but if you’ve lost the / at the end of your experiment which denotes whether you need /html or not.

Try https://moryscarter.com/vespr/pavlovia.php?folder=lydiabrown&experiment=face_learning_online_part2/&id={{%PROLIFIC_ID%}}

Hi,
I have also used your app and it has been extremely useful! Is it possible to use the consecutive ID that is stored for assigning the stimuli?
I have been trying to assign to single subject specific stimuli calculated with this number. However whenever I run the script it stores participant as 0 (as in expInfo dictionary is empty) although the number of the file is higher.
Thanks a lot for developing this app!

I think that either you’ve removed participant from the expInfo dialogue box, or you’re URL has an error in it. The page has details of how to assign conditions using modulus. If you’d like me to check, please post the link you’re using.

Hi,
First thanks for the quick replay.

My URL is:
moryscarter.com/vespr/pavlovia.php?folder=rewardersBCN&experiment=memoriamusical-/

This is the code I am using to extract the number and then use variable p to calculate the assigned stimuli

let expInfo = {‘participant’:’’};

var m = expInfo[‘participant’];
var p = Number(m);
console.log§;

Cool.

The participant value is reaching your experiment.

However, I can’t understand your code, possibly because I code primarily in Python.

Try

p=int(expInfo[‘participant’]) in an Auto code component

Thanks for the reply! In javascript what you suggest is the Number (as it is equivalent to int in python as far as I understand).
I will continue trying!
Thanks again for the developing of the app and for the reply

As per my crib sheet, wherever possible I write Python code in Auto translate code components. Even if you don’t intend to run it offline, the auto translate means you get an extra level of error checking.

I have a related question. I’ve been using @wakecarter’s web app. The original URL for my study is:https://run.pavlovia.org/TSKang/virtual-joint-simon-task/html

I have modified the example link so that I have:

https://moryscarter.com/vespr/pavlovia.php?folder=TSKang&experiment=virtual-joint-simon-task/

I keep getting a photo for error. Is this because I need to manually into the default experiment url in Pavlovia? I’m unable to click the change one at the moment, this I imagine it’s because I have to get somebody in IT/my departmental ethics board to click a button approving my study?

No – the issue is that you’ve added a / to the link when it shouldn’t have one. Try https://moryscarter.com/vespr/pavlovia.php?folder=TSKang&experiment=virtual-joint-simon-task

Thank you! When I try your modified link I get an error message:

TSKang/virtual-joint-simon-task is currently in PILOTING mode but the pilot token is missing from the URL."

This means that the modified URL can only be clicked on when the experiment is in running mode? Apologies if this question is stupid!

Yes, that is correct. My app doesn’t currently pass through __pilotToken and __oauthToken though that would be a trivial upgrade for me to make to it, so perhaps I should.

1 Like

Well, now I know how to resolve the problem I will. Thank you so much!

I’ve also now updated my app

Hi again @wakecarter,

Thank you for your help before. I have made a couple of small changes to my experiment. I’ve added some more trials and a keyboard response to a task and changed the content of some text displayed.

I am using your webapp to counterbalance 2 conditions. As the counterbalancing relies on your webapp, the experiment doesn’t run locally. However, if I strip away all of the counterbalancing, the experiment and the new changes work fine locally.

I use the following code to assign participants to 1 of 2 counterbalancing conditions:

if expInfo[‘participant’]%2:
group = ‘A’
else:
group = ‘B’

I noticed I had a small spelling error in this code (if expInof…) so I’ve corrected that too.

When I tried to sync these changes to the online project, the .js file didn’t get updated. I used the url http://moryscarter.com/vespr/pavlovia.php?folder=lydiabrown&experiment=online_face_exp_part2/ and it correctly gives each participant a new number, but it loads the old version of the experiment.

It also hasn’t created a html folder like in the previous experiment I’ve run using PsychoPy / Pavlovia. If on the PsychoPy builder I try File > Export HTML it gives me this error message “ NotADirectoryError: [Errno 20] Not a directory: ‘/Users/lydiabrown/Documents/online_exp/online_exp.js’ ”

Any ideas on what’s going wrong?

Thank you,

Lydia

I would use (as per my page)

if int(expInfo['participant'])%2:
     group = ‘A’
else:
     group = ‘B’

PsychoPy no longer puts the online files into an html folder to save on duplication of resources.

Have you tried Ctl-Shift-R to flush the cache at the experiment start screen to load the newest version of the experiment? This will only work if you can see the latest js file on Gitlab (via View Code). If not, then are you getting a green icon when you select sync?

I never use File > Export HTML having had difficulties with local testing of online experiments in the past so I always just press the sync button.

Hi @wakecarter,

“if int(expInfo[‘participant’])%2:”
Thank you for the code edit, I’ve changed that now.

“This will only work if you can see the latest js file on Gitlab (via View Code).”
I can’t see the latest js file on Gitlab, this is the main problem I can’t fix.

“If not, then are you getting a green icon when you select sync?”
Earlier today, I could press the ‘sync with web project’ button, and I would have to type in what changes had been made, and it would sync and I could see the changes in Gitlab (although it wouldn’t change the .js file). Now, if I click on it, it comes up with this box


so I have to click on the ‘find existing studies online’ globe button, click my study and press sync. This way doesn’t require me to type in what changes I’ve made and I’m not 100% sure if this method has worked despite it saying ‘successful’, as on Gitlab it doesn’t show any new updates in the ‘last update’ column.

Lydia

Also this might be helpful. When I click on ‘sync with web project’ it says “NotADirectoryError: [Errno 20] Not a directory: ‘/Users/lydiabrown/Documents/online_exp/online_exp.js’”, then when I click cancel on the pop up box (screenshot in previous message), it gives this error message “125.1094 ERROR Failed to recreate project to sync with”

Hope this helps.

Lydia

How about recreating the project with a new name?