Skip to content

Commit 68bbab2

Browse files
author
arcangelo7
committed
refactor!: switch check_results output from text report to structured JSON
The text report was not machine-readable, making it unusable by pipeline orchestrators. Output is now a JSON file with status (PASS/FAIL), per-file stats, errors, and warnings. Exit code 1 on errors, 0 otherwise. BREAKING CHANGE: output format changed from plain text to JSON
1 parent 9e56b68 commit 68bbab2

4 files changed

Lines changed: 468 additions & 328 deletions

File tree

docs/src/content/docs/guides/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ uv run python -m oc_meta.run.meta_process -c meta_config.yaml
124124
Verify:
125125

126126
```bash
127-
uv run python -m oc_meta.run.meta.check_results meta_config.yaml --output report.txt
127+
uv run python -m oc_meta.run.meta.check_results meta_config.yaml report.json
128128
```
129129

130130
## Next steps

docs/src/content/docs/guides/verification.md

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ uv run python -m oc_meta.run.meta.check_results <CONFIG_PATH> <OUTPUT_FILE>
1818
Example:
1919

2020
```bash
21-
uv run python -m oc_meta.run.meta.check_results meta_config.yaml report.txt
21+
uv run python -m oc_meta.run.meta.check_results meta_config.yaml report.json
2222
```
2323

24+
The script exits with code 0 if all checks pass, or 1 if any errors are found.
25+
2426
## What it checks
2527

2628
### 1. Identifier analysis
@@ -57,25 +59,64 @@ For each OMID found:
5759

5860
## Output format
5961

60-
The script reports issues grouped by category:
61-
62+
The script produces a JSON report with the following structure:
63+
64+
```json
65+
{
66+
"status": "PASS",
67+
"timestamp": "2026-04-04T12:00:00",
68+
"config_path": "/path/to/meta_config.yaml",
69+
"total_files_processed": 3,
70+
"files": [
71+
{
72+
"file": "input.csv",
73+
"total_rows": 100,
74+
"rows_with_ids": 95,
75+
"total_identifiers": 200,
76+
"identifiers_with_omids": 190,
77+
"identifiers_without_omids": 10
78+
}
79+
],
80+
"summary": {
81+
"total_rows": 100,
82+
"total_identifiers": 200,
83+
"identifiers_with_omids": 190,
84+
"identifiers_without_omids": 10,
85+
"omids_with_provenance": 185,
86+
"omids_without_provenance": 5
87+
},
88+
"errors": [
89+
{
90+
"type": "missing_omid",
91+
"schema": "doi",
92+
"value": "10.1234/example",
93+
"file": "input.csv",
94+
"row": 5,
95+
"column": "id"
96+
}
97+
],
98+
"warnings": [
99+
{
100+
"type": "multiple_omids",
101+
"identifier": "doi:10.1234/duplicate",
102+
"omid_count": 2,
103+
"omids": ["https://w3id.org/oc/meta/br/0601", "https://w3id.org/oc/meta/br/0602"],
104+
"occurrences": [{"file": "input.csv", "row": 10, "column": "id"}]
105+
}
106+
]
107+
}
62108
```
63-
=== Verification Report ===
64109

65-
Identifiers without OMID:
66-
doi:10.1234/missing-entity-1
67-
doi:10.1234/missing-entity-2
110+
### Status semantics
111+
112+
- **`status: "PASS"`**: all identifiers have OMIDs and all OMIDs have provenance. Exit code 0.
113+
- **`status: "FAIL"`**: at least one error found. Exit code 1.
114+
115+
### Error types
68116

69-
Identifiers with multiple OMIDs:
70-
doi:10.1234/duplicate-entity -> omid:br/060/1, omid:br/060/2
117+
- **`missing_omid`**: an identifier from the input CSV has no corresponding OMID in the triplestore. Indicates a processing failure.
118+
- **`missing_provenance`**: an OMID exists in the triplestore but has no provenance record. Indicates incomplete ingestion.
71119

72-
OMIDs without provenance:
73-
omid:br/060/12345
120+
### Warning types
74121

75-
Summary:
76-
Total identifiers: 50000
77-
Identifiers with OMID: 49998
78-
Identifiers without OMID: 2
79-
OMIDs with provenance: 49995
80-
OMIDs without provenance: 3
81-
```
122+
- **`multiple_omids`**: an identifier is associated with more than one OMID across files. Indicates a disambiguation issue that should be resolved via the merge pipeline.

0 commit comments

Comments
 (0)