1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
|
%global _empty_manifest_terminate_build 0
Name: python-bids-validator
Version: 1.10.0
Release: 1
Summary: Validator for the Brain Imaging Data Structure
License: MIT
URL: https://github.com/bids-standard/bids-validator
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/83/1a/49b54987bf00d2f4e1fcdb21e29de6c1f9bac6e6d796a4e1291476a92528/bids-validator-1.10.0.tar.gz
BuildArch: noarch
%description
[](https://github.com/bids-standard/bids-validator/actions/workflows/node_tests.yml)
[](https://github.com/bids-standard/bids-validator/actions/workflows/python_tests.yml)
[](https://github.com/bids-standard/bids-validator/actions/workflows/test-bids-examples.yml)
[](https://circleci.com/gh/bids-standard/bids-validator)
[](https://codecov.io/gh/bids-standard/bids-validator)
[](https://doi.org/10.5281/zenodo.3688707)
# BIDS-Validator
- [BIDS-Validator](#bids-validator)
- [Quickstart](#quickstart)
- [Support](#support)
- [Maintainers and Contributors](#maintainers-and-contributors)
- [Use](#use)
- [API](#api)
- [.bidsignore](#bidsignore)
- [Configuration](#configuration)
- [In the Browser](#in-the-browser)
- [On the Server](#on-the-server)
- [Through Command Line](#through-command-line)
- [Docker image](#docker-image)
- [Python Library](#python-library)
- [Example](#example)
- [Development](#development)
- [Running Locally in a Browser](#running-locally-in-a-browser)
- [Testing](#testing)
- [Publishing](#publishing)
- [Acknowledgments](#acknowledgments)
## Quickstart
1. Web version:
1. Open [Google Chrome](https://www.google.com/chrome/) or
[Mozilla Firefox](https://mozilla.org/firefox) (currently the only
supported browsers)
1. Go to https://bids-standard.github.io/bids-validator/ and select a folder
with your BIDS dataset. If the validator seems to be working longer than
couple of minutes please open [developer tools ](https://developer.chrome.com/devtools)
and report the error at [https://github.com/bids-standard/bids-validator/issues](https://github.com/bids-standard/bids-validator/issues).
1. Command line version:
1. Install [Node.js](https://nodejs.org) (at least version 12.12.0)
1. Update `npm` to be at least version 7 (`npm install --global npm@^7`)
1. From a terminal run `npm install -g bids-validator`
1. Run `bids-validator` to start validating datasets.
1. Docker
1. Install Docker
1. From a terminal run `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data`
but replace the `/path/to/data` part of the command with your own path on your machine.
1. Python Library:
1. Install [Python](https://www.python.org/)
1. Install [Pip](https://pip.pypa.io/en/stable/installing/) package manager for Python, if
not already installed.
1. From a terminal run `pip install bids_validator` to acquire the
[BIDS Validator PyPI package](https://pypi.org/project/bids-validator/)
or `conda install bids-validator` for the
[Conda package](https://anaconda.org/conda-forge/bids-validator).
1. Open a Python terminal and type: `python`
1. Import the BIDS Validator package `from bids_validator import BIDSValidator`
1. Check if a file is BIDS compatible `BIDSValidator().is_bids('path/to/a/bids/file')`
## Support
The BIDS Validator is designed to work in both the browser and in Node.js. We
target support for the latest long term stable (LTS) release of Node.js and the
latest version of Chrome.
There is also a library of helper functions written in Python, for use with BIDS
compliant applications written in this language.
Please report any issues you experience while using these support targets via
the [GitHub issue tracker](https://github.com/bids-standard/bids-validator/issues).
If you experience issues outside of these supported environments and believe we
should extend our targeted support feel free to open a new issue describing the
issue, your support target and why you require extended support and we will
address these issues on a case by case basis.
## Maintainers and Contributors
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
Contributions of any kind are welcome!
The project is maintained by [@rwblair](https://github.com/rwblair/) with the help of many contributors listed below.
(The [emoji key](https://allcontributors.org/docs/en/emoji-key) is indicating the kind of contribution)
Please also see [Acknowledgments](#acknowledgments).
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://adam2392.github.io/"><img src="https://avatars.githubusercontent.com/u/3460267?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Adam Li</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=adam2392" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=adam2392" title="Tests">β οΈ</a> <a href="#userTesting-adam2392" title="User Testing">π</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Aadam2392" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/agt24"><img src="https://avatars.githubusercontent.com/u/7869017?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Adam Thomas</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=agt24" title="Documentation">π</a></td>
<td align="center"><a href="http://happy5214.freedynamicdns.org/"><img src="https://avatars.githubusercontent.com/u/2992751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Alexander Jones</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=happy5214" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=happy5214" title="Tests">β οΈ</a> <a href="#ideas-happy5214" title="Ideas, Planning, & Feedback">π€</a></td>
<td align="center"><a href="https://github.com/musicinmybrain"><img src="https://avatars.githubusercontent.com/u/6898909?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Ben Beasley</b></sub></a><br /><a href="#platform-musicinmybrain" title="Packaging/porting to new platform">π¦</a></td>
<td align="center"><a href="http://chrisgorgolewski.org"><img src="https://avatars.githubusercontent.com/u/238759?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Gorgolewski</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Achrisgorgo" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Code">π»</a> <a href="#data-chrisgorgo" title="Data">π£</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Documentation">π</a> <a href="#example-chrisgorgo" title="Examples">π‘</a> <a href="#ideas-chrisgorgo" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-chrisgorgo" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-chrisgorgo" title="Maintenance">π§</a> <a href="#mentoring-chrisgorgo" title="Mentoring">π§βπ«</a> <a href="#question-chrisgorgo" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Achrisgorgo" title="Reviewed Pull Requests">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Tests">β οΈ</a> <a href="#tutorial-chrisgorgo" title="Tutorials">β
</a> <a href="#talk-chrisgorgo" title="Talks">π’</a> <a href="#userTesting-chrisgorgo" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/choldgraf"><img src="https://avatars.githubusercontent.com/u/1839645?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Holdgraf</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=choldgraf" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/effigies"><img src="https://avatars.githubusercontent.com/u/83442?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Markiewicz</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=effigies" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=effigies" title="Tests">β οΈ</a> <a href="#ideas-effigies" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Aeffigies" title="Bug reports">π</a> <a href="#question-effigies" title="Answering Questions">π¬</a> <a href="#tool-effigies" title="Tools">π§</a> <a href="#maintenance-effigies" title="Maintenance">π§</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/david-nishi"><img src="https://avatars.githubusercontent.com/u/28666458?v=4?s=50" width="50px;" alt=""/><br /><sub><b>David Nishikawa</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=david-nishi" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=david-nishi" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/DimitriPapadopoulos"><img src="https://avatars.githubusercontent.com/u/3234522?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Dimitri Papadopoulos Orfanos</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=DimitriPapadopoulos" title="Code">π»</a></td>
<td align="center"><a href="https://duncanmmacleod.github.io/"><img src="https://avatars.githubusercontent.com/u/1618530?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Duncan Macleod</b></sub></a><br /><a href="#infra-duncanmmacleod" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
<td align="center"><a href="https://github.com/franklin-feingold"><img src="https://avatars.githubusercontent.com/u/35307458?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Franklin Feingold</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=franklin-feingold" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/thinknoack"><img src="https://avatars.githubusercontent.com/u/3342083?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Gregory noack</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=thinknoack" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=thinknoack" title="Tests">β οΈ</a></td>
<td align="center"><a href="http://chymera.eu/"><img src="https://avatars.githubusercontent.com/u/950524?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Horea Christian</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=TheChymera" title="Code">π»</a></td>
<td align="center"><a href="https://kaczmarj.github.io/"><img src="https://avatars.githubusercontent.com/u/17690870?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Jakub Kaczmarzyk</b></sub></a><br /><a href="#infra-kaczmarj" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/jokedurnez"><img src="https://avatars.githubusercontent.com/u/7630327?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Joke Durnez</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=jokedurnez" title="Code">π»</a></td>
<td align="center"><a href="http://jasmainak.github.io/"><img src="https://avatars.githubusercontent.com/u/15852194?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Mainak Jas</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=jasmainak" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=jasmainak" title="Tests">β οΈ</a> <a href="#ideas-jasmainak" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Ajasmainak" title="Reviewed Pull Requests">π</a> <a href="#userTesting-jasmainak" title="User Testing">π</a></td>
<td align="center"><a href="http://fair.dei.unipd.it/marco-castellaro"><img src="https://avatars.githubusercontent.com/u/5088923?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Marco Castellaro</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=marcocastellaro" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=marcocastellaro" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/MaxvandenBoom"><img src="https://avatars.githubusercontent.com/u/43676624?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Max</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=MaxvandenBoom" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3AMaxvandenBoom" title="Bug reports">π</a></td>
<td align="center"><a href="http://psychoinformatics.de/"><img src="https://avatars.githubusercontent.com/u/136479?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Michael Hanke</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=mih" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/naveau"><img src="https://avatars.githubusercontent.com/u/1488318?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Mikael Naveau</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=naveau" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/nellh"><img src="https://avatars.githubusercontent.com/u/11369795?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Nell Hardcastle</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=nellh" title="Code">π»</a> <a href="#ideas-nellh" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-nellh" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#question-nellh" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Anellh" title="Reviewed Pull Requests">π</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/ntraut"><img src="https://avatars.githubusercontent.com/u/22977927?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Nicolas Traut</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=ntraut" title="Code">π»</a></td>
<td align="center"><a href="https://www.linkedin.com/in/parul-sethi"><img src="https://avatars.githubusercontent.com/u/11822050?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Parul Sethi</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=parulsethi" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=parulsethi" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/patsycle"><img src="https://avatars.githubusercontent.com/u/41481345?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Patricia Clement</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=patsycle" title="Code">π»</a></td>
<td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars.githubusercontent.com/u/6961185?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=Remi-Gau" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=Remi-Gau" title="Documentation">π</a> <a href="#userTesting-Remi-Gau" title="User Testing">π</a></td>
<td align="center"><a href="https://hoechenberger.net/"><img src="https://avatars.githubusercontent.com/u/2046265?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Richard HΓΆchenberger</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=hoechenberger" title="Code">π»</a> <a href="#userTesting-hoechenberger" title="User Testing">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=hoechenberger" title="Tests">β οΈ</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Ahoechenberger" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/robertoostenveld"><img src="https://avatars.githubusercontent.com/u/899043?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Robert Oostenveld</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=robertoostenveld" title="Code">π»</a> <a href="#ideas-robertoostenveld" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Arobertoostenveld" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=robertoostenveld" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/SetCodesToFire"><img src="https://avatars.githubusercontent.com/u/25459509?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Rohan Goyal</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=SetCodesToFire" title="Code">π»</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/rwblair"><img src="https://avatars2.githubusercontent.com/u/14927911?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Ross Blair</b></sub></a><br /><a href="#maintenance-rwblair" title="Maintenance">π§</a> <a href="#ideas-rwblair" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=rwblair" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Arwblair" title="Bug reports">π</a> <a href="#infra-rwblair" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-rwblair" title="Project Management">π</a> <a href="#question-rwblair" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Arwblair" title="Reviewed Pull Requests">π</a> <a href="#tool-rwblair" title="Tools">π§</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=rwblair" title="Tests">β οΈ</a></td>
<td align="center"><a href="http://www.poldracklab.org/"><img src="https://avatars.githubusercontent.com/u/871056?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Russ Poldrack</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=poldrack" title="Code">π»</a> <a href="#financial-poldrack" title="Financial">π΅</a> <a href="#fundingFinding-poldrack" title="Funding Finding">π</a></td>
<td align="center"><a href="http://soichi.us/"><img src="https://avatars.githubusercontent.com/u/923896?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Soichi Hayashi</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Asoichih" title="Bug reports">π</a></td>
<td align="center"><a href="https://www.stefanappelhoff.com"><img src="https://avatars.githubusercontent.com/u/9084751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Stefan Appelhoff</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Asappelhoff" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Code">π»</a> <a href="#data-sappelhoff" title="Data">π£</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Documentation">π</a> <a href="#example-sappelhoff" title="Examples">π‘</a> <a href="#ideas-sappelhoff" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-sappelhoff" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-sappelhoff" title="Maintenance">π§</a> <a href="#mentoring-sappelhoff" title="Mentoring">π§βπ«</a> <a href="#question-sappelhoff" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Asappelhoff" title="Reviewed Pull Requests">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Tests">β οΈ</a> <a href="#tutorial-sappelhoff" title="Tutorials">β
</a> <a href="#talk-sappelhoff" title="Talks">π’</a> <a href="#userTesting-sappelhoff" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/suyashdb"><img src="https://avatars.githubusercontent.com/u/11152799?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Suyash </b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=suyashdb" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/tsalo"><img src="https://avatars.githubusercontent.com/u/8228902?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Taylor Salo</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=tsalo" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/olgn"><img src="https://avatars.githubusercontent.com/u/8853289?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Teal Hobson-Lowther</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=olgn" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=olgn" title="Tests">β οΈ</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/riddlet"><img src="https://avatars.githubusercontent.com/u/4789331?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Travis Riddle</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Ariddlet" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/VisLab"><img src="https://avatars.githubusercontent.com/u/1189050?v=4?s=50" width="50px;" alt=""/><br /><sub><b>VisLab</b></sub></a><br /><a href="#ideas-VisLab" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=VisLab" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/wazeerzulfikar"><img src="https://avatars.githubusercontent.com/u/15856554?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Wazeer Zulfikar</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=wazeerzulfikar" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/yarikoptic"><img src="https://avatars.githubusercontent.com/u/39889?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Yaroslav Halchenko</b></sub></a><br /><a href="#ideas-yarikoptic" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=yarikoptic" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=yarikoptic" title="Documentation">π</a> <a href="#userTesting-yarikoptic" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/constellates"><img src="https://avatars.githubusercontent.com/u/4325905?v=4?s=50" width="50px;" alt=""/><br /><sub><b>constellates</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=constellates" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=constellates" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/dewarrn1"><img src="https://avatars.githubusercontent.com/u/1322751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>dewarrn1</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=dewarrn1" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/dkp"><img src="https://avatars.githubusercontent.com/u/965184?v=4?s=50" width="50px;" alt=""/><br /><sub><b>dkp</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=dkp" title="Code">π»</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/MatthewZito"><img src="https://avatars.githubusercontent.com/u/47864657?v=4?s=50" width="50px;" alt=""/><br /><sub><b>goldmund</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=MatthewZito" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=MatthewZito" title="Tests">β οΈ</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
## Use
### API
The BIDS Validator has one primary method that takes a directory as either a
path to the directory (node) or the object given by selecting a directory with a
file input (browser), an options object, and a callback.
Available options include:
- ignoreWarnings - (boolean - defaults to false)
- ignoreNiftiHeaders - (boolean - defaults to false)
For example:
`validate.BIDS(directory, {ignoreWarnings: true}, function (issues, summary) {console.log(issues.errors, issues.warnings);});`
If you would like to test individual files you can use the file specific checks
that we expose.
- validate.BIDS()
- validate.JSON()
- validate.TSV()
- validate.NIFTI()
Additionally you can reformat stored errors against a new config using `validate.reformat()`
### .bidsignore
Optionally one can include a `.bidsignore` file in the root of the dataset. This
file lists patterns (compatible with the [.gitignore syntax](https://git-scm.com/docs/gitignore))
defining files that should be ignored by the validator. This option is useful
when the validated dataset includes file types not yet supported by BIDS
specification.
```Text
*_not_bids.txt
extra_data/
```
### Configuration
You can configure the severity of errors by passing a json configuration file
with a `-c` or `--config` flag to the command line interface or by defining a
config object on the options object passed during javascript usage.
If no path is specified a default path of `.bids-validator-config.json` will be used. You can add this file to your dataset to share dataset specific validation configuration. To disable this behavior use `--no-config` and the default configuration will be used.
The basic configuration format is outlined below. All configuration is optional.
```JSON
{
"ignore": [],
"warn": [],
"error": [],
"ignoredFiles": []
}
```
`ignoredFiles` takes a list of file paths or glob patterns you'd like to ignore.
Lets say we want to ignore all files and sub-directory under `/derivatives/`.
**This is not the same syntax as used in the .bidsignore file**
```JSON
{
"ignoredFiles": ["/derivatives/**"]
}
```
Note that adding two stars `**` in path makes validator recognize all files and
sub-dir to be ignored.
`ignore`, `warn`, and `error` take lists of issue codes or issue keys and change
the severity of those issues so they are either ignored or reported as warnings
or errors. You can find a list of all available issues at
[utils/issues/list](https://github.com/bids-standard/bids-validator/blob/master/bids-validator/utils/issues/list.js).
Some issues may be ignored by default, but can be elevated to warnings or errors.
These provide a way to check for common things that are more specific than BIDS
compatibility. An example is a check for the presence of a T1w modality. The
following would raise an error if no T1W image was found in a dataset.
```JSON
{
"error": ["NO_T1W"]
}
```
In addition to issue codes and keys these lists can also contain objects with
and "and" or "or" properties set to arrays of codes or keys. These allow some
level of conditional logic when configuring issues. For example:
```JSON
{
"ignore": [
{
"and": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
]
}
```
In the above example the two issues will only be ignored if both of them are
triggered during validation.
```JSON
{
"ignore": [
{
"and": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
{
"or": [
"ECHO_TIME1-2_NOT_DEFINED",
"ECHO_TIME_MUST_DEFINE"
]
}
]
}
]
}
```
And in this example the listed issues will only be ignored if
`ECHO_TIME_GREATER_THAN`, `ECHO_TIME_NOT_DEFINED` and either
`ECHO_TIME1-2_NOT_DEFINED` or `ECHO_TIME_MUST_DEFINE` are triggered during
validation.
"or" arrays are not supported at the lowest level because it wouldn't add any
functionality. For example the following is not supported.
```JSON
{
"ignore": [
{
"or": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
]
}
```
because it would be functionally the same as this:
```JSON
{
"ignore": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
```
For passing a configuration while using the bids-validator on the command line,
you can use the following style to for example ignore empty
file errors (99) and files that cannot be read (44):
```
bids-validator --config.ignore=99 --config.ignore=44 path/to/bids/dir
```
This style of use puts limits on what configuration you can require, so for
complex scenarios, we advise users to create a dedicated configuration file with
contents as described above.
### In the Browser
The BIDS Validator currently works in the browser with [browserify](https://browserify.org/)
or [webpack](https://webpack.js.org/). You can add it to a project by cloning
the validator and requiring it with browserify syntax
`const validate = require('bids-validator');` or an ES2015 webpack import
`import validate from 'bids-validator'`.
### On the Server
The BIDS validator works like most npm packages. You can install it by running
`npm install bids-validator`.
### Through Command Line
If you install the bids validator globally by using `npm install -g bids-validator`
you will be able to use it as a command line tool. Once installed you should be
able to run `bids-validator /path/to/your/bids/directory` and see any validation
issues logged to the terminal. Run `bids-validator` without a directory path to
see available options.
## Docker image
[](https://hub.docker.com/r/bids/validator)
To use bids validator with [docker](https://www.docker.com/), you simply need to
[install docker](https://docs.docker.com/install/) on your system.
And then from a terminal run:
- `docker run -ti --rm bids/validator --version` to print the version of the
docker image
- `docker run -ti --rm bids/validator --help` to print the help
- `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data`
to validate the dataset `/path/to/data` on your host machine
See here for a brief explanation of the commands:
- `docker run` is the command to tell docker to run a certain docker image,
usually taking the form `docker run <IMAGENAME> <COMMAND>`
- the `-ti` flag means the inputs are accepted and outputs are printed to the
terminal
- the `--rm` flag means that the state of the docker container is not saved
after it has run
- the `-v` flag is adding your local data to the docker container
([bind-mounts](https://docs.docker.com/storage/bind-mounts/)). Importantly,
the input after the `-v` flag consists of three fields separated colons: `:`
- the first field is the path to the directory on the host machine:
`/path/to/data`
- the second field is the path where the directory is mounted in the
container
- the third field is optional. In our case, we use `ro` to specify that the
mounted data is _read only_
## Python Library
[](https://badge.fury.io/py/bids-validator)
[](https://anaconda.org/conda-forge/bids-validator)
There are is a limited library of helper functions written in Python. The main function
determines if a file extension is compliant with the BIDS specification. You can find
the available functions in the library, as well as their descriptions,
[here](https://github.com/bids-standard/bids-validator/blob/master/bids-validator/bids_validator/bids_validator.py).
To install, run `pip install -U bids_validator` (requires python and pip) or
`conda install bids-validator` (requires a Conda environment).
### Example
```Python
from bids_validator import BIDSValidator
validator = BIDSValidator()
filepaths = ["/sub-01/anat/sub-01_rec-CSD_T1w.nii.gz", "/sub-01/anat/sub-01_acq-23_rec-CSD_T1w.exe"]
for filepath in filepaths:
print(validator.is_bids(filepath)) # will print True, and then False
```
## Development
To develop locally, clone the project and run `npm install` from the project
root. This will install external dependencies. If you wish to install
`bids-validator` globally (so that you can run it in other folders), use the
following command to install it globally: `cd bids-validator && npm install -g` (for windows users, if in a different drive add /d, e.g. `cd /d F:\bids-validator && npm install -g`)
Please see the [CONTRIBUTING.md](../CONTRIBUTING.md)
for additional details.
### Bundling
bids-validator is bundled with esbuild. While developing, the script `bids-validator/bin/bids-validator` will automatically bundle the project each time it is run. To test a build without publishing it `npm -w bids-validator run build`. This will generate a bids-validator/dist directory containing the local build and `bids-validator/bin/bids-validator` will use this build. To return to automatic bundling on each run, remove the dist directory.
### Running Locally in a Browser
A note about OS X, the dependencies for the browser require a npm package called
node-gyp which needs xcode to be installed in order to be compiled.
1. The browser version of `bids-validator` lives in the repo subdirectory
`/bids-validator-web`. It is a [React.js](https://reactjs.org/) application
that uses the [next.js](https://nextjs.org/) framework.
2. To develop `bids-validator` and see how it will act in the browser, simply run
`npm run web-dev` in the project root and navigate to `localhost:3000`.
3. In development mode, changes to the codebase will trigger rebuilds of the application
automatically.
4. Changes to the `/bids-validator` in the codebase will also be reflected in the
web application.
5. Tests use the [Jest](https://jestjs.io/index.html) testing library and should be developed in `/bids-validator-web/tests`.
We can always use more tests, so please feel free to contribute a test that reduces the chance
of any bugs you fix!
6. To ensure that the web application compiles successfully in production, run `npm run web-export`
### Testing
If it's your first time running tests, first use the command `git submodule update --init --depth 1` to pull the test example data. This repo contains the [bids-examples github repository](https://github.com/bids-standard/bids-examples) as a [submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
To start the test suite run `npm run test` from the project root. `npm run test -- --watch`
is useful to run tests while making changes. A coverage report is available with
`npm run coverage`.
To run the linter which checks code conventions run `npm run lint`.
### Install globally from a development branch
Global installs are not recommended for development because of the possibility of package conflicts with other Node.js projects. If you do need to test with a global install from a development tree, follow these steps to generate the NPM package without publishing it and install the package locally.
1. `npm -w bids-validator run build`
2. `npm -w bids-validator pack`
3. `npm install -g bids-validator-*.tgz`
### Publishing
Publishing is done with [Lerna](https://github.com/lerna/lerna). Use the command `npx lerna publish` and follow instructions to set a new version.
Using lerna publish will create a git commit with updated version information and create a version number tag for it, push the tag to GitHub, then publish to NPM and PyPI. The GitHub release is manual following that.
## Acknowledgments
Many contributions to the `bids-validator` were done by members of the
BIDS community. See the
[list of contributors](https://bids-specification.readthedocs.io/en/stable/99-appendices/01-contributors.html).
A large part of the development of `bids-validator` is currently done by
[Squishymedia](https://squishymedia.com/), who are in turn financed through
different grants offered for the general development of BIDS. See the list
below.
Development and contributions were supported through the following federally
funded projects/grants:
- [BIDS Derivatives (NIMH: R24MH114705, PI: Poldrack)](https://grantome.com/grant/NIH/R24-MH114705-01)
- [OpenNeuro (NIMH: R24MH117179, PI: Poldrack)](https://grantome.com/grant/NIH/R24-MH117179-01)
- [Spokes: MEDIUM: WEST (NSF: 1760950, PI: Poldrack & Gorgolewski)](https://grantome.com/grant/NSF/IIS-1760950)
- [ReproNim](http://repronim.org) [(NIH-NIBIB P41 EB019936, PI: Kennedy)](https://projectreporter.nih.gov/project_info_description.cfm?aid=8999833)
%package -n python3-bids-validator
Summary: Validator for the Brain Imaging Data Structure
Provides: python-bids-validator
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-bids-validator
[](https://github.com/bids-standard/bids-validator/actions/workflows/node_tests.yml)
[](https://github.com/bids-standard/bids-validator/actions/workflows/python_tests.yml)
[](https://github.com/bids-standard/bids-validator/actions/workflows/test-bids-examples.yml)
[](https://circleci.com/gh/bids-standard/bids-validator)
[](https://codecov.io/gh/bids-standard/bids-validator)
[](https://doi.org/10.5281/zenodo.3688707)
# BIDS-Validator
- [BIDS-Validator](#bids-validator)
- [Quickstart](#quickstart)
- [Support](#support)
- [Maintainers and Contributors](#maintainers-and-contributors)
- [Use](#use)
- [API](#api)
- [.bidsignore](#bidsignore)
- [Configuration](#configuration)
- [In the Browser](#in-the-browser)
- [On the Server](#on-the-server)
- [Through Command Line](#through-command-line)
- [Docker image](#docker-image)
- [Python Library](#python-library)
- [Example](#example)
- [Development](#development)
- [Running Locally in a Browser](#running-locally-in-a-browser)
- [Testing](#testing)
- [Publishing](#publishing)
- [Acknowledgments](#acknowledgments)
## Quickstart
1. Web version:
1. Open [Google Chrome](https://www.google.com/chrome/) or
[Mozilla Firefox](https://mozilla.org/firefox) (currently the only
supported browsers)
1. Go to https://bids-standard.github.io/bids-validator/ and select a folder
with your BIDS dataset. If the validator seems to be working longer than
couple of minutes please open [developer tools ](https://developer.chrome.com/devtools)
and report the error at [https://github.com/bids-standard/bids-validator/issues](https://github.com/bids-standard/bids-validator/issues).
1. Command line version:
1. Install [Node.js](https://nodejs.org) (at least version 12.12.0)
1. Update `npm` to be at least version 7 (`npm install --global npm@^7`)
1. From a terminal run `npm install -g bids-validator`
1. Run `bids-validator` to start validating datasets.
1. Docker
1. Install Docker
1. From a terminal run `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data`
but replace the `/path/to/data` part of the command with your own path on your machine.
1. Python Library:
1. Install [Python](https://www.python.org/)
1. Install [Pip](https://pip.pypa.io/en/stable/installing/) package manager for Python, if
not already installed.
1. From a terminal run `pip install bids_validator` to acquire the
[BIDS Validator PyPI package](https://pypi.org/project/bids-validator/)
or `conda install bids-validator` for the
[Conda package](https://anaconda.org/conda-forge/bids-validator).
1. Open a Python terminal and type: `python`
1. Import the BIDS Validator package `from bids_validator import BIDSValidator`
1. Check if a file is BIDS compatible `BIDSValidator().is_bids('path/to/a/bids/file')`
## Support
The BIDS Validator is designed to work in both the browser and in Node.js. We
target support for the latest long term stable (LTS) release of Node.js and the
latest version of Chrome.
There is also a library of helper functions written in Python, for use with BIDS
compliant applications written in this language.
Please report any issues you experience while using these support targets via
the [GitHub issue tracker](https://github.com/bids-standard/bids-validator/issues).
If you experience issues outside of these supported environments and believe we
should extend our targeted support feel free to open a new issue describing the
issue, your support target and why you require extended support and we will
address these issues on a case by case basis.
## Maintainers and Contributors
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
Contributions of any kind are welcome!
The project is maintained by [@rwblair](https://github.com/rwblair/) with the help of many contributors listed below.
(The [emoji key](https://allcontributors.org/docs/en/emoji-key) is indicating the kind of contribution)
Please also see [Acknowledgments](#acknowledgments).
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://adam2392.github.io/"><img src="https://avatars.githubusercontent.com/u/3460267?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Adam Li</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=adam2392" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=adam2392" title="Tests">β οΈ</a> <a href="#userTesting-adam2392" title="User Testing">π</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Aadam2392" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/agt24"><img src="https://avatars.githubusercontent.com/u/7869017?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Adam Thomas</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=agt24" title="Documentation">π</a></td>
<td align="center"><a href="http://happy5214.freedynamicdns.org/"><img src="https://avatars.githubusercontent.com/u/2992751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Alexander Jones</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=happy5214" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=happy5214" title="Tests">β οΈ</a> <a href="#ideas-happy5214" title="Ideas, Planning, & Feedback">π€</a></td>
<td align="center"><a href="https://github.com/musicinmybrain"><img src="https://avatars.githubusercontent.com/u/6898909?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Ben Beasley</b></sub></a><br /><a href="#platform-musicinmybrain" title="Packaging/porting to new platform">π¦</a></td>
<td align="center"><a href="http://chrisgorgolewski.org"><img src="https://avatars.githubusercontent.com/u/238759?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Gorgolewski</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Achrisgorgo" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Code">π»</a> <a href="#data-chrisgorgo" title="Data">π£</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Documentation">π</a> <a href="#example-chrisgorgo" title="Examples">π‘</a> <a href="#ideas-chrisgorgo" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-chrisgorgo" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-chrisgorgo" title="Maintenance">π§</a> <a href="#mentoring-chrisgorgo" title="Mentoring">π§βπ«</a> <a href="#question-chrisgorgo" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Achrisgorgo" title="Reviewed Pull Requests">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Tests">β οΈ</a> <a href="#tutorial-chrisgorgo" title="Tutorials">β
</a> <a href="#talk-chrisgorgo" title="Talks">π’</a> <a href="#userTesting-chrisgorgo" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/choldgraf"><img src="https://avatars.githubusercontent.com/u/1839645?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Holdgraf</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=choldgraf" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/effigies"><img src="https://avatars.githubusercontent.com/u/83442?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Markiewicz</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=effigies" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=effigies" title="Tests">β οΈ</a> <a href="#ideas-effigies" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Aeffigies" title="Bug reports">π</a> <a href="#question-effigies" title="Answering Questions">π¬</a> <a href="#tool-effigies" title="Tools">π§</a> <a href="#maintenance-effigies" title="Maintenance">π§</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/david-nishi"><img src="https://avatars.githubusercontent.com/u/28666458?v=4?s=50" width="50px;" alt=""/><br /><sub><b>David Nishikawa</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=david-nishi" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=david-nishi" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/DimitriPapadopoulos"><img src="https://avatars.githubusercontent.com/u/3234522?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Dimitri Papadopoulos Orfanos</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=DimitriPapadopoulos" title="Code">π»</a></td>
<td align="center"><a href="https://duncanmmacleod.github.io/"><img src="https://avatars.githubusercontent.com/u/1618530?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Duncan Macleod</b></sub></a><br /><a href="#infra-duncanmmacleod" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
<td align="center"><a href="https://github.com/franklin-feingold"><img src="https://avatars.githubusercontent.com/u/35307458?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Franklin Feingold</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=franklin-feingold" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/thinknoack"><img src="https://avatars.githubusercontent.com/u/3342083?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Gregory noack</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=thinknoack" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=thinknoack" title="Tests">β οΈ</a></td>
<td align="center"><a href="http://chymera.eu/"><img src="https://avatars.githubusercontent.com/u/950524?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Horea Christian</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=TheChymera" title="Code">π»</a></td>
<td align="center"><a href="https://kaczmarj.github.io/"><img src="https://avatars.githubusercontent.com/u/17690870?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Jakub Kaczmarzyk</b></sub></a><br /><a href="#infra-kaczmarj" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/jokedurnez"><img src="https://avatars.githubusercontent.com/u/7630327?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Joke Durnez</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=jokedurnez" title="Code">π»</a></td>
<td align="center"><a href="http://jasmainak.github.io/"><img src="https://avatars.githubusercontent.com/u/15852194?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Mainak Jas</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=jasmainak" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=jasmainak" title="Tests">β οΈ</a> <a href="#ideas-jasmainak" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Ajasmainak" title="Reviewed Pull Requests">π</a> <a href="#userTesting-jasmainak" title="User Testing">π</a></td>
<td align="center"><a href="http://fair.dei.unipd.it/marco-castellaro"><img src="https://avatars.githubusercontent.com/u/5088923?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Marco Castellaro</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=marcocastellaro" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=marcocastellaro" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/MaxvandenBoom"><img src="https://avatars.githubusercontent.com/u/43676624?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Max</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=MaxvandenBoom" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3AMaxvandenBoom" title="Bug reports">π</a></td>
<td align="center"><a href="http://psychoinformatics.de/"><img src="https://avatars.githubusercontent.com/u/136479?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Michael Hanke</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=mih" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/naveau"><img src="https://avatars.githubusercontent.com/u/1488318?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Mikael Naveau</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=naveau" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/nellh"><img src="https://avatars.githubusercontent.com/u/11369795?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Nell Hardcastle</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=nellh" title="Code">π»</a> <a href="#ideas-nellh" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-nellh" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#question-nellh" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Anellh" title="Reviewed Pull Requests">π</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/ntraut"><img src="https://avatars.githubusercontent.com/u/22977927?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Nicolas Traut</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=ntraut" title="Code">π»</a></td>
<td align="center"><a href="https://www.linkedin.com/in/parul-sethi"><img src="https://avatars.githubusercontent.com/u/11822050?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Parul Sethi</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=parulsethi" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=parulsethi" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/patsycle"><img src="https://avatars.githubusercontent.com/u/41481345?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Patricia Clement</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=patsycle" title="Code">π»</a></td>
<td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars.githubusercontent.com/u/6961185?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=Remi-Gau" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=Remi-Gau" title="Documentation">π</a> <a href="#userTesting-Remi-Gau" title="User Testing">π</a></td>
<td align="center"><a href="https://hoechenberger.net/"><img src="https://avatars.githubusercontent.com/u/2046265?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Richard HΓΆchenberger</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=hoechenberger" title="Code">π»</a> <a href="#userTesting-hoechenberger" title="User Testing">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=hoechenberger" title="Tests">β οΈ</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Ahoechenberger" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/robertoostenveld"><img src="https://avatars.githubusercontent.com/u/899043?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Robert Oostenveld</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=robertoostenveld" title="Code">π»</a> <a href="#ideas-robertoostenveld" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Arobertoostenveld" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=robertoostenveld" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/SetCodesToFire"><img src="https://avatars.githubusercontent.com/u/25459509?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Rohan Goyal</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=SetCodesToFire" title="Code">π»</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/rwblair"><img src="https://avatars2.githubusercontent.com/u/14927911?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Ross Blair</b></sub></a><br /><a href="#maintenance-rwblair" title="Maintenance">π§</a> <a href="#ideas-rwblair" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=rwblair" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Arwblair" title="Bug reports">π</a> <a href="#infra-rwblair" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-rwblair" title="Project Management">π</a> <a href="#question-rwblair" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Arwblair" title="Reviewed Pull Requests">π</a> <a href="#tool-rwblair" title="Tools">π§</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=rwblair" title="Tests">β οΈ</a></td>
<td align="center"><a href="http://www.poldracklab.org/"><img src="https://avatars.githubusercontent.com/u/871056?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Russ Poldrack</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=poldrack" title="Code">π»</a> <a href="#financial-poldrack" title="Financial">π΅</a> <a href="#fundingFinding-poldrack" title="Funding Finding">π</a></td>
<td align="center"><a href="http://soichi.us/"><img src="https://avatars.githubusercontent.com/u/923896?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Soichi Hayashi</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Asoichih" title="Bug reports">π</a></td>
<td align="center"><a href="https://www.stefanappelhoff.com"><img src="https://avatars.githubusercontent.com/u/9084751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Stefan Appelhoff</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Asappelhoff" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Code">π»</a> <a href="#data-sappelhoff" title="Data">π£</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Documentation">π</a> <a href="#example-sappelhoff" title="Examples">π‘</a> <a href="#ideas-sappelhoff" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-sappelhoff" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-sappelhoff" title="Maintenance">π§</a> <a href="#mentoring-sappelhoff" title="Mentoring">π§βπ«</a> <a href="#question-sappelhoff" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Asappelhoff" title="Reviewed Pull Requests">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Tests">β οΈ</a> <a href="#tutorial-sappelhoff" title="Tutorials">β
</a> <a href="#talk-sappelhoff" title="Talks">π’</a> <a href="#userTesting-sappelhoff" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/suyashdb"><img src="https://avatars.githubusercontent.com/u/11152799?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Suyash </b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=suyashdb" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/tsalo"><img src="https://avatars.githubusercontent.com/u/8228902?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Taylor Salo</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=tsalo" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/olgn"><img src="https://avatars.githubusercontent.com/u/8853289?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Teal Hobson-Lowther</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=olgn" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=olgn" title="Tests">β οΈ</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/riddlet"><img src="https://avatars.githubusercontent.com/u/4789331?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Travis Riddle</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Ariddlet" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/VisLab"><img src="https://avatars.githubusercontent.com/u/1189050?v=4?s=50" width="50px;" alt=""/><br /><sub><b>VisLab</b></sub></a><br /><a href="#ideas-VisLab" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=VisLab" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/wazeerzulfikar"><img src="https://avatars.githubusercontent.com/u/15856554?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Wazeer Zulfikar</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=wazeerzulfikar" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/yarikoptic"><img src="https://avatars.githubusercontent.com/u/39889?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Yaroslav Halchenko</b></sub></a><br /><a href="#ideas-yarikoptic" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=yarikoptic" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=yarikoptic" title="Documentation">π</a> <a href="#userTesting-yarikoptic" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/constellates"><img src="https://avatars.githubusercontent.com/u/4325905?v=4?s=50" width="50px;" alt=""/><br /><sub><b>constellates</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=constellates" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=constellates" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/dewarrn1"><img src="https://avatars.githubusercontent.com/u/1322751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>dewarrn1</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=dewarrn1" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/dkp"><img src="https://avatars.githubusercontent.com/u/965184?v=4?s=50" width="50px;" alt=""/><br /><sub><b>dkp</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=dkp" title="Code">π»</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/MatthewZito"><img src="https://avatars.githubusercontent.com/u/47864657?v=4?s=50" width="50px;" alt=""/><br /><sub><b>goldmund</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=MatthewZito" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=MatthewZito" title="Tests">β οΈ</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
## Use
### API
The BIDS Validator has one primary method that takes a directory as either a
path to the directory (node) or the object given by selecting a directory with a
file input (browser), an options object, and a callback.
Available options include:
- ignoreWarnings - (boolean - defaults to false)
- ignoreNiftiHeaders - (boolean - defaults to false)
For example:
`validate.BIDS(directory, {ignoreWarnings: true}, function (issues, summary) {console.log(issues.errors, issues.warnings);});`
If you would like to test individual files you can use the file specific checks
that we expose.
- validate.BIDS()
- validate.JSON()
- validate.TSV()
- validate.NIFTI()
Additionally you can reformat stored errors against a new config using `validate.reformat()`
### .bidsignore
Optionally one can include a `.bidsignore` file in the root of the dataset. This
file lists patterns (compatible with the [.gitignore syntax](https://git-scm.com/docs/gitignore))
defining files that should be ignored by the validator. This option is useful
when the validated dataset includes file types not yet supported by BIDS
specification.
```Text
*_not_bids.txt
extra_data/
```
### Configuration
You can configure the severity of errors by passing a json configuration file
with a `-c` or `--config` flag to the command line interface or by defining a
config object on the options object passed during javascript usage.
If no path is specified a default path of `.bids-validator-config.json` will be used. You can add this file to your dataset to share dataset specific validation configuration. To disable this behavior use `--no-config` and the default configuration will be used.
The basic configuration format is outlined below. All configuration is optional.
```JSON
{
"ignore": [],
"warn": [],
"error": [],
"ignoredFiles": []
}
```
`ignoredFiles` takes a list of file paths or glob patterns you'd like to ignore.
Lets say we want to ignore all files and sub-directory under `/derivatives/`.
**This is not the same syntax as used in the .bidsignore file**
```JSON
{
"ignoredFiles": ["/derivatives/**"]
}
```
Note that adding two stars `**` in path makes validator recognize all files and
sub-dir to be ignored.
`ignore`, `warn`, and `error` take lists of issue codes or issue keys and change
the severity of those issues so they are either ignored or reported as warnings
or errors. You can find a list of all available issues at
[utils/issues/list](https://github.com/bids-standard/bids-validator/blob/master/bids-validator/utils/issues/list.js).
Some issues may be ignored by default, but can be elevated to warnings or errors.
These provide a way to check for common things that are more specific than BIDS
compatibility. An example is a check for the presence of a T1w modality. The
following would raise an error if no T1W image was found in a dataset.
```JSON
{
"error": ["NO_T1W"]
}
```
In addition to issue codes and keys these lists can also contain objects with
and "and" or "or" properties set to arrays of codes or keys. These allow some
level of conditional logic when configuring issues. For example:
```JSON
{
"ignore": [
{
"and": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
]
}
```
In the above example the two issues will only be ignored if both of them are
triggered during validation.
```JSON
{
"ignore": [
{
"and": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
{
"or": [
"ECHO_TIME1-2_NOT_DEFINED",
"ECHO_TIME_MUST_DEFINE"
]
}
]
}
]
}
```
And in this example the listed issues will only be ignored if
`ECHO_TIME_GREATER_THAN`, `ECHO_TIME_NOT_DEFINED` and either
`ECHO_TIME1-2_NOT_DEFINED` or `ECHO_TIME_MUST_DEFINE` are triggered during
validation.
"or" arrays are not supported at the lowest level because it wouldn't add any
functionality. For example the following is not supported.
```JSON
{
"ignore": [
{
"or": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
]
}
```
because it would be functionally the same as this:
```JSON
{
"ignore": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
```
For passing a configuration while using the bids-validator on the command line,
you can use the following style to for example ignore empty
file errors (99) and files that cannot be read (44):
```
bids-validator --config.ignore=99 --config.ignore=44 path/to/bids/dir
```
This style of use puts limits on what configuration you can require, so for
complex scenarios, we advise users to create a dedicated configuration file with
contents as described above.
### In the Browser
The BIDS Validator currently works in the browser with [browserify](https://browserify.org/)
or [webpack](https://webpack.js.org/). You can add it to a project by cloning
the validator and requiring it with browserify syntax
`const validate = require('bids-validator');` or an ES2015 webpack import
`import validate from 'bids-validator'`.
### On the Server
The BIDS validator works like most npm packages. You can install it by running
`npm install bids-validator`.
### Through Command Line
If you install the bids validator globally by using `npm install -g bids-validator`
you will be able to use it as a command line tool. Once installed you should be
able to run `bids-validator /path/to/your/bids/directory` and see any validation
issues logged to the terminal. Run `bids-validator` without a directory path to
see available options.
## Docker image
[](https://hub.docker.com/r/bids/validator)
To use bids validator with [docker](https://www.docker.com/), you simply need to
[install docker](https://docs.docker.com/install/) on your system.
And then from a terminal run:
- `docker run -ti --rm bids/validator --version` to print the version of the
docker image
- `docker run -ti --rm bids/validator --help` to print the help
- `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data`
to validate the dataset `/path/to/data` on your host machine
See here for a brief explanation of the commands:
- `docker run` is the command to tell docker to run a certain docker image,
usually taking the form `docker run <IMAGENAME> <COMMAND>`
- the `-ti` flag means the inputs are accepted and outputs are printed to the
terminal
- the `--rm` flag means that the state of the docker container is not saved
after it has run
- the `-v` flag is adding your local data to the docker container
([bind-mounts](https://docs.docker.com/storage/bind-mounts/)). Importantly,
the input after the `-v` flag consists of three fields separated colons: `:`
- the first field is the path to the directory on the host machine:
`/path/to/data`
- the second field is the path where the directory is mounted in the
container
- the third field is optional. In our case, we use `ro` to specify that the
mounted data is _read only_
## Python Library
[](https://badge.fury.io/py/bids-validator)
[](https://anaconda.org/conda-forge/bids-validator)
There are is a limited library of helper functions written in Python. The main function
determines if a file extension is compliant with the BIDS specification. You can find
the available functions in the library, as well as their descriptions,
[here](https://github.com/bids-standard/bids-validator/blob/master/bids-validator/bids_validator/bids_validator.py).
To install, run `pip install -U bids_validator` (requires python and pip) or
`conda install bids-validator` (requires a Conda environment).
### Example
```Python
from bids_validator import BIDSValidator
validator = BIDSValidator()
filepaths = ["/sub-01/anat/sub-01_rec-CSD_T1w.nii.gz", "/sub-01/anat/sub-01_acq-23_rec-CSD_T1w.exe"]
for filepath in filepaths:
print(validator.is_bids(filepath)) # will print True, and then False
```
## Development
To develop locally, clone the project and run `npm install` from the project
root. This will install external dependencies. If you wish to install
`bids-validator` globally (so that you can run it in other folders), use the
following command to install it globally: `cd bids-validator && npm install -g` (for windows users, if in a different drive add /d, e.g. `cd /d F:\bids-validator && npm install -g`)
Please see the [CONTRIBUTING.md](../CONTRIBUTING.md)
for additional details.
### Bundling
bids-validator is bundled with esbuild. While developing, the script `bids-validator/bin/bids-validator` will automatically bundle the project each time it is run. To test a build without publishing it `npm -w bids-validator run build`. This will generate a bids-validator/dist directory containing the local build and `bids-validator/bin/bids-validator` will use this build. To return to automatic bundling on each run, remove the dist directory.
### Running Locally in a Browser
A note about OS X, the dependencies for the browser require a npm package called
node-gyp which needs xcode to be installed in order to be compiled.
1. The browser version of `bids-validator` lives in the repo subdirectory
`/bids-validator-web`. It is a [React.js](https://reactjs.org/) application
that uses the [next.js](https://nextjs.org/) framework.
2. To develop `bids-validator` and see how it will act in the browser, simply run
`npm run web-dev` in the project root and navigate to `localhost:3000`.
3. In development mode, changes to the codebase will trigger rebuilds of the application
automatically.
4. Changes to the `/bids-validator` in the codebase will also be reflected in the
web application.
5. Tests use the [Jest](https://jestjs.io/index.html) testing library and should be developed in `/bids-validator-web/tests`.
We can always use more tests, so please feel free to contribute a test that reduces the chance
of any bugs you fix!
6. To ensure that the web application compiles successfully in production, run `npm run web-export`
### Testing
If it's your first time running tests, first use the command `git submodule update --init --depth 1` to pull the test example data. This repo contains the [bids-examples github repository](https://github.com/bids-standard/bids-examples) as a [submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
To start the test suite run `npm run test` from the project root. `npm run test -- --watch`
is useful to run tests while making changes. A coverage report is available with
`npm run coverage`.
To run the linter which checks code conventions run `npm run lint`.
### Install globally from a development branch
Global installs are not recommended for development because of the possibility of package conflicts with other Node.js projects. If you do need to test with a global install from a development tree, follow these steps to generate the NPM package without publishing it and install the package locally.
1. `npm -w bids-validator run build`
2. `npm -w bids-validator pack`
3. `npm install -g bids-validator-*.tgz`
### Publishing
Publishing is done with [Lerna](https://github.com/lerna/lerna). Use the command `npx lerna publish` and follow instructions to set a new version.
Using lerna publish will create a git commit with updated version information and create a version number tag for it, push the tag to GitHub, then publish to NPM and PyPI. The GitHub release is manual following that.
## Acknowledgments
Many contributions to the `bids-validator` were done by members of the
BIDS community. See the
[list of contributors](https://bids-specification.readthedocs.io/en/stable/99-appendices/01-contributors.html).
A large part of the development of `bids-validator` is currently done by
[Squishymedia](https://squishymedia.com/), who are in turn financed through
different grants offered for the general development of BIDS. See the list
below.
Development and contributions were supported through the following federally
funded projects/grants:
- [BIDS Derivatives (NIMH: R24MH114705, PI: Poldrack)](https://grantome.com/grant/NIH/R24-MH114705-01)
- [OpenNeuro (NIMH: R24MH117179, PI: Poldrack)](https://grantome.com/grant/NIH/R24-MH117179-01)
- [Spokes: MEDIUM: WEST (NSF: 1760950, PI: Poldrack & Gorgolewski)](https://grantome.com/grant/NSF/IIS-1760950)
- [ReproNim](http://repronim.org) [(NIH-NIBIB P41 EB019936, PI: Kennedy)](https://projectreporter.nih.gov/project_info_description.cfm?aid=8999833)
%package help
Summary: Development documents and examples for bids-validator
Provides: python3-bids-validator-doc
%description help
[](https://github.com/bids-standard/bids-validator/actions/workflows/node_tests.yml)
[](https://github.com/bids-standard/bids-validator/actions/workflows/python_tests.yml)
[](https://github.com/bids-standard/bids-validator/actions/workflows/test-bids-examples.yml)
[](https://circleci.com/gh/bids-standard/bids-validator)
[](https://codecov.io/gh/bids-standard/bids-validator)
[](https://doi.org/10.5281/zenodo.3688707)
# BIDS-Validator
- [BIDS-Validator](#bids-validator)
- [Quickstart](#quickstart)
- [Support](#support)
- [Maintainers and Contributors](#maintainers-and-contributors)
- [Use](#use)
- [API](#api)
- [.bidsignore](#bidsignore)
- [Configuration](#configuration)
- [In the Browser](#in-the-browser)
- [On the Server](#on-the-server)
- [Through Command Line](#through-command-line)
- [Docker image](#docker-image)
- [Python Library](#python-library)
- [Example](#example)
- [Development](#development)
- [Running Locally in a Browser](#running-locally-in-a-browser)
- [Testing](#testing)
- [Publishing](#publishing)
- [Acknowledgments](#acknowledgments)
## Quickstart
1. Web version:
1. Open [Google Chrome](https://www.google.com/chrome/) or
[Mozilla Firefox](https://mozilla.org/firefox) (currently the only
supported browsers)
1. Go to https://bids-standard.github.io/bids-validator/ and select a folder
with your BIDS dataset. If the validator seems to be working longer than
couple of minutes please open [developer tools ](https://developer.chrome.com/devtools)
and report the error at [https://github.com/bids-standard/bids-validator/issues](https://github.com/bids-standard/bids-validator/issues).
1. Command line version:
1. Install [Node.js](https://nodejs.org) (at least version 12.12.0)
1. Update `npm` to be at least version 7 (`npm install --global npm@^7`)
1. From a terminal run `npm install -g bids-validator`
1. Run `bids-validator` to start validating datasets.
1. Docker
1. Install Docker
1. From a terminal run `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data`
but replace the `/path/to/data` part of the command with your own path on your machine.
1. Python Library:
1. Install [Python](https://www.python.org/)
1. Install [Pip](https://pip.pypa.io/en/stable/installing/) package manager for Python, if
not already installed.
1. From a terminal run `pip install bids_validator` to acquire the
[BIDS Validator PyPI package](https://pypi.org/project/bids-validator/)
or `conda install bids-validator` for the
[Conda package](https://anaconda.org/conda-forge/bids-validator).
1. Open a Python terminal and type: `python`
1. Import the BIDS Validator package `from bids_validator import BIDSValidator`
1. Check if a file is BIDS compatible `BIDSValidator().is_bids('path/to/a/bids/file')`
## Support
The BIDS Validator is designed to work in both the browser and in Node.js. We
target support for the latest long term stable (LTS) release of Node.js and the
latest version of Chrome.
There is also a library of helper functions written in Python, for use with BIDS
compliant applications written in this language.
Please report any issues you experience while using these support targets via
the [GitHub issue tracker](https://github.com/bids-standard/bids-validator/issues).
If you experience issues outside of these supported environments and believe we
should extend our targeted support feel free to open a new issue describing the
issue, your support target and why you require extended support and we will
address these issues on a case by case basis.
## Maintainers and Contributors
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
Contributions of any kind are welcome!
The project is maintained by [@rwblair](https://github.com/rwblair/) with the help of many contributors listed below.
(The [emoji key](https://allcontributors.org/docs/en/emoji-key) is indicating the kind of contribution)
Please also see [Acknowledgments](#acknowledgments).
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://adam2392.github.io/"><img src="https://avatars.githubusercontent.com/u/3460267?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Adam Li</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=adam2392" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=adam2392" title="Tests">β οΈ</a> <a href="#userTesting-adam2392" title="User Testing">π</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Aadam2392" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/agt24"><img src="https://avatars.githubusercontent.com/u/7869017?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Adam Thomas</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=agt24" title="Documentation">π</a></td>
<td align="center"><a href="http://happy5214.freedynamicdns.org/"><img src="https://avatars.githubusercontent.com/u/2992751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Alexander Jones</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=happy5214" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=happy5214" title="Tests">β οΈ</a> <a href="#ideas-happy5214" title="Ideas, Planning, & Feedback">π€</a></td>
<td align="center"><a href="https://github.com/musicinmybrain"><img src="https://avatars.githubusercontent.com/u/6898909?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Ben Beasley</b></sub></a><br /><a href="#platform-musicinmybrain" title="Packaging/porting to new platform">π¦</a></td>
<td align="center"><a href="http://chrisgorgolewski.org"><img src="https://avatars.githubusercontent.com/u/238759?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Gorgolewski</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Achrisgorgo" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Code">π»</a> <a href="#data-chrisgorgo" title="Data">π£</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Documentation">π</a> <a href="#example-chrisgorgo" title="Examples">π‘</a> <a href="#ideas-chrisgorgo" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-chrisgorgo" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-chrisgorgo" title="Maintenance">π§</a> <a href="#mentoring-chrisgorgo" title="Mentoring">π§βπ«</a> <a href="#question-chrisgorgo" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Achrisgorgo" title="Reviewed Pull Requests">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=chrisgorgo" title="Tests">β οΈ</a> <a href="#tutorial-chrisgorgo" title="Tutorials">β
</a> <a href="#talk-chrisgorgo" title="Talks">π’</a> <a href="#userTesting-chrisgorgo" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/choldgraf"><img src="https://avatars.githubusercontent.com/u/1839645?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Holdgraf</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=choldgraf" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/effigies"><img src="https://avatars.githubusercontent.com/u/83442?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Chris Markiewicz</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=effigies" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=effigies" title="Tests">β οΈ</a> <a href="#ideas-effigies" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Aeffigies" title="Bug reports">π</a> <a href="#question-effigies" title="Answering Questions">π¬</a> <a href="#tool-effigies" title="Tools">π§</a> <a href="#maintenance-effigies" title="Maintenance">π§</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/david-nishi"><img src="https://avatars.githubusercontent.com/u/28666458?v=4?s=50" width="50px;" alt=""/><br /><sub><b>David Nishikawa</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=david-nishi" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=david-nishi" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/DimitriPapadopoulos"><img src="https://avatars.githubusercontent.com/u/3234522?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Dimitri Papadopoulos Orfanos</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=DimitriPapadopoulos" title="Code">π»</a></td>
<td align="center"><a href="https://duncanmmacleod.github.io/"><img src="https://avatars.githubusercontent.com/u/1618530?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Duncan Macleod</b></sub></a><br /><a href="#infra-duncanmmacleod" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
<td align="center"><a href="https://github.com/franklin-feingold"><img src="https://avatars.githubusercontent.com/u/35307458?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Franklin Feingold</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=franklin-feingold" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/thinknoack"><img src="https://avatars.githubusercontent.com/u/3342083?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Gregory noack</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=thinknoack" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=thinknoack" title="Tests">β οΈ</a></td>
<td align="center"><a href="http://chymera.eu/"><img src="https://avatars.githubusercontent.com/u/950524?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Horea Christian</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=TheChymera" title="Code">π»</a></td>
<td align="center"><a href="https://kaczmarj.github.io/"><img src="https://avatars.githubusercontent.com/u/17690870?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Jakub Kaczmarzyk</b></sub></a><br /><a href="#infra-kaczmarj" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/jokedurnez"><img src="https://avatars.githubusercontent.com/u/7630327?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Joke Durnez</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=jokedurnez" title="Code">π»</a></td>
<td align="center"><a href="http://jasmainak.github.io/"><img src="https://avatars.githubusercontent.com/u/15852194?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Mainak Jas</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=jasmainak" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=jasmainak" title="Tests">β οΈ</a> <a href="#ideas-jasmainak" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Ajasmainak" title="Reviewed Pull Requests">π</a> <a href="#userTesting-jasmainak" title="User Testing">π</a></td>
<td align="center"><a href="http://fair.dei.unipd.it/marco-castellaro"><img src="https://avatars.githubusercontent.com/u/5088923?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Marco Castellaro</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=marcocastellaro" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=marcocastellaro" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/MaxvandenBoom"><img src="https://avatars.githubusercontent.com/u/43676624?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Max</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=MaxvandenBoom" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3AMaxvandenBoom" title="Bug reports">π</a></td>
<td align="center"><a href="http://psychoinformatics.de/"><img src="https://avatars.githubusercontent.com/u/136479?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Michael Hanke</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=mih" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/naveau"><img src="https://avatars.githubusercontent.com/u/1488318?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Mikael Naveau</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=naveau" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/nellh"><img src="https://avatars.githubusercontent.com/u/11369795?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Nell Hardcastle</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=nellh" title="Code">π»</a> <a href="#ideas-nellh" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-nellh" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#question-nellh" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Anellh" title="Reviewed Pull Requests">π</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/ntraut"><img src="https://avatars.githubusercontent.com/u/22977927?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Nicolas Traut</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=ntraut" title="Code">π»</a></td>
<td align="center"><a href="https://www.linkedin.com/in/parul-sethi"><img src="https://avatars.githubusercontent.com/u/11822050?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Parul Sethi</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=parulsethi" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=parulsethi" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/patsycle"><img src="https://avatars.githubusercontent.com/u/41481345?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Patricia Clement</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=patsycle" title="Code">π»</a></td>
<td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars.githubusercontent.com/u/6961185?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=Remi-Gau" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=Remi-Gau" title="Documentation">π</a> <a href="#userTesting-Remi-Gau" title="User Testing">π</a></td>
<td align="center"><a href="https://hoechenberger.net/"><img src="https://avatars.githubusercontent.com/u/2046265?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Richard HΓΆchenberger</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=hoechenberger" title="Code">π»</a> <a href="#userTesting-hoechenberger" title="User Testing">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=hoechenberger" title="Tests">β οΈ</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Ahoechenberger" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/robertoostenveld"><img src="https://avatars.githubusercontent.com/u/899043?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Robert Oostenveld</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=robertoostenveld" title="Code">π»</a> <a href="#ideas-robertoostenveld" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Arobertoostenveld" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=robertoostenveld" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/SetCodesToFire"><img src="https://avatars.githubusercontent.com/u/25459509?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Rohan Goyal</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=SetCodesToFire" title="Code">π»</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/rwblair"><img src="https://avatars2.githubusercontent.com/u/14927911?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Ross Blair</b></sub></a><br /><a href="#maintenance-rwblair" title="Maintenance">π§</a> <a href="#ideas-rwblair" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=rwblair" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Arwblair" title="Bug reports">π</a> <a href="#infra-rwblair" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-rwblair" title="Project Management">π</a> <a href="#question-rwblair" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Arwblair" title="Reviewed Pull Requests">π</a> <a href="#tool-rwblair" title="Tools">π§</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=rwblair" title="Tests">β οΈ</a></td>
<td align="center"><a href="http://www.poldracklab.org/"><img src="https://avatars.githubusercontent.com/u/871056?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Russ Poldrack</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=poldrack" title="Code">π»</a> <a href="#financial-poldrack" title="Financial">π΅</a> <a href="#fundingFinding-poldrack" title="Funding Finding">π</a></td>
<td align="center"><a href="http://soichi.us/"><img src="https://avatars.githubusercontent.com/u/923896?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Soichi Hayashi</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Asoichih" title="Bug reports">π</a></td>
<td align="center"><a href="https://www.stefanappelhoff.com"><img src="https://avatars.githubusercontent.com/u/9084751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Stefan Appelhoff</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Asappelhoff" title="Bug reports">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Code">π»</a> <a href="#data-sappelhoff" title="Data">π£</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Documentation">π</a> <a href="#example-sappelhoff" title="Examples">π‘</a> <a href="#ideas-sappelhoff" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-sappelhoff" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-sappelhoff" title="Maintenance">π§</a> <a href="#mentoring-sappelhoff" title="Mentoring">π§βπ«</a> <a href="#question-sappelhoff" title="Answering Questions">π¬</a> <a href="https://github.com/bids-standard/bids-validator/pulls?q=is%3Apr+reviewed-by%3Asappelhoff" title="Reviewed Pull Requests">π</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=sappelhoff" title="Tests">β οΈ</a> <a href="#tutorial-sappelhoff" title="Tutorials">β
</a> <a href="#talk-sappelhoff" title="Talks">π’</a> <a href="#userTesting-sappelhoff" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/suyashdb"><img src="https://avatars.githubusercontent.com/u/11152799?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Suyash </b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=suyashdb" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/tsalo"><img src="https://avatars.githubusercontent.com/u/8228902?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Taylor Salo</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=tsalo" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/olgn"><img src="https://avatars.githubusercontent.com/u/8853289?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Teal Hobson-Lowther</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=olgn" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=olgn" title="Tests">β οΈ</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/riddlet"><img src="https://avatars.githubusercontent.com/u/4789331?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Travis Riddle</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/issues?q=author%3Ariddlet" title="Bug reports">π</a></td>
<td align="center"><a href="https://github.com/VisLab"><img src="https://avatars.githubusercontent.com/u/1189050?v=4?s=50" width="50px;" alt=""/><br /><sub><b>VisLab</b></sub></a><br /><a href="#ideas-VisLab" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=VisLab" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/wazeerzulfikar"><img src="https://avatars.githubusercontent.com/u/15856554?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Wazeer Zulfikar</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=wazeerzulfikar" title="Documentation">π</a></td>
<td align="center"><a href="https://github.com/yarikoptic"><img src="https://avatars.githubusercontent.com/u/39889?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Yaroslav Halchenko</b></sub></a><br /><a href="#ideas-yarikoptic" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=yarikoptic" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=yarikoptic" title="Documentation">π</a> <a href="#userTesting-yarikoptic" title="User Testing">π</a></td>
<td align="center"><a href="https://github.com/constellates"><img src="https://avatars.githubusercontent.com/u/4325905?v=4?s=50" width="50px;" alt=""/><br /><sub><b>constellates</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=constellates" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=constellates" title="Tests">β οΈ</a></td>
<td align="center"><a href="https://github.com/dewarrn1"><img src="https://avatars.githubusercontent.com/u/1322751?v=4?s=50" width="50px;" alt=""/><br /><sub><b>dewarrn1</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=dewarrn1" title="Code">π»</a></td>
<td align="center"><a href="https://github.com/dkp"><img src="https://avatars.githubusercontent.com/u/965184?v=4?s=50" width="50px;" alt=""/><br /><sub><b>dkp</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=dkp" title="Code">π»</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/MatthewZito"><img src="https://avatars.githubusercontent.com/u/47864657?v=4?s=50" width="50px;" alt=""/><br /><sub><b>goldmund</b></sub></a><br /><a href="https://github.com/bids-standard/bids-validator/commits?author=MatthewZito" title="Code">π»</a> <a href="https://github.com/bids-standard/bids-validator/commits?author=MatthewZito" title="Tests">β οΈ</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
## Use
### API
The BIDS Validator has one primary method that takes a directory as either a
path to the directory (node) or the object given by selecting a directory with a
file input (browser), an options object, and a callback.
Available options include:
- ignoreWarnings - (boolean - defaults to false)
- ignoreNiftiHeaders - (boolean - defaults to false)
For example:
`validate.BIDS(directory, {ignoreWarnings: true}, function (issues, summary) {console.log(issues.errors, issues.warnings);});`
If you would like to test individual files you can use the file specific checks
that we expose.
- validate.BIDS()
- validate.JSON()
- validate.TSV()
- validate.NIFTI()
Additionally you can reformat stored errors against a new config using `validate.reformat()`
### .bidsignore
Optionally one can include a `.bidsignore` file in the root of the dataset. This
file lists patterns (compatible with the [.gitignore syntax](https://git-scm.com/docs/gitignore))
defining files that should be ignored by the validator. This option is useful
when the validated dataset includes file types not yet supported by BIDS
specification.
```Text
*_not_bids.txt
extra_data/
```
### Configuration
You can configure the severity of errors by passing a json configuration file
with a `-c` or `--config` flag to the command line interface or by defining a
config object on the options object passed during javascript usage.
If no path is specified a default path of `.bids-validator-config.json` will be used. You can add this file to your dataset to share dataset specific validation configuration. To disable this behavior use `--no-config` and the default configuration will be used.
The basic configuration format is outlined below. All configuration is optional.
```JSON
{
"ignore": [],
"warn": [],
"error": [],
"ignoredFiles": []
}
```
`ignoredFiles` takes a list of file paths or glob patterns you'd like to ignore.
Lets say we want to ignore all files and sub-directory under `/derivatives/`.
**This is not the same syntax as used in the .bidsignore file**
```JSON
{
"ignoredFiles": ["/derivatives/**"]
}
```
Note that adding two stars `**` in path makes validator recognize all files and
sub-dir to be ignored.
`ignore`, `warn`, and `error` take lists of issue codes or issue keys and change
the severity of those issues so they are either ignored or reported as warnings
or errors. You can find a list of all available issues at
[utils/issues/list](https://github.com/bids-standard/bids-validator/blob/master/bids-validator/utils/issues/list.js).
Some issues may be ignored by default, but can be elevated to warnings or errors.
These provide a way to check for common things that are more specific than BIDS
compatibility. An example is a check for the presence of a T1w modality. The
following would raise an error if no T1W image was found in a dataset.
```JSON
{
"error": ["NO_T1W"]
}
```
In addition to issue codes and keys these lists can also contain objects with
and "and" or "or" properties set to arrays of codes or keys. These allow some
level of conditional logic when configuring issues. For example:
```JSON
{
"ignore": [
{
"and": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
]
}
```
In the above example the two issues will only be ignored if both of them are
triggered during validation.
```JSON
{
"ignore": [
{
"and": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
{
"or": [
"ECHO_TIME1-2_NOT_DEFINED",
"ECHO_TIME_MUST_DEFINE"
]
}
]
}
]
}
```
And in this example the listed issues will only be ignored if
`ECHO_TIME_GREATER_THAN`, `ECHO_TIME_NOT_DEFINED` and either
`ECHO_TIME1-2_NOT_DEFINED` or `ECHO_TIME_MUST_DEFINE` are triggered during
validation.
"or" arrays are not supported at the lowest level because it wouldn't add any
functionality. For example the following is not supported.
```JSON
{
"ignore": [
{
"or": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
]
}
```
because it would be functionally the same as this:
```JSON
{
"ignore": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
```
For passing a configuration while using the bids-validator on the command line,
you can use the following style to for example ignore empty
file errors (99) and files that cannot be read (44):
```
bids-validator --config.ignore=99 --config.ignore=44 path/to/bids/dir
```
This style of use puts limits on what configuration you can require, so for
complex scenarios, we advise users to create a dedicated configuration file with
contents as described above.
### In the Browser
The BIDS Validator currently works in the browser with [browserify](https://browserify.org/)
or [webpack](https://webpack.js.org/). You can add it to a project by cloning
the validator and requiring it with browserify syntax
`const validate = require('bids-validator');` or an ES2015 webpack import
`import validate from 'bids-validator'`.
### On the Server
The BIDS validator works like most npm packages. You can install it by running
`npm install bids-validator`.
### Through Command Line
If you install the bids validator globally by using `npm install -g bids-validator`
you will be able to use it as a command line tool. Once installed you should be
able to run `bids-validator /path/to/your/bids/directory` and see any validation
issues logged to the terminal. Run `bids-validator` without a directory path to
see available options.
## Docker image
[](https://hub.docker.com/r/bids/validator)
To use bids validator with [docker](https://www.docker.com/), you simply need to
[install docker](https://docs.docker.com/install/) on your system.
And then from a terminal run:
- `docker run -ti --rm bids/validator --version` to print the version of the
docker image
- `docker run -ti --rm bids/validator --help` to print the help
- `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data`
to validate the dataset `/path/to/data` on your host machine
See here for a brief explanation of the commands:
- `docker run` is the command to tell docker to run a certain docker image,
usually taking the form `docker run <IMAGENAME> <COMMAND>`
- the `-ti` flag means the inputs are accepted and outputs are printed to the
terminal
- the `--rm` flag means that the state of the docker container is not saved
after it has run
- the `-v` flag is adding your local data to the docker container
([bind-mounts](https://docs.docker.com/storage/bind-mounts/)). Importantly,
the input after the `-v` flag consists of three fields separated colons: `:`
- the first field is the path to the directory on the host machine:
`/path/to/data`
- the second field is the path where the directory is mounted in the
container
- the third field is optional. In our case, we use `ro` to specify that the
mounted data is _read only_
## Python Library
[](https://badge.fury.io/py/bids-validator)
[](https://anaconda.org/conda-forge/bids-validator)
There are is a limited library of helper functions written in Python. The main function
determines if a file extension is compliant with the BIDS specification. You can find
the available functions in the library, as well as their descriptions,
[here](https://github.com/bids-standard/bids-validator/blob/master/bids-validator/bids_validator/bids_validator.py).
To install, run `pip install -U bids_validator` (requires python and pip) or
`conda install bids-validator` (requires a Conda environment).
### Example
```Python
from bids_validator import BIDSValidator
validator = BIDSValidator()
filepaths = ["/sub-01/anat/sub-01_rec-CSD_T1w.nii.gz", "/sub-01/anat/sub-01_acq-23_rec-CSD_T1w.exe"]
for filepath in filepaths:
print(validator.is_bids(filepath)) # will print True, and then False
```
## Development
To develop locally, clone the project and run `npm install` from the project
root. This will install external dependencies. If you wish to install
`bids-validator` globally (so that you can run it in other folders), use the
following command to install it globally: `cd bids-validator && npm install -g` (for windows users, if in a different drive add /d, e.g. `cd /d F:\bids-validator && npm install -g`)
Please see the [CONTRIBUTING.md](../CONTRIBUTING.md)
for additional details.
### Bundling
bids-validator is bundled with esbuild. While developing, the script `bids-validator/bin/bids-validator` will automatically bundle the project each time it is run. To test a build without publishing it `npm -w bids-validator run build`. This will generate a bids-validator/dist directory containing the local build and `bids-validator/bin/bids-validator` will use this build. To return to automatic bundling on each run, remove the dist directory.
### Running Locally in a Browser
A note about OS X, the dependencies for the browser require a npm package called
node-gyp which needs xcode to be installed in order to be compiled.
1. The browser version of `bids-validator` lives in the repo subdirectory
`/bids-validator-web`. It is a [React.js](https://reactjs.org/) application
that uses the [next.js](https://nextjs.org/) framework.
2. To develop `bids-validator` and see how it will act in the browser, simply run
`npm run web-dev` in the project root and navigate to `localhost:3000`.
3. In development mode, changes to the codebase will trigger rebuilds of the application
automatically.
4. Changes to the `/bids-validator` in the codebase will also be reflected in the
web application.
5. Tests use the [Jest](https://jestjs.io/index.html) testing library and should be developed in `/bids-validator-web/tests`.
We can always use more tests, so please feel free to contribute a test that reduces the chance
of any bugs you fix!
6. To ensure that the web application compiles successfully in production, run `npm run web-export`
### Testing
If it's your first time running tests, first use the command `git submodule update --init --depth 1` to pull the test example data. This repo contains the [bids-examples github repository](https://github.com/bids-standard/bids-examples) as a [submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
To start the test suite run `npm run test` from the project root. `npm run test -- --watch`
is useful to run tests while making changes. A coverage report is available with
`npm run coverage`.
To run the linter which checks code conventions run `npm run lint`.
### Install globally from a development branch
Global installs are not recommended for development because of the possibility of package conflicts with other Node.js projects. If you do need to test with a global install from a development tree, follow these steps to generate the NPM package without publishing it and install the package locally.
1. `npm -w bids-validator run build`
2. `npm -w bids-validator pack`
3. `npm install -g bids-validator-*.tgz`
### Publishing
Publishing is done with [Lerna](https://github.com/lerna/lerna). Use the command `npx lerna publish` and follow instructions to set a new version.
Using lerna publish will create a git commit with updated version information and create a version number tag for it, push the tag to GitHub, then publish to NPM and PyPI. The GitHub release is manual following that.
## Acknowledgments
Many contributions to the `bids-validator` were done by members of the
BIDS community. See the
[list of contributors](https://bids-specification.readthedocs.io/en/stable/99-appendices/01-contributors.html).
A large part of the development of `bids-validator` is currently done by
[Squishymedia](https://squishymedia.com/), who are in turn financed through
different grants offered for the general development of BIDS. See the list
below.
Development and contributions were supported through the following federally
funded projects/grants:
- [BIDS Derivatives (NIMH: R24MH114705, PI: Poldrack)](https://grantome.com/grant/NIH/R24-MH114705-01)
- [OpenNeuro (NIMH: R24MH117179, PI: Poldrack)](https://grantome.com/grant/NIH/R24-MH117179-01)
- [Spokes: MEDIUM: WEST (NSF: 1760950, PI: Poldrack & Gorgolewski)](https://grantome.com/grant/NSF/IIS-1760950)
- [ReproNim](http://repronim.org) [(NIH-NIBIB P41 EB019936, PI: Kennedy)](https://projectreporter.nih.gov/project_info_description.cfm?aid=8999833)
%prep
%autosetup -n bids-validator-1.10.0
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-bids-validator -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Wed Mar 08 2023 Python_Bot <Python_Bot@openeuler.org> - 1.10.0-1
- Package Spec generated
|