Automatically incrementing participant number?

I’d like my experiment (run on pavlovia, interfacing with sona) to automatically assign a participant number, based on how many participants have completed the experiment. In other words, I want the first participant to be assigned participant number 1, and the next participant to be assigned participant number 2 (unless participant 1 failed to complete), and so on. I understand that it’s possible to incorporate participant IDs into links from sona, but unless I’ve missed something, those have to be hard coded rather than increment with experiment completions. Can anyone point me in the right direction? Thanks for reading!

Jon

1 Like

Do you have Qualtrics? I would like Sona to Qualtrics, add a participant ID there (see these notes for how), then redirect to PsychoPy with a URL than includes participant=id and then finally back to Sona.

1 Like

Thanks for your reply. I’ll have to look into Qualtrics, as I’ve never used it before. Does this mean there’s no way to do this inside PsychoPy? Cheers!

If you don’t have Qualtrics then this isn’t a reason to get it. It’s not free.

The issue is that Pavlovia won’t save to custom files.

Why do you want consecutive ids? Why not just use the randomly generated id variable you can get from Sona?

Thanks again. The issue is that I have a custom counterbalancing of stimuli based on participant number, so I want one participant for each participant number (restricted to 1-30). It turns out my university does have qualtrics but I’ve never used it and fear that adding two new platforms (haven’t used psychopy before either) in one experiment is asking for trouble. I’ll look into the sona random id variable to see if that will work - is that a fairly easy tweak? Cheers!

I’m planning to use Qualtrics for all online PsychoPy experiments to present the PI sheet, gather demographics and assign equally to conditions. The link to my notes above also has details about how to create a custom Sona link. I also have some Qualtrics and PsychoPy primer slides at https://moryscarter.com/vespr/

An ID from Qualtrics will increment whether or not the participant completes the PsychoPy so that aspect will be tricky anyway. You’d probably need to keep an eye on which participant numbers have completed and reuse other counterbalancing orders.

Alternatively, randomise your orders instead.

2 Likes

Assign Consecutive Participant IDs

I have written a web app. which can be used for Pavlovia experiments: https://moryscarter.com/vespr/pavlovia.php

The page takes four parameters: folder, experiment, id and researcher.

folder (required) is your Pavlovia username

experiment (required) is your experiment name as formatted for the study link

id (optional) is a unique code which you could assign, for example as a random number in Qualtrics, so you can link your PsychoPy data back. It is passed to Pavlovia unchanged

researcher (optional) is also passed to Pavlovia unchanged. I am using it to ensure that participants start in Qualtrics where they can view the participant information sheet, not Pavlovia.

participant is assigned by my app. as a consecutive number. You could use a modulus of participant in order to assign participants to conditions. The number increments whether or not the participant finishes. It would be considerably more complicated to re-assign aborted participant numbers.

Example URL: https://moryscarter.com/vespr/pavlovia.php?folder=Wake&experiment=prospective-memory-ldt&researcher=wakecarter&id=test

6 Likes

Hi, Thank you very much for this great app!

However I’m not sure why but it doesn’t work with my study, there’s a 404 Not Found error even though the folder and the experiment name are right. Maybe it’s because there’s an underscore in my experiment name?

Also: is there a way to reset the count to 0?

Thank you!

Please could you message me the link you are trying so I can fix my code or your syntax and clear out the database to reset your counter?

Just sent you, thanks!

Hi !
@wakecarter I tried to use your app on one of my experiments. But participant number started at 2 instead of 1 and when I click again on the URL i have got a ‘403 forbidden’ error message. Plus participant number seems to be incremented 2 by 2. Right now I am still testing so is it possible to reset participant numbers to restart at 1 ?

Thank you!

The 403 error may be because your experiment isn’t in the html folder. In that case add a / to the end of your experiment name.

There isn’t a particular reason to start participant numbers at 1. However, there is a good reason not to allow remote resetting of the numbers (in case it is done by accident and real participants have duplicate numbers). You could always “wind it forward” to a whole number so your first participant is 11 (or whatever).

I’m not sure about the incrementing by 2. If that keeps happening, please message me the link you are using so I can test.

Best wishes,

Wakefield

Thank you for your answer!
There is already a / at the end of the experiment name. It worked once and then I got the error message.

Hello,
I am currently running an online experiment with the webapp for participant’s number and it appears that 3 participants got the same number and I don’t know how it is even possible.
Do you know where the problem might come from ?

Thank you!

Might one participant have shared their experiment URL with others – or refreshed their browser and started the experiment again using the same link? The times of the different log files might help decipher this. Are you saving incomplete data?

Hi Wakefield, thank you for this. Unfortunately for me it doesn’t work as the new link just goes to 404 not found. Do you know why this might be?
Thank You

What link are you using? Maybe you need to add a / after the folder name.

Hello,
Can we use this url also while running the experiment (not just pilot). I have not yet tried to run the experiment so I’m not sure how this would work.

It’s easier to use this for experiments than pilots because then you don’t have to add the pilot code.

I’m not sure of the question. I recommend that you try it and don’t worry that your first real participant isn’t participant 1. If you want to reset the numbering, you can use my VESPR Study Portal instead.