Skip to content

Update NwbFile.m : Generate uuid if no identifier is given for file#839

Open
ehennestad wants to merge 3 commits into
mainfrom
set-identifier-using-uuid-if-not-provided
Open

Update NwbFile.m : Generate uuid if no identifier is given for file#839
ehennestad wants to merge 3 commits into
mainfrom
set-identifier-using-uuid-if-not-provided

Conversation

@ehennestad

@ehennestad ehennestad commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Motivation

nwbinspector docs states that MatNWB will add a uuid to the NWBFiles identifier property.

This was actually not happening, but this PR fixes that. When creating an NWB file using NwbFile, if no identifier is given on construction, a uuid is assigned.

How to test the behavior?

Creating an NwbFile object without an identifier:

>> nwb = NwbFile();
>> nwb.identifier

ans =

    '67028a4f-f303-4785-9330-63d31f894ce5'

Creating an NwbFile object with a custom identifier:

>> nwb = NwbFile('identifier', 'some_id');
>> nwb.identifier

ans =

    'some_id'

Checklist

  • Have you ensured the PR description clearly describes the problem and solutions?
  • Have you checked to ensure that there aren't other open or previously closed Pull Requests for the same change?
  • If this PR fixes an issue, is the first line of the PR description fix #XX where XX is the issue number?

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

Fixes NwbFile construction so that an identifier is automatically assigned when omitted, aligning MatNWB behavior with the NWBInspector “best practice” guidance for NWBFile.identifier.

Changes:

  • Adds automatic UUID assignment to identifier during NwbFile construction.
  • Passes the generated identifier through to the underlying types.core.NWBFile constructor via name/value pairs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread NwbFile.m
Comment thread NwbFile.m
Co-authored-by: ehennestad <17237719+ehennestad@users.noreply.github.com>
@ehennestad ehennestad changed the title Update NwbFile.m Update NwbFile.m : Generate uuid if no identifier is given for file Jun 26, 2026
@ehennestad ehennestad enabled auto-merge June 26, 2026 21:20
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.31%. Comparing base (6f4e97a) to head (52e9edb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #839   +/-   ##
=======================================
  Coverage   95.31%   95.31%           
=======================================
  Files         219      219           
  Lines        7647     7648    +1     
=======================================
+ Hits         7289     7290    +1     
  Misses        358      358           

☔ 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.

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.

3 participants