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

Request for a Python Variant of JS bids-validator

Open hjbockholt opened this issue 1 year ago • 4 comments

Our team frequently utilizes the JS bids-validator and appreciates its robust capabilities.

Given the increasing adoption of Python in the neuroimaging community and some challenges we face using the Node-based validator, we wonder if there's any consideration or roadmap for a Python-centric version of the bids-validator.

Specifically:

  • We find the process of installing node, executing it as a child process, and subsequently handling its results to be less than seamless.
  • The current validation mechanism in pybids, while functional, doesn't quite capture all intricacies, leading to issues when utilizing certain BIDS-apps.

While we're keen on the idea of a py-bids-validator, our team's resources might be stretched to take the lead. However, we're enthusiastic about contributing if such a project is initiated.

Thank you for considering this feedback.

hjbockholt avatar Oct 11 '23 14:10 hjbockholt

Just to make sure it is mentioned.

There is already a python library that can help do a "superficial" validation of bids filenames:

https://github.com/bids-standard/bids-validator/tree/master/bids-validator#python-library

https://pypi.org/project/bids-validator/

Also if Node installation is source of trouble but docker is not, consider using the docker image of the validator:

https://hub.docker.com/r/bids/validator

Remi-Gau avatar Oct 12 '23 06:10 Remi-Gau

We also have the start of a validator in the BIDS specification repository: https://github.com/bids-standard/bids-specification/blob/master/tools/schemacode/bidsschematools/validator.py

This is installed with the Python package bidsschematools. Right now, it's just a Python interface, and it only does filename validation. It's been written toward the DANDI archive's use for BIDS validation, so the API may need refinement to fit other use cases.

effigies avatar Oct 16 '23 18:10 effigies

Note that I've started scoping out a design in this doc:

https://demo.hedgedoc.org/s/yvkCVA3kh#

effigies avatar Dec 15 '23 15:12 effigies

Thank you, @effigies. Looking forward to this tool. Please let me know if you need help with testing, brainstorming, etc.

kabilar avatar Dec 15 '23 16:12 kabilar

Please see https://github.com/bids-standard/python-validator, which has been moved out of this repository.

Contributions are more than welcome, and I've begun fleshing out some more of the validator structures in https://github.com/bids-standard/python-validator/pull/2. It is currently a side-project for me, as the javascript validator is the most critical goal. I would be happy to discuss and hand off work with someone if they have the time and energy to put into it.

effigies avatar Aug 06 '24 15:08 effigies

Please see https://github.com/bids-standard/python-validator, which has been moved out of this repository.

Contributions are more than welcome, and I've begun fleshing out some more of the validator structures in bids-standard/python-validator#2. It is currently a side-project for me, as the javascript validator is the most critical goal. I would be happy to discuss and hand off work with someone if they have the time and energy to put into it.

probably worth making an "announcement" about this

Remi-Gau avatar Aug 06 '24 15:08 Remi-Gau

Sure. Where? bids-discussion? Or update the README?

effigies avatar Aug 06 '24 15:08 effigies

update the README

Let's start with this but I was thinking of a mini-blog post on the new bids website that we could then advertise in the mailing list, neurostars and social medias.

Maybe something that reminds people of the deno validator?

Remi-Gau avatar Aug 06 '24 15:08 Remi-Gau

Yeah, a blog post sounds good. It would be good to walk through the overall schema world:

v1.14.6

graph LR;
    subgraph bids-specification;
        markdown ---> specification
        schema --> bidsschematools --> specification & schema.json
    end
    subgraph "bids-validator @ v1.14.6";
        regex["filename patterns"] --> Node.js & python
        deno
    end

    specification -. interpreted .-> regex
    schema.json --> deno

v1.14.7

graph LR;
    subgraph bids-specification;
        markdown ---> specification
        schema --> bidsschematools --> specification & schema.json
    end
    subgraph "bids-validator @ v1.14.7";
        regex["filename patterns"] --> Node.js
        deno
        python
    end

    specification -. interpreted .-> regex
    schema.json --> deno
    bidsschematools --> python

v1.14.8+

graph LR;
    subgraph bids-specification;
        markdown ---> specification
        schema --> bidsschematools --> specification & schema.json
    end
    subgraph "bids-validator > v1.14.7";
        regex["filename patterns"] --> Node.js
        deno
    end
    subgraph "python-validator > v1.14.7";
        python
    end

    specification -. interpreted .-> regex
    schema.json --> deno
    bidsschematools ---> python

effigies avatar Aug 06 '24 15:08 effigies