Giter Site home page Giter Site logo

brainvision-validator's Introduction

brainvision-validator's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar sappelhoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

brainvision-validator's Issues

Use issue_list.js and integer issue codes

instead of specifying error strings in index.js and pushing them to the issues if a validator function returns false, do the following:

  • validator functions return integer codes
    • e.g., a 1 if a file was not read, a 2 if internal links were wrong, ...
  • the new issue_list.js exports a dictionary mapping these issue codes to issue messages
  • index.js gets the issue code, uses it to get the issue message ... and add that to the issues.

With that approach, a single validator function can potentially raise more than one issue. E.g. when checking for link consistency within the file triplet, it might happen that a file cannot be opened ... so we can return the more specific issue code 1

Add more validation checks

Add more checks in validator.js, put adequate tests into test_validator.js ... and then add these checks to the validateBrainVision function in index.js.

Some ideas:

  • check if file size of .eeg, .vmrk, .vhdr is adequately big
  • make sure .eeg is binary (e.g., using https://github.com/bevry/istextorbinary)
  • estimate filesize of .eeg using SamplingInterval and nChannels
  • check if files are readable
  • check if all mandatory sections are present, such as [Binary Infos], [Common Infos], ...
  • within the mandatory sections are all non-default fields present? Such as SamplingInterval
  • check the first line of vhdr: is it the header? --> which version of BrainVision format?
  • check that links (file pointers) are relative and do not contain idiosyncratic paths because that will make copying the files troublesome (e.g., not /home/stefan/Desktop/test.vhdr but simply test.vhdr)

the more sensible checks, the merrier.

Better to make them fine-grained, so that meaningful issue messages can be pushed in index.js

make utils.js

wrapping up repeated functions in a utils.js module

e.g.,
--> parsing sections and key-value pairs ... make available in dictionary like datatype

--> get all paths as a dictionary ... so "filepaths.vhdr" or "filepaths.eeg" ...

fix extracting index from unmatched regexp (=null)

x@y:~/Desktop/brainvision-validator/test/data$ brainvision-validator test.vmrk
/usr/lib/node_modules/brainvision-validator/validator.js:40
        var vmrkBaseName = vhdrContent.match(vmrkRe)[1];
                                                    ^

TypeError: Cannot read property '1' of null
    at Object.assertBVTriplet (/usr/lib/node_modules/brainvision-validator/validator.js:40:53)
    at validateBrainVision (/usr/lib/node_modules/brainvision-validator/index.js:25:38)
    at module.exports (/usr/lib/node_modules/brainvision-validator/cli.js:7:18)
    at Object.<anonymous> (/usr/lib/node_modules/brainvision-validator/bin/brainvision-validator:19:21)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)

check file links for correct format

check that links (file pointers) are relative and do not contain idiosyncratic paths because that will make copying the files troublesome (e.g., not /home/stefan/Desktop/test.vhdr but simply test.vhdr)

allow ignoring certain errors

within the command line, allow for an option that specifies an array of "keys" ... these keys map to certain issues to be ignored.

also requires that issue keys are printed together with the issue text upon validation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.