Overhauling validation results to get them closer to cover different types of validators#1514
Overhauling validation results to get them closer to cover different types of validators#1514yarikoptic merged 6 commits intomasterfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1514 +/- ##
==========================================
+ Coverage 88.54% 88.66% +0.11%
==========================================
Files 78 78
Lines 10872 10937 +65
==========================================
+ Hits 9627 9697 +70
+ Misses 1245 1240 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
In updating the use of Line 1122 in 45db66c Do we have a dandi standard? If we do, it doesn't seem that we version this standard. I think we should indeed define an enum class for the supported standard, and also talk about how to retrieve the version of those standards. |
dcb456e to
2df818f
Compare
b49f622 to
f9053b4
Compare
We now, with the latest commit, have a subclass of |
Per #1514 (comment) this request should be postponed for now
|
@yarikoptic I think a dandi-cli/dandi/files/bases.py Lines 193 to 217 in 386e50d The above snippet uses ValidationResult to represent an error other than a ValidationError. The captured error doesn't tell how valid a data instance is. It has nothing to do with the data being validated against but how our software is written. If that error is raised it is either a bug in the software, which should be propagated, or a user's mistake, which should be handled gracefully in another manner. The current arrangement is conflating error handling with the purpose of ValidationResult. Case in point, you can't provide the standard for the origin field in the above example.
Another misuse of dandi-cli/dandi/pynwb_utils.py Lines 404 to 427 in 386e50d The code snippet above also has other problems. For example, it suppresses errors. The problems should be fixed in an other dedicated PR though. |
b468eb1 to
b9563cc
Compare
46eb9d3 to
06e8fe8
Compare
d27cad7 to
a2cec1b
Compare
bd6b714 to
cb0ef16
Compare
This commit include the following changes to make `ValidationResult` a better representation of the result of a validation process. (In this message "models" is used to refer to `ValidationResult` and related models defined in `validate_types.py`. - Redefine the models as Pydantic models for easy serialization to JSON - Introduce `Enum` types for used in fields in the models. - Rename `ValidationOrigin` to `Origin` - Replace `ValidationOrigin.bids_version` to more generic `Origin.standard` + `Origin.standard_version` - Renamed `ValidationOrigin.name` to `Origin.validator` and ` ValidationOrigin.version` to `Origin.validator_version` - `Severity.HINT`, `Severity.WARNING`, and `Severity.ERROR` now have value of `20`, `30`, and `40` respectively instead of `1`, `2`, and `3`. - Introduce `Origin.type` to indicate the type of the origin of a validation result - Documentation in models are now expressed in triple-quoted strings - Correction in use of the models where appropriate. I.e. corrections in settings of the fields of `Origin` model instances Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
This is needed to support the syntax of `|` in expressing union types in Python 3.9. This has been needed long ago; however, the necessity only becomes apparent after `|` is used in Pydantic model definitions since Pydantic evaluate those types at runtime. Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
cb0ef16 to
5c12e8b
Compare
Bring in changes that remove deprecated uses of Pydantic
|
The Change from #1601 is merged. This PR is ready for a final review. |
yarikoptic
left a comment
There was a problem hiding this comment.
a few spots where to define local origin to be reused.
But also I wonder if generally we should pre-define all those origins so they get reused across all the paths. It smells a little as premature optimization to me though, so may be not worth it. But at least I think it is worth renaming them locally so they become a little more descriptive than just origin variables
c09cab4 to
1836ea2
Compare
The validations are done by the `dandi-cli` directly and should be label so.
1836ea2 to
cf401cd
Compare
|
This one is ready for a final review. |
yeah, better to be reanalyzed/improved. I think we burnt there a few times already |
| https://zarr-specs.readthedocs.io/en/latest/specs.html, used in the Zarr data | ||
| object | ||
| """ | ||
| import zarr # Delay heavy import |
There was a problem hiding this comment.
hm, apparently we have no single test on validation of zarrs? that's odd :-/
filed dedicated
for that
|
Thank you @candleindark , let's proceed with continuation in |
|
🚀 PR was released in |
Ref:
and result of our chat with @candleindark while also reviewing results of linkml validation over dandisets:
Notes/TODOs:
ValidationOrigin.bids_versionto more genericOrigin.standard+Origin.standard_versionValidationOrigin.nametoOrigin.validatorandValidationOrigin.versiontoOrigin.validator_versionSeverity.HINT,Severity.WARNING, andSeverity.ERRORnow have value of20,30, and40respectively instead of1,2, and3.Origin.typeto indicate the type of the origin of a validation result.ValidationResultmodel into a Pydantic model so that it is readily to serialization to JSON.redo Validation results refactoring: centralize results for different reused origins, use _pydantic_errors_to_validation_results more #1176 in herePlease see individual commit messages for more details of the change.
Note:
This PR needs the changes in #1601 to pass the tests. Rebase/merge with master once #1601 is merged into master.