Skip to content

Drop bids_filters entries with no matching query - #1058

Merged
effigies merged 1 commit into
nipreps:masterfrom
asaraog:fix/collect-data-unmatched-filters
Sep 8, 2026
Merged

effigies merged 1 commit into
nipreps:masterfrom
asaraog:fix/collect-data-unmatched-filters

Conversation

@asaraog

@asaraog asaraog commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Closes #862.

collect_data merges filters with queries[acq].update(entities) and never checks that acq is a key, so a filter naming a suffix absent from a caller-supplied queries raises instead of being ignored:

collect_data(root, '01', bids_validate=False,
             queries={'t1w': {'datatype': 'anat', 'suffix': 'T1w'}},
             bids_filters={'pet': {'session': '15'}})
# KeyError: 'pet'

Two-line guard skips those filters. Test added using generate_bids_skeleton; it fails without the fix with the same KeyError. pytest niworkflows/utils: 73 passed, 5 skipped.

collect_data merged every filter with queries[acq].update(entities), so a
filter naming a suffix absent from a caller-supplied queries dict raised
KeyError instead of being ignored.

Closes nipreps#862

@effigies effigies left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Thanks!

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.14%. Comparing base (bde002c) to head (a958e82).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1058      +/-   ##
==========================================
+ Coverage   67.12%   67.14%   +0.02%     
==========================================
  Files          54       54              
  Lines        6853     6855       +2     
  Branches      852      853       +1     
==========================================
+ Hits         4600     4603       +3     
  Misses       2038     2038              
+ Partials      215      214       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@effigies
effigies merged commit 09d0d2b into nipreps:master Sep 8, 2026
15 checks passed
@effigies effigies added the backport candidate Change that may be backported to a maintenance branch label Sep 28, 2026
effigies pushed a commit that referenced this pull request Sep 28, 2026
collect_data merged every filter with queries[acq].update(entities), so a
filter naming a suffix absent from a caller-supplied queries dict raised
KeyError instead of being ignored.

Closes #862
effigies pushed a commit that referenced this pull request Oct 2, 2026
collect_data merged every filter with queries[acq].update(entities), so a
filter naming a suffix absent from a caller-supplied queries dict raised
KeyError instead of being ignored.

Closes #862
effigies added a commit that referenced this pull request Oct 2, 2026
1.14.5 (October 02, 2026)

Patch release in the 1.14.x series.

* FIX: Collect data interactions with sessions and bids filters (#1063)
* FIX: Write NIfTI data in the byte order the header declares (#1061)
* FIX: Drop bids_filters entries with no matching query (#1058)
* FIX: Disable colorbar after default switch (#1057)
* FIX: Use rigid affine initialization for BOLD mask (#1064)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport candidate Change that may be backported to a maintenance branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

niworkflows.utils.bids.collect_data should drop unnecessary filters

2 participants