Skip to content

Update schema to NWB 2.10#300

Open
oruebel wants to merge 82 commits into
mainfrom
schema_2_10
Open

Update schema to NWB 2.10#300
oruebel wants to merge 82 commits into
mainfrom
schema_2_10

Conversation

@oruebel

@oruebel oruebel commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fix #298
Fix #306

Update schema version to the latest releases

From #301 : Add event VectorData types

Fix #299

  • Update schematype_to_aqnwb.py to facilitate generation the new types
    • Fixed indent of REGISTER_SUBCLASS call and use the proper core and hdmf-common namespace when used as included schema
    • Updated minimum Python version for resources/utils to ensure use of the latest versions of PyNWB with uv
    • Updated cpp code generation to use new std::weak_ptr via getIO instead of the previous m_io shared pointer
  • Implement the new TimestampVectorData and DurationVectorData types:
    • Implemented nwb/event/TimestampVectorData.hpp/cpp
    • Implemented nwb/event/DurationVectorData.hpp/cpp
    • Added unit tests for TimestampVectorData
    • Added unit tests for DurationVectorData
  • Update and test that DynamicTable properly supports the new column types:
    • Updated DynamicTable.readColumn using type traits to to support reading of both: i) VectorData columns with a specific data type and ii) columns that are a subtype of VectorData (e.g., TimestampVectorData and DurationVectorData)
    • Added override for DyanmicTable.addColumn to allow adding of fully configured VectorData columns and derived column types
    • Added unit test to ensure TimestampVectorData and DurationVectorData can be added viaDynamicTable.addColumn and read back via DynamicTable.readColumn
  • Other changes:
    • Updated the CHANGELOG

From #302 : Add MeaningsTable

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 added this to the 0.4.0 milestone Jul 2, 2026
Copilot AI review requested due to automatic review settings July 2, 2026 05:11
@oruebel oruebel added the category: enhancement proposed enhancements or new features label Jul 2, 2026

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 updates the embedded, auto-generated NWB/HDMF schema specifications used by AqNWB to align with the latest upstream releases referenced in Issue #298.

Changes:

  • Updated the NWB core schema spec to version 2.10.0, including new/updated schema components (e.g., nwb.event and updates under nwb.file, nwb.misc, nwb.image, nwb.behavior).
  • Updated the HDMF common schema spec to version 1.9.0, including adding the resources spec (HERD external resources tables) under hdmf-common.
  • Updated the HDMF experimental schema spec to version 0.6.0, adjusting the namespace contents accordingly.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/spec/core.hpp Bumps core schema to NWB 2.10.0 and incorporates new/updated core spec content (including nwb.event and updated NWBFile structure).
src/spec/hdmf_common.hpp Bumps HDMF common schema to 1.9.0 and adds the resources specification (HERD) to the namespace.
src/spec/hdmf_experimental.hpp Bumps HDMF experimental schema to 0.6.0 and updates namespace schema sources accordingly.

@codecov-commenter

codecov-commenter commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.28125% with 171 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.54%. Comparing base (6571d66) to head (2fa4b96).

Files with missing lines Patch % Lines
src/nwb/hdmf/table/DynamicTable.cpp 70.26% 91 Missing ⚠️
src/nwb/NWBFile.cpp 49.33% 38 Missing ⚠️
src/io/BaseIO.hpp 34.61% 17 Missing ⚠️
src/nwb/event/DurationVectorData.cpp 78.57% 6 Missing ⚠️
src/nwb/event/TimestampVectorData.cpp 77.77% 6 Missing ⚠️
src/nwb/hdmf/table/ElementIdentifiers.hpp 73.33% 4 Missing ⚠️
src/nwb/hdmf/table/VectorData.hpp 73.33% 4 Missing ⚠️
src/nwb/file/ElectrodesTable.cpp 95.12% 2 Missing ⚠️
src/nwb/hdmf/table/MeaningsTable.cpp 93.33% 2 Missing ⚠️
src/nwb/event/EventsTable.cpp 97.22% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #300      +/-   ##
==========================================
- Coverage   84.52%   81.54%   -2.99%     
==========================================
  Files          57       65       +8     
  Lines        2591     3180     +589     
  Branches      332      413      +81     
==========================================
+ Hits         2190     2593     +403     
- Misses        401      587     +186     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@oruebel oruebel mentioned this pull request Jul 13, 2026
13 tasks
@oruebel oruebel mentioned this pull request Jul 23, 2026
18 tasks
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

4 participants