Repository navigation
Set session and subject metadata through the NWB2 options of the Record Node - #2
Merged
Merged
Conversation
…rd Node Add record engine parameters (IDs 1-13; ID 0 remains the identifier) for the session description, experimenter(s), institution, lab, and the subject's ID, species, sex, age, date of birth, genotype, strain, weight and description. GUI development (open-ephys/plugin-GUI#710, 3c513e8) shows them in the Record Node's format options, saves them with the signal chain and exposes them in the HTTP API (engine_NWB2_<id>). Options that are set override the values in nwb_metadata.json; empty options don't. Log a warning if the subject fields that DANDI requires are missing when an NWB file is created. Fixes open-ephys-plugins#7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New NWB2 option 14, "Metadata file (JSON)": the absolute path of the metadata file. If it is empty, nwb_metadata.json is searched next to the recording as before. A missing file or a relative path is logged as an error. - AqNWB only writes date_of_birth as an ISO 8601 date and time with time zone and reports other values on stderr only. The plugin now logs an error in the GUI log and leaves the field out. - Shorter age and date-of-birth labels, which didn't fit the options dialog. - README: the options first, with a screenshot of the dialog, then the metadata file; both are applied when an NWB file is created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 10, 2026
oruebel
marked this pull request as ready for review
November 11, 2026 06:54
oruebel
added a commit
that referenced
this pull request
Nov 20, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR builds on open-ephys-plugins#6 and the batch-writes PR (#1). It addresses open-ephys-plugins#7.
GUI
developmentapplies record engine parameters per Record Node (open-ephys/plugin-GUI#710, 3c513e8). They appear in the options behind the gear button next to the recording-format selector, are saved with the signal chain, and are exposed in the HTTP API asengine_<engine ID>_<parameter ID>.Changes
New NWB2 engine parameters (strings), after the existing Identifier Text (ID 0):
/session_description;/general/experimenter/general/institution/general/lab/general/subject/*Metadata file: option 14 sets the path of the JSON metadata file (NeuroConv structure, as in Write NWB 2.11 files with AqNWB and read NWB files with AqNWB in the NWB File Source open-ephys-plugins/nwb-format#6). If it's empty, the plugin keeps looking for
nwb_metadata.jsonnext to the recording, as before. The file provides fields that have no option (e.g., keywords, protocol, surgery) and works with GUI v1.1.0, which doesn't apply the options.Precedence: options that are set override the values in the metadata file; empty options don't.
Date of birth: AqNWB only writes
date_of_birthwith time and time zone (e.g.,2026-01-15T00:00:00Z) and reports other values on stderr only. The plugin now logs an error with the required format in the GUI log and leaves the field out. The README gives the format too.The plugin logs a warning when an NWB file is created without the subject fields that DANDI requires (subject ID, species, sex, and age or date of birth).
README: the options come first, with a screenshot of the dialog, and their HTTP API names; then the metadata file. The options and the file are applied when an NWB file is created (at the first recording of each experiment). The gui-docs page is updated separately.
Testing
On GUI
development(e6008f0), macOS, with the options set throughPUT /api/processors/101/parameters/engine_NWB2_<id>:;), institution, lab and subject, and the NWB Inspector'scheck_subject_existspasses.nwb_metadata.jsononly, options empty: the JSON values are written, unchanged from before.nwb_metadata.jsonin the recording directory, and the options that are set still override it. A missing file or a relative path logs an error, and no file metadata is written.2026-01-01T00:00:00Zis written.2026-01-01logs the error and is left out (and the subject is reported as incomplete).The Record Node registers all 15 options (
engine_NWB2_0-14inGET /api/processors/101/parameters). The README shows the options dialog; all labels fit (I shortened the age and date-of-birth labels, which were truncated).Question
Should the plugin keep the metadata file now that the GUI has the options? It covers fields without an option and GUI v1.1.0, but it's a convention of this plugin, not of Open Ephys. Longer term, an "advanced" flag or groups for engine parameters (a collapsible section in the options dialog) would allow exposing more fields without cluttering the GUI. That would need a change to the plugin API, so I've only added the file option here.
🤖 Generated with Claude Code