From 3322a4023f954931b074678f5f78c7779d13a619 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 26 Apr 2024 09:42:32 -0400 Subject: [PATCH] FIX: Re-add run entity to electrodes.tsv (#1722) * FIX: Re-add run entity to electrodes.tsv * [ENH] Recommend electrodes usage/require inheritance * SCHEMA: Add check to warn against excessive electrode specificity --- .../electroencephalography.md | 6 ++++++ .../intracranial-electroencephalography.md | 6 ++++++ src/schema/rules/checks/electrodes.yaml | 15 +++++++++++++++ src/schema/rules/files/raw/channels.yaml | 1 + 4 files changed, 28 insertions(+) create mode 100644 src/schema/rules/checks/electrodes.yaml diff --git a/src/modality-specific-files/electroencephalography.md b/src/modality-specific-files/electroencephalography.md index 6ba02cc13a..8a584bb7a0 100644 --- a/src/modality-specific-files/electroencephalography.md +++ b/src/modality-specific-files/electroencephalography.md @@ -308,6 +308,12 @@ and a guide for using macros can be found at --> {{ MACROS___make_columns_table("eeg.EEGElectrodes") }} +`*_electrodes.tsv` files SHOULD NOT be duplicated for each data file, +for example, during multiple runs of a task. +The [inheritance principle](../common-principles.md#the-inheritance-principle) MUST +be used to find the appropriate electrode positions for a given data file. +If electrodes are repositioned, it is RECOMMENDED to use multiple sessions to indicate this. + ### Example `*_electrodes.tsv` See also the corresponding [`electrodes.tsv` example](#example-channelstsv). diff --git a/src/modality-specific-files/intracranial-electroencephalography.md b/src/modality-specific-files/intracranial-electroencephalography.md index ae6a669a84..096b96f97d 100644 --- a/src/modality-specific-files/intracranial-electroencephalography.md +++ b/src/modality-specific-files/intracranial-electroencephalography.md @@ -349,6 +349,12 @@ and a guide for using macros can be found at --> {{ MACROS___make_columns_table("ieeg.iEEGElectrodes") }} +`*_electrodes.tsv` files SHOULD NOT be duplicated for each data file, +for example, during multiple runs of a task. +The [inheritance principle](../common-principles.md#the-inheritance-principle) MUST +be used to find the appropriate electrode positions for a given data file. +If electrodes are repositioned, it is RECOMMENDED to use multiple sessions to indicate this. + ### Example `*_electrodes.tsv` ```Text diff --git a/src/schema/rules/checks/electrodes.yaml b/src/schema/rules/checks/electrodes.yaml new file mode 100644 index 0000000000..29f81d3d44 --- /dev/null +++ b/src/schema/rules/checks/electrodes.yaml @@ -0,0 +1,15 @@ +--- +ElectrodeSpecificity: + issue: + code: EXCESSIVE_ELECTRODE_SPECIFICITY + message: | + Run or acquisition entities detected in electrodes.tsv. + Electrode definitions should generally not vary within a session. + Consider creating a new session each time electrodes are reconfigured. + level: warning + selectors: + - suffix == 'electrodes' + - extension == '.tsv' + checks: + - '!("run" in entities)' + - '!("acquisition" in entities)' diff --git a/src/schema/rules/files/raw/channels.yaml b/src/schema/rules/files/raw/channels.yaml index 06c213be17..25aa1deff3 100644 --- a/src/schema/rules/files/raw/channels.yaml +++ b/src/schema/rules/files/raw/channels.yaml @@ -70,6 +70,7 @@ electrodes: subject: required session: optional acquisition: optional + run: optional space: optional # MEG has an additional entity available