Skip to content

Commit 0848af9

Browse files
authored
Merge pull request #1 from OliverACollins/interoception-blog
Update DataPipe steps
2 parents c9b6143 + b71df99 commit 0848af9

1 file changed

Lines changed: 28 additions & 14 deletions

File tree

  • content/post/2025-07-02-DataPipeOSF

content/post/2025-07-02-DataPipeOSF/index.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,46 +34,60 @@ DataPipe is a tool that allows you to collect and save data in OSF (Open Science
3434
1. **Create an OSF Project**: Start by creating a new project in [OSF](https://osf.io/). This will be the container for your data and any related files. You can set up an account if you don't have one already, quite easily!
3535

3636
- Go to the OSF homepage and log in or create an account. You can easily sign up through institutional access.
37-
- Click on "Create a New Project" and fill in the necessary details such as project title, description, and visibility settings. ***DO NOT SET IT AS PUBLIC*** as the data being saved will not be anonymized and may contain sensitive information.
37+
- Click on "Create New Project" and fill in the necessary details such as project title, description, and visibility settings. Choose "Germany - Frankfurt" as the server location; this is important for data privacy and compliance with regulations such as GDPR.***DO NOT SET YOUR PROJECT AS PUBLIC*** as the data being saved will not be anonymized and may contain sensitive information.
3838

3939
2. **Create OSF Token**: You will need to create a token to grant DataPipe the necessary permissions to access your OSF project.
4040

41-
- Go to your OSF account settings and navigate to the "personal access tokens" section.
42-
- Click on "Create a new token" and give it a name (e.g., "DataPipe Token").
41+
- Go to your OSF "Settings" tab and navigate to the "Personal Access Tokens" section.
42+
- Click on "Create Token" and give it a name (e.g., "DataPipe Token").
4343
- Set the permissions for the token, ensuring it has access to read and write data in your project.
4444
- Copy the generated token; you will need it later.
4545

46-
3. **Link OSF to DataPipe**: In DataPipe, you will need to link your OSF project using the token you created.
46+
3. **Link OSF to DataPipe**: In [DataPipe](https://pipe.jspsych.org/), you will need to link your OSF project using the token you created.
4747

48-
- Open DataPipe, click Account on the top right corner and select settings.
49-
- Click on the 'Set OSF Token' button and paste the token you copied earlier.
48+
- Open DataPipe, click "Account" in the top-right corner and select "Settings".
49+
- Click on the "Set OSF Token" button and paste the token you copied earlier from OSF.
5050

5151
4. **Create new experiment on DataPipe**: Now that your OSF project is linked, you can create a new experiment in DataPipe.
5252

53-
- Click on "Create New Experiment" in DataPipe.
53+
- In the "My Experiments" DataPipe tab, click on the "Create New Experiment" button.
5454
- Give the experiment a name - I recommend using the same name as your OSF project for consistency.
5555
- Add the OSF project ID to the experiment settings. You can find the project ID in the URL of your OSF project (it is the alphanumeric string after osf.io/)
56-
- Create a new OSF Data component called 'data'. This will create a folder - named data - in your OSF project where all the data collected will be saved.
57-
- Choose Germany - Frankfurt as the server location for your DataPipe experiment. This is important for data privacy and compliance with regulations such as GDPR.
56+
- Create a New OSF Data Component called "data". This will create a folder - named "data" - in your OSF project where all the data collected will be saved.
57+
- Again, choose "Germany - Frankfurt" as the server location for your DataPipe experiment.
5858

59-
5. **Configure Data Collection**: Once the experiment is set up on DataPipe enable data collection on the Status section. You can optionally enable base64 data collection if you wish to encode any video, audio or image files as strings. 'Condition assignment' can also be enabled- this makes DataPipe loop through the conditions when it requests the data. When deciding whether these features are suitable, it's best to consider how you will preprocess the data. It's advised that you only enable the minimum needed as a security measure.
59+
5. **Configure Data Collection**: Once the experiment is set up on DataPipe, enable data collection on the "Status" section. You can optionally enable base64 data collection if you wish to encode any video, audio, or image files as strings. "Condition assignment" can also be enabled - this makes DataPipe loop through the conditions when it requests the data. When deciding whether these features are suitable, it's best to consider how you will preprocess the data. It's advised that you only enable the minimum needed as a security measure.
6060

61-
6. **Save the data from the experiment hosted on GitHub**: If you are using a GitHub repository to host your experiment, you can save the data collected by writing the below code to the experiment HTML file. This bit of code should be called at the end of your experiment to ensure that all data is saved to the OSF project
61+
6. **Save the data from the experiment hosted on GitHub**: If you are using a GitHub repository to host your experiment, you can save the data collected by writing the following code within the experiment HTML file. Here is what that code might look like...
6262

63-
- Here is what the code should look like in your experiment HTML file:
63+
- Ensure you load the jsPsych DataPipe plugin, along with the rest of your plugins, within the head of the HTML script:
64+
65+
``` javascript
66+
<script src="https://unpkg.com/@jspsych-contrib/plugin-pipe"></script>
67+
```
68+
69+
- After initializing your jsPsych timeline, to generate a random participant ID for your study, you can code the following:
70+
71+
``` javascript
72+
// Initialize timeline
73+
var timeline = []
74+
participant_ID = jsPsych.randomization.randomID(10)
75+
```
76+
77+
- This next bit of code should be called at the end of your experiment (albeit before running the timeline) to ensure that all data is saved to the OSF project, using the unique participant ID generated from the step above:
6478

6579
``` javascript
6680
// Save data via DataPipe
6781
timeline.push({
6882
type: jsPsychPipe,
6983
action: "save",
7084
experiment_id: "xxxxxxxxxx", // This in generated in the DataPipe interface
71-
filename: `${participantID}.csv`,
85+
filename: `${participant_ID}.csv`,
7286
data_string: () => jsPsych.data.get().csv(),
7387
})
7488
```
7589

76-
- On the experiment created on DataPipe, there is an 'Experiment ID' field. This is the ID you need to add to the `experiment_id` field in the code above.
90+
- On the experiment created in DataPipe, there is an 'Experiment ID' field. This is the ID you need to add to the `experiment_id` field in the code above.
7791

7892
- The `filename` field can be customized to include the participant ID or any other identifier you prefer.
7993

0 commit comments

Comments
 (0)