Skip to content

pop_importbids: read event fields from visible TSV headers - #780

Merged
suraj-ranganath merged 3 commits into
developfrom
suraj/742-bids-event-field-scan
Nov 28, 2026
Merged

suraj-ranganath merged 3 commits into
developfrom
suraj/742-bids-event-field-scan

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Part of #742. Follow-up to #720.

The event-field scan added in #720 split headers on tabs without unquoting, so a quoted "event_code" column was offered with its quotes while the table loader calls it event_code. It also scanned dotfiles and hidden folders, and when a dataset had only timing columns it offered an invented value field with event replacement checked.

This matches EEG-BIDS pop_importbids.m: hidden entries are skipped, header names are parsed the same way the loader parses them, and with no usable field the events box starts unchecked with a disabled n/a menu. EEG-BIDS applies the timing-column filter only on return from subfolders, so a root-level timing column can slip through there; here the filter runs at every level. That difference is documented in the help page and the BIDS guide and covered by a test.

Tests: both new regression cases fail on develop and pass here; tests/test_stream10_export_bids.py (28 passed) and the File menu import selection (3 passed); ruff and pre-commit clean.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 1m 13s —— View job


Code review

  • Overall assessment: Looks good. I checked header unquoting against the table loader, hidden-entry skipping, the case with no event field (dialog spec and _import_dialog), callers of the changed pop_importbids_dialog_spec default, the updated docs and help, and the two new tests.
  • Highest-risk area: the "no event field" path in _import_dialog. I traced it and it is safe. fields is empty, so eventtype is never set. If the user ticks the events box anyway, the loader falls back to its default type column instead of trying to read a column named n/a.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

  • src/eegprep/plugins/EEG_BIDS/pop_importbids.py, _event_columns docstring (lines 368-373): it still says the scan takes "every column of every events.tsv file". Since this PR, the function skips hidden entries, unquotes header names, and returns () instead of ("value",) when nothing is left. Both callers now rely on that empty result to show events off with an n/a menu, so the docstring should say it. Suggested wording: "Header names of visible events.tsv files, unquoted like read_bids_table, sorted, without the timing columns; value is listed first. Empty when no type column exists." (I couldn't leave this as an inline comment because those lines are outside the diff.)

Test gaps

None. The quoted "event_code" header case and the new test_importbids_without_visible_event_fields_disables_type_menu cover the three behavior changes: a hidden folder, a dotfile at the root, and a root file with only timing columns.

EEGLAB parity notes

  • I couldn't compare line by line: pop_importbids.m and bids_geteventfieldsfromfolder.m are not in the vendored src/eegprep/eeglab/ tree. I checked against the PR's description of EEG-BIDS instead.
  • One difference from EEG-BIDS is intentional: EEGPrep filters timing columns at the dataset root as well as in subfolders. It is documented in pop_importbids.md and bids_workflow.rst, and the root events.tsv with only onset/duration in the new test locks it in.
  • csv.reader(..., delimiter="\t") unquotes the same way as the pd.read_csv(sep="\t") call in read_bids_table, which uses the default " quote character. So the menu label now matches the column name the loader looks up.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance. I did not run the tests: running commands needed approval in this session.

@suraj-ranganath
suraj-ranganath merged commit 0d0e4f2 into develop Nov 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant