Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trail making task #23

Open
wants to merge 91 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
777dd3f
Organizing
steffejr May 26, 2021
a192e40
Organizing
steffejr May 26, 2021
ab93a67
Organizing into branches
steffejr May 26, 2021
fb9ab57
organizing
steffejr May 26, 2021
97abc2b
removing JATOS files
steffejr May 26, 2021
057d835
Create GoalsAndNotes.md
steffejr May 26, 2021
fd6610b
renaming things
steffejr May 26, 2021
a0be25b
Update Readme.md
steffejr May 26, 2021
93b7423
Update Readme.md
steffejr May 26, 2021
f3a4ef2
Update Readme.md
steffejr May 26, 2021
f50fb9b
Update Readme.md
steffejr May 26, 2021
05f9a6c
minor fixes and organization, plus I aded titles
steffejr May 26, 2021
b590ac3
checked and confirmed stai scoring
steffejr May 26, 2021
5c20a66
checked AES
steffejr May 26, 2021
2eb4d70
more checking
steffejr May 27, 2021
0367b02
Update GoalsAndNotes.md
steffejr May 27, 2021
24f17aa
adding more modifiable variables
steffejr May 27, 2021
71fcade
Create GoalsAndNotes.md
steffejr May 27, 2021
10b3ee7
Update GoalsAndNotes.md
steffejr May 27, 2021
dbda023
working on block based
steffejr May 28, 2021
6dc5be2
added class to dynamically change the task loads presented
steffejr Jun 1, 2021
f829bf4
Update .gitignore
steffejr Jun 1, 2021
08794e3
Update DMS_BlockBased.html
steffejr Jun 2, 2021
3859a60
fixed up DMS adaptive and block based
steffejr Jun 2, 2021
b3dca30
Update GoalsAndNotes.md
steffejr Jun 2, 2021
c43bd1a
Update .gitignore
steffejr Jun 2, 2021
9d2f09b
added the functionality to split a question list into multiple pages
steffejr Jun 4, 2021
b9aca00
updated CFI
steffejr Jun 4, 2021
306d6ed
Update Readme.md
steffejr Jun 4, 2021
a490c4f
Update Readme.md
steffejr Jun 4, 2021
3c9d7a5
updated HTML with multi-page
steffejr Jun 7, 2021
a5d7cf9
trying (and failing) to split BDI into multiple pages
steffejr Jun 7, 2021
ac79848
minor changes
steffejr Jun 9, 2021
2410cd1
minor edits
steffejr Jun 10, 2021
927b475
Update .gitignore
steffejr Jun 11, 2021
c65482e
Broke BDI into multiple pages
steffejr Jun 11, 2021
79351a7
figured out how to score MC questionnaires
steffejr Jun 11, 2021
78b8079
finalizing scoring MC type surveys
steffejr Jun 14, 2021
eeff7e0
Update GoalsAndNotes.md
steffejr Jun 25, 2021
0aeea72
Create index.html
steffejr Jun 25, 2021
4a2ef13
Merge branch 'ANT' into Modifications
steffejr May 25, 2022
1c052bf
Merge branch 'LetterDMS' into Modifications
steffejr May 25, 2022
92a20a0
Merge branch 'Questionnaires' into Modifications
steffejr May 25, 2022
280464e
Merge branch 'BaddeleyGramReason' into Modifications
steffejr May 25, 2022
875997d
Merge branch 'TestButtons' into Modifications
steffejr May 25, 2022
ddbc5e9
Cleaned up adaptive results file a bit.
steffejr May 25, 2022
7268d4b
updating the ANTs task
steffejr May 25, 2022
56efd08
Worked on the ANT to clean up the setup file
steffejr May 27, 2022
1ff73db
added minor note
steffejr Aug 1, 2022
2a21f49
Starting TrailMaking
steffejr Aug 3, 2022
e9c8bb6
Update .gitignore
steffejr Aug 3, 2022
f2ebd57
Update .gitignore
steffejr Aug 3, 2022
319fd67
Update .gitignore
steffejr Aug 3, 2022
41cd053
Update TrailMakingA.html
steffejr Aug 3, 2022
3183ca0
organizing jspsych
steffejr Aug 3, 2022
8987920
organizing files
steffejr Aug 3, 2022
e78baf9
move updated sketchpad
steffejr Aug 3, 2022
f448cd8
minor updates
steffejr Aug 3, 2022
e57205b
changed the sketchpad for making circles, labels and changing color w…
steffejr Aug 4, 2022
021702f
This is a fully functional trailmaking tasks
steffejr Aug 4, 2022
e5ba0a9
renaming a file
steffejr Aug 4, 2022
064d905
added scoring of enter and exit the circles
steffejr Aug 4, 2022
e076b8b
corrected the logic for scoring
steffejr Aug 5, 2022
33f610d
Added Trail A locations
steffejr Aug 6, 2022
2891710
Made dynamic spacing of dots based on screen size
steffejr Aug 8, 2022
8e558cd
added trailmaking B and started a calibration script
steffejr Aug 29, 2022
3ed2011
turned on full screen mode
steffejr Aug 30, 2022
664faa5
Minor improvements including vertical centering of labels
steffejr Aug 30, 2022
d07ddf0
added start/end labels and sample locations
steffejr Aug 30, 2022
56856d2
added screen size check
steffejr Aug 30, 2022
a1e6fd9
Added suggested height and width so choose a correct canvas size. Nee…
steffejr Aug 31, 2022
cbfc0b3
auto download PNG of drawing and fixed screen sizing
steffejr Sep 1, 2022
b03452c
streamlined the code so it all runs with one html file
steffejr Sep 2, 2022
526f657
Writing up the readme file
steffejr Sep 2, 2022
8d43226
adding instructions
steffejr Sep 2, 2022
23fbba7
Added instructions
steffejr Sep 6, 2022
9ba8cc4
working out making a grid of buttons for numerical entry
steffejr Sep 7, 2022
e50426e
made a working numeric button response for digit span tasks
steffejr Sep 7, 2022
06aa746
added backspace key to number pad
steffejr Sep 8, 2022
c8ef7ee
fixed missing lines of code in setting canvas size
steffejr Sep 13, 2022
cef9e05
Finalized task and JATOS works and receives data!
steffejr Sep 14, 2022
bb66793
Started a touch screen version of the Stroop using a modified html re…
steffejr Sep 29, 2022
f25aed7
fixed the title
steffejr Sep 30, 2022
c42c394
Making a touch screen version of Stroop word
steffejr Oct 3, 2022
1112b4a
Added all parts to Stroop touch screen. Need to just double check eve…
steffejr Oct 3, 2022
5fd7871
Working complete Stroop, Word
steffejr Oct 3, 2022
ccce003
added stroop color touch screen version
steffejr Oct 4, 2022
186e420
added touch screen color/word
steffejr Oct 5, 2022
b17b306
minor changes
steffejr Oct 5, 2022
4d5fb7e
Added communication of values between JATOS and jsPsych
steffejr Oct 6, 2022
f4b2bc3
made a display of buttons in JATOS for a user to pick the next task a…
steffejr Oct 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
node_modules/
.DS_Store
**/.DS_Store
Thumbs.db
/.settings/
/.project
/.tern-project
site/

/ANT/jsPsych/
Questionnaires/BackgroundPapers/
Questionnaires/ToAdd/
ANT/jsPsych/


BaddeleyGramReason/jspsych/

ANT/.idea/vcs.xml
ANT/.idea/ANT.iml
ANT/.idea/modules.xml
ANT/.idea/workspace.xml

TrailMaking/jspysch/*
TestButtons/jspsych/*
Stroop/jspsych/*
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/experiment-demos.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 125 additions & 0 deletions ANT/ANT_Setup_EN.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// This variable affects the distance between the center of
// the screen and the high and low line


// How many times to cycle over all different trials for PRACTICE
var NumberOfCyclesForPractice = 1
// How many times to cycle over all different trials for TESTING
var NumberOfCyclesForTesting = 2

var InstructionText = 'For this task you will see...'

var ScreenSpacing = 300
// Set the fixation time between trials, in milliseconds
var FixationDuration = 300
// how many flankers should be on either side of the central arrow
var NFlankers = 2;
// define the flankers as empty strings
var flankersL = '';
var flankersR = '';
var flankersN = '';
// append to the empty strings the different number of flankers
for (i = 0; i < NFlankers; i++)
{
// the following are the codes for the specific arrows and star to use
// https://www.fileformat.info/info/unicode/char/2190/index.htm
flankersL += "\u2190";
flankersR += "\u2192";
flankersN += "\u2014";
}
// font size of the stimuli
var FontSize = 72

// What are the keyboard keys to record responses from
var KeyboardChoices = ['arrowleft', 'arrowright'];
// The above key codes need to be mapped onto text descriptions used later for scoring
var ResponseMapping = ['left', 'right'];

// format the stimuli on the screen. This uses the fontsize specified above
// The stimuli are presented with some at the top of the screen, some in the middle and some at the bottom. Build an
// html formatted table of the stimuli.
function PutIntoTable(top='top', middle='mid', bottom='bot', width=600, height=ScreenSpacing) {
return '<table margin-left="auto" margin-right="auto" border="0" width="'+width+'"><tr height="'+height+'"><td>'+top+'</td></tr><tr height="'+height+'"><td><div style="font-size:'+FontSize+'px;">'+middle+'</div></td></tr> <tr height="'+height+'"><td>'+bottom+'</td></tr></table>';
}

// What type of trial is this?
// Factors:
// flanker: left, right, none [3]
// central arrow direction: left, right [2]
// star: top&bot, top, bot, none, middle [5]
// position: top, bottom [2]


// Create the array of objects dynamically
// https://stackoverflow.com/questions/7858385/how-to-add-values-to-an-array-of-objects-dynamically-in-javascript

// The order of these is important and needs to map onto the for loops below which index these lists
var flankers = [flankersL, flankersR, flankersN];
var centralArrow = ["\u2190", "\u2192"]; // left, right
var fixation = [PutIntoTable("\u2217","+","\u2217"), PutIntoTable("\u2217","+"," "), PutIntoTable(" ","+","\u2217"), PutIntoTable(" ","+"," "), PutIntoTable(" ","\u2217"," ")];
var position = ["high","low"];
var count = 0;
var ANT = [];

// The test procedure in the HTML specifies how many times to repeat the stimuli presentation
// The following sets up the stimuli for all cells across the different factors
// This also adds text descriptions which will go into the resulatnt data file and will be used for scoring
for(var i=0; i<3; i++) { // flanker type: LEFT, RIGHT, NEUTRAL
for (var j = 0; j < 2; j++) { // cycle over central arrow directions
for (var k = 0; k < 1; k++) { // cycle over fixation positions
for (var m = 0; m < 2; m++) { // cycle over stimulus position
// Set up all the stimuli
ANT[count] = {};
ANT[count].flanker = flankers[i]; // left/right/neutral
ANT[count].centralArrow = centralArrow[j]; // right/left
ANT[count].fixation = fixation[k]; //upper/lower/both/center/none
ANT[count].position = position[m]; // upper/lower
// THE FOLLOWING NEEDS TO BE CHECKED AND CONFIRMED

// Define what is considered correct and incorrect for each trial
// The central arrow points to the LEFT
if (j==0) {ANT[count].correct = 'left'}
// The central arrow points to the RIGHT
if (j==1) {ANT[count].correct = 'right'}

// map the stim to the type
// using the indices is a convenience. It would be better if this was more explicit
// This information will be used for scoring this experiment

// Flankers are LEFT
// Central arrow is LEFT
if (i==0 & j==0) {ANT[count].flankerType = 'conFlanker';}
// Central arrow is RIGHT
if (i==0 & j==1) {ANT[count].flankerType = 'incFlanker';}
// Flankers are RIGHT
// Central arrow is RIGHT
if (i==1 & j==1) {ANT[count].flankerType = 'conFlanker';}
// Central arrow is LEFT
if (i==1 & j==0) {ANT[count].flankerType = 'incFlanker';}
// Flankers are NEURAL
if (i==2) {ANT[count].flankerType = 'neuFlanker';}
// Position of the CUE

if (k==0) {ANT[count].cuePos = 'both';}
if (k==1) {ANT[count].cuePos = 'upper';}
if (k==2) {ANT[count].cuePos = 'lower';}
if (k==3) {ANT[count].cuePos = 'none';}
if (k==4) {ANT[count].cuePos = 'center';}
// Code whether the stim is congruent with the CUE
// Stimulus is HIGH (m = 0)
if (k==0 & m==0) {ANT[count].cueType = 'bothCue';}
if (k==1 & m==0) {ANT[count].cueType = 'conCue';}
if (k==2 & m==0) {ANT[count].cueType = 'incCue';}
if (k==3 & m==0) {ANT[count].cueType = 'noCue';}
if (k==4 & m==0) {ANT[count].cueType = 'centerCue';}
// Stimulus is LOW (m = 1)
if (k==2 & m==1) {ANT[count].cueType = 'conCue';}
if (k==1 & m==1) {ANT[count].cueType = 'incCue';}
if (k==0 & m==1) {ANT[count].cueType = 'bothCue';}
if (k==3 & m==1) {ANT[count].cueType = 'noCue';}
if (k==4 & m==1) {ANT[count].cueType = 'centerCue';}
count += 1;
}
}
}
}
49 changes: 49 additions & 0 deletions ANT/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Attention Network Task-Flanker Task
[Description](http://lcni-3.uoregon.edu/phenowiki/index.php/Attention_Network_Task-Flanker_Task_(ANT))

[In depth description](https://scienceofbehaviorchange.org/measures/attentional-network-task/)

This task tests the three attentional networks of alerting, orienting, and executive control. It is a combination of a cued reaction time task and a flanker task.

The flanker task stimuli are presented at the top or bottom of the screen. An alerting star(s) is also presented in the following locations:
- upper
- lower
- both
- center
- none

## Conditions
- cue type (5)
- upper
- lower
- both
- center
- none

- target location (2)
- upper
- lower

- target direction (2)
- left
- right

- flanker condition (3)
- congruent
- flanking arrows the same direction as the target direction
- incongruent
- flanking arrows the opposite direction as the target direction
- neutral
- the target is flanked by lines without arrowheads

There are a total of 60 unique condition combinations.
The resulatant measures need to be accuracy and response time for the following conditions:
- cue type (5)
- target location (2)
- flanker condition (3)
This is 30 different measures!!!

# To do
- Add instructions
- Add practice trials
- Should there be trials with feedback?
146 changes: 146 additions & 0 deletions ANT/ant.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="jsPsych ANT">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="Jason Steffener, NCMLab">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ANT</title>
<script src="jspsych/jspsych.js"></script>
<script src="jspsych/plugins/jspsych-html-keyboard-response.js"></script>
<script src="jspsych/plugins/jspsych-image-keyboard-response.js"></script>
<script src="jspsych/plugins/jspsych-fullscreen.js"></script>
<script src="jspsych/plugins/jspsych-instructions.js"></script>
<script src="ANT_Setup_EN.js"></script>
<link href="jspsych/css/jspsych.css" rel="stylesheet" type="text/css">

<style>
.stimulus { font-size: FontSize; }
.jspsych-html-keyboard-response-stimulus {font-size: FontSize;}
.jspsych-display-element {
font-family: 'Open Sans', 'Arial', sans-serif;
font-size: 72px;
line-height: 0.85em;
}
.center {
margin-left: auto;
margin-right: auto;
}

</style>
</head>
<script>
/*<?php
$post_data = json_decode(file_get_contents('php://input'), true);
// the directory "data" must be writable by the server
$name = "data/".$post_data['filename'].".csv";
$data = $post_data['filedata'];
// write the file to disk
file_put_contents($name, $data);
?>*/

/* create timeline */

var timeline = [];

//https://www.webnots.com/keyboard-shortcuts-for-asterisk-symbol/
var Stim = {
type: 'html-keyboard-response',
stimulus: function()
{ // The stimulus is based on the conditions laid out in the ANT
// variable read from the setup file.
// Recall that the ANT variable is an array of objects.
// The object contains everything there is know about this trial.
// Read how this trial will be made
var centralArrow = jsPsych.timelineVariable("centralArrow", true)
var flanker = jsPsych.timelineVariable("flanker", true)
var position = jsPsych.timelineVariable("position", true)

// make the stimulus for this trial
var stim = flanker + centralArrow + flanker
return stim
},
choices: KeyboardChoices,
on_finish: function(data, correct){
// find the correct response for this trial
var correct = jsPsych.timelineVariable("correct", true)
// in the list of allowable key presses, what is the index of what was pressed?
var ResponseIndex = KeyboardChoices.indexOf(data.response)
//console.log(ResponseMapping[ResponseIndex])

if (ResponseMapping[ResponseIndex] == correct)
{data.correct = 1}
else {data.correct = 0}
/* If the ESCAPE key is pressed the current timeline is ended and the thank you screen is shown */
if (data.key_press == 27) {jsPsych.end();}
// What data to write to the output data file
data.flankerType = jsPsych.timelineVariable("flankerType", true);
data.cuePos = jsPsych.timelineVariable("cuePos", true);
data.cueType = jsPsych.timelineVariable("cueType", true);
data.trialType = 'trial';
},

}

var Fix = {
// Each trial also has its own specific cue which occurs BEFORE the stimulus presentation
// The cue itself is actually made in the setup file and not here. This could be changed if desired
type: 'html-keyboard-response',
stimulus: function()
{
var stim = jsPsych.timelineVariable("fixation", true)
return stim
},
choices: jsPsych.NO_KEYS,
trial_duration: FixationDuration,
//on_finish: function(data){
// data.trialType = "fixation"
//}

}

var test_procedure = {
// Make sure this order is correct: fixation cue and then the stimulus
// Otherwise the scoring will not make any sense
timeline: [Fix, Stim],
timeline_variables: ANT,
sample: {
type: 'fixed-repetitions',
// "fixed-repetitons": Repeat each item in the timeline variables size times, in a random order.
// Unlike using the repetitons parameter, this method allows for consecutive trials to use the same
// timeline variable set.
size: 1,
}
};
timeline.push(test_procedure)

/* define debrief */
var debrief_block = {
type: 'html-keyboard-response',
stimulus: function() {

var trials = jsPsych.data.get().filter({trialType: 'trial'});
var correct_trials = trials.filter({correct: true});
var accuracy = Math.round(correct_trials.count() / trials.count() * 100);
var rt = Math.round(correct_trials.select('rt').mean());

return `<p>You responded correctly on ${accuracy}% of the trials.</p>
<p>Your average response time was ${rt}ms.</p>
<p>Press any key to complete the experiment. Thank you!</p>`;

}
};
timeline.push(debrief_block);

/* start the experiment */
//jatos.onLoad(function() {
jsPsych.init({
experiment_width: 600,
timeline: timeline,
on_finish: function() {
jsPsych.data.get().localSave('csv','ANTMydata.csv');
}
})
</script>
</html>
1 change: 1 addition & 0 deletions BaddeleyGramReason/BGR.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body {background-color: rgb(150, 150, 150)}
Loading