External Trial Input

Hi all,

I’m exploring which software would best suit my research needs. As I’m - not yet - familiar with PsychoPy I wanted to ask whether my research idea is possible within the PsychoPy framework before diving in, spending time, and finding out that it is not.

I want to create an experiment where the responses from Participant 1 can be re-used for Participants 2-N. For example, if I ask Participant 1 to provide an association with “Disney”, and they may answer “Mickey Mouse”, I then want to ask Participant 2 to provide an association to “Mickey Mouse”. Of course, like most of you during Corona times the study needs to be run online.

I can currently think of some potential solutions, but am looking for confirmation whether it is indeed possible. Plus some guidelines on how to achieve it. So far my searches have not yielded any useful information.

  1. Access the end-of-experiment csv’s per participant and process them in the experiment (potentially slow as participant numbers increase?)
  2. Process the participant responses and save only the necessary information to a separate data-file (is that possible with Pavlovia?)
  3. Use some sort of external data storage (eg., Google Sheets) and call/store the information in each experiment. (have not seen examples of this yet)

I appreciate any help I can get!

I’m using something like 3 for one of my experiments. I send averages to my vespr website and start the experiment from a php page which sends the averages to expInfo

Would I be able to view the code you used for this somewhere? I have to say your description is a bit too cryptic for me to understand & estimate whether I’d be able to implement it too (e.g., no php knowledge).

You can try out my experiment here: https://moryscarter.com/vespr/avatars/
It allows the current participant to compare themselves with previous participants.

You’d need access to a web server which runs php/MySQL (or equivalent, but that’s what I code in). Then it would be a case of uploading the answer from each participant and then adding it to the URL for the next participant.

Here’s the core of the code that starts the experiment:

	<form action="https://run.pavlovia.org/Wake/self-bias-avatars/html/" method="get" name="form1" target="_self" class="style1" id="form1">

				<p>How do you describe your gender? 
	  <select name="gender" style="font-size: 20pt">
	    <option value="">Please select</option>
	    <option value="W">Woman</option>
	    <option value="M">Man</option>
	    <option value="N">Non-binary</option>
	    <option value="I">In another way</option>
	    <option value="P">Prefer not to say</option>
            </select>
	</p>
	<p>How old are you (in years)? 
	    <input name="age" type="text" style="font-size: 20pt"/> 
	</p>
	<p>Please tick if you are happy for your anonymous results to be used for research purposes. 
	  <input name="consent" type="checkbox" id="consent" value="1"  style="height: 30px; width: 30px"/>
	</p>
	    <?php
    	$query = "SELECT AVG(youscore) AS youav, AVG(relationscore) AS relav, AVG(youtime) AS youtimav, AVG(relationtime) AS reltimav, COUNT(*) AS participant FROM psych_workshop_avatars WHERE 1";
    $Result = mysqli_query($link,$query) or die(mysqli_error($link));
if (mysqli_num_rows($Result)) 
    {
    $row = mysqli_fetch_row($Result);
    $youav = $row[0];
	$relav = $row[1];
	$youtimav = $row[2];
	$reltimav = $row[3];
	$participant = $row[4];
        
    }
	
echo "<input type=\"hidden\" id=\"youav\" name=\"youav\" value=\"$youav\">";
echo "<input type=\"hidden\" id=\"relav\" name=\"relav\" value=\"$relav\">";
echo "<input type=\"hidden\" id=\"youtimav\" name=\"youtimav\" value=\"$youtimav\">";
echo "<input type=\"hidden\" id=\"reltimav\" name=\"reltimav\" value=\"$reltimav\">";
echo "<input type=\"hidden\" id=\"participant\" name=\"participant\" value=\"$participant\">";?>
	      <input type="submit" name="Submit" value="Start experiment"  style="font-size: 30pt"/>
	    </p>
	</form>

And here is the results page that updates the database:

    <?php
$participant = $_GET["participant"];
$gender = $_GET["gender"];
$age = $_GET["age"];
$AvatarSelf = $_GET["AvatarSelf"];
$AvatarSelfMatch_score = $_GET["AvatarSelfMatch_score"];
$AvatarSelfNomatch_score = $_GET["AvatarSelfNomatch_score"];
$AvatarStrangerMatch_score = $_GET["AvatarStrangerMatch_score"];
$AvatarStrangerNomatch_score = $_GET["AvatarStrangerNomatch_score"];
$AvatarSelfMatch_rtcm = $_GET["AvatarSelfMatch_rtcm"];
$AvatarSelfNomatch_rtcm = $_GET["AvatarSelfNomatch_rtcm"];
$AvatarStrangerMatch_rtcm = $_GET["AvatarStrangerMatch_rtcm"];
$AvatarStrangerNomatch_rtcm = $_GET["AvatarStrangerNomatch_rtcm"];
$AvatarSelfMatch_percent = $_GET["AvatarSelfMatch_percent"];
$AvatarSelfNomatch_percent = $_GET["AvatarSelfNomatch_percent"];
$AvatarStrangerMatch_percent = $_GET["AvatarStrangerMatch_percent"];
$AvatarStrangerNomatch_percent = $_GET["AvatarStrangerNomatch_percent"];

  	$query = "SELECT AVG(youscore) AS youav, AVG(relationscore) AS relav, AVG(youtime) AS youtimav, AVG(relationtime) AS reltimav, COUNT(*) AS participant FROM psych_workshop_avatars WHERE 1";
    $Result = mysqli_query($link,$query) or die(mysqli_error($link));
if (mysqli_num_rows($Result)) 
    {
    $row = mysqli_fetch_row($Result);
    $youav = round($row[0]);
	$relav = round($row[1]);
	$youtimav = round($row[2]);
	$reltimav = round($row[3]);
	$participant = $row[4];

    }

$trials = $AvatarSelf_trials+$AvatarStranger_trials;
$query = "INSERT INTO psych_workshop_avatars VALUES ('', '$participant', '$gender', '$age', '$trials', '$AvatarSelf_percent', '$AvatarStranger_percent', '$AvatarSelf_rtcm', '$AvatarStranger_rtcm', '$ip', '$AvatarSelfMatch_percent', '$AvatarSelfNomatch_percent', '$AvatarStrangerMatch_percent', '$AvatarStrangerNomatch_percent', '$AvatarSelfMatch_rtcm', '$AvatarSelfNomatch_rtcm', '$AvatarStrangerMatch_rtcm', '$AvatarStrangerNomatch_rtcm', '$consent')";
$Result = mysqli_query($link,$query) or die(mysqli_error($link));


?> 

Thanks for the detailed reply! I think - looking at your code - I have to be honest with myself and accept that this is beyond my level of expertise at the moment.

Hopefully someone has an easier solution?