Skip to content

Fix zero-padded integer metadata conflicts - #1267

Open
viranovskaya wants to merge 1 commit into
bids-standard:mainfrom
viranovskaya:fix/zero-padded-entity-metadata
Open

Fix zero-padded integer metadata conflicts#1267
viranovskaya wants to merge 1 commit into
bids-standard:mainfrom
viranovskaya:fix/zero-padded-entity-metadata

Conversation

@viranovskaya

Copy link
Copy Markdown

Summary

  • compare duplicate filename and sidecar values using the configured integer entity conversion
  • treat zero-padded filename entities such as run-01 as equivalent to numeric metadata values such as 1
  • preserve conflict detection for booleans, strings, non-integral numbers, and different numeric values

Root cause

Metadata indexing compared the string representation of both values, so the filename value "01" and the JSON number 1 were treated as different even though the run entity is configured as an integer.

Validation

  • python -m pytest src/bids/layout/tests/test_layout.py -q — 109 passed
  • ruff format --check src/bids/layout/index.py src/bids/layout/tests/test_layout.py
  • git diff --check

Fixes #1255

@viranovskaya
viranovskaya marked this pull request as ready for review August 1, 2026 18:06
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.

BIDSLayout crashes with BIDSConflictingValuesError when zero-padded entities in filenames match integer entities in JSON sidecars

1 participant