bids-validator icon indicating copy to clipboard operation
bids-validator copied to clipboard

SIDECAR_WITHOUT_DATAFILE: should adjust check so it works on annexed files (broken symlinks)

Open yarikoptic opened this issue 1 year ago • 2 comments

ATM we get a number of

        2: [ERR] A json sidecar file was found without a corresponding data file (code: 90 - SIDECAR_WITHOUT_DATAFILE)
                ./sub-0001/ses-01/fmap/sub-0001_ses-01_acq-96dirX6b0Xmb_dir-ap_epi.json
                ./sub-0001/ses-01/func/sub-0001_ses-01_task-alignvideo_acq-mb8_run-01_bold.json
                ./sub-0001/ses-02/fmap/sub-0001_ses-02_acq-mb8_dir-ap_run-01_epi.json
                ./sub-0001/ses-02/func/sub-0001_ses-02_task-alignvideo_acq-mb8_run-01_bold.json
                ./sub-0001/ses-03/fmap/sub-0001_ses-03_acq-mb8_dir-ap_run-01_epi.json
                ./sub-0001/ses-03/func/sub-0001_ses-03_task-alignvideo_acq-mb8_run-01_bold.json
                ./sub-0001/ses-04/fmap/sub-0001_ses-04_acq-mb8_dir-ap_run-01_epi.json
                ./sub-0001/ses-04/func/sub-0001_ses-04_task-alignvideo_acq-mb8_run-01_bold.json
                ./sub-0002/ses-01/fmap/sub-0002_ses-01_acq-96dirX6b0Xmb_dir-ap_epi.json
                ./sub-0002/ses-01/func/sub-0002_ses-01_task-alignvideo_acq-mb8_run-01_bold.json
                ... and 836 more files having this issue (Use --verbose to see them all).

although looking for a sample we do have a broken symlink file:

❯ ls -l ./sub-0001/ses-01/fmap/sub-0001_ses-01_acq-96dirX6b0Xmb_dir-ap_epi.*
-rw------- 1 yoh yoh 29381 Feb 13  2024 ./sub-0001/ses-01/fmap/sub-0001_ses-01_acq-96dirX6b0Xmb_dir-ap_epi.json
lrwxrwxrwx 1 yoh yoh   143 Mar 18  2022 ./sub-0001/ses-01/fmap/sub-0001_ses-01_acq-96dirX6b0Xmb_dir-ap_epi.nii.gz -> ../../../.git/annex/objects/9w/13/MD5E-s2505686--7466a152870ff883702e136b78e2a2eb.nii.gz/MD5E-s2505686--7466a152870ff883702e136b78e2a2eb.nii.gz

IMHO in this test, it should allow for a symlink or to provide a different message.

FWIW according to absent output in

❯ /usr/bin/find sub-* -iname '*_*.json' | while read f; do /bin/ls ${f%.json}.[^j]* > /dev/null || echo $f; done

I likely have no sidecar files without some other non .json file

yarikoptic avatar Sep 06 '24 14:09 yarikoptic