Skip to content

Commit 8d3f9a8

Browse files
committed
Add more details
1 parent 6591e66 commit 8d3f9a8

3 files changed

Lines changed: 113 additions & 57 deletions

File tree

docs/tutorial/config.json.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ Open `public/tutorial/config.json`. The starter file already has the main parts
4848
- [`$schema`](../typedoc/interfaces/StudyConfig.md#schema) points to the Study Config schema.
4949
- [`studyMetadata`](../typedoc/interfaces/StudyMetadata.md) describes the study.
5050
- [`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.
5353

5454
The tutorial is mostly about the last two pieces: add a component, then add that component's id to the sequence.
5555

@@ -543,6 +543,10 @@ This component renders `ReactExample.tsx`. The `parameters` object tells the Rea
543543
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.
544544
:::
545545

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+
546550
Add `reactExampleCars` to the sequence.
547551

548552
![The tutorial study with the reactExampleCars trial](./img/config.json/step10.png)
@@ -897,6 +901,9 @@ import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLink
897901
referenceLinks={[
898902
{name: "Pre Tutorial", url: "../tutorial/"},
899903
{name: "replication-config.json Tutorial", url: "../replication-config.json/"},
900-
{name: "How Does It Work?", url: "../../getting-started/how-does-it-work/"}
904+
{name: "How Does It Work?", url: "../../getting-started/how-does-it-work/"},
905+
{name: "Study Config Reference", url: "../../typedoc/interfaces/StudyConfig/"},
906+
{name: "Forms Reference", url: "../../designing-studies/forms/"},
907+
{name: "Study Sequences", url: "../../designing-studies/sequences/study-sequences/"}
901908
]}
902909
/>

docs/tutorial/replication-config.json.md

Lines changed: 94 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ The completed version is [`public/tutorial/_answers/replication-config.json`](ht
1313
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.
1414
:::
1515

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+
1620
## Starting point
1721

1822
The starter file ends with:
@@ -33,6 +37,10 @@ You will fill these sections in order:
3337
3. Add those components to the sequence.
3438
4. Add the dynamic sequence block.
3539

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+
3644
## Step 1: Add the reusable scatter plot base component
3745

3846
Replace the empty `baseComponents` object with `scatterBase`:
@@ -65,9 +73,17 @@ Replace the empty `baseComponents` object with `scatterBase`:
6573
}
6674
```
6775

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.
6977

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+
:::
7187

7288
## Step 2: Add the first practice trial
7389

@@ -92,28 +108,31 @@ Replace the empty `components` object with the first practice trial:
92108
}
93109
```
94110

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.
96112

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`.
98114

99115
## Step 3: Add the second practice trial
100116

101117
Add a comma after the first practice trial, then add:
102118

103119
```json title="public/tutorial/replication-config.json"
104-
"practice T2 A:0.9 B:0.6": {
105-
"baseComponent": "scatterBase",
106-
"parameters": {
107-
"r1": 0.9,
108-
"r2": 0.6
109-
},
110-
"correctAnswer": [
111-
{
112-
"id": "buttonsResponse",
113-
"answer": "left"
114-
}
115-
],
116-
"provideFeedback": true
120+
"components": {
121+
"practice T1 A:0.3 B:0.7": { ... },
122+
"practice T2 A:0.9 B:0.6": {
123+
"baseComponent": "scatterBase",
124+
"parameters": {
125+
"r1": 0.9,
126+
"r2": 0.6
127+
},
128+
"correctAnswer": [
129+
{
130+
"id": "buttonsResponse",
131+
"answer": "left"
132+
}
133+
],
134+
"provideFeedback": true
135+
}
117136
}
118137
```
119138

@@ -126,19 +145,23 @@ This is the main benefit of `baseComponents`: the shared stimulus and response a
126145
Add the third practice trial after the second:
127146

128147
```json title="public/tutorial/replication-config.json"
129-
"practice T3 A:0.6 B:0.3": {
130-
"baseComponent": "scatterBase",
131-
"parameters": {
132-
"r1": 0.6,
133-
"r2": 0.3
134-
},
135-
"correctAnswer": [
136-
{
137-
"id": "buttonsResponse",
138-
"answer": "left"
139-
}
140-
],
141-
"provideFeedback": true
148+
"components": {
149+
"practice T1 A:0.3 B:0.7": { ... },
150+
"practice T2 A:0.9 B:0.6": { ... },
151+
"practice T3 A:0.6 B:0.3": {
152+
"baseComponent": "scatterBase",
153+
"parameters": {
154+
"r1": 0.6,
155+
"r2": 0.3
156+
},
157+
"correctAnswer": [
158+
{
159+
"id": "buttonsResponse",
160+
"answer": "left"
161+
}
162+
],
163+
"provideFeedback": true
164+
}
142165
}
143166
```
144167

@@ -151,15 +174,24 @@ All three practice trials use `provideFeedback: true` so Participants can learn
151174
Add one more component after the practice trials:
152175

153176
```json title="public/tutorial/replication-config.json"
154-
"trial": {
155-
"baseComponent": "scatterBase"
177+
"components": {
178+
"practice T1 A:0.3 B:0.7": { ... },
179+
"practice T2 A:0.9 B:0.6": { ... },
180+
"practice T3 A:0.6 B:0.3": { ... },
181+
"trial": {
182+
"baseComponent": "scatterBase"
183+
}
156184
}
157185
```
158186

159187
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.
160188

161189
Use this pattern when many trials share the same display and response format, but the exact trial values are generated or selected dynamically.
162190

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+
163195
## Step 6: Add the fixed practice sequence
164196

165197
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
184216

185217
At this point, the Study Config has a complete practice section.
186218

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+
187223
## Step 7: Add the dynamic JND block
188224

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:
190226

191227
```json title="public/tutorial/replication-config.json"
192-
{
193-
"order": "dynamic",
194-
"id": "steppedSequence",
195-
"functionPath": "tutorial/assets/replication/JNDDynamic.tsx",
196-
"parameters": {}
228+
"sequence": {
229+
"order": "fixed",
230+
"components": [
231+
{
232+
"order": "fixed",
233+
"components": [
234+
...,
235+
{
236+
"order": "dynamic",
237+
"id": "steppedSequence",
238+
"functionPath": "tutorial/assets/replication/JNDDynamic.tsx",
239+
"parameters": {}
240+
}
241+
]
242+
}
243+
]
197244
}
198245
```
199246

@@ -225,19 +272,13 @@ The dynamic block calls the function at `tutorial/assets/replication/JNDDynamic.
225272

226273
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.
227274

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+
:::
239278

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+
:::
241282

242283
<!-- Importing links -->
243284
import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLinks.tsx';
@@ -251,6 +292,8 @@ import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLink
251292
referenceLinks={[
252293
{name: "Pre Tutorial", url: "../tutorial/"},
253294
{name: "config.json Tutorial", url: "../config.json/"},
254-
{name: "Dynamic Blocks", url: "../../designing-studies/sequences/dynamic-blocks/"}
295+
{name: "Dynamic Blocks", url: "../../designing-studies/sequences/dynamic-blocks/"},
296+
{name: "Study Config Reference", url: "../../typedoc/interfaces/StudyConfig/"},
297+
{name: "React Components", url: "../../typedoc/interfaces/ReactComponent/"}
255298
]}
256299
/>

docs/tutorial/tutorial.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ By the end of this page, you should know:
1919

2020
## Tutorial Roadmap
2121

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.
2323

2424
The main sections are:
2525

@@ -37,7 +37,7 @@ Use these links during the tutorial:
3737

3838
| Resource | Link |
3939
| --- | --- |
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) |
4141
| reVISit home page | [https://revisit.dev/](https://revisit.dev/) |
4242
| reVISit GitHub organization | [https://github.com/reVISit-studies/](https://github.com/reVISit-studies/) |
4343
| Installation guide | [Installation](../getting-started/installation.md) |
@@ -202,7 +202,7 @@ When you compare your starter file to an answer file, focus on the section you j
202202

203203
## Step 5: Know what starts empty
204204

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).
206206

207207
In `public/tutorial/config.json`, the main work starts here:
208208

@@ -225,6 +225,8 @@ In `public/tutorial/replication-config.json`, the main work starts here:
225225
}
226226
```
227227

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+
228230
These empty sections are intentional. They make it easier to see exactly what each tutorial step adds.
229231

230232
## Step 6: Use the videos as references
@@ -282,6 +284,10 @@ Common mistakes are usually small:
282284
- A response `id` in `correctAnswer` or `skip` that does not match the response definition.
283285
- Editing a file in `_answers` instead of the starter file.
284286

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+
285291
## Step 8: Move to the first config tutorial
286292

287293
Once your local site runs and you understand the file layout, continue to [config.json](./config.json.md).

0 commit comments

Comments
 (0)