Skip to content

Commit

Permalink
clarify nested data types
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeddelta committed Oct 19, 2024
1 parent 132c1f5 commit 1af38c4
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 13 deletions.
20 changes: 17 additions & 3 deletions packages/plugin-copying-task/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,31 @@ var jsPsychCopyingTask = (function (jspsych) {
},
/** The contents of the grids as the trial ends. */
grid_contents: {
type: jspsych.ParameterType.COMPLEX, //TODO: specify structure of model/workspace/resource grid contents
type: jspsych.ParameterType.COMPLEX,
nested: {
// all are arrays of arrays of strings
/** The contents of the model grid the participant was to copy. */
model: {
type: jspsych.ParameterType.COMPLEX,
array: true,
},
/** The contents of the workspace grid the participant was to copy the model grid to. */
workspace: {
type: jspsych.ParameterType.COMPLEX,
array: true,
},
/** The contents of the resource grid where participants were given images to drag to the workspace. */
resource: {
type: jspsych.ParameterType.COMPLEX,
array: true,
},
},
},
/** An array of objects which each consist of interactions with the resource grid images. */
trial_events: {
type: jspsych.ParameterType.COMPLEX,
array: true,
parameters: {
nested: {
/** The type of event the interaction was, split into if the participant successfully or unsuccessfully
* interacted with the resource grid image, along with if the item was placed correctly or not. */
event: {
Expand All @@ -201,7 +205,17 @@ var jsPsychCopyingTask = (function (jspsych) {
},
/** The location on the resource grid that the participant interacted with. */
grid_coords: {
type: jspsych.ParameterType.COMPLEX, //TODO: add "row" and "column" demarkations
type: jspsych.ParameterType.COMPLEX,
nested: {
/** The row of the resource grid the participant interacted with. */
row: {
type: jspsych.ParameterType.INT,
},
/** The column of the resource grid the participant interacted with. */
column: {
type: jspsych.ParameterType.INT,
},
},
},
/** The timestamp of when the interaction occured, in milliseconds measured from when the stimulus appeared. */
timestamp: {
Expand Down
15 changes: 14 additions & 1 deletion packages/plugin-corsi-blocks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,25 +143,38 @@ const info = <const>{
},
},
data: {
/** The sequence of block indicies that were displayed. */
sequence: {
type: ParameterType.INT,
array: true,
},
/** The sequence of blocks that were selected by the participant. */
response: {
type: ParameterType.INT,
array: true,
},
/** The time, in milliseconds, that the participant took to respond to each block.
* These times are cumulative, measured from the onset of the display. */
rt: {
type: ParameterType.INT,
array: true,
},
/** The x and y coordinates of each block that was displayed. */
blocks: {
type: ParameterType.COMPLEX,
array: true,
nested: {
x: {
type: ParameterType.INT,
},
y: {
type: ParameterType.INT,
},
},
},
/** Whether the participant's response was correct. */
correct: {
type: ParameterType.BOOL,
default: null,
},
},
};
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-gamepad/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const info = <const>{
/** The gamepad inputs recorded during the trial. */
input: {
type: ParameterType.COMPLEX,
array: true,
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-html-keyboard-slider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const info = <const>{
* Slider minimum - Note Ints here can also be floats without issue
*/
min: {
type: ParameterType.INT, // BOOL, STRING, INT, FLOAT, FUNCTION, KEY, KEYS, SELECT, HTML_STRING, IMAGE, AUDIO, VIDEO, OBJECT, COMPLEX
type: ParameterType.INT,
default: 0,
},
/**
Expand Down
16 changes: 13 additions & 3 deletions packages/plugin-html-vas-response/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,22 @@ var jsPsychHtmlVasResponse = (function (jspsych) {
type: jspsych.ParameterType.STRING,
},
/**
* A record of the participant's clicks on the scale. Each element in the array is an object with properties `time`
* (the time of the click, in milliseconds since the trial began) and `location`
* (the location of the click on the VAS, from 0 to 1).
* A record of the participant's clicks on the scale. Each element in the array is an object
* with properties `time` and `location`.
*/
clicks: {
type: jspsych.ParameterType.COMPLEX,
array: true,
nested: {
/** The time of the click, in milliseconds since the trial began. */
time: {
type: jspsych.ParameterType.INT,
},
/** The location of the click on the VAS, from 0 to 1. */
location: {
type: jspsych.ParameterType.FLOAT,
},
},
},
},
};
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-survey-slider/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";

// BOOL, STRING, INT, FLOAT, FUNCTION, KEY, KEYS, SELECT, HTML_STRING, IMAGE, AUDIO, VIDEO, OBJECT, COMPLEX

const info = <const>{
name: "survey-slider",
version: "2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ In addition to the [default data collected by all plugins](https://www.jspsych.o

| Name | Type | Value |
| --------- | ----------- | ---------------------------------------- |
| stimulus | array | Array where each element is a stimulus from the sequence, in the order that they were shown. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. |
| stimuli | array | Array where each element is a stimulus from the sequence, in the order that they were shown. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. |
| response | array | Array containing all response information. Each element in the array is an object representing each valid response. Each response item has three properties: `key` the key that was pressed, `stimulus` the index of the stimulus that was displayed when the response was made, and `rt` the response time measured since the start of the sequence. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. |

## Examples
Expand Down
20 changes: 18 additions & 2 deletions packages/plugin-vsl-animate-occlusion/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,27 @@ const info = <const>{
* when data is saved using the `.json()` or `.csv()` functions. */
response: {
type: ParameterType.COMPLEX,
array: true,
nested: {
/** The key that was pressed. */
key: {
type: ParameterType.STRING,
},
/** The index of the stimulus that was displayed when the response was made. */
stimulus: {
type: ParameterType.INT,
},
/** The response time measured since the start of the sequence. */
rt: {
type: ParameterType.INT,
},
},
},
/** Array where each element is a stimulus from the sequence, in the order that they were shown.
* This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */
stimulus: {
type: ParameterType.COMPLEX,
stimuli: {
type: ParameterType.STRING,
array: true,
},
},
};
Expand Down

0 comments on commit 1af38c4

Please sign in to comment.