feat: add validation for duplicate structure acronyms#734
Merged
IgorTatarnikov merged 6 commits intobrainglobe:mainfrom Jan 12, 2026
Merged
feat: add validation for duplicate structure acronyms#734IgorTatarnikov merged 6 commits intobrainglobe:mainfrom
IgorTatarnikov merged 6 commits intobrainglobe:mainfrom
Conversation
Closes brainglobe#666 Added `validate_unique_acronyms` function that checks for duplicate acronyms in atlas structures during validation. Duplicate acronyms are incompatible with brainglobe-atlasapi as acronyms are used as primary keys to fetch region details. Changes: - Add `validate_unique_acronyms` validation function - Register function in `get_all_validation_functions()` - Add test for failure case with duplicate acronyms
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Pull request overview
This PR adds validation to detect duplicate structure acronyms during atlas generation. Duplicate acronyms are problematic because they're used as primary keys to fetch region details in brainglobe-atlasapi.
Key changes:
- Added
validate_unique_acronyms()function that checks for duplicate acronyms in atlas structures - Integrated the validation into the existing validation pipeline
- Added test coverage for the duplicate detection failure case
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
brainglobe_atlasapi/atlas_generation/validate_atlases.py |
Implements the validate_unique_acronyms() function and adds it to validation function lists |
tests/atlasgen/test_validation.py |
Adds test case for duplicate acronym detection failure scenario |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jan 9, 2026
IgorTatarnikov
requested changes
Jan 12, 2026
Member
IgorTatarnikov
left a comment
There was a problem hiding this comment.
This is great, thank you @thisisrick25!
I had a few comments regarding the implementation. We can decrease the time complexity of this code by adjusting the approach slightly.
IgorTatarnikov
approved these changes
Jan 12, 2026
Member
IgorTatarnikov
left a comment
There was a problem hiding this comment.
LGTM 🚀 Thanks @thisisrick25
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.
Description
What is this PR
Why is this PR needed?
Closes #666
Duplicate structure acronyms are incompatible with the current implementation of
brainglobe-atlasapias acronyms are used as primary keys to fetch region details. This validation catches such issues during atlas generation.What does this PR do?
Adds a validate_unique_acronyms function that checks for duplicate acronyms in atlas structures during validation and raises an
AssertionErrorwith a meaningful error message listing the duplicate acronyms.References
How has this PR been tested?
test_validate_unique_acronyms_failtest that mocks atlas structures with duplicate acronyms and verifies the validation fails with the expected error messagetest_valid_atlas_passes_all_validationstest will automatically verify the function passes on valid atlasesIs this a breaking change?
No!
Does this PR require an update to the documentation?
No, this is an internal validation function used during atlas generation.
Checklist: