if (!require('pak')) install.packages('pak'); pak::pkg_install("gorkang/jsPsychMaker")
7 New protocols and tasks
There are a number of elements the tasks need to work well with jsPsychR, so we recommend to use one of the systems we have developed.
For example, with jsPsychMaker::create_protocol()
, you can use tasks we already developed, and/or create new tasks defining their parameters in csv/excel files. The tasks will be part of a fully working protocol. You will need R 4.2 or higher to use it.
create_protocol()
can:
- Loop through the subfolders in
folder_tasks
to create one task per subfolder
- Copy
canonical_protocol_clean
tofolder_output
- Include in the protocol any tasks in
canonical_tasks
- Modify
config.js
to add all the tasks created and selected
- Modify
index.html
to inlude only the plugins those tasks will use
- Modify
index.html
to add the media those task will use
- Check task names are OK: no spaces, -, _, do not start by a number, …
- Check names of all trialid’s are OK (NAMETASK_NUMBER, e.g. MYTASK_001)
- Check only one csv or xls/xlsx file per folder
- Check plugins used exist in jsPsych-6/plugins
- Check we have the necessary parameters (WIP)
- Delete files of plugins not used
create_protocol()
cannot yet:
- Modify config.js to adapt
all_conditions
to the experimental tasks added
- Use shiny app to edit the local config.js
7.1 New protocols
You can create a new protocol in seconds, choosing from the tasks we already have available.
Make sure you have the last version of jsPsychMaker, installing from Github:
Check if there are new tasks available in a new version of the Github package:
jsPsychMaker::check_NEW_tasks_Github()
7.1.1 List available tasks
You can list available tasks to choose from. You have more details in the section available-tasks. You can choose between available tasks for jsPsych 6.3 and jsPsych 7.3 with jsPsych_version
.
::list_available_tasks(jsPsych_version = 6) jsPsychMaker
$tasks
[1] "AIM" "AntiBots" "APrioriDiagnostic"
[4] "APrioriScreening" "Bank" "BART"
[7] "Bayesian39" "Bayesian40" "BDI"
[10] "BNT" "bRCOPE" "CAS"
[13] "CEL" "CIT" "CMApost"
[16] "CMApre" "Consent" "ConsentAudio"
[19] "ConsentHTML" "Cov19Q" "COVIDCONTROL"
[22] "CRQ" "CRS" "CRT7"
[25] "CRTMCQ4_ES-es" "CRTMCQ4" "CRTv"
[28] "CS" "CTT" "DASS21"
[31] "DEBRIEF" "DEBRIEF39" "DEMOGR"
[34] "DMW" "EAR" "EmpaTom"
[37] "EQ" "ERQ" "ESM"
[40] "ESV" "ESZ" "fauxPasEv"
[43] "FDMQ" "FKEA" "GBS"
[46] "GHQ12" "Goodbye" "HRPVB"
[49] "HRPVBpost" "IBT" "ICvsID"
[52] "IDQ" "IEC" "INFCONS"
[55] "IRI" "IRS" "LoB"
[58] "LOT" "LSNS" "MCQ30"
[61] "MDDF" "MDMQ" "MIS"
[64] "NARS" "OBJNUM" "OTRASRELIG"
[67] "PBSr" "PERMA" "PPD"
[70] "PRFBM" "PRFBMpost" "PSC"
[73] "PSETPP" "PSPPC" "PSS"
[76] "PVC" "PWb" "REI40"
[79] "Report" "RMET" "RobToM"
[82] "RSS" "RTS" "SASS"
[85] "SBS" "SCGT" "SCSORF"
[88] "SDG" "SILS" "sProQOL"
[91] "SRA" "SRBQP" "SRSav"
[94] "STAI" "SWBQ" "UCLA"
[97] "WaisMatrices" "WaisMatricesES" "WaisWorkingMemory"
[100] "WaisWorkingMemoryES" "WEBEXEC"
$tasks_js
[1] "AIM.js" "AntiBots.js" "APrioriDiagnostic.js"
[4] "APrioriScreening.js" "Bank.js" "BART.js"
[7] "Bayesian39.js" "Bayesian40.js" "BDI.js"
[10] "BNT.js" "bRCOPE.js" "CAS.js"
[13] "CEL.js" "CIT.js" "CMApost.js"
[16] "CMApre.js" "Consent.js" "ConsentAudio.js"
[19] "ConsentHTML.js" "Cov19Q.js" "COVIDCONTROL.js"
[22] "CRQ.js" "CRS.js" "CRT7.js"
[25] "CRTMCQ4_ES-es.js" "CRTMCQ4.js" "CRTv.js"
[28] "CS.js" "CTT.js" "DASS21.js"
[31] "DEBRIEF.js" "DEBRIEF39.js" "DEMOGR.js"
[34] "DMW.js" "EAR.js" "EmpaTom.js"
[37] "EQ.js" "ERQ.js" "ESM.js"
[40] "ESV.js" "ESZ.js" "fauxPasEv.js"
[43] "FDMQ.js" "FKEA.js" "GBS.js"
[46] "GHQ12.js" "Goodbye.js" "HRPVB.js"
[49] "HRPVBpost.js" "IBT.js" "ICvsID.js"
[52] "IDQ.js" "IEC.js" "INFCONS.js"
[55] "IRI.js" "IRS.js" "LoB.js"
[58] "LOT.js" "LSNS.js" "MCQ30.js"
[61] "MDDF.js" "MDMQ.js" "MIS.js"
[64] "NARS.js" "OBJNUM.js" "OTRASRELIG.js"
[67] "PBSr.js" "PERMA.js" "PPD.js"
[70] "PRFBM.js" "PRFBMpost.js" "PSC.js"
[73] "PSETPP.js" "PSPPC.js" "PSS.js"
[76] "PVC.js" "PWb.js" "REI40.js"
[79] "Report.js" "RMET.js" "RobToM.js"
[82] "RSS.js" "RTS.js" "SASS.js"
[85] "SBS.js" "SCGT.js" "SCSORF.js"
[88] "SDG.js" "SILS.js" "sProQOL.js"
[91] "SRA.js" "SRBQP.js" "SRSav.js"
[94] "STAI.js" "SWBQ.js" "UCLA.js"
[97] "WaisMatrices.js" "WaisMatricesES.js" "WaisWorkingMemory.js"
[100] "WaisWorkingMemoryES.js" "WEBEXEC.js"
7.1.2 Create a protocol
This will create a fully working protocol in folder_output
. You can edit config.js
to adapt the protocol to your needs. See experiment configuration for more details.
::create_protocol(canonical_tasks = c("AIM", "EAR", "IRI"),
jsPsychMakerfolder_output = "~/Downloads/protocol999",
launch_browser = TRUE,
jsPsych_version = 6)
7.2 New tasks
7.2.1 Create tasks
You can create new tasks with create_task()
using csv
or xls/xlxs
files for the items, and html
files for the instructions. But we recommend you use create_protocol()
instead, so the tasks will be part of a fully working protocol, and testing them will be a breeze.
There are some things to take into account:
folder_tasks expects a folder with sub-folders with the ShortName of tasks (ShortName is an example of the ShortName of a task, for example, MyTask). Inside, they need to have one
ShortName.csv
orShortName.xls/xlxs
file and*_instructions.html
files. UsejsPsychMaker::copy_example_tasks(destination_folder = "~/Downloads/TEST")
to see a working exampleThe csv or xls/xlsx file (ShortName.csv or Shortname.xls/xlsx) needs to have an
ID
andplugin
columns, and then columns by the name of parameters used in the plugin (e.g. if using thesurvey-text
plugin, you will need theprompt
parameter). If you need help with the plugins parameters, see the jsPsych 6.3 list of pluginsFor each html file ending with
_instructions.html
orinstructions#.html
(# is a number), an instructions page will be created (e.g. ShortName_instructions.html, ShortName_instructions2.html, etc). If there is no html, a default page will be used.For key questions (e.g. present this question only if participants responded “3”), you need to create a column named
if_question
and include a logical condition. For example:1 != 25
: Response to item 1 is NOT 253 == 20
: Response to item 3 is 2015 == yes
: Response to item 3 is yes
If you use tasks with images, video or audio, make sure to include the files in a
media/
folder, inside a subfolder with the name of the task. So, if your task name isALL
:- Images:
media/images/ALL
- Videos:
media/videos/ALL
- Audio:
media/audios/ALL
- Images:
If you use a plugin with different options or alternatives (e.g.
survey-multi-choice-vertical
), the different responseoptions
will be the words or sentences separated by semi-colons (e.g. Yes, I am; No, I am not). If your options have semi-colons, you can to use theoptions_separator
parameter to change the default.
You can run the fully reproducible example included in jsPsychMaker:
- Install jsPsychMaker from Github and load library
if (!require('pak')) install.packages('pak'); pak::pkg_install("gorkang/jsPsychMaker")
- Copy example tasks
This will copy a few example tasks that you use to adapt your tasks. For example, MultiChoice
and Slider
tasks, a key questions mini-task (IfQuestion
), and an ImageButtonResponse
task.
::copy_example_tasks(destination_folder = "~/Downloads/ExampleTasks") jsPsychMaker
- Create your protocol
# Create protocol
::create_protocol(folder_tasks = "~/Downloads/ExampleTasks/",
jsPsychMakerfolder_output = "~/Downloads/protocol999",
launch_browser = TRUE)
7.3 HELP with new tasks
If you need help developing new tasks, you can open a new Issue in the jsPsychMaker Github.
We will ask you to add the details about the task in the NEW tasks document.
Once the task is implemented, our goal is to always end up having a sister task preparation script in jsPsychHelpeR. You can try to create the preparation script and do a Pull request, or ask for help opening a new Issue in the jsPsychHelpeR Github.
7.3.1 How to fill the NEW tasks document
First of all, you will need the original paper where the task was validated/translated to have all the details at hand. Please, send us a link to the paper.
The best way to fill the NEW tasks document is:
Find a task similar to yours in the document Tareas jsPsychR where we have information about all the available tasks.
Copy/paste the information from all the tabs to the NEW tasks document and adapt it.
Try to be as consistent as possible. For example, when entering the information about numeric conversion in the Puntajes_items tab:
All the cells must be:
1 = Mucho
2 = Poco
...
DO NOT do things like:
1: Mucho
1 Mucho
1 pto = Mucho
Mucho 1
Please, make sure you fill out all the details in all the tabs.