Git Product home page Git Product logo

Comments (3)

effigies avatar effigies commented on July 19, 2024 1

This is a feature request for the validator to introspect the assertions that it's enforcing and show the variables that led to the failure. We would need something like pytest's magic, which would be a significant undertaking.

Not to say we shouldn't do it, but this is a consequence of pushing logic into the schema so that there is less custom code for each issue in the validator.

from bids-validator.

yarikoptic avatar yarikoptic commented on July 19, 2024

could it be made explicit? e.g. (assuming that syntax for sets handling is added)

diff --git a/src/schema/rules/checks/dataset.yaml b/src/schema/rules/checks/dataset.yaml
index 91704d32..434fe2fc 100644
--- a/src/schema/rules/checks/dataset.yaml
+++ b/src/schema/rules/checks/dataset.yaml
@@ -11,7 +11,8 @@ SubjectFolders:
   selectors:
     - path == '/dataset_description.json'
   checks:
-    - length(dataset.subjects.sub_dirs) > 0
+    - check: length(dataset.subjects.sub_dirs) > 0
+      hint: length(dataset.subjects.sub_dirs)
 
 # 49
 ParticipantIDMismatch:
@@ -24,7 +25,8 @@ ParticipantIDMismatch:
   selectors:
     - path == '/participants.tsv'
   checks:
-    - allequal(sorted(columns.participant_id), sorted(dataset.subjects.sub_dirs))
+    - check: allequal(set(columns.participant_id), set(dataset.subjects.sub_dirs))
+      hint: set(columns.participant_id).difference(dataset.subjects.sub_dirs)
 
 # 51
 PhenotypeSubjectsMissing:

? although indeed while doing few of those I started to think about pytest's approach ;-)

edit: 1st example I did was quite dumb ;-)

from bids-validator.

effigies avatar effigies commented on July 19, 2024

Whoever implements this gets to decide whether it makes more sense to modify the schema to allow hints to be specified there or to do introspection.

Personally, I don't want to do either. If we do this, I would probably do it in the Python validator, since I've already written a parser for the expression language. With an AST, we will be able to easily introspect every check.

from bids-validator.

Related Issues (20)

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.