Skip to content

Commit ea02934

Browse files
authored
[FIX] clarify no blank and duplicated headers in TSV (#1116)
* FIX: clarify no blank and duplicated headers in TSV * also add a note to physio/stim * restructure and clarify physio section * fix md
1 parent f254e86 commit ea02934

File tree

2 files changed

+52
-43
lines changed

2 files changed

+52
-43
lines changed

src/02-common-principles.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,12 @@ files where commas are replaced by tabs. Tabs MUST be true tab characters and
477477
MUST NOT be a series of space characters. Each TSV file MUST start with a header
478478
line listing the names of all columns (with the exception of
479479
[physiological and other continuous recordings](04-modality-specific-files/06-physiological-and-other-continuous-recordings.md)).
480-
Names MUST be separated with tabs.
481480
It is RECOMMENDED that the column names in the header of the TSV file are
482481
written in [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) with the
483482
first letter in lower case (for example, `variable_name`, not `Variable_name`).
483+
As for all other data in the TSV files, column names MUST be separated with tabs.
484+
Furthermore, column names MUST NOT be blank (that is, an empty string) and MUST NOT
485+
be duplicated within a single TSV file.
484486
String values containing tabs MUST be escaped using double
485487
quotes. Missing and non-applicable values MUST be coded as `n/a`. Numerical
486488
values MUST employ the dot (`.`) as decimal separator and MAY be specified

src/04-modality-specific-files/06-physiological-and-other-continuous-recordings.md

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Physiological and other continuous recordings
22

3+
Physiological recordings such as cardiac and respiratory signals and other
4+
continuous measures (such as parameters of a film or audio stimuli) MAY be
5+
specified using two files:
6+
7+
1. a [gzip](https://datatracker.ietf.org/doc/html/rfc1952)
8+
compressed TSV file with data (without header line)
9+
10+
1. a JSON file for storing metadata fields (see below)
11+
312
[Example datasets](https://github.com/bids-standard/bids-examples)
413
with physiological data have been formatted using this specification
514
and can be used for practical guidance when curating a new dataset:
@@ -18,8 +27,6 @@ sub-<label>/[ses-<label>/]
1827
<matches>[_recording-<label>]_stim.json
1928
```
2029

21-
Optional: Yes
22-
2330
For the template directory name, `<datatype>` can correspond to any data
2431
recording modality, for example `func`, `anat`, `dwi`, `meg`, `eeg`, `ieeg`,
2532
or `beh`.
@@ -29,8 +36,11 @@ before the suffix.
2936
For example for the file `sub-control01_task-nback_run-1_bold.nii.gz`,
3037
`<matches>` would correspond to `sub-control01_task-nback_run-1`.
3138

32-
The [`recording-<label>`](../99-appendices/09-entities.md#recording) entity can be used to distinguish between several
33-
recording files.
39+
Note that when supplying a `*_<physio|stim>.tsv.gz` file, an accompanying
40+
`*_<physio|stim>.json` MUST be supplied as well.
41+
42+
The [`recording-<label>`](../99-appendices/09-entities.md#recording)
43+
entity MAY be used to distinguish between several recording files.
3444
For example `sub-01_task-bart_recording-eyetracking_physio.tsv.gz` to contain
3545
the eyetracking data in a certain sampling frequency, and
3646
`sub-01_task-bart_recording-breathing_physio.tsv.gz` to contain respiratory
@@ -39,14 +49,7 @@ measurements in a different sampling frequency.
3949
Physiological recordings (including eyetracking) SHOULD use the `_physio`
4050
suffix, and signals related to the stimulus SHOULD use `_stim` suffix.
4151

42-
Physiological recordings such as cardiac and respiratory signals and other
43-
continuous measures (such as parameters of a film or audio stimuli) can be
44-
specified using two files: a [gzip](https://datatracker.ietf.org/doc/html/rfc1952)
45-
compressed TSV file with data (without header line)
46-
and a JSON file for storing the following metadata fields.
47-
48-
Note that when supplying a `*_<physio|stim>.tsv.gz` file, an accompanying
49-
`*_<physio|stim>.json` MUST be supplied as well.
52+
The following table specifies metadata fields for the `*_<physio|stim>.json` file.
5053

5154
<!-- This block generates a metadata table.
5255
The definitions of these fields can be found in
@@ -59,6 +62,10 @@ and a guide for using macros can be found at
5962
"SamplingFrequency": "REQUIRED",
6063
"StartTime": "REQUIRED",
6164
"Columns": "REQUIRED",
65+
"Manufacturer": "RECOMMENDED",
66+
"ManufacturersModelName": "RECOMMENDED",
67+
"SoftwareVersions": "RECOMMENDED",
68+
"DeviceSerialNumber": "RECOMMENDED",
6269
}
6370
) }}
6471

@@ -68,9 +75,12 @@ example, the units of the recorded time series.
6875
Please note that, in contrast to other TSV files in BIDS, the TSV files specified
6976
for physiological and other continuous recordings *do not* include a header
7077
line.
71-
Instead the name of columns are specified in the JSON file.
78+
Instead the name of columns are specified in the JSON file (see `Columns` field).
7279
This is to improve compatibility with existing software (for example, FSL, PNM)
7380
as well as to make support for other file formats possible in the future.
81+
As in any TSV file, column names MUST NOT be blank (that is, an empty string),
82+
and MUST NOT be duplicated within a single JSON file describing a headerless
83+
TSV file.
7484

7585
Example `*_physio.tsv.gz`:
7686

@@ -114,15 +124,32 @@ A guide for using macros can be found at
114124

115125
```JSON
116126
{
117-
"SamplingFrequency": 100.0,
118-
"StartTime": -22.345,
119-
"Columns": ["cardiac", "respiratory", "trigger"],
120-
"cardiac": {
121-
"Units": "mV"
122-
}
127+
"SamplingFrequency": 100.0,
128+
"StartTime": -22.345,
129+
"Columns": ["cardiac", "respiratory"],
130+
"Manufacturer": "Brain Research Equipment ltd.",
131+
"cardiac": {
132+
"Description": "continuous pulse measurement",
133+
"Units": "mV"
134+
},
135+
"respiratory": {
136+
"Description": "continuous measurements by respiration belt",
137+
"Units": "mV"
138+
}
123139
}
124140
```
125141

142+
Note how apart from the general metadata fields like `SamplingFrequency`, `StartTime`, `Columns`,
143+
and `Manufacturer`,
144+
each individual column in the TSV file may be documented as its own field in the JSON file
145+
(identical to the practice in other TSV+JSON file pairs).
146+
Here, only the `Description` and `Units` fields are shown, but you may use any other of the
147+
[defined fields](../02-common-principles.md#tabular-files) such as `TermURL`, `LongName`, and so on.
148+
In this example, the `"cardiac"` and `"respiratory"` time series are produced by devices from
149+
the same manufacturer and follow the same sampling frequency.
150+
To specify different sampling frequencies or manufacturers, the time series would have to be split
151+
into separate files like `*_recording-cardiac_physio.<tsv.gz|json>` and `*_recording-respiratory_physio.<tsv.gz|json>`.
152+
126153
## Recommendations for specific use cases
127154

128155
To store pulse or breathing measurements, or the scanner trigger signal, the
@@ -146,7 +173,9 @@ For any other data to be specified in columns, the column names can be chosen
146173
as deemed appropriate by the researcher.
147174

148175
Recordings with different sampling frequencies or starting times should be
149-
stored in separate files.
176+
stored in separate files
177+
(and the [`recording-<label>`](../99-appendices/09-entities.md#recording)
178+
entity MAY be used to distinguish these files).
150179

151180
If the same continuous recording has been used for all subjects (for example in
152181
the case where they all watched the same movie), one file MAY be used and
@@ -176,25 +205,3 @@ A guide for using macros can be found at
176205
},
177206
}
178207
) }}
179-
180-
### Other RECOMMENDED metadata for physiological data
181-
182-
The following RECOMMENDED metadata can also be added in the side-car JSON files
183-
of any `*_<physio>.tsv.gz` file.
184-
185-
<!-- This block generates a metadata table.
186-
The definitions of these fields can be found in
187-
src/schema/objects/metadata.yaml
188-
and a guide for using macros can be found at
189-
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
190-
-->
191-
{{ MACROS___make_metadata_table(
192-
{
193-
"Manufacturer": "RECOMMENDED",
194-
"ManufacturersModelName": "RECOMMENDED",
195-
"SoftwareVersions": "RECOMMENDED",
196-
"DeviceSerialNumber": "RECOMMENDED",
197-
}
198-
) }}
199-
200-
<!-- Link Definitions -->

0 commit comments

Comments
 (0)