Skip to content

Commit

Permalink
Merge pull request #1016 from effigies/fix/null_metadata
Browse files Browse the repository at this point in the history
FIX: Drop JSON sidecar fields with null values during metadata indexing
  • Loading branch information
effigies authored Aug 16, 2023
2 parents 3dac64f + c732750 commit 1633f97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions bids/layout/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ def create_association_pair(src, dst, kind, kind2=None):

# Create Tag <-> Entity mappings, and any newly discovered Entities
for md_key, md_val in file_md.items():
# Treat null entries (deserialized to None) as absent
# Alternative is to cast None to null in layout.models._create_tag_dict
if md_val is None:
continue
tag_string = '{}_{}'.format(bf.path, md_key)
# Skip pairs that were already found in the filenames
if tag_string in all_tags:
Expand Down
3 changes: 2 additions & 1 deletion bids/tests/data/ds005/task-mixedgamblestask_bold.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"RepetitionTime": 2.0,
"TaskName": "mixed-gambles task",
"SliceTiming": [0.0, 0.0571, 0.1143, 0.1714, 0.2286, 0.2857]
"SliceTiming": [0.0, 0.0571, 0.1143, 0.1714, 0.2286, 0.2857],
"NullTestMetadata": null
}

0 comments on commit 1633f97

Please sign in to comment.