[Feature]: Validation should check for uniqueness of object IDs in file #1904
Labels
category: enhancement
improvements of code or code behavior
priority: medium
non-critical problem and/or affecting only a small set of NWB users
Milestone
What would you like to see added to PyNWB?
Object IDs are intended to be unique within a file. Spyglass and perhaps other data management systems rely on that. Sometimes object IDs may be the same for two different objects because an object was copied. See NeurodataWithoutBorders/nwb_benchmarks#60 for an example.
I think this should be an error on validation and probably before/on write too. However, we have to be careful because there already exists data with duplicate object IDs in a file.
Is your feature request related to a problem?
No response
What solution would you like?
In PyNWB, if there is a duplicate key in the file, calling
nwbfile.objects
will raise an error like:TypeError: Key 'f5bbf768-f39f-4139-b4dc-08f71abb157d' is already in this dict. Cannot reset items in a LabelledDict.
.We could also write a check based on
nwbfile.all_children
: https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/src/pynwb/file.py#L520-L535Do you have any interest in helping implement the feature?
Yes.
Code of Conduct
The text was updated successfully, but these errors were encountered: