Skip to content

Add age.reference support - #250

Merged
bendichter merged 2 commits into
devfrom
add_age_reference_support
Jun 30, 2026
Merged

Add age.reference support#250
bendichter merged 2 commits into
devfrom
add_age_reference_support

Conversation

@CodyCBakerPhD

@CodyCBakerPhD CodyCBakerPhD commented Aug 16, 2022

Copy link
Copy Markdown
Contributor

Adds check_subject_age_reference, which validates that Subject.age__reference, when present, is one of the supported values ("birth" or "gestational").

This revives and completes the original 2022 WIP (rebased onto the current restructured dev), finishing both open TODOs:

  • add best practice section (docs/best_practices/nwbfile_metadata.rst, under Subject Age)
  • add tests (tests/unit_tests/test_nwbfile_metadata.py, 5 cases)

Note on scope

The original dependency (pynwb PR #1540) merged long ago, and current PyNWB now enforces age__reference ∈ {birth, gestational} at construction time (raises ValueError), defaulting to "birth". The check therefore serves a defensive role: catching invalid references in files written by other tools (e.g. MatNWB) and read back. Tests simulate that case by overriding the field after construction.

Not added to the DANDI critical config, since the value is schema-enforced and defaulted.

🤖 Generated with Claude Code

@CodyCBakerPhD CodyCBakerPhD self-assigned this Aug 16, 2022
Comment thread nwbinspector/checks/nwbfile_metadata.py Outdated
Comment thread nwbinspector/checks/nwbfile_metadata.py Outdated
Comment thread nwbinspector/checks/nwbfile_metadata.py Outdated
@CodyCBakerPhD CodyCBakerPhD added the category: new check a new best practices check to apply to all NWBFiles and their contents label Oct 4, 2022
Comment thread requirements.txt Outdated
@CodyCBakerPhD CodyCBakerPhD moved this to Uncategorized in My Work History May 20, 2026
bendichter added a commit that referenced this pull request Jun 30, 2026
Port the age.reference support from the 2022 WIP PR #250 onto the current
restructured codebase and complete its open TODOs (best-practice docs + tests).

Adds check_subject_age_reference, which flags Subject.age__reference values
outside {"birth", "gestational"}. PyNWB now enforces this constraint at
construction time, so the check is defensive against files written by other
tools (e.g. MatNWB) and read back.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bendichter
bendichter force-pushed the add_age_reference_support branch from b634cd1 to 377dcf5 Compare June 30, 2026 20:05
@bendichter bendichter changed the title [WIP] add age.reference support Add age.reference support Jun 30, 2026
@bendichter
bendichter marked this pull request as ready for review June 30, 2026 20:07
@bendichter
bendichter requested review from h-mayorquin and rly June 30, 2026 20:07
Port the age.reference support from the 2022 WIP PR #250 onto the current
restructured codebase and complete its open TODOs (best-practice docs + tests).

Adds check_subject_age_reference, which flags Subject.age__reference values
outside {"birth", "gestational"}. PyNWB now enforces this constraint at
construction time, so the check is defensive against files written by other
tools (e.g. MatNWB) and read back.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bendichter
bendichter force-pushed the add_age_reference_support branch from 553a30c to c36ae54 Compare June 30, 2026 20:14
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.93%. Comparing base (13d0d67) to head (77cd8cc).
⚠️ Report is 7 commits behind head on dev.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #250      +/-   ##
==========================================
+ Coverage   79.44%   82.93%   +3.49%     
==========================================
  Files          48       48              
  Lines        1897     1910      +13     
==========================================
+ Hits         1507     1584      +77     
+ Misses        390      326      -64     
Files with missing lines Coverage Δ
src/nwbinspector/checks/__init__.py 100.00% <ø> (ø)
src/nwbinspector/checks/_nwbfile_metadata.py 96.37% <100.00%> (+0.11%) ⬆️

... and 5 files with indirect coverage changes

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

@bendichter
bendichter merged commit 40a7a39 into dev Jun 30, 2026
25 checks passed
@bendichter
bendichter deleted the add_age_reference_support branch June 30, 2026 20:40
@github-project-automation github-project-automation Bot moved this from Uncategorized to Done in My Work History Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: new check a new best practices check to apply to all NWBFiles and their contents

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants