You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial/config.json.md
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,8 @@ Open `public/tutorial/config.json`. The starter file already has the main parts
48
48
-[`$schema`](../typedoc/interfaces/StudyConfig.md#schema) points to the Study Config schema.
49
49
-[`studyMetadata`](../typedoc/interfaces/StudyMetadata.md) describes the study.
50
50
-[`uiConfig`](../typedoc/interfaces/UIConfig.md) controls reVISit interface behavior, such as the contact email, help text, progress bar, sidebar, logo, and recording settings.
51
-
-[`components`](../typedoc/interfaces/BaseIndividualComponent.md) defines the stimuli and tasks that the Participant can see.
52
-
-[`sequence`](../typedoc/interfaces/Sequence.md) decides which components appear and in what order.
51
+
-[`components`](../typedoc/interfaces/StudyConfig.md#components) defines the stimuli and tasks that the Participant can see.
52
+
-[`sequence`](../typedoc/interfaces/StudyConfig.md#sequence) decides which components appear and in what order.
53
53
54
54
The tutorial is mostly about the last two pieces: add a component, then add that component's id to the sequence.
55
55
@@ -543,6 +543,10 @@ This component renders `ReactExample.tsx`. The `parameters` object tells the Rea
543
543
Values in `parameters` are passed into the `.tsx` file as the `parameters` prop, alongside reVISit's `setAnswer` callback. The same React file can therefore power many trials with different data, fields, or behavior.
544
544
:::
545
545
546
+
:::info
547
+
React component paths are relative to `src/public/`, not the root `public/` folder. The path `tutorial/assets/ReactExample.tsx` points to `src/public/tutorial/assets/ReactExample.tsx`.
548
+
:::
549
+
546
550
Add `reactExampleCars` to the sequence.
547
551
548
552

@@ -897,6 +901,9 @@ import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLink
Copy file name to clipboardExpand all lines: docs/tutorial/replication-config.json.md
+94-51Lines changed: 94 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,10 @@ The completed version is [`public/tutorial/_answers/replication-config.json`](ht
13
13
This exercise shows how to make a reusable base component, create several practice trials from it, and then hand off to a dynamic block that chooses later trials.
14
14
:::
15
15
16
+
:::tip
17
+
If you have not completed the [config.json tutorial](./config.json.md), do that first. This page assumes you already understand the basic loop: define a component, add it to the sequence, save, refresh, and preview with **Next participant**.
18
+
:::
19
+
16
20
## Starting point
17
21
18
22
The starter file ends with:
@@ -33,6 +37,10 @@ You will fill these sections in order:
33
37
3. Add those components to the sequence.
34
38
4. Add the dynamic sequence block.
35
39
40
+
:::warning
41
+
The component names in this exercise intentionally include spaces and correlation values, such as `practice T1 A:0.3 B:0.7`. That is allowed, but the name must match exactly everywhere it is used in the sequence.
42
+
:::
43
+
36
44
## Step 1: Add the reusable scatter plot base component
37
45
38
46
Replace the empty `baseComponents` object with `scatterBase`:
@@ -65,9 +73,17 @@ Replace the empty `baseComponents` object with `scatterBase`:
65
73
}
66
74
```
67
75
68
-
This base component defines the stimulus once. It points to the React component that renders the scatter plots and defines the response Participants will use for every trial.
76
+
This [base component](../typedoc/interfaces/StudyConfig.md#basecomponents) defines the stimulus once. It points to the [React component](../typedoc/interfaces/ReactComponent.md) that renders the scatter plots and defines the response Participants will use for every trial.
69
77
70
-
The response uses `buttons` because Participants choose between two clear options. The stored values are `left` and `right`, which you will use in `correctAnswer` later.
78
+
The response uses [`buttons`](../typedoc/interfaces/ButtonsResponse.md) because Participants choose between two clear options. The stored values are `left` and `right`, which you will use in `correctAnswer` later.
79
+
80
+
:::tip
81
+
`baseComponents` are templates — they are not added to the sequence directly. Other components inherit from them via `"baseComponent": "scatterBase"` and override only the fields that change (typically `parameters` and `correctAnswer`).
82
+
:::
83
+
84
+
:::info
85
+
React component paths are relative to `src/public/`. The path `tutorial/assets/replication/ScatterWrapper.tsx` points to `src/public/tutorial/assets/replication/ScatterWrapper.tsx`.
86
+
:::
71
87
72
88
## Step 2: Add the first practice trial
73
89
@@ -92,28 +108,31 @@ Replace the empty `components` object with the first practice trial:
92
108
}
93
109
```
94
110
95
-
This trial inherits the stimulus and response from `scatterBase`. The `parameters` values tell the React component which correlations to show in the left and right plots.
111
+
This trial [inherits](../typedoc/type-aliases/InheritedComponent.md) the stimulus and response from `scatterBase`. The `parameters` values tell the React component which correlations to show in the left and right plots.
96
112
97
-
For this practice trial, `r2` is larger than `r1`, so the correct answer is `"right"`. The `id` in `correctAnswer` must match the response id from the base component: `buttonsResponse`.
113
+
For this practice trial, `r2` is larger than `r1`, so the correct answer is `"right"`. The `id` in [`correctAnswer`](../typedoc/interfaces/Answer.md) must match the response id from the base component: `buttonsResponse`.
98
114
99
115
## Step 3: Add the second practice trial
100
116
101
117
Add a comma after the first practice trial, then add:
This component also inherits from `scatterBase`, but it does not define fixed parameters or a fixed correct answer. The dynamic block will provide those values while the study runs.
160
188
161
189
Use this pattern when many trials share the same display and response format, but the exact trial values are generated or selected dynamically.
162
190
191
+
:::note
192
+
`trial` deliberately omits `parameters` and `correctAnswer` — both are injected at runtime by the dynamic block's function. This keeps a single reusable component definition for an arbitrary number of trials.
193
+
:::
194
+
163
195
## Step 6: Add the fixed practice sequence
164
196
165
197
Replace the empty top-level sequence with a fixed block:
@@ -184,16 +216,31 @@ This shows the three practice trials in order. The component names in this seque
184
216
185
217
At this point, the Study Config has a complete practice section.
186
218
219
+
:::tip
220
+
Preview the study here before adding the dynamic block. You should see the three practice trials in order, and each should provide feedback after the Participant answers.
221
+
:::
222
+
187
223
## Step 7: Add the dynamic JND block
188
224
189
-
Inside the nested fixed block, add the dynamic block after the three practice trials:
225
+
Inside the nested fixed block, add the [dynamic block](../typedoc/interfaces/DynamicBlock.md) after the three practice trials:
@@ -225,19 +272,13 @@ The dynamic block calls the function at `tutorial/assets/replication/JNDDynamic.
225
272
226
273
The `id` gives the dynamic block a stable name in the study sequence. The empty `parameters` object is still included so the block has the same shape as dynamic blocks that do receive custom settings.
227
274
228
-
## Step 8: Compare with the completed config
229
-
230
-
Open [`public/tutorial/_answers/replication-config.json`](https://github.com/revisit-studies/template/blob/main/public/tutorial/_answers/replication-config.json) and check:
231
-
232
-
-`baseComponents.scatterBase` defines the React stimulus and the shared button response.
233
-
- Each practice component uses `"baseComponent": "scatterBase"`.
234
-
- Each practice component passes `r1` and `r2` through `parameters`.
235
-
- Each practice component has a `correctAnswer` that uses `buttonsResponse`.
236
-
-`trial` inherits from `scatterBase` without fixed parameters.
237
-
- The sequence shows three practice trials before the dynamic block.
238
-
- The dynamic block uses `functionPath: "tutorial/assets/replication/JNDDynamic.tsx"`.
275
+
:::tip
276
+
The function at `functionPath` returns the next component id (typically `"trial"` here) plus the `parameters` and `correctAnswer` to inject. Use dynamic blocks for adaptive procedures like staircases, JND/QUEST, or branching based on prior responses. See the [Dynamic Blocks guide](../designing-studies/sequences/dynamic-blocks.md) for the full function contract.
277
+
:::
239
278
240
-
When those pieces match, the replication Study Config is complete.
279
+
:::info
280
+
Dynamic block function paths are also relative to `src/public/`. In the repository, `tutorial/assets/replication/JNDDynamic.tsx` lives at `src/public/tutorial/assets/replication/JNDDynamic.tsx`.
281
+
:::
241
282
242
283
<!-- Importing links -->
243
284
import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLinks.tsx';
@@ -251,6 +292,8 @@ import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLink
Copy file name to clipboardExpand all lines: docs/tutorial/tutorial.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ By the end of this page, you should know:
19
19
20
20
## Tutorial Roadmap
21
21
22
-
This tutorial follows the same general structure as the ReVISit visualization tutorial worksheet. You will start by getting the template running locally, then build and test a Study Config, and then look at analysis and deployment topics.
22
+
This tutorial follows the same general structure as the reVISit visualization tutorial worksheet. You will start by getting the template running locally, then build and test a Study Config, and then look at analysis and deployment topics.
23
23
24
24
The main sections are:
25
25
@@ -37,7 +37,7 @@ Use these links during the tutorial:
37
37
38
38
| Resource | Link |
39
39
| --- | --- |
40
-
|ReVISit Slack team |[Join Slack](https://join.slack.com/t/revisit-nsf/shared_invite/zt-25mrh5ppi-6sDAL6HqcWJh_uvt2~~DMQ)|
40
+
|reVISit Slack team |[Join Slack](https://join.slack.com/t/revisit-nsf/shared_invite/zt-25mrh5ppi-6sDAL6HqcWJh_uvt2~~DMQ)|
41
41
| reVISit home page |[https://revisit.dev/](https://revisit.dev/)|
@@ -202,7 +202,7 @@ When you compare your starter file to an answer file, focus on the section you j
202
202
203
203
## Step 5: Know what starts empty
204
204
205
-
Both starter configs already include the basic Study Config structure: schema, study metadata, UI config, empty components, and an empty sequence.
205
+
Both starter configs already include the basic [Study Config](../typedoc/interfaces/StudyConfig.md) structure: [`$schema`](../typedoc/interfaces/StudyConfig.md#schema), [`studyMetadata`](../typedoc/interfaces/StudyMetadata.md), [`uiConfig`](../typedoc/interfaces/UIConfig.md), empty [`components`](../typedoc/interfaces/StudyConfig.md#components), and an empty [`sequence`](../typedoc/interfaces/StudyConfig.md#sequence).
206
206
207
207
In `public/tutorial/config.json`, the main work starts here:
208
208
@@ -225,6 +225,8 @@ In `public/tutorial/replication-config.json`, the main work starts here:
225
225
}
226
226
```
227
227
228
+
The replication config adds [`baseComponents`](../typedoc/interfaces/StudyConfig.md#basecomponents) on top of the standard structure — these are reusable templates that other components inherit from.
229
+
228
230
These empty sections are intentional. They make it easier to see exactly what each tutorial step adds.
229
231
230
232
## Step 6: Use the videos as references
@@ -282,6 +284,10 @@ Common mistakes are usually small:
282
284
- A response `id` in `correctAnswer` or `skip` that does not match the response definition.
283
285
- Editing a file in `_answers` instead of the starter file.
284
286
287
+
:::tip
288
+
With the `$schema` line at the top of each Study Config, VS Code (or any IDE that supports JSON Schema) will underline most of these mistakes as you type — missing commas, wrong types, unknown fields, and even mismatched component ids in the sequence. That's faster than catching them via reVISit's error page after refresh.
289
+
:::
290
+
285
291
## Step 8: Move to the first config tutorial
286
292
287
293
Once your local site runs and you understand the file layout, continue to [config.json](./config.json.md).
0 commit comments