From 12aa1902a6a42324b9a37fdb23d04e9e4f1f52b5 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 20 Mar 2024 18:09:33 -0400 Subject: [PATCH 1/3] mention that events.tsv should be sorted by onset --- src/modality-specific-files/task-events.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modality-specific-files/task-events.md b/src/modality-specific-files/task-events.md index 0fb6ec2a52..9b0ffa69f3 100644 --- a/src/modality-specific-files/task-events.md +++ b/src/modality-specific-files/task-events.md @@ -42,6 +42,8 @@ and a guide for using macros can be found at --> {{ MACROS___make_columns_table("task.TaskEvents") }} +The content of `events.tsv` files SHOULD be sorted by values in the `onset` column. + Note for MRI data: If any acquired scans have been discarded before forming the imaging data file, ensure that an `onset` of 0 corresponds to the time the first image was stored. From 1cb8a7eba7aa37dec5423acc5a509ce8f97141e1 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 21 Mar 2024 15:50:42 -0400 Subject: [PATCH 2/3] ENH: Add schema rule for warning on unsorted onset column --- src/schema/rules/checks/events.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/schema/rules/checks/events.yaml b/src/schema/rules/checks/events.yaml index cd8fd414bd..7fee64530f 100644 --- a/src/schema/rules/checks/events.yaml +++ b/src/schema/rules/checks/events.yaml @@ -27,3 +27,15 @@ StimulusFileMissing: - columns.stim_file != null checks: - exists(columns.stim_file, "stimuli") == length(columns.stim_file) - count(columns.stim_file, "n/a") + +SortedOnsets: + issue: + code: EVENT_ONSET_ORDER + message: | + The onset column in events.tsv files should be sorted. + level: warning + selectors: + - suffix == "events" + - extension == ".tsv" + checks: + - sorted(columns.onset) == columns.onset From 2825e702f283e877f76162d08612a73b29bdc5fa Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 25 Mar 2024 11:37:52 -0400 Subject: [PATCH 3/3] Update src/schema/rules/checks/events.yaml --- src/schema/rules/checks/events.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/schema/rules/checks/events.yaml b/src/schema/rules/checks/events.yaml index 7fee64530f..1d6c52584c 100644 --- a/src/schema/rules/checks/events.yaml +++ b/src/schema/rules/checks/events.yaml @@ -38,4 +38,5 @@ SortedOnsets: - suffix == "events" - extension == ".tsv" checks: + # n/a values will likely cause false alarms if encountered. Consider alternatives. - sorted(columns.onset) == columns.onset