How to use bids-validator - 7 common examples

To help you get started, weโ€™ve selected a few bids-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bids-standard / bids-validator / bids-validator-web / components / App.jsx View on Github external
import React from 'react'
import bowser from 'bowser'
import Issues from '../components/Issues'
import BrowserWarning from './BrowserWarning'
import Validate from '../components/Validate'
import validate from 'bids-validator'
import validatorPackageJson from 'bids-validator/package.json'
const version = validatorPackageJson.version

// component setup -----------------------------------------------------------

const initState = () => ({
  dirName: '',
  list: {},
  nameError: null,
  projectId: '',
  refs: {},
  errors: [],
  warnings: [],
  summary: null,
  status: '',
  uploadStatus: '',
  options: {
    ignoreWarnings: false,
github bids-standard / bids-validator / bids-validator-web / components / App.jsx View on Github external
_validate(selectedFiles) {
    const dirName = selectedFiles.list[0].webkitRelativePath.split('/')[0]
    const defaultConfig = `${dirName}/.bids-validator-config.json`
    this.setState({
      status: 'validating',
      showIssues: true,
      activeKey: 3,
      dirName,
    })
    return validate.BIDS(
      selectedFiles.list,
      {
        verbose: true,
        ...this.state.options,
        config: defaultConfig,
      },
      (issues, summary) => {
        if (issues === 'Invalid') {
          return this.setState({
            errors: 'Invalid',
            summary,
            status: 'validated',
          })
        } else {
          return this.setState({
            errors: issues.errors ? issues.errors : [],
github OpenNeuroOrg / openneuro / packages / openneuro-cli / src / upload.js View on Github external
return new Promise((resolve, reject) => {
    validate.BIDS(dir, options, ({ errors, warnings }, summary) => {
      if (errors.length + warnings.length === 0) {
        resolve({ summary })
      } else {
        reject({ errors, warnings })
      }
    })
  })
}
github OpenNeuroOrg / openneuro / packages / openneuro-app / src / scripts / workers / validate.worker.js View on Github external
new Promise(resolve => {
    validate.BIDS(files, options, (issues, summary) =>
      resolve({ issues, summary }),
    )
  })
github OpenNeuroOrg / openneuro / packages / openneuro-app / src / scripts / uploader / upload-issues.jsx View on Github external
componentWillMount() {
    const options = {}
    validate.BIDS(this.props.files, options, this.done)
  }
github OpenNeuroOrg / openneuro / server / handlers / validation.js View on Github external
scitran.downloadSymlinkDataset(datasetId, (err, hash) => {
      if (err) {
        return res.status(500).send({ error: generic_failure })
      }
      try {
        validate.BIDS(
          config.location + '/persistent/datasets/' + hash,
          {},
          (validation, summary) => {
            scitran.updateProject(
              datasetId,
              {
                metadata: { validation, summary },
              },
              () => {
                scitran.removeTag('projects', datasetId, 'validating', () => {
                  if (validation.errors && validation.errors.length > 0) {
                    scitran.addTag('projects', datasetId, 'invalid', () => {
                      res.send({ validation, summary })
                    })
                  } else {
                    scitran.removeTag('projects', datasetId, 'invalid', () => {
github OpenNeuroOrg / openneuro / src / scripts / dataset / dataset.tools.jobs.jsx View on Github external
scitran.getProject(snapshotId, (res) => {
            for (let app of this.props.apps) {
                let longDescription = typeof(app.longDescription) == 'string' ? JSON.parse(app.longDescription) : app.longDescription;
                let appConfig = longDescription.hasOwnProperty('appConfig') ? longDescription.appConfig : {error: []};
                let issues = validate.reformat(res.body.metadata.validation, res.body.metadata.summary, appConfig);
                if (issues.errors.length > 0) {
                    disabledApps[app.id] = {issues};
                }
            }
            this.setState({selectedSnapshot: snapshotId, disabledApps});
        },{snapshot:true});
    }

bids-validator

[![Node Tests](https://github.com/bids-standard/bids-validator/actions/workflows/node_tests.yml/badge.svg)](https://github.com/bids-standard/bids-validator/actions/workflows/node_tests.yml) [![bids-examples tests](https://github.com/bids-standard/bids-val

MIT
Latest version published 3 days ago

Package Health Score

79 / 100
Full package analysis

Similar packages