Skip to content

Add meanings table - #302

Merged
oruebel merged 56 commits into
add_event_vectordatafrom
add_meanings_table
Jul 23, 2026
Merged

Add meanings table#302
oruebel merged 56 commits into
add_event_vectordatafrom
add_meanings_table

Conversation

@oruebel

@oruebel oruebel commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fix #284

Implement new MeaningsTable type:

  • Implement the new src/nwb/hdmf/table/MeaningsTable.* source for MeaningsTable
  • Implement comprehensive unit tests for MeaningsTable

Update DynamicTable to support adding MeaningsTables:

  • Added "DEFINE_UNNAMED_REGISTERED_FIELD(" to create readMeaningsTable for reading MeaningsTables associated with a DynamicTable. This also creates createMeaningsTableInstance methods for creatin a new MeaningsTables that is not yet initialized.
  • Added DynamicTable.createMeaningsTable methods for creating a fully initialized MeaningsTable that is associated with a particular column of the DynamicTable
  • Add unit tests to test the new DynamicTable.createMeaningsTable and DynamicTable.readMeaningsTable methods.
    - [ ] Update the docs/tutorials as necessary to describe the use of MeaningsTable alongside DynamicTable This will be part of follow-up once the full stack for EventsTable has been added

Other Changes

  • Updated ElectrodesTable.initialize to add a new optional parameter rowChunkSize. Similar to the MeaningsTable the existing ElectrodesTable also creates pre-defined columns in initialize. Currently the chunking was set in ElectrodesTable to 1, which is too small. Adding rowChunkSize increases the default to 100 and allows the caller to set the chunk size.
  • Updated the CHANGELOG

From #304 : Add EventsTable type

Fix #285

Add support for EventsTable

  • Added new EventTable type
  • Added unit tests for the new EventTable type
  • Updated NWBFile to create events/ group and added NWBFile::createEventsTable convenience function

Enhance DynamicTable to improve support for use during acquisition

  • Refactored DynamicTable so it creates and initializes its ElementIdentifiers id column internally during initialize(). This is to ensure the ElementIdentifiers are always create before we start the recording. Calling DynamicTable::setRowIDs() previously required creation of ElementIdentifiers but may be called later during recording. As part of this change, setRowIDs() now takes only the row ID values and writes them directly to the table's built-in id column instead of accepting a separate ElementIdentifiers object. In practice this aligns the API with the intended usage, since callers should have always used the table's own id dataset. (@oruebel, #302)
  • Updated DynamicTable column-name management to be immediate and table-driven. addColumnName() now flushes new column names to the file as columns are added, setColNames() is now restricted to reordering the existing set of columns (it no longer acts as a general overwrite mechanism), and finalize() no longer writes the colnames attribute because column-name updates are persisted when they occur. This ensures that the colnames attribute is always consistent with the actual columns in the table and helps avoid creation of invalid files. (@oruebel, #304)

Other

  • Fix bugs in TimestampVectorData and DurationVectorData; e.g, bad namespace and inconsistent ordering of parameters in initialize
  • Update Changelog

From #305 : Row-based Recordings

Fix #303

Problem: The current implementation of DynamicTable is mainly designed for the purpose of metadata tables, e.g., ElectrodeTable, where we can usually fill in the whole table before the actual acquisition. With the new EventTable, however, we need enhanced support for acquiring the data in the table as part of the acquisition workflow.

Goal: Update DynamicTable and EventTable to simplify row-based recording and configuration of the table

Changes:

  • Support configuration of the columns of a DynamicTable directly via initialize, rather than just incremental viaaddColumn
    • Added Data::DataSpecBase and Data::DataSpec<T> to support runtime configuration of DynamicTable column layouts and to decouple table schema definition from object initialization. Each Data subclass (e.g., VectorData, ElementIdentifiers, TimestampVectorData, DurationVectorData) now exposes a nested DataSpec struct that bundles the dataset configuration, description, and any type-specific parameters needed to create and initialize the column.
    • Added DynamicTable::createDefaultDataSpecs static factory to return the default ordered list of DataSpec objects for a table (currently just the id column). Subclasses (ElectrodesTable, EventsTable, MeaningsTable) override this to append their own required columns, allowing callers to retrieve, inspect, and customize the default column configuration before passing it to initialize().
    • Updated DynamicTable::initialize, ElectrodesTable::initialize, EventsTable::initialize, and MeaningsTable::initialize to accept a std::vector<DataSpecPtr> column-spec list instead of individual rowChunkSize / resolution / flag parameters.
    • Added DynamicTable::addColumn(DataSpecPtr) overload consistent with the new DataSpec-based API used by initialize() and createDefaultDataSpecs().
    • Added DyanmicTable::validateDataSpecs (and DynamicTable::checkRequiredColumnNames helper function) to validate column specifications as part of DyanmicTable::initialize before initialization. Also updated subclassed of DynamicTable (e.g., ElectrodesTable, EventsTable, MeaningsTable) to override validateDataSpecs to provide their specific validation logic.
  • Support row-based write of DynamicTable across all columns of the table
    • Added DynamicTable::addRow and DynamicTable::addRows methods to support row-based data insertion into a DynamicTable. Rows are specified as DynamicTable::RowData (an unordered_map from column name to CellValue variant), enabling type-safe, column-keyed writes without requiring callers to manage per-column buffers directly. Row IDs are auto-generated if not provided.
    • Added BaseDataType::BaseDataVariant scalar variant type and BaseDataType::createEmptyVectorVariant helper to support runtime-typed single-cell and buffer operations needed by addRow/addRows. (@cline, @oruebel, #305)
  • Update Documentation
    • Added tutorial to demonstrate acquisition workflow for DynamicTable. The tutorial uses EventsTable as an example and shows: 1) row-based appending of data and 2)column-based write and addition of full columns to a table, and 3) adding of a MeaningsTable to a columns
    • Updated the CHANGELOG
  • Created Follow-up issues

@oruebel oruebel linked an issue Jul 2, 2026 that may be closed by this pull request
8 tasks
@oruebel oruebel added the category: enhancement proposed enhancements or new features label Jul 2, 2026
@oruebel oruebel added this to the 0.4.0 milestone Jul 2, 2026
@oruebel
oruebel marked this pull request as ready for review July 2, 2026 14:40
Copilot AI review requested due to automatic review settings July 2, 2026 14:40

Copilot AI 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.

Pull request overview

This PR adds first-class support for the new HDMF Common MeaningsTable type and wires it into DynamicTable, while also improving ElectrodesTable dataset chunking by making row chunk size configurable (defaulting to 100) to avoid inefficient chunking of 1.

Changes:

  • Added src/nwb/hdmf/table/MeaningsTable.* implementing the new MeaningsTable registered type and initialization logic.
  • Extended DynamicTable with support for creating/reading MeaningsTable instances (including a convenience createMeaningsTable API) and added unit tests.
  • Updated ElectrodesTable.initialize / NWBFile::createElectrodesTable and related tests to use and verify a configurable row chunk size.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/testRecordingWorkflow.cpp Updates electrodes table creation to pass a row chunk size and asserts expected HDF5 chunking.
tests/testRecordingObjects.cpp Updates electrodes table creation to pass a row chunk size and asserts expected HDF5 chunking.
tests/testNWBFile.cpp Updates electrodes table creation to pass a row chunk size and asserts expected HDF5 chunking.
tests/testMeaningsTable.cpp Adds new unit tests covering MeaningsTable initialization, chunking, linking, and data read/write.
tests/testDynamicTable.cpp Adds tests for DynamicTable::createMeaningsTable and DynamicTable::readMeaningsTable.
tests/CMakeLists.txt Adds the new testMeaningsTable.cpp to the test target.
src/nwb/NWBFile.hpp Extends createElectrodesTable API with optional rowChunkSize parameter.
src/nwb/NWBFile.cpp Passes rowChunkSize through to ElectrodesTable::initialize.
src/nwb/hdmf/table/MeaningsTable.hpp Introduces the MeaningsTable type and its registered fields (value/meaning/target).
src/nwb/hdmf/table/MeaningsTable.cpp Implements MeaningsTable::initialize (datasets + target link).
src/nwb/hdmf/table/DynamicTable.hpp Adds API/macro support for MeaningsTable plus a convenience creation method.
src/nwb/hdmf/table/DynamicTable.cpp Implements DynamicTable::createMeaningsTable (group creation + initialization).
src/nwb/file/ElectrodesTable.hpp Extends ElectrodesTable::initialize with optional rowChunkSize.
src/nwb/file/ElectrodesTable.cpp Applies rowChunkSize to dataset chunking during initialization.
CMakeLists.txt Adds MeaningsTable.cpp to the library build.

Comment thread src/nwb/hdmf/table/DynamicTable.hpp
Comment thread src/nwb/hdmf/table/DynamicTable.hpp Outdated
Comment thread src/nwb/hdmf/table/MeaningsTable.cpp Outdated
Comment thread src/nwb/hdmf/table/MeaningsTable.cpp Outdated
oruebel and others added 7 commits July 2, 2026 07:54
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Comment thread tests/CMakeLists.txt
Comment thread src/nwb/file/ElectrodesTable.hpp
Comment thread src/nwb/file/ElectrodesTable.cpp Outdated
Comment thread src/nwb/hdmf/table/MeaningsTable.cpp
oruebel and others added 5 commits July 2, 2026 08:33
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@oruebel
oruebel requested a review from rly July 2, 2026 21:29
@oruebel oruebel self-assigned this Jul 2, 2026
oruebel and others added 24 commits July 5, 2026 00:02
…cquisition

Updated DynamicTable configuration to support row-based recording
@oruebel
oruebel merged commit 68f809e into add_event_vectordata Jul 23, 2026
11 of 12 checks passed
@oruebel
oruebel deleted the add_meanings_table branch July 23, 2026 18:27
This was referenced Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: enhancement proposed enhancements or new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for new MeaningsTable type in hdfm-common

3 participants