Name: bids-validator
Owner: International Neuroinformatics Coordinating Facility (INCF)
Description: Validator for the Brain Imaging Data Structure
Created: 2015-06-09 22:08:27.0
Updated: 2018-01-11 23:30:14.0
Pushed: 2018-01-15 16:39:38.0
Homepage: http://incf.github.io/bids-validator
Size: 24009
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
npm install -g bids-validator
bids-validator
to start validating datasets.docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data
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.
Please report any issues you experience while using these support targets. 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.
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:
For example:
ou would like to test individual files you can use the file specific checks that we expose.
lidate.BIDS()
lidate.JSON()
lidate.TSV()
lidate.NIFTI()
tionally you can reformat stored errors against a new config using `validate.reformat()`
.bidsignore
onally one can include a `.bidsignore` file in the root of the dataset. This file lists patterns (compatible
the [.gitignore syntax](https://git-scm.com/docs/gitignore)) defining files that should be ignored by the
dator. This option is useful when the validated dataset includes file types not yet supported by BIDS specification.
*_not_bids.txt
extra_data/
Configuration
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.
basic configuration format is outlined below. All configuration is optional.
{
"ignore": [],
"warn": [],
"error": [],
"ignoredFiles": []
}
oredFiles` 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/`.
{
"ignoredFiles": ["/derivatives/**"]
}
that adding two stars `**` in path makes validator recognize all files and sub-dir to be ignored.
ore`, `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/INCF/bids-validator/tree/master/utils/issues/list.js).
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.
{
"error": ["NO_T1W"]
}
ddition 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:
{
"ignore": [
{
"and": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
]
}
he above example the two issues will only be ignored if both of them are triggered during validation.
{
"ignore": [
{
"and": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
{
"or": [
"ECHO_TIME1-2_NOT_DEFINED",
"ECHO_TIME_MUST_DEFINE"
]
}
]
}
]
}
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.
arrays are not supported at the lowest level because it wouldn't add any functionality. For example the following is not supported.
{
"ignore": [
{
"or": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
]
}
use it would be functionally the same as this
{
"ignore": [
"ECHO_TIME_GREATER_THAN",
"ECHO_TIME_NOT_DEFINED"
]
}
In the Browser
BIDS Validator currently works in the browser with [browserify](http://browserify.org/). You can add it to a browserify project by cloning the validator and requiring it with browserify syntax ```var validate = require('bids-validator');```.
On the Server
BIDS validator works like most npm packages. You can install it by running ```npm install bids-validator```.
Through Command Line
ou 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.
evelopment
evelop locally, clone the project and run ```npm install``` from the project root. This will install external dependencies.
Running Locally in a Browser
te 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.
reate a separate directory with the gh-pages branch in it.
he local version of the validator needs to be added to npm. This is done through the command `npm --save relative/path/to/bids-validator`.
n the gh-pages package.json file replace `bids-validator: "latest"` with `bids-validator: "relative/path/to/bids-validator` so if the normal bids-validator project is in the same directory as the gh-pages project this line would read `bids-validator: "../bids-validator". This will install your local version of the bids-validator project instead of going to the central npm repository.
he default gh-pages application minifies javascript. This make it difficult to test things locally. To disable minification of javascript comment out the line `.pipe(uglify())` in gulpfule.js
n the gh-pages directory execute `npm install` and then `gulp build` this will install all the dependencies of the bids-validator browser application and build it.
ny subsequent changes to the bids-validator will require the gh-pages application rebuilt with `gulp build`.
ia Chrome you can now open the index.html in gh-pages generated by gulp.
Testing
tart the test suite run ```npm test``` from the project root.
un the linter which checks code conventions run ```npm run lint```.