Add age.reference support - #250
Merged
Merged
Conversation
bendichter
reviewed
Aug 17, 2022
bendichter
reviewed
Aug 17, 2022
CodyCBakerPhD
commented
Aug 26, 2022
bendichter
reviewed
Sep 6, 2023
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
force-pushed
the
add_age_reference_support
branch
from
June 30, 2026 20:05
b634cd1 to
377dcf5
Compare
bendichter
marked this pull request as ready for review
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
force-pushed
the
add_age_reference_support
branch
from
June 30, 2026 20:14
553a30c to
c36ae54
Compare
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
rly
approved these changes
Jun 30, 2026
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.
Adds
check_subject_age_reference, which validates thatSubject.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:docs/best_practices/nwbfile_metadata.rst, under Subject Age)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 (raisesValueError), 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