vids-validator 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vids_validator-1.1.0/LICENSE +155 -0
- vids_validator-1.1.0/PKG-INFO +121 -0
- vids_validator-1.1.0/README.md +91 -0
- vids_validator-1.1.0/pyproject.toml +54 -0
- vids_validator-1.1.0/setup.cfg +4 -0
- vids_validator-1.1.0/src/vids_validator/__init__.py +15 -0
- vids_validator-1.1.0/src/vids_validator/__main__.py +4 -0
- vids_validator-1.1.0/src/vids_validator/validator.py +447 -0
- vids_validator-1.1.0/src/vids_validator.egg-info/PKG-INFO +121 -0
- vids_validator-1.1.0/src/vids_validator.egg-info/SOURCES.txt +11 -0
- vids_validator-1.1.0/src/vids_validator.egg-info/dependency_links.txt +1 -0
- vids_validator-1.1.0/src/vids_validator.egg-info/entry_points.txt +2 -0
- vids_validator-1.1.0/src/vids_validator.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by the
|
|
13
|
+
copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other
|
|
16
|
+
entities that control, are controlled by, or are under common control
|
|
17
|
+
with that entity. For the purposes of this definition, "control" means
|
|
18
|
+
(i) the power, direct or indirect, to cause the direction or management
|
|
19
|
+
of such entity, whether by contract or otherwise, or (ii) ownership of
|
|
20
|
+
fifty percent (50%) or more of the outstanding shares, or (iii)
|
|
21
|
+
beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
24
|
+
permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation source,
|
|
28
|
+
and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but not limited
|
|
32
|
+
to compiled object code, generated documentation, and conversions to
|
|
33
|
+
other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or Object
|
|
36
|
+
form, made available under the License, as indicated by a copyright
|
|
37
|
+
notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the original
|
|
45
|
+
version of the Work and any modifications or additions to that Work or
|
|
46
|
+
Derivative Works thereof, that is intentionally submitted to the
|
|
47
|
+
Licensor for inclusion in the Work by the copyright owner or by an
|
|
48
|
+
individual or Legal Entity authorized to submit on behalf of the
|
|
49
|
+
copyright owner.
|
|
50
|
+
|
|
51
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on
|
|
52
|
+
behalf of whom a Contribution has been received by the Licensor and
|
|
53
|
+
subsequently incorporated within the Work.
|
|
54
|
+
|
|
55
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
56
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
57
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright
|
|
58
|
+
license to reproduce, prepare Derivative Works of, publicly display,
|
|
59
|
+
publicly perform, sublicense, and distribute the Work and such Derivative
|
|
60
|
+
Works in Source or Object form.
|
|
61
|
+
|
|
62
|
+
3. Grant of Patent License. Subject to the terms and conditions of this
|
|
63
|
+
License, each Contributor hereby grants to You a perpetual, worldwide,
|
|
64
|
+
non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
|
|
65
|
+
this section) patent license to make, have made, use, offer to sell,
|
|
66
|
+
sell, import, and otherwise transfer the Work, where such license applies
|
|
67
|
+
only to those patent claims licensable by such Contributor that are
|
|
68
|
+
necessarily infringed by their Contribution(s) alone or by combination
|
|
69
|
+
of their Contribution(s) with the Work to which such Contribution(s) was
|
|
70
|
+
submitted.
|
|
71
|
+
|
|
72
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or
|
|
73
|
+
Derivative Works thereof in any medium, with or without modifications,
|
|
74
|
+
and in Source or Object form, provided that You meet the following
|
|
75
|
+
conditions:
|
|
76
|
+
|
|
77
|
+
(a) You must give any other recipients of the Work or Derivative Works
|
|
78
|
+
a copy of this License; and
|
|
79
|
+
|
|
80
|
+
(b) You must cause any modified files to carry prominent notices stating
|
|
81
|
+
that You changed the files; and
|
|
82
|
+
|
|
83
|
+
(c) You must retain, in the Source form of any Derivative Works that You
|
|
84
|
+
distribute, all copyright, patent, trademark, and attribution
|
|
85
|
+
notices from the Source form of the Work, excluding those notices
|
|
86
|
+
that do not pertain to any part of the Derivative Works; and
|
|
87
|
+
|
|
88
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
89
|
+
distribution, then any Derivative Works that You distribute must
|
|
90
|
+
include a readable copy of the attribution notices contained within
|
|
91
|
+
such NOTICE file, excluding any notices that do not pertain to any
|
|
92
|
+
part of the Derivative Works, in at least one of the following
|
|
93
|
+
places: within a NOTICE text file distributed as part of the
|
|
94
|
+
Derivative Works; within the Source form or documentation, if
|
|
95
|
+
provided along with the Derivative Works; or, within a display
|
|
96
|
+
generated by the Derivative Works, if and wherever such third-party
|
|
97
|
+
notices normally appear.
|
|
98
|
+
|
|
99
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any
|
|
100
|
+
Contribution intentionally submitted for inclusion in the Work by You to
|
|
101
|
+
the Licensor shall be under the terms and conditions of this License,
|
|
102
|
+
without any additional terms or conditions.
|
|
103
|
+
|
|
104
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
105
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
106
|
+
except as required for reasonable and customary use in describing the
|
|
107
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
108
|
+
|
|
109
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to
|
|
110
|
+
in writing, Licensor provides the Work (and each Contributor provides
|
|
111
|
+
its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
|
112
|
+
OF ANY KIND, either express or implied, including, without limitation,
|
|
113
|
+
any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY,
|
|
114
|
+
or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
|
|
115
|
+
determining the appropriateness of using or redistributing the Work and
|
|
116
|
+
assume any risks associated with Your exercise of permissions under this
|
|
117
|
+
License.
|
|
118
|
+
|
|
119
|
+
8. Limitation of Liability. In no event and under no legal theory, whether
|
|
120
|
+
in tort (including negligence), contract, or otherwise, unless required
|
|
121
|
+
by applicable law (such as deliberate and grossly negligent acts) or
|
|
122
|
+
agreed to in writing, shall any Contributor be liable to You for damages,
|
|
123
|
+
including any direct, indirect, special, incidental, or consequential
|
|
124
|
+
damages of any character arising as a result of this License or out of
|
|
125
|
+
the use or inability to use the Work (including but not limited to
|
|
126
|
+
damages for loss of goodwill, work stoppage, computer failure or
|
|
127
|
+
malfunction, or any and all other commercial damages or losses), even
|
|
128
|
+
if such Contributor has been advised of the possibility of such damages.
|
|
129
|
+
|
|
130
|
+
9. Accepting Warranty or Additional Liability. While redistributing the
|
|
131
|
+
Work or Derivative Works thereof, You may choose to offer, and charge a
|
|
132
|
+
fee for, acceptance of support, warranty, indemnity, or other liability
|
|
133
|
+
obligations and/or rights consistent with this License. However, in
|
|
134
|
+
accepting such obligations, You may act only on Your own behalf and on
|
|
135
|
+
Your sole responsibility, not on behalf of any other Contributor, and
|
|
136
|
+
only if You agree to indemnify, defend, and hold each Contributor
|
|
137
|
+
harmless for any liability incurred by, or claims asserted against, such
|
|
138
|
+
Contributor by reason of your accepting any such warranty or additional
|
|
139
|
+
liability.
|
|
140
|
+
|
|
141
|
+
END OF TERMS AND CONDITIONS
|
|
142
|
+
|
|
143
|
+
Copyright 2026 Princeton Medical Systems
|
|
144
|
+
|
|
145
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
146
|
+
you may not use this file except in compliance with the License.
|
|
147
|
+
You may obtain a copy of the License at
|
|
148
|
+
|
|
149
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
150
|
+
|
|
151
|
+
Unless required by applicable law or agreed to in writing, software
|
|
152
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
153
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
154
|
+
See the License for the specific language governing permissions and
|
|
155
|
+
limitations under the License.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vids-validator
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Reference validator for the VIDS (Verified Imaging Dataset Standard) specification
|
|
5
|
+
Author-email: Princeton Medical Systems <standards@vidsstandard.org>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/vids-standard/vids-standard
|
|
8
|
+
Project-URL: Documentation, https://github.com/vids-standard/vids-standard/blob/main/SPEC.md
|
|
9
|
+
Project-URL: Repository, https://github.com/vids-standard/vids-standard
|
|
10
|
+
Project-URL: Issues, https://github.com/vids-standard/vids-standard/issues
|
|
11
|
+
Keywords: medical-imaging,dataset-validation,DICOM,NIfTI,BIDS,annotation,provenance,radiology,AI,machine-learning
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
25
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
26
|
+
Requires-Python: >=3.8
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# VIDS Validator
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/vids-validator/)
|
|
34
|
+
[](https://pypi.org/project/vids-validator/)
|
|
35
|
+
[](https://github.com/vids-standard/vids-standard/blob/main/LICENSE-TOOLS)
|
|
36
|
+
|
|
37
|
+
Reference validator for the **[VIDS (Verified Imaging Dataset Standard)](https://github.com/vids-standard/vids-standard)** specification.
|
|
38
|
+
|
|
39
|
+
Zero dependencies. Python 3.8+. One command.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install vids-validator
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Command line
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Validate a dataset (auto-detects profile from .vids marker)
|
|
53
|
+
vids-validate /path/to/dataset
|
|
54
|
+
|
|
55
|
+
# Explicit Full profile validation
|
|
56
|
+
vids-validate /path/to/dataset --profile full
|
|
57
|
+
|
|
58
|
+
# JSON output (for CI pipelines)
|
|
59
|
+
vids-validate /path/to/dataset --json
|
|
60
|
+
|
|
61
|
+
# Save report to file
|
|
62
|
+
vids-validate /path/to/dataset --output report.json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Python API
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from vids_validator import VIDSValidator
|
|
69
|
+
|
|
70
|
+
validator = VIDSValidator("/path/to/dataset", profile="auto")
|
|
71
|
+
report = validator.validate()
|
|
72
|
+
|
|
73
|
+
print(report["Summary"]["Status"]) # "PASS" or "FAIL"
|
|
74
|
+
print(report["Summary"]["Passed"]) # number of rules passed
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### As a module
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python -m vids_validator /path/to/dataset
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## What it checks
|
|
84
|
+
|
|
85
|
+
21 validation rules across 6 categories:
|
|
86
|
+
|
|
87
|
+
| Category | Rules | Scope |
|
|
88
|
+
|----------|-------|-------|
|
|
89
|
+
| Structure (S001–S006) | `.vids` marker, `dataset_description.json`, participants, README, subject/session dirs | All profiles |
|
|
90
|
+
| Imaging (I001–I004) | NIfTI files, sidecar JSONs, valid JSON, naming convention | All profiles |
|
|
91
|
+
| Annotation (A001–A005) | Annotation directory, segmentation files, sidecars, provenance fields | All profiles |
|
|
92
|
+
| Quality (Q001–Q003) | Quality directory, quality summary, annotation agreement | Full only |
|
|
93
|
+
| ML (M001–M002) | ML directory, splits.json | Full only |
|
|
94
|
+
| Metadata (D001) | CHANGES.md | All (WARN) |
|
|
95
|
+
|
|
96
|
+
A dataset is **compliant** if and only if zero rules have FAIL status.
|
|
97
|
+
|
|
98
|
+
## Profiles
|
|
99
|
+
|
|
100
|
+
- **POC** (15 rules) — quick prototypes, pilots, internal research
|
|
101
|
+
- **Full** (21 rules) — production, publications, regulatory submissions
|
|
102
|
+
|
|
103
|
+
The profile is declared in the `.vids` marker file at the dataset root.
|
|
104
|
+
|
|
105
|
+
## Exit codes
|
|
106
|
+
|
|
107
|
+
- `0` — validation passed
|
|
108
|
+
- `1` — validation failed
|
|
109
|
+
|
|
110
|
+
## Links
|
|
111
|
+
|
|
112
|
+
- [VIDS Specification](https://github.com/vids-standard/vids-standard/blob/main/SPEC.md)
|
|
113
|
+
- [Validation Rules](https://github.com/vids-standard/vids-standard/blob/main/VALIDATION_RULES.md)
|
|
114
|
+
- [Example Datasets](https://github.com/vids-standard/vids-standard/blob/main/EXAMPLES.md)
|
|
115
|
+
- [Contributing](https://github.com/vids-standard/vids-standard/blob/main/CONTRIBUTING.md)
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
Apache License 2.0 — see [LICENSE](https://github.com/vids-standard/vids-standard/blob/main/LICENSE-TOOLS).
|
|
120
|
+
|
|
121
|
+
VIDS was created by [Princeton Medical Systems](https://princetonmed.systems) and is maintained as an open community standard.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# VIDS Validator
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/vids-validator/)
|
|
4
|
+
[](https://pypi.org/project/vids-validator/)
|
|
5
|
+
[](https://github.com/vids-standard/vids-standard/blob/main/LICENSE-TOOLS)
|
|
6
|
+
|
|
7
|
+
Reference validator for the **[VIDS (Verified Imaging Dataset Standard)](https://github.com/vids-standard/vids-standard)** specification.
|
|
8
|
+
|
|
9
|
+
Zero dependencies. Python 3.8+. One command.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install vids-validator
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Command line
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Validate a dataset (auto-detects profile from .vids marker)
|
|
23
|
+
vids-validate /path/to/dataset
|
|
24
|
+
|
|
25
|
+
# Explicit Full profile validation
|
|
26
|
+
vids-validate /path/to/dataset --profile full
|
|
27
|
+
|
|
28
|
+
# JSON output (for CI pipelines)
|
|
29
|
+
vids-validate /path/to/dataset --json
|
|
30
|
+
|
|
31
|
+
# Save report to file
|
|
32
|
+
vids-validate /path/to/dataset --output report.json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Python API
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from vids_validator import VIDSValidator
|
|
39
|
+
|
|
40
|
+
validator = VIDSValidator("/path/to/dataset", profile="auto")
|
|
41
|
+
report = validator.validate()
|
|
42
|
+
|
|
43
|
+
print(report["Summary"]["Status"]) # "PASS" or "FAIL"
|
|
44
|
+
print(report["Summary"]["Passed"]) # number of rules passed
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### As a module
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python -m vids_validator /path/to/dataset
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## What it checks
|
|
54
|
+
|
|
55
|
+
21 validation rules across 6 categories:
|
|
56
|
+
|
|
57
|
+
| Category | Rules | Scope |
|
|
58
|
+
|----------|-------|-------|
|
|
59
|
+
| Structure (S001–S006) | `.vids` marker, `dataset_description.json`, participants, README, subject/session dirs | All profiles |
|
|
60
|
+
| Imaging (I001–I004) | NIfTI files, sidecar JSONs, valid JSON, naming convention | All profiles |
|
|
61
|
+
| Annotation (A001–A005) | Annotation directory, segmentation files, sidecars, provenance fields | All profiles |
|
|
62
|
+
| Quality (Q001–Q003) | Quality directory, quality summary, annotation agreement | Full only |
|
|
63
|
+
| ML (M001–M002) | ML directory, splits.json | Full only |
|
|
64
|
+
| Metadata (D001) | CHANGES.md | All (WARN) |
|
|
65
|
+
|
|
66
|
+
A dataset is **compliant** if and only if zero rules have FAIL status.
|
|
67
|
+
|
|
68
|
+
## Profiles
|
|
69
|
+
|
|
70
|
+
- **POC** (15 rules) — quick prototypes, pilots, internal research
|
|
71
|
+
- **Full** (21 rules) — production, publications, regulatory submissions
|
|
72
|
+
|
|
73
|
+
The profile is declared in the `.vids` marker file at the dataset root.
|
|
74
|
+
|
|
75
|
+
## Exit codes
|
|
76
|
+
|
|
77
|
+
- `0` — validation passed
|
|
78
|
+
- `1` — validation failed
|
|
79
|
+
|
|
80
|
+
## Links
|
|
81
|
+
|
|
82
|
+
- [VIDS Specification](https://github.com/vids-standard/vids-standard/blob/main/SPEC.md)
|
|
83
|
+
- [Validation Rules](https://github.com/vids-standard/vids-standard/blob/main/VALIDATION_RULES.md)
|
|
84
|
+
- [Example Datasets](https://github.com/vids-standard/vids-standard/blob/main/EXAMPLES.md)
|
|
85
|
+
- [Contributing](https://github.com/vids-standard/vids-standard/blob/main/CONTRIBUTING.md)
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
Apache License 2.0 — see [LICENSE](https://github.com/vids-standard/vids-standard/blob/main/LICENSE-TOOLS).
|
|
90
|
+
|
|
91
|
+
VIDS was created by [Princeton Medical Systems](https://princetonmed.systems) and is maintained as an open community standard.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vids-validator"
|
|
7
|
+
version = "1.1.0"
|
|
8
|
+
description = "Reference validator for the VIDS (Verified Imaging Dataset Standard) specification"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Princeton Medical Systems", email = "standards@vidsstandard.org"},
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"medical-imaging",
|
|
17
|
+
"dataset-validation",
|
|
18
|
+
"DICOM",
|
|
19
|
+
"NIfTI",
|
|
20
|
+
"BIDS",
|
|
21
|
+
"annotation",
|
|
22
|
+
"provenance",
|
|
23
|
+
"radiology",
|
|
24
|
+
"AI",
|
|
25
|
+
"machine-learning",
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 5 - Production/Stable",
|
|
29
|
+
"Intended Audience :: Science/Research",
|
|
30
|
+
"Intended Audience :: Healthcare Industry",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
"Programming Language :: Python :: 3",
|
|
34
|
+
"Programming Language :: Python :: 3.8",
|
|
35
|
+
"Programming Language :: Python :: 3.9",
|
|
36
|
+
"Programming Language :: Python :: 3.10",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
40
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
41
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/vids-standard/vids-standard"
|
|
46
|
+
Documentation = "https://github.com/vids-standard/vids-standard/blob/main/SPEC.md"
|
|
47
|
+
Repository = "https://github.com/vids-standard/vids-standard"
|
|
48
|
+
Issues = "https://github.com/vids-standard/vids-standard/issues"
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
vids-validate = "vids_validator:main"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["src"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
VIDS Validator — Reference validator for the Verified Imaging Dataset Standard.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
CLI: vids-validate /path/to/dataset
|
|
6
|
+
CLI (JSON): vids-validate /path/to/dataset --json
|
|
7
|
+
Python: from vids_validator import VIDSValidator
|
|
8
|
+
|
|
9
|
+
Zero dependencies beyond the Python standard library.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from .validator import VIDSValidator, print_report, main
|
|
13
|
+
|
|
14
|
+
__version__ = "1.1.0"
|
|
15
|
+
__all__ = ["VIDSValidator", "print_report", "main", "__version__"]
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
VIDS Unified Validator - 21-Rule Compliance Check
|
|
4
|
+
Validates a dataset against the full VIDS specification.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python validate_vids.py /path/to/dataset
|
|
8
|
+
python validate_vids.py /path/to/dataset --profile full
|
|
9
|
+
python validate_vids.py /path/to/dataset --json
|
|
10
|
+
python validate_vids.py /path/to/dataset --fix (auto-fix minor issues)
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import sys
|
|
15
|
+
import argparse
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import List, Dict, Optional
|
|
18
|
+
from datetime import datetime, timezone
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class VIDSValidator:
|
|
22
|
+
"""Validates a dataset against the VIDS specification."""
|
|
23
|
+
|
|
24
|
+
RULES = [
|
|
25
|
+
# Structure rules (S001-S006)
|
|
26
|
+
('S001', 'vids_marker', '.vids marker file exists'),
|
|
27
|
+
('S002', 'dataset_description', 'dataset_description.json exists and valid'),
|
|
28
|
+
('S003', 'participants_file', 'participants.json or .tsv exists'),
|
|
29
|
+
('S004', 'readme_exists', 'README.md exists'),
|
|
30
|
+
('S005', 'subject_directories', 'Subject directories follow sub-XXX pattern'),
|
|
31
|
+
('S006', 'session_directories', 'Session directories follow ses-XXX pattern'),
|
|
32
|
+
# Imaging rules (I001-I004)
|
|
33
|
+
('I001', 'imaging_files', 'Imaging NIfTI files present for each subject'),
|
|
34
|
+
('I002', 'imaging_sidecars', 'Imaging sidecar JSON files present'),
|
|
35
|
+
('I003', 'imaging_json_valid', 'Imaging sidecar JSONs are valid'),
|
|
36
|
+
('I004', 'filename_convention', 'Files follow VIDS naming convention'),
|
|
37
|
+
# Annotation rules (A001-A005)
|
|
38
|
+
('A001', 'annotation_directory', 'derivatives/annotations/ exists'),
|
|
39
|
+
('A002', 'annotation_files', 'Segmentation files present for annotated subjects'),
|
|
40
|
+
('A003', 'annotation_sidecars', 'Annotation sidecar JSONs present'),
|
|
41
|
+
('A004', 'annotation_json_valid', 'Annotation JSONs valid and contain required fields'),
|
|
42
|
+
('A005', 'provenance_complete', 'Provenance fields populated (Annotator, Tool, Date)'),
|
|
43
|
+
# Quality rules (Q001-Q003) - Full profile only
|
|
44
|
+
('Q001', 'quality_directory', 'quality/ directory exists (Full profile)'),
|
|
45
|
+
('Q002', 'quality_summary', 'quality_summary.json present (Full profile)'),
|
|
46
|
+
('Q003', 'annotation_agreement', 'annotation_agreement.json present (Full profile)'),
|
|
47
|
+
# ML rules (M001-M002) - Full profile only
|
|
48
|
+
('M001', 'ml_directory', 'ml/ directory exists (Full profile)'),
|
|
49
|
+
('M002', 'ml_splits', 'ml/splits.json present (Full profile)'),
|
|
50
|
+
# Metadata rules (D001)
|
|
51
|
+
('D001', 'changes_file', 'CHANGES.md exists'),
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
def __init__(self, dataset_path: str, profile: str = 'auto'):
|
|
55
|
+
self.dataset_path = Path(dataset_path).resolve()
|
|
56
|
+
self.profile = profile
|
|
57
|
+
self.results = []
|
|
58
|
+
self.errors = []
|
|
59
|
+
self.warnings = []
|
|
60
|
+
self.subjects = []
|
|
61
|
+
|
|
62
|
+
def detect_profile(self) -> str:
|
|
63
|
+
"""Auto-detect profile from .vids marker."""
|
|
64
|
+
marker = self.dataset_path / '.vids'
|
|
65
|
+
if marker.exists():
|
|
66
|
+
content = marker.read_text()
|
|
67
|
+
if 'full' in content.lower():
|
|
68
|
+
return 'full'
|
|
69
|
+
if 'poc' in content.lower():
|
|
70
|
+
return 'poc'
|
|
71
|
+
return 'poc' # default
|
|
72
|
+
|
|
73
|
+
def _pass(self, rule_id: str, message: str):
|
|
74
|
+
self.results.append({'rule': rule_id, 'status': 'PASS', 'message': message})
|
|
75
|
+
|
|
76
|
+
def _fail(self, rule_id: str, message: str):
|
|
77
|
+
self.results.append({'rule': rule_id, 'status': 'FAIL', 'message': message})
|
|
78
|
+
self.errors.append(f"{rule_id}: {message}")
|
|
79
|
+
|
|
80
|
+
def _warn(self, rule_id: str, message: str):
|
|
81
|
+
self.results.append({'rule': rule_id, 'status': 'WARN', 'message': message})
|
|
82
|
+
self.warnings.append(f"{rule_id}: {message}")
|
|
83
|
+
|
|
84
|
+
def _skip(self, rule_id: str, message: str):
|
|
85
|
+
self.results.append({'rule': rule_id, 'status': 'SKIP', 'message': message})
|
|
86
|
+
|
|
87
|
+
def _load_json(self, path: Path) -> Optional[dict]:
|
|
88
|
+
try:
|
|
89
|
+
with open(path) as f:
|
|
90
|
+
return json.load(f)
|
|
91
|
+
except Exception:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
# ── Structure Rules ─────────────────────────────────────
|
|
95
|
+
def check_vids_marker(self):
|
|
96
|
+
if (self.dataset_path / '.vids').exists():
|
|
97
|
+
self._pass('S001', '.vids marker file present')
|
|
98
|
+
else:
|
|
99
|
+
self._fail('S001', '.vids marker file missing')
|
|
100
|
+
|
|
101
|
+
def check_dataset_description(self):
|
|
102
|
+
p = self.dataset_path / 'dataset_description.json'
|
|
103
|
+
if not p.exists():
|
|
104
|
+
self._fail('S002', 'dataset_description.json missing')
|
|
105
|
+
return
|
|
106
|
+
data = self._load_json(p)
|
|
107
|
+
if data is None:
|
|
108
|
+
self._fail('S002', 'dataset_description.json is not valid JSON')
|
|
109
|
+
return
|
|
110
|
+
# Spec-aligned required fields (VIDS v1.0)
|
|
111
|
+
required = ['Name', 'VIDSVersion', 'DatasetVersion', 'License', 'Description', 'Authors']
|
|
112
|
+
missing = [f for f in required if f not in data]
|
|
113
|
+
if missing:
|
|
114
|
+
self._fail('S002', f"dataset_description.json missing fields: {', '.join(missing)}")
|
|
115
|
+
else:
|
|
116
|
+
self._pass('S002', 'dataset_description.json valid')
|
|
117
|
+
|
|
118
|
+
def check_participants_file(self):
|
|
119
|
+
has_json = (self.dataset_path / 'participants.json').exists()
|
|
120
|
+
has_tsv = (self.dataset_path / 'participants.tsv').exists()
|
|
121
|
+
if has_json or has_tsv:
|
|
122
|
+
self._pass('S003', f"Participants file present ({'json' if has_json else 'tsv'})")
|
|
123
|
+
else:
|
|
124
|
+
self._fail('S003', 'No participants.json or participants.tsv')
|
|
125
|
+
|
|
126
|
+
def check_readme_exists(self):
|
|
127
|
+
if (self.dataset_path / 'README.md').exists():
|
|
128
|
+
self._pass('S004', 'README.md present')
|
|
129
|
+
else:
|
|
130
|
+
self._fail('S004', 'README.md missing')
|
|
131
|
+
|
|
132
|
+
def check_subject_directories(self):
|
|
133
|
+
self.subjects = sorted([d for d in self.dataset_path.glob('sub-*') if d.is_dir()])
|
|
134
|
+
if self.subjects:
|
|
135
|
+
self._pass('S005', f'{len(self.subjects)} subject directories found')
|
|
136
|
+
else:
|
|
137
|
+
self._fail('S005', 'No subject directories (sub-*) found')
|
|
138
|
+
|
|
139
|
+
def check_session_directories(self):
|
|
140
|
+
if not self.subjects:
|
|
141
|
+
self._skip('S006', 'No subjects to check')
|
|
142
|
+
return
|
|
143
|
+
bad = []
|
|
144
|
+
for subj in self.subjects:
|
|
145
|
+
sessions = [d for d in subj.glob('ses-*') if d.is_dir()]
|
|
146
|
+
if not sessions:
|
|
147
|
+
bad.append(subj.name)
|
|
148
|
+
if bad:
|
|
149
|
+
self._fail('S006', f"{len(bad)} subjects missing session dirs: {', '.join(bad[:5])}")
|
|
150
|
+
else:
|
|
151
|
+
self._pass('S006', 'All subjects have session directories')
|
|
152
|
+
|
|
153
|
+
# ── Imaging Rules ───────────────────────────────────────
|
|
154
|
+
def check_imaging_files(self):
|
|
155
|
+
if not self.subjects:
|
|
156
|
+
self._skip('I001', 'No subjects')
|
|
157
|
+
return
|
|
158
|
+
missing = []
|
|
159
|
+
for subj in self.subjects:
|
|
160
|
+
nifti = list(subj.rglob('*_img.nii.gz')) + list(subj.rglob('*_img.nii'))
|
|
161
|
+
if not nifti:
|
|
162
|
+
missing.append(subj.name)
|
|
163
|
+
if missing:
|
|
164
|
+
self._fail('I001', f"{len(missing)} subjects missing imaging files: {', '.join(missing[:5])}")
|
|
165
|
+
else:
|
|
166
|
+
self._pass('I001', 'All subjects have imaging files')
|
|
167
|
+
|
|
168
|
+
def check_imaging_sidecars(self):
|
|
169
|
+
if not self.subjects:
|
|
170
|
+
self._skip('I002', 'No subjects')
|
|
171
|
+
return
|
|
172
|
+
missing = []
|
|
173
|
+
for subj in self.subjects:
|
|
174
|
+
jsons = list(subj.rglob('*_img.json'))
|
|
175
|
+
if not jsons:
|
|
176
|
+
missing.append(subj.name)
|
|
177
|
+
if missing:
|
|
178
|
+
self._fail('I002', f"{len(missing)} subjects missing imaging sidecar JSONs")
|
|
179
|
+
else:
|
|
180
|
+
self._pass('I002', 'All subjects have imaging sidecar JSONs')
|
|
181
|
+
|
|
182
|
+
def check_imaging_json_valid(self):
|
|
183
|
+
all_jsons = []
|
|
184
|
+
for subj in self.subjects:
|
|
185
|
+
all_jsons.extend(subj.rglob('*_img.json'))
|
|
186
|
+
if not all_jsons:
|
|
187
|
+
self._skip('I003', 'No imaging JSONs to validate')
|
|
188
|
+
return
|
|
189
|
+
invalid = []
|
|
190
|
+
for jf in all_jsons:
|
|
191
|
+
if self._load_json(jf) is None:
|
|
192
|
+
invalid.append(str(jf.relative_to(self.dataset_path)))
|
|
193
|
+
if invalid:
|
|
194
|
+
self._fail('I003', f"{len(invalid)} invalid imaging JSONs: {', '.join(invalid[:3])}")
|
|
195
|
+
else:
|
|
196
|
+
self._pass('I003', f'{len(all_jsons)} imaging JSONs valid')
|
|
197
|
+
|
|
198
|
+
def check_filename_convention(self):
|
|
199
|
+
if not self.subjects:
|
|
200
|
+
self._skip('I004', 'No subjects')
|
|
201
|
+
return
|
|
202
|
+
bad = []
|
|
203
|
+
for subj in self.subjects:
|
|
204
|
+
for nifti in subj.rglob('*.nii.gz'):
|
|
205
|
+
name = nifti.stem.replace('.nii', '')
|
|
206
|
+
if not name.startswith('sub-'):
|
|
207
|
+
bad.append(str(nifti.relative_to(self.dataset_path)))
|
|
208
|
+
if bad:
|
|
209
|
+
self._warn('I004', f"{len(bad)} files don't follow naming convention: {', '.join(bad[:3])}")
|
|
210
|
+
else:
|
|
211
|
+
self._pass('I004', 'All files follow VIDS naming convention')
|
|
212
|
+
|
|
213
|
+
# ── Annotation Rules ────────────────────────────────────
|
|
214
|
+
def check_annotation_directory(self):
|
|
215
|
+
if (self.dataset_path / 'derivatives' / 'annotations').is_dir():
|
|
216
|
+
self._pass('A001', 'derivatives/annotations/ exists')
|
|
217
|
+
else:
|
|
218
|
+
self._fail('A001', 'derivatives/annotations/ missing')
|
|
219
|
+
|
|
220
|
+
def check_annotation_files(self):
|
|
221
|
+
annot_root = self.dataset_path / 'derivatives' / 'annotations'
|
|
222
|
+
if not annot_root.is_dir():
|
|
223
|
+
self._skip('A002', 'No annotations directory')
|
|
224
|
+
return
|
|
225
|
+
segs = list(annot_root.rglob('*_seg.nii.gz')) + list(annot_root.rglob('*_seg.nii'))
|
|
226
|
+
if segs:
|
|
227
|
+
self._pass('A002', f'{len(segs)} segmentation files found')
|
|
228
|
+
else:
|
|
229
|
+
self._fail('A002', 'No segmentation files in derivatives/annotations/')
|
|
230
|
+
|
|
231
|
+
def check_annotation_sidecars(self):
|
|
232
|
+
annot_root = self.dataset_path / 'derivatives' / 'annotations'
|
|
233
|
+
if not annot_root.is_dir():
|
|
234
|
+
self._skip('A003', 'No annotations directory')
|
|
235
|
+
return
|
|
236
|
+
jsons = list(annot_root.rglob('*_seg.json'))
|
|
237
|
+
if jsons:
|
|
238
|
+
self._pass('A003', f'{len(jsons)} annotation sidecar JSONs found')
|
|
239
|
+
else:
|
|
240
|
+
self._fail('A003', 'No annotation sidecar JSONs found')
|
|
241
|
+
|
|
242
|
+
def check_annotation_json_valid(self):
|
|
243
|
+
annot_root = self.dataset_path / 'derivatives' / 'annotations'
|
|
244
|
+
if not annot_root.is_dir():
|
|
245
|
+
self._skip('A004', 'No annotations directory')
|
|
246
|
+
return
|
|
247
|
+
jsons = list(annot_root.rglob('*_seg.json'))
|
|
248
|
+
invalid = []
|
|
249
|
+
missing_fields = []
|
|
250
|
+
for jf in jsons:
|
|
251
|
+
data = self._load_json(jf)
|
|
252
|
+
if data is None:
|
|
253
|
+
invalid.append(jf.name)
|
|
254
|
+
elif 'VIDSVersion' not in data:
|
|
255
|
+
missing_fields.append(jf.name)
|
|
256
|
+
if invalid:
|
|
257
|
+
self._fail('A004', f"{len(invalid)} invalid annotation JSONs")
|
|
258
|
+
elif missing_fields:
|
|
259
|
+
self._fail('A004', f"{len(missing_fields)} JSONs missing VIDSVersion")
|
|
260
|
+
elif jsons:
|
|
261
|
+
self._pass('A004', f'{len(jsons)} annotation JSONs valid')
|
|
262
|
+
else:
|
|
263
|
+
self._skip('A004', 'No annotation JSONs to check')
|
|
264
|
+
|
|
265
|
+
def check_provenance_complete(self):
|
|
266
|
+
annot_root = self.dataset_path / 'derivatives' / 'annotations'
|
|
267
|
+
if not annot_root.is_dir():
|
|
268
|
+
self._skip('A005', 'No annotations directory')
|
|
269
|
+
return
|
|
270
|
+
jsons = list(annot_root.rglob('*_seg.json'))
|
|
271
|
+
incomplete = []
|
|
272
|
+
for jf in jsons:
|
|
273
|
+
data = self._load_json(jf)
|
|
274
|
+
if data is None:
|
|
275
|
+
continue
|
|
276
|
+
prov = data.get('Provenance', {})
|
|
277
|
+
if not isinstance(prov, dict):
|
|
278
|
+
incomplete.append(jf.name)
|
|
279
|
+
continue
|
|
280
|
+
annotator = prov.get('Annotator', {})
|
|
281
|
+
process = prov.get('AnnotationProcess', {})
|
|
282
|
+
if not annotator.get('ID') and not annotator.get('Name'):
|
|
283
|
+
incomplete.append(jf.name)
|
|
284
|
+
elif not process.get('Date') and not process.get('Tool'):
|
|
285
|
+
incomplete.append(jf.name)
|
|
286
|
+
if incomplete:
|
|
287
|
+
self._fail('A005', f"{len(incomplete)} files with incomplete provenance: {', '.join(incomplete[:3])}")
|
|
288
|
+
elif jsons:
|
|
289
|
+
self._pass('A005', 'All annotations have complete provenance')
|
|
290
|
+
else:
|
|
291
|
+
self._skip('A005', 'No annotations to check')
|
|
292
|
+
|
|
293
|
+
# ── Quality Rules (Full profile only) ───────────────────
|
|
294
|
+
def check_quality_directory(self):
|
|
295
|
+
if self.profile != 'full':
|
|
296
|
+
self._skip('Q001', 'POC profile — quality/ optional')
|
|
297
|
+
return
|
|
298
|
+
if (self.dataset_path / 'quality').is_dir():
|
|
299
|
+
self._pass('Q001', 'quality/ directory exists')
|
|
300
|
+
else:
|
|
301
|
+
self._fail('Q001', 'quality/ directory missing (required for Full profile)')
|
|
302
|
+
|
|
303
|
+
def check_quality_summary(self):
|
|
304
|
+
if self.profile != 'full':
|
|
305
|
+
self._skip('Q002', 'POC profile — quality_summary optional')
|
|
306
|
+
return
|
|
307
|
+
if (self.dataset_path / 'quality' / 'quality_summary.json').exists():
|
|
308
|
+
self._pass('Q002', 'quality_summary.json present')
|
|
309
|
+
else:
|
|
310
|
+
self._fail('Q002', 'quality/quality_summary.json missing')
|
|
311
|
+
|
|
312
|
+
def check_annotation_agreement(self):
|
|
313
|
+
if self.profile != 'full':
|
|
314
|
+
self._skip('Q003', 'POC profile — annotation_agreement optional')
|
|
315
|
+
return
|
|
316
|
+
if (self.dataset_path / 'quality' / 'annotation_agreement.json').exists():
|
|
317
|
+
self._pass('Q003', 'annotation_agreement.json present')
|
|
318
|
+
else:
|
|
319
|
+
self._fail('Q003', 'quality/annotation_agreement.json missing')
|
|
320
|
+
|
|
321
|
+
# ── ML Rules (Full profile only) ────────────────────────
|
|
322
|
+
def check_ml_directory(self):
|
|
323
|
+
if self.profile != 'full':
|
|
324
|
+
self._skip('M001', 'POC profile — ml/ optional')
|
|
325
|
+
return
|
|
326
|
+
if (self.dataset_path / 'ml').is_dir():
|
|
327
|
+
self._pass('M001', 'ml/ directory exists')
|
|
328
|
+
else:
|
|
329
|
+
self._fail('M001', 'ml/ directory missing (required for Full profile)')
|
|
330
|
+
|
|
331
|
+
def check_ml_splits(self):
|
|
332
|
+
if self.profile != 'full':
|
|
333
|
+
self._skip('M002', 'POC profile — splits optional')
|
|
334
|
+
return
|
|
335
|
+
if (self.dataset_path / 'ml' / 'splits.json').exists():
|
|
336
|
+
self._pass('M002', 'ml/splits.json present')
|
|
337
|
+
else:
|
|
338
|
+
self._fail('M002', 'ml/splits.json missing')
|
|
339
|
+
|
|
340
|
+
# ── Metadata Rules ──────────────────────────────────────
|
|
341
|
+
def check_changes_file(self):
|
|
342
|
+
if (self.dataset_path / 'CHANGES.md').exists():
|
|
343
|
+
self._pass('D001', 'CHANGES.md present')
|
|
344
|
+
else:
|
|
345
|
+
self._warn('D001', 'CHANGES.md missing (recommended)')
|
|
346
|
+
|
|
347
|
+
# ── Runner ──────────────────────────────────────────────
|
|
348
|
+
def validate(self) -> Dict:
|
|
349
|
+
"""Run all 21 validation rules."""
|
|
350
|
+
if self.profile == 'auto':
|
|
351
|
+
self.profile = self.detect_profile()
|
|
352
|
+
|
|
353
|
+
for rule_id, method_name, description in self.RULES:
|
|
354
|
+
method = getattr(self, f'check_{method_name}', None)
|
|
355
|
+
if method:
|
|
356
|
+
try:
|
|
357
|
+
method()
|
|
358
|
+
except Exception as e:
|
|
359
|
+
self._fail(rule_id, f'Validator error: {e}')
|
|
360
|
+
|
|
361
|
+
passed = sum(1 for r in self.results if r['status'] == 'PASS')
|
|
362
|
+
failed = sum(1 for r in self.results if r['status'] == 'FAIL')
|
|
363
|
+
warned = sum(1 for r in self.results if r['status'] == 'WARN')
|
|
364
|
+
skipped = sum(1 for r in self.results if r['status'] == 'SKIP')
|
|
365
|
+
|
|
366
|
+
return {
|
|
367
|
+
'VIDSVersion': '1.0',
|
|
368
|
+
'ValidatorVersion': '1.1',
|
|
369
|
+
'DatasetPath': str(self.dataset_path),
|
|
370
|
+
'Profile': self.profile,
|
|
371
|
+
'ValidationDate': datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'),
|
|
372
|
+
'Summary': {
|
|
373
|
+
'TotalRules': len(self.RULES),
|
|
374
|
+
'Passed': passed,
|
|
375
|
+
'Failed': failed,
|
|
376
|
+
'Warnings': warned,
|
|
377
|
+
'Skipped': skipped,
|
|
378
|
+
'Status': 'PASS' if failed == 0 else 'FAIL'
|
|
379
|
+
},
|
|
380
|
+
'Results': self.results,
|
|
381
|
+
'Errors': self.errors,
|
|
382
|
+
'Warnings': self.warnings
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def print_report(report: Dict):
|
|
387
|
+
"""Print formatted validation report."""
|
|
388
|
+
summary = report['Summary']
|
|
389
|
+
status = summary['Status']
|
|
390
|
+
|
|
391
|
+
print(f"\n{'='*60}")
|
|
392
|
+
print(f"VIDS Validation Report")
|
|
393
|
+
print(f"Profile: {report['Profile'].upper()}")
|
|
394
|
+
print(f"Dataset: {report['DatasetPath']}")
|
|
395
|
+
print(f"{'='*60}\n")
|
|
396
|
+
|
|
397
|
+
status_icons = {'PASS': '✅', 'FAIL': '❌', 'WARN': '⚠️ ', 'SKIP': '⏭ '}
|
|
398
|
+
|
|
399
|
+
for r in report['Results']:
|
|
400
|
+
icon = status_icons.get(r['status'], '?')
|
|
401
|
+
print(f" {icon} {r['rule']}: {r['message']}")
|
|
402
|
+
|
|
403
|
+
print(f"\n{'-'*60}")
|
|
404
|
+
print(f" Passed: {summary['Passed']}")
|
|
405
|
+
print(f" Failed: {summary['Failed']}")
|
|
406
|
+
print(f" Warnings: {summary['Warnings']}")
|
|
407
|
+
print(f" Skipped: {summary['Skipped']}")
|
|
408
|
+
print(f"{'-'*60}")
|
|
409
|
+
|
|
410
|
+
if status == 'PASS':
|
|
411
|
+
print(f"\n✅ VALIDATION PASSED ({summary['Passed']}/{summary['TotalRules']} rules)\n")
|
|
412
|
+
else:
|
|
413
|
+
print(f"\n❌ VALIDATION FAILED ({summary['Failed']} errors)\n")
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def main():
|
|
417
|
+
parser = argparse.ArgumentParser(description='VIDS 21-Rule Compliance Validator')
|
|
418
|
+
parser.add_argument('dataset_root', help='Path to dataset root')
|
|
419
|
+
parser.add_argument('--profile', choices=['poc', 'full', 'auto'], default='auto',
|
|
420
|
+
help='Validation profile (default: auto-detect)')
|
|
421
|
+
parser.add_argument('--json', action='store_true', help='Output JSON')
|
|
422
|
+
parser.add_argument('--output', help='Write JSON report to file')
|
|
423
|
+
args = parser.parse_args()
|
|
424
|
+
|
|
425
|
+
dataset_root = Path(args.dataset_root)
|
|
426
|
+
if not dataset_root.exists():
|
|
427
|
+
print(f"Error: {dataset_root} not found", file=sys.stderr)
|
|
428
|
+
sys.exit(1)
|
|
429
|
+
|
|
430
|
+
validator = VIDSValidator(str(dataset_root), profile=args.profile)
|
|
431
|
+
report = validator.validate()
|
|
432
|
+
|
|
433
|
+
if args.json:
|
|
434
|
+
print(json.dumps(report, indent=2))
|
|
435
|
+
elif args.output:
|
|
436
|
+
with open(args.output, 'w') as f:
|
|
437
|
+
json.dump(report, f, indent=2)
|
|
438
|
+
print(f"✅ Report written to {args.output}")
|
|
439
|
+
print_report(report)
|
|
440
|
+
else:
|
|
441
|
+
print_report(report)
|
|
442
|
+
|
|
443
|
+
sys.exit(0 if report['Summary']['Status'] == 'PASS' else 1)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
if __name__ == '__main__':
|
|
447
|
+
main()
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vids-validator
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Reference validator for the VIDS (Verified Imaging Dataset Standard) specification
|
|
5
|
+
Author-email: Princeton Medical Systems <standards@vidsstandard.org>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/vids-standard/vids-standard
|
|
8
|
+
Project-URL: Documentation, https://github.com/vids-standard/vids-standard/blob/main/SPEC.md
|
|
9
|
+
Project-URL: Repository, https://github.com/vids-standard/vids-standard
|
|
10
|
+
Project-URL: Issues, https://github.com/vids-standard/vids-standard/issues
|
|
11
|
+
Keywords: medical-imaging,dataset-validation,DICOM,NIfTI,BIDS,annotation,provenance,radiology,AI,machine-learning
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
25
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
26
|
+
Requires-Python: >=3.8
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# VIDS Validator
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/vids-validator/)
|
|
34
|
+
[](https://pypi.org/project/vids-validator/)
|
|
35
|
+
[](https://github.com/vids-standard/vids-standard/blob/main/LICENSE-TOOLS)
|
|
36
|
+
|
|
37
|
+
Reference validator for the **[VIDS (Verified Imaging Dataset Standard)](https://github.com/vids-standard/vids-standard)** specification.
|
|
38
|
+
|
|
39
|
+
Zero dependencies. Python 3.8+. One command.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install vids-validator
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Command line
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Validate a dataset (auto-detects profile from .vids marker)
|
|
53
|
+
vids-validate /path/to/dataset
|
|
54
|
+
|
|
55
|
+
# Explicit Full profile validation
|
|
56
|
+
vids-validate /path/to/dataset --profile full
|
|
57
|
+
|
|
58
|
+
# JSON output (for CI pipelines)
|
|
59
|
+
vids-validate /path/to/dataset --json
|
|
60
|
+
|
|
61
|
+
# Save report to file
|
|
62
|
+
vids-validate /path/to/dataset --output report.json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Python API
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from vids_validator import VIDSValidator
|
|
69
|
+
|
|
70
|
+
validator = VIDSValidator("/path/to/dataset", profile="auto")
|
|
71
|
+
report = validator.validate()
|
|
72
|
+
|
|
73
|
+
print(report["Summary"]["Status"]) # "PASS" or "FAIL"
|
|
74
|
+
print(report["Summary"]["Passed"]) # number of rules passed
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### As a module
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python -m vids_validator /path/to/dataset
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## What it checks
|
|
84
|
+
|
|
85
|
+
21 validation rules across 6 categories:
|
|
86
|
+
|
|
87
|
+
| Category | Rules | Scope |
|
|
88
|
+
|----------|-------|-------|
|
|
89
|
+
| Structure (S001–S006) | `.vids` marker, `dataset_description.json`, participants, README, subject/session dirs | All profiles |
|
|
90
|
+
| Imaging (I001–I004) | NIfTI files, sidecar JSONs, valid JSON, naming convention | All profiles |
|
|
91
|
+
| Annotation (A001–A005) | Annotation directory, segmentation files, sidecars, provenance fields | All profiles |
|
|
92
|
+
| Quality (Q001–Q003) | Quality directory, quality summary, annotation agreement | Full only |
|
|
93
|
+
| ML (M001–M002) | ML directory, splits.json | Full only |
|
|
94
|
+
| Metadata (D001) | CHANGES.md | All (WARN) |
|
|
95
|
+
|
|
96
|
+
A dataset is **compliant** if and only if zero rules have FAIL status.
|
|
97
|
+
|
|
98
|
+
## Profiles
|
|
99
|
+
|
|
100
|
+
- **POC** (15 rules) — quick prototypes, pilots, internal research
|
|
101
|
+
- **Full** (21 rules) — production, publications, regulatory submissions
|
|
102
|
+
|
|
103
|
+
The profile is declared in the `.vids` marker file at the dataset root.
|
|
104
|
+
|
|
105
|
+
## Exit codes
|
|
106
|
+
|
|
107
|
+
- `0` — validation passed
|
|
108
|
+
- `1` — validation failed
|
|
109
|
+
|
|
110
|
+
## Links
|
|
111
|
+
|
|
112
|
+
- [VIDS Specification](https://github.com/vids-standard/vids-standard/blob/main/SPEC.md)
|
|
113
|
+
- [Validation Rules](https://github.com/vids-standard/vids-standard/blob/main/VALIDATION_RULES.md)
|
|
114
|
+
- [Example Datasets](https://github.com/vids-standard/vids-standard/blob/main/EXAMPLES.md)
|
|
115
|
+
- [Contributing](https://github.com/vids-standard/vids-standard/blob/main/CONTRIBUTING.md)
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
Apache License 2.0 — see [LICENSE](https://github.com/vids-standard/vids-standard/blob/main/LICENSE-TOOLS).
|
|
120
|
+
|
|
121
|
+
VIDS was created by [Princeton Medical Systems](https://princetonmed.systems) and is maintained as an open community standard.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/vids_validator/__init__.py
|
|
5
|
+
src/vids_validator/__main__.py
|
|
6
|
+
src/vids_validator/validator.py
|
|
7
|
+
src/vids_validator.egg-info/PKG-INFO
|
|
8
|
+
src/vids_validator.egg-info/SOURCES.txt
|
|
9
|
+
src/vids_validator.egg-info/dependency_links.txt
|
|
10
|
+
src/vids_validator.egg-info/entry_points.txt
|
|
11
|
+
src/vids_validator.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vids_validator
|