Skip to content

[GUI] Edit participant values beside their BIDS column descriptions - #1052

Open
arnodelorme wants to merge 4 commits into
agent/issue-875-file-eventinfofrom
agent/issue-875-file-participantinfo
Open

arnodelorme wants to merge 4 commits into
agent/issue-875-file-eventinfofrom
agent/issue-875-file-participantinfo

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Participant values and metadata now appear side by side. The public editor preserves custom columns and their descriptions, groups repeated subjects across recordings, and can import columns from a TSV or CSV matched by participant ID. Stacked on #1050 (agent/issue-875-file-eventinfo).

EEGLAB, EEGPrep before, EEGPrep after

Native geometry and same-input distances

Measurements and verification

Native client dimensions on jamming were 1300.0 × 600.0 px in MATLAB, 278 × 442 before and 913 × 492 after. The Qt table went from 278 × 442 to 913 × 492 pixels. MATLAB uses a fixed 1300 × 600 window. Three actual participant-table submissions retained the same participant ID and ages 21, 22 and 23 in both applications. A regression also verifies that two recordings for one subject reopen as one row and keep their custom metadata. The File/BIDS suites passed 115 tests with 5 deselected. The Qt capture used the guarded checkout on PYTHONPATH.

Closes #1053. Part of #875.

Full inventory report for the project team. pop_participantinfo (p. 14). PDF · Editable Word.

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

🤖 Review before taking this out of draft.

State. The updated parent (#1050) is merged in (823af5dfc). On the Mac 286 tests pass and jamming passes 307 geometry tests.

What I checked. One row per participant (datasets of the same subject share a row), columns can be added, removed and imported from a TSV or CSV file, and the column descriptions keep Levels and Units. The import refuses a table without participant_id or with no matching subject, with a message.

Findings, none blocking.

  1. The form is built by hand in bids_tools.py (about 130 lines of Qt code) and not through a dialog specification. It is the same choice as for the event table, so it is consistent, but none of it goes through the layout tests.
  2. Like [GUI] Edit BIDS event field mappings in the public metadata table #1050, the new columns and their Levels can change what the export writes, so one exported participants.tsv and participants.json compared with EEGLAB's would be good evidence.

Verdict: ready for review.

@arnodelorme
arnodelorme marked this pull request as ready for review December 2, 2026 05:50

@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 Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @arnodelorme's task in 1m 42s —— View job


Code review

  • Overall assessment: The participant editor works and I found nothing blocking. I checked one row per subject, writing the edited row back to every recording of that subject, adding and removing columns, TSV/CSV import, handling of Levels and column_info, the menu caller (menu_actions._bids_tool_action), and how the export reads participant_columns (pop_exportbids._write_participants_json). There is one important but small error-handling issue and one test gap.
  • Highest-risk area: the gui=True branch. Since L136 changed, single-dataset gui=True calls also open the new hand-built Qt table.
  • Merge recommendation: Needs changes (small).

Blocking

None.

Important

  • bids_tools._participant_table (L795): the PySide6 import skips the install hint. The new local from PySide6.QtWidgets import ... runs before _qt_widgets("pop_participantinfo"). Without Qt, users get a bare ModuleNotFoundError instead of the "pip install eegprep[gui]" message. Since L136 changed, any pop_participantinfo(EEG, gui=True) call now reaches this code, including from the console with no study. Fix: call _qt_widgets(...) first (inline suggestion posted).

Nits

  • L842–L844: columns.verticalHeader().hide() is undone by .show() two lines later. Remove the hide() call (inline suggestion posted).

Test gaps

  • TSV/CSV import is untested. import_columns is the riskiest new logic: it picks the delimiter from the extension, rejects a file without participant_id or with no matching subject, and adds columns. The new test only covers grouping. Suggested test: monkeypatch QFileDialog.getOpenFileName (a filesystem boundary, so allowed by AGENTS.md) to return a tmp_path TSV with participant_id\tHandedness\nsub-01\tleft. Then click "Import column(s)" and accept. Assert that etc.bids.participant["Handedness"] == "left" on every recording of sub-01. Add a second case with a CSV that has no participant_id column, and assert that nothing changes.

EEGLAB parity notes

  • The vendored src/eegprep/eeglab/ checkout is not present in this CI workspace, so I could not compare against pop_participantinfo.m line by line. Like [GUI] Edit BIDS event field mappings in the public metadata table #1050, new columns and Levels change what participants.json contains. The PR body already proposes comparing one exported participants.tsv and participants.json with EEGLAB's output, and that is still the right evidence to get before merging.
  • The dialog shows an empty Units cell for Age and HeadCircumference. The export still writes the defaults years and cm from _write_participants_json, because blank cells are not saved. The output is correct, but the editor does not show the Units that will be exported. Consider adding Units to the dialog defaults so what users see matches the export.

Comment on lines +795 to +797
from PySide6.QtWidgets import QFileDialog, QGridLayout, QHBoxLayout, QInputDialog, QLabel, QMessageBox, QPushButton

QDialog, QDialogButtonBox, _, Item, QVBoxLayout = _qt_widgets("pop_participantinfo")

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.

Important (error handling). This unguarded PySide6 import runs before _qt_widgets("pop_participantinfo"), so the guard never runs. Without Qt, pop_participantinfo(EEG, gui=True) raises a bare ModuleNotFoundError: No module named 'PySide6' instead of the "Install it with pip install eegprep[gui]" message from _qt_widgets (

def _qt_widgets(function: str) -> tuple[Any, Any, Any, Any, Any]:
try:
from PySide6.QtWidgets import QDialog, QDialogButtonBox, QTableWidget, QTableWidgetItem, QVBoxLayout
except ImportError as exc:
raise ImportError(
f"{function}: the table dialog needs PySide6. "
"Install it with `pip install eegprep[gui]`, then open the dialog again."
) from exc
return QDialog, QDialogButtonBox, QTableWidget, QTableWidgetItem, QVBoxLayout
). Because of this PR's change at L136, single-dataset gui=True calls now come here too, so more users can hit this.

Fix: call _qt_widgets first so its error fires before this import.

Suggested change
from PySide6.QtWidgets import QFileDialog, QGridLayout, QHBoxLayout, QInputDialog, QLabel, QMessageBox, QPushButton
QDialog, QDialogButtonBox, _, Item, QVBoxLayout = _qt_widgets("pop_participantinfo")
QDialog, QDialogButtonBox, _, Item, QVBoxLayout = _qt_widgets("pop_participantinfo")
from PySide6.QtWidgets import QFileDialog, QGridLayout, QHBoxLayout, QInputDialog, QLabel, QMessageBox, QPushButton

Comment on lines +842 to +844
columns.verticalHeader().hide()
columns.setColumnHidden(0, True)
columns.verticalHeader().show()

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.

Nit. Line 842 hides columns.verticalHeader() and line 844 shows it again, so the hide() call does nothing and can be removed.

Suggested change
columns.verticalHeader().hide()
columns.setColumnHidden(0, True)
columns.verticalHeader().show()
columns.setColumnHidden(0, True)

This branch has not been deployed

No deployments
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