Adaptive Semantic Judgment Task
The Adaptive Semantic Judgment Task is an interactive cognitive assessment tool developed using JsPsych at the DNP.
Table of Contents
- Prerequisites
- Quick Start
- Installation
- Configuration
- Integration with Open Data Capture
- Customizing Stimuli
- Data Output
- Technical Details
Prerequisites
- Browser with text-to-speech capability. (Google Chrome has one packaged with it)
- Node.js and npm (if building from source)
Quick Start
- Download the latest release from GitHub releases
- Extract the files and navigate to the
distdirectory - Start a local server:
python -m http.server - Open your browser to
http://localhost:8000
Installation
Option 1: Download Pre-built Files (Recommended)
- Go to the releases page
- Download the latest release
- Extract the archive - you'll find
index.htmlin thedistdirectory
Option 2: Build from Source
- Clone the repository:
git clone https://github.com/DouglasNeuroInformatics/AdaptiveSemanticJudgementTask.git - Install dependencies:
npm install - Build the project:
npm run build - The built files will be in the
distdirectory
Running Locally
The recommended way to run this task locally is with a local HTTP server of your choice.
Using Python 3:
cd path/to/dist/directory
python -m http.server 8000
Configuration
Experiment Settings
Configure the task by editing src/experimentSettings.ts before building:
export const experimentSettings = {
advancementSchedule: 2, // Number of correct answers needed to increase difficulty
regressionSchedule: 1, // Number of incorrect answers needed to decrease difficulty
language: "en", // Language: "en" or "fr"
seed: 42, // Random seed (null for random)
initialDifficulty: 1, // Starting difficulty level
numberOfLevels: 9, // Total difficulty levels available
};
| Parameter | Type | Description | Default | Valid Values |
|---|---|---|---|---|
| advancementSchedule | number | Correct answers to advance level | 2 | 1+ |
| regressionSchedule | number | Incorrect answers to regress level | 1 | 1+ |
| language | string | Task language | "en" | "en", "fr" |
| seed | number|null | Random seed for reproducibility | null | Any integer or null |
| initialDifficulty | number | Starting difficulty | 1 | 1 to numberOfLevels |
| numberOfLevels | number | Total difficulty levels | 9 | 1+ |
Integration with Open Data Capture
This task integrates with Open Data Capture for research data collection.
Setup in ODC Playground
- Visit the ODC Playground
- Upload a zip archive of all files from the
srcdirectory - Or use our pre-configured instrument
- Upload bundle to your instance of ODC via the menu available on the playground
For more information on instruments, see the ODC documentation.
Customizing Stimuli
Stimuli Structure
Edit src/stimuliList.ts to customize word pairs. Each stimulus object requires:
interface Stimulus {
stimulus: string; // First word shown
prompt: string; // Second word (shown after delay)
difficultyLevel: number; // Difficulty level (1 to numberOfLevels)
language: "en" | "fr"; // Language identifier
relation: "related" | "unrelated"; // Semantic relationship
}
example stimulus
{
"stimulus": "dog",
"prompt": "cat",
"difficultyLevel": 1,
"language": "en",
"relation": "related"
}
Data output
| Field | Type | Description | Example Values |
|---|---|---|---|
| word_pair | string | The stimulus and prompt words | "dog cat", "table freedom" |
| correctResponse | enum | The correct semantic relationship | "related", "unrelated" |
| userChoice | enum | The participant's response | "related", "unrelated", "timeout" |
| difficultyLevel | number | Difficulty level when trial was presented | 1, 2, 3, ..., 9 |
| language | string | Language of the stimulus pair | "en", "fr" |
| rt | number | Response time in milliseconds | 1250, 2340, 5000 |
Technical Details
Task Logic
- Two practice runs precede the main task to reduce variability
- Stimuli are randomly selected from the current difficulty level and the selected language
- Adaptive algorithm adjusts difficulty based on performance
Note
Built-in logic prevents more than 2 consecutive related or unrelated pairs To modify the consecutive response limits, edit line 546 in src/adaptiveSemanticJudgmentTask.ts.