omids-validator 0.2.0__py3-none-any.whl
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.
- omids_validator/__init__.py +11 -0
- omids_validator/__main__.py +11 -0
- omids_validator/acquisition_profiles.py +478 -0
- omids_validator/cli.py +185 -0
- omids_validator/data/metadata_requirements.json +337 -0
- omids_validator/data/rules.json +364 -0
- omids_validator/file_types.py +46 -0
- omids_validator/inventory.py +133 -0
- omids_validator/models.py +60 -0
- omids_validator/participant_table.py +128 -0
- omids_validator/participants.py +235 -0
- omids_validator/patient_metadata.py +150 -0
- omids_validator/reporters/__init__.py +1 -0
- omids_validator/reporters/html_report.py +607 -0
- omids_validator/reporters/json_report.py +74 -0
- omids_validator/reporters/markdown_report.py +283 -0
- omids_validator/reporters/report_data.py +79 -0
- omids_validator/reporters/terminal.py +18 -0
- omids_validator/rule_catalog.py +279 -0
- omids_validator/rules/__init__.py +5 -0
- omids_validator/rules/layer0_structure.py +316 -0
- omids_validator/rules/layer1_naming.py +191 -0
- omids_validator/rules/layer2_sidecars.py +292 -0
- omids_validator/rules/layer3_metadata.py +144 -0
- omids_validator/rules/layer4_image_headers.py +152 -0
- omids_validator/rules/layer5_dataset.py +261 -0
- omids_validator/rules_document.py +192 -0
- omids_validator/validator.py +274 -0
- omids_validator-0.2.0.dist-info/METADATA +158 -0
- omids_validator-0.2.0.dist-info/RECORD +34 -0
- omids_validator-0.2.0.dist-info/WHEEL +5 -0
- omids_validator-0.2.0.dist-info/entry_points.txt +3 -0
- omids_validator-0.2.0.dist-info/licenses/LICENSE +677 -0
- omids_validator-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"""Layer 5: compare participant information across the dataset.
|
|
2
|
+
|
|
3
|
+
These rules compare subject folders with ``participants.tsv`` and check values
|
|
4
|
+
that should agree within a subject or imaging session.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from omids_validator.inventory import DatasetInventory, build_inventory
|
|
10
|
+
from omids_validator.models import Finding
|
|
11
|
+
from omids_validator.patient_metadata import (
|
|
12
|
+
PatientMetadataCollection,
|
|
13
|
+
collect_patient_metadata,
|
|
14
|
+
)
|
|
15
|
+
from omids_validator.participant_table import (
|
|
16
|
+
ParticipantTable,
|
|
17
|
+
ParticipantTableProblem,
|
|
18
|
+
read_participants_table,
|
|
19
|
+
)
|
|
20
|
+
from omids_validator.rule_catalog import finding_for_rule
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _participants_table_names(
|
|
24
|
+
inventory: DatasetInventory,
|
|
25
|
+
) -> tuple[bool, list[str]]:
|
|
26
|
+
"""Return exact-table presence and differently cased table names."""
|
|
27
|
+
|
|
28
|
+
exact_table_exists = any(
|
|
29
|
+
item.is_file() and item.name == "participants.tsv"
|
|
30
|
+
for item in inventory.root_items
|
|
31
|
+
)
|
|
32
|
+
case_variant_names = [
|
|
33
|
+
item.name
|
|
34
|
+
for item in inventory.root_items
|
|
35
|
+
if item.is_file()
|
|
36
|
+
and item.name.casefold() == "participants.tsv"
|
|
37
|
+
and item.name != "participants.tsv"
|
|
38
|
+
]
|
|
39
|
+
return exact_table_exists, case_variant_names
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def mids_501_conflicting_participants_table_filenames(
|
|
43
|
+
inventory: DatasetInventory,
|
|
44
|
+
) -> list[Finding]:
|
|
45
|
+
"""MIDS-501: report exact and case-variant table conflicts."""
|
|
46
|
+
|
|
47
|
+
exact_table_exists, case_variant_names = _participants_table_names(
|
|
48
|
+
inventory
|
|
49
|
+
)
|
|
50
|
+
if not exact_table_exists or not case_variant_names:
|
|
51
|
+
return []
|
|
52
|
+
|
|
53
|
+
return [
|
|
54
|
+
finding_for_rule(
|
|
55
|
+
"MIDS-501",
|
|
56
|
+
message=(
|
|
57
|
+
"Dataset contains the correctly named participants.tsv "
|
|
58
|
+
"and case-variant file(s): "
|
|
59
|
+
+ ", ".join(repr(name) for name in case_variant_names)
|
|
60
|
+
+ "."
|
|
61
|
+
),
|
|
62
|
+
path="participants.tsv",
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def mids_504_missing_participants_table(
|
|
68
|
+
inventory: DatasetInventory,
|
|
69
|
+
) -> list[Finding]:
|
|
70
|
+
"""MIDS-504: require one exactly named ``participants.tsv`` file."""
|
|
71
|
+
|
|
72
|
+
exact_table_exists, case_variant_names = _participants_table_names(
|
|
73
|
+
inventory
|
|
74
|
+
)
|
|
75
|
+
if exact_table_exists:
|
|
76
|
+
return []
|
|
77
|
+
|
|
78
|
+
message = "Dataset does not contain an exactly named participants.tsv file."
|
|
79
|
+
if case_variant_names:
|
|
80
|
+
names = ", ".join(repr(name) for name in case_variant_names)
|
|
81
|
+
message += f" Found case-variant file(s): {names}; rename exactly."
|
|
82
|
+
|
|
83
|
+
return [
|
|
84
|
+
finding_for_rule(
|
|
85
|
+
"MIDS-504",
|
|
86
|
+
message=message,
|
|
87
|
+
path="participants.tsv",
|
|
88
|
+
)
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _participants_table_findings(
|
|
93
|
+
inventory: DatasetInventory,
|
|
94
|
+
problems: tuple[ParticipantTableProblem, ...],
|
|
95
|
+
) -> list[Finding]:
|
|
96
|
+
"""Translate shared table-reading problems into MIDS-502 findings."""
|
|
97
|
+
|
|
98
|
+
return [
|
|
99
|
+
finding_for_rule(
|
|
100
|
+
"MIDS-502",
|
|
101
|
+
message=problem.message,
|
|
102
|
+
path=inventory.relative_path(problem.path),
|
|
103
|
+
)
|
|
104
|
+
for problem in problems
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def mids_502_invalid_participants_table(
|
|
109
|
+
inventory: DatasetInventory,
|
|
110
|
+
) -> list[Finding]:
|
|
111
|
+
"""MIDS-502: report whether ``participants.tsv`` can be used safely."""
|
|
112
|
+
|
|
113
|
+
_, problems = read_participants_table(inventory)
|
|
114
|
+
return _participants_table_findings(inventory, problems)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def mids_503_participant_inventory_mismatch(
|
|
118
|
+
inventory: DatasetInventory,
|
|
119
|
+
participant_table: ParticipantTable,
|
|
120
|
+
) -> list[Finding]:
|
|
121
|
+
"""MIDS-503: compare valid participant IDs with subject directories."""
|
|
122
|
+
|
|
123
|
+
directory_subjects = {
|
|
124
|
+
subject_directory.name
|
|
125
|
+
for subject_directory in inventory.subject_directories()
|
|
126
|
+
}
|
|
127
|
+
missing_from_table = sorted(directory_subjects - participant_table.participant_ids)
|
|
128
|
+
missing_directory = sorted(participant_table.participant_ids - directory_subjects)
|
|
129
|
+
|
|
130
|
+
findings: list[Finding] = []
|
|
131
|
+
for subject_id in missing_from_table:
|
|
132
|
+
findings.append(
|
|
133
|
+
finding_for_rule(
|
|
134
|
+
"MIDS-503",
|
|
135
|
+
message=(
|
|
136
|
+
f"Subject directory {subject_id!r} has no matching "
|
|
137
|
+
"participant_id row."
|
|
138
|
+
),
|
|
139
|
+
path=inventory.relative_path(inventory.root / subject_id),
|
|
140
|
+
)
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
for participant_id in missing_directory:
|
|
144
|
+
findings.append(
|
|
145
|
+
finding_for_rule(
|
|
146
|
+
"MIDS-503",
|
|
147
|
+
message=(
|
|
148
|
+
f"participant_id {participant_id!r} has no matching "
|
|
149
|
+
"subject directory."
|
|
150
|
+
),
|
|
151
|
+
path=inventory.relative_path(participant_table.path),
|
|
152
|
+
)
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
return findings
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def mids_505_patient_age_differs_within_session(
|
|
159
|
+
inventory: DatasetInventory,
|
|
160
|
+
patient_metadata: PatientMetadataCollection | None = None,
|
|
161
|
+
) -> list[Finding]:
|
|
162
|
+
"""MIDS-505: compare patient age strings within each imaging session."""
|
|
163
|
+
|
|
164
|
+
collection = patient_metadata or collect_patient_metadata(inventory)
|
|
165
|
+
ages_by_session: dict[tuple[str, str | None], list[str]] = {}
|
|
166
|
+
for observation in collection.observations:
|
|
167
|
+
if observation.age is None:
|
|
168
|
+
continue
|
|
169
|
+
key = (observation.subject_id, observation.session_id)
|
|
170
|
+
ages_by_session.setdefault(key, []).append(observation.age)
|
|
171
|
+
|
|
172
|
+
findings: list[Finding] = []
|
|
173
|
+
for (subject_id, session_id), ages in ages_by_session.items():
|
|
174
|
+
if len(set(ages)) < 2:
|
|
175
|
+
continue
|
|
176
|
+
|
|
177
|
+
affected_directory = inventory.root / subject_id
|
|
178
|
+
session_description = "the implicit imaging session"
|
|
179
|
+
if session_id is not None:
|
|
180
|
+
affected_directory /= session_id
|
|
181
|
+
session_description = f"session {session_id!r}"
|
|
182
|
+
findings.append(
|
|
183
|
+
finding_for_rule(
|
|
184
|
+
"MIDS-505",
|
|
185
|
+
message=(
|
|
186
|
+
f"Subject {subject_id!r} has conflicting patient age "
|
|
187
|
+
f"metadata within {session_description} across "
|
|
188
|
+
f"{len(ages)} patient sidecars."
|
|
189
|
+
),
|
|
190
|
+
path=inventory.relative_path(affected_directory),
|
|
191
|
+
)
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
return findings
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def mids_506_patient_sex_differs_within_subject(
|
|
198
|
+
inventory: DatasetInventory,
|
|
199
|
+
patient_metadata: PatientMetadataCollection | None = None,
|
|
200
|
+
) -> list[Finding]:
|
|
201
|
+
"""MIDS-506: compare patient sex strings across each subject."""
|
|
202
|
+
|
|
203
|
+
collection = patient_metadata or collect_patient_metadata(inventory)
|
|
204
|
+
sex_values_by_subject: dict[str, list[str]] = {}
|
|
205
|
+
for observation in collection.observations:
|
|
206
|
+
if observation.sex is None:
|
|
207
|
+
continue
|
|
208
|
+
sex_values_by_subject.setdefault(observation.subject_id, []).append(
|
|
209
|
+
observation.sex
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
findings: list[Finding] = []
|
|
213
|
+
for subject_id, sex_values in sex_values_by_subject.items():
|
|
214
|
+
if len(set(sex_values)) < 2:
|
|
215
|
+
continue
|
|
216
|
+
findings.append(
|
|
217
|
+
finding_for_rule(
|
|
218
|
+
"MIDS-506",
|
|
219
|
+
message=(
|
|
220
|
+
f"Subject {subject_id!r} has conflicting patient sex "
|
|
221
|
+
f"metadata across {len(sex_values)} patient sidecars."
|
|
222
|
+
),
|
|
223
|
+
path=inventory.relative_path(inventory.root / subject_id),
|
|
224
|
+
)
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
return findings
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def validate_dataset(dataset_path: Path) -> list[Finding]:
|
|
231
|
+
"""Run Layer 5 rules with one inventory scan and one table read."""
|
|
232
|
+
|
|
233
|
+
inventory = build_inventory(dataset_path)
|
|
234
|
+
return validate_dataset_inventory(inventory)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def validate_dataset_inventory(
|
|
238
|
+
inventory: DatasetInventory,
|
|
239
|
+
patient_metadata: PatientMetadataCollection | None = None,
|
|
240
|
+
) -> list[Finding]:
|
|
241
|
+
"""Run Layer 5 rules against an inventory supplied by the coordinator."""
|
|
242
|
+
|
|
243
|
+
collection = patient_metadata or collect_patient_metadata(inventory)
|
|
244
|
+
findings = mids_501_conflicting_participants_table_filenames(inventory)
|
|
245
|
+
findings.extend(mids_504_missing_participants_table(inventory))
|
|
246
|
+
participant_table, table_problems = read_participants_table(inventory)
|
|
247
|
+
findings.extend(_participants_table_findings(inventory, table_problems))
|
|
248
|
+
|
|
249
|
+
if participant_table is not None:
|
|
250
|
+
findings.extend(
|
|
251
|
+
mids_503_participant_inventory_mismatch(inventory, participant_table)
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
findings.extend(
|
|
255
|
+
mids_505_patient_age_differs_within_session(inventory, collection)
|
|
256
|
+
)
|
|
257
|
+
findings.extend(
|
|
258
|
+
mids_506_patient_sex_differs_within_subject(inventory, collection)
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
return findings
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"""Turn the packaged rule catalogue into a readable Markdown document.
|
|
2
|
+
|
|
3
|
+
The command-line interface calls this module for ``omids_validator --rules``.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from omids_validator.models import Severity
|
|
9
|
+
from omids_validator.rule_catalog import (
|
|
10
|
+
NEXT_STEP_KINDS,
|
|
11
|
+
NextStep,
|
|
12
|
+
RuleCatalog,
|
|
13
|
+
load_rule_catalog,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
LAYER_TITLES = {
|
|
18
|
+
0: "Dataset structure",
|
|
19
|
+
1: "File naming and relationships",
|
|
20
|
+
2: "Sidecar files",
|
|
21
|
+
3: "JSON metadata",
|
|
22
|
+
4: "Optional image integrity and consistency",
|
|
23
|
+
5: "Dataset-wide consistency and participants",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
SEVERITY_DESCRIPTIONS = {
|
|
27
|
+
Severity.ERROR: (
|
|
28
|
+
"A convention violation likely to cause problems in downstream "
|
|
29
|
+
"pipelines or prevent data and code from being interoperable between "
|
|
30
|
+
"research groups. The user should fix it."
|
|
31
|
+
),
|
|
32
|
+
Severity.WARNING: (
|
|
33
|
+
"A probable problem or important inconsistency that the user should "
|
|
34
|
+
"review and probably fix."
|
|
35
|
+
),
|
|
36
|
+
Severity.INFO: "A non-blocking observation the user may appreciate knowing.",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
GUIDANCE_DESCRIPTIONS = {
|
|
40
|
+
"command": "an exact command is available",
|
|
41
|
+
"tool": "a programmatic tool is available, with workflow-specific options",
|
|
42
|
+
"manual": "a direct manual correction is available",
|
|
43
|
+
"review": "the response depends on the dataset or study context",
|
|
44
|
+
"none": "no action is normally required",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
GLOSSARY = {
|
|
48
|
+
"Dataset root": (
|
|
49
|
+
"The top-level directory supplied to the validator. It contains "
|
|
50
|
+
"`sub-<ID>` subject directories and, when present, `participants.tsv`."
|
|
51
|
+
),
|
|
52
|
+
"Subject directory": (
|
|
53
|
+
"A directory named `sub-<ID>` containing all imaging data for one "
|
|
54
|
+
"participant."
|
|
55
|
+
),
|
|
56
|
+
"Session directory": (
|
|
57
|
+
"An optional directory named `ses-<ID>` inside a subject directory. "
|
|
58
|
+
"It groups imaging data from one visit, time point, or session."
|
|
59
|
+
),
|
|
60
|
+
"Datatype directory": (
|
|
61
|
+
"A directory that groups images by imaging category. This validator "
|
|
62
|
+
"currently recognizes `mr-anat`, `mr-quant`, `ct`, and `rx`."
|
|
63
|
+
),
|
|
64
|
+
"Direct-datatype layout": (
|
|
65
|
+
"A subject layout without session directories, where datatype "
|
|
66
|
+
"directories occur immediately inside the subject directory."
|
|
67
|
+
),
|
|
68
|
+
"NIfTI image": (
|
|
69
|
+
"An imaging file with a `.nii` or `.nii.gz` extension."
|
|
70
|
+
),
|
|
71
|
+
"JSON sidecar": (
|
|
72
|
+
"A JSON metadata file stored beside an image. A primary sidecar has "
|
|
73
|
+
"the same filename stem as its image."
|
|
74
|
+
),
|
|
75
|
+
"Acquisition suffix": (
|
|
76
|
+
"The final recognized acquisition label in an image filename, used "
|
|
77
|
+
"to determine its datatype and metadata profile."
|
|
78
|
+
),
|
|
79
|
+
"Participants table": (
|
|
80
|
+
"The root-level `participants.tsv` file containing one "
|
|
81
|
+
"`participant_id` row for each subject represented in the dataset."
|
|
82
|
+
),
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _rule_number(rule_id: str) -> int:
|
|
87
|
+
"""Return the numeric part of a validated rule ID."""
|
|
88
|
+
|
|
89
|
+
return int(rule_id.rsplit("-", maxsplit=1)[1])
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _render_next_step(next_step: NextStep) -> str:
|
|
93
|
+
"""Render one guidance block with its optional command or tool."""
|
|
94
|
+
|
|
95
|
+
lines = [f"**Recommended response:** {next_step.text}"]
|
|
96
|
+
if next_step.command is not None:
|
|
97
|
+
lines.extend(["", f"**Command:** `{next_step.command}`"])
|
|
98
|
+
if next_step.tool is not None:
|
|
99
|
+
lines.extend(["", f"**Tool:** `{next_step.tool}`"])
|
|
100
|
+
return "\n".join(lines)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _render_rule(rule_id: str, catalogue: RuleCatalog) -> str:
|
|
104
|
+
"""Render one validated rule definition."""
|
|
105
|
+
|
|
106
|
+
rule = catalogue.get(rule_id)
|
|
107
|
+
lines = [
|
|
108
|
+
f"### {rule.rule_id} — {rule.title}",
|
|
109
|
+
"",
|
|
110
|
+
f"- **Severity:** {rule.severity.value.upper()}",
|
|
111
|
+
f"- **Response type:** {rule.next_step.kind}",
|
|
112
|
+
"",
|
|
113
|
+
rule.description,
|
|
114
|
+
"",
|
|
115
|
+
_render_next_step(rule.next_step),
|
|
116
|
+
]
|
|
117
|
+
return "\n".join(lines)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def render_rules_markdown(catalogue: RuleCatalog | None = None) -> str:
|
|
121
|
+
"""Return the complete human-readable rule catalogue."""
|
|
122
|
+
|
|
123
|
+
selected_catalogue = catalogue or load_rule_catalog()
|
|
124
|
+
lines = [
|
|
125
|
+
(
|
|
126
|
+
"<!-- Generated from the packaged rules.json catalogue. "
|
|
127
|
+
"Do not edit directly. -->"
|
|
128
|
+
),
|
|
129
|
+
"",
|
|
130
|
+
"# OMIDS Validator Rules",
|
|
131
|
+
"",
|
|
132
|
+
"## Purpose",
|
|
133
|
+
"",
|
|
134
|
+
(
|
|
135
|
+
"The OMIDS Validator evaluates finished ORMIR-MIDS datasets and "
|
|
136
|
+
"reports structural, naming, sidecar, metadata, image-header, and "
|
|
137
|
+
"dataset-wide consistency findings."
|
|
138
|
+
),
|
|
139
|
+
"",
|
|
140
|
+
(
|
|
141
|
+
"This document is generated from the packaged `rules.json` "
|
|
142
|
+
f"catalogue (schema version {selected_catalogue.schema_version})."
|
|
143
|
+
),
|
|
144
|
+
"",
|
|
145
|
+
"## Severity",
|
|
146
|
+
"",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
for severity in Severity:
|
|
150
|
+
lines.append(
|
|
151
|
+
f"- **{severity.value.upper()}:** "
|
|
152
|
+
f"{SEVERITY_DESCRIPTIONS[severity]}"
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
lines.extend(["", "## Response types", ""])
|
|
156
|
+
for kind in NEXT_STEP_KINDS:
|
|
157
|
+
lines.append(f"- **{kind}:** {GUIDANCE_DESCRIPTIONS[kind]}.")
|
|
158
|
+
|
|
159
|
+
rule_ids_by_layer: dict[int, list[str]] = {}
|
|
160
|
+
for rule_id, rule in selected_catalogue.rules.items():
|
|
161
|
+
if rule.status != "active":
|
|
162
|
+
continue
|
|
163
|
+
rule_ids_by_layer.setdefault(rule.layer, []).append(rule_id)
|
|
164
|
+
|
|
165
|
+
for layer in sorted(rule_ids_by_layer):
|
|
166
|
+
title = LAYER_TITLES.get(layer, "Reserved")
|
|
167
|
+
lines.extend(["", f"## Layer {layer}: {title}", ""])
|
|
168
|
+
rule_ids = sorted(rule_ids_by_layer[layer], key=_rule_number)
|
|
169
|
+
lines.append(
|
|
170
|
+
"\n\n".join(
|
|
171
|
+
_render_rule(rule_id, selected_catalogue)
|
|
172
|
+
for rule_id in rule_ids
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
lines.extend(["", "## Glossary", ""])
|
|
177
|
+
for term, definition in GLOSSARY.items():
|
|
178
|
+
lines.append(f"- **{term}:** {definition}")
|
|
179
|
+
|
|
180
|
+
return "\n".join(lines) + "\n"
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def write_rules_markdown(
|
|
184
|
+
path: Path,
|
|
185
|
+
catalogue: RuleCatalog | None = None,
|
|
186
|
+
) -> None:
|
|
187
|
+
"""Write the human-readable rule catalogue to ``path``."""
|
|
188
|
+
|
|
189
|
+
path.write_text(
|
|
190
|
+
render_rules_markdown(catalogue),
|
|
191
|
+
encoding="utf-8",
|
|
192
|
+
)
|