Add datacard_validator — standalone validator library for MODCON Datacard v1 - #10
Open
jeanbez wants to merge 1 commit into
Open
Add datacard_validator — standalone validator library for MODCON Datacard v1#10jeanbez wants to merge 1 commit into
jeanbez wants to merge 1 commit into
Conversation
…ard v1 Adds a rule-based validator that flags incomplete, incorrect, inconsistent, and misleading information in datacards produced by the datacard-generator skill (or handwritten to the same template). - datacard_validator/ — importable library: checks, findings model, HTML and human renderers. Public API: validate_file(), build_summary(), load_datacard(), run_checks(), plus the harvest_*/lookup helpers. - datacard_validator/__main__.py — CLI (python -m datacard_validator), with --offline, --json, --sidecar, --html, --summary-out, --level. - scripts/validate_datacard.py — shim keeping the historical invocation working. - tests/test_validator.py — 59 tests covering the check matrix. - pyproject.toml — installs as an editable package so downstream consumers (datacard-explorer) can import it instead of shelling out. Checks cover: ORCID format + ISO-7064 checksum, ROR, DOI and OSTI lookups, ISO dates and date monotonicity, enum/SPDX values, surviving template placeholders, per-level required-field matrices (L1-L3), L3 over-claim, and missing data-access pointers. Severity ladder is critical > error > warning > info; a card with no declared level validates as L1 and reports the omission. Multi-file runs emit a roll-up with per-check "top issues" ranked by files affected, and an optional validation_summary.html dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
A rule-based validator that flags incomplete, incorrect, inconsistent, and misleading information in datacards produced by the
datacard-generatorskill (or handwritten to the same template). It was built as a standalone tool — deliberately not part of the skill — so cards can be checked after the fact, in bulk, and from other services.Recovered from an uncommitted working tree; it had never been committed to any branch.
Contents
datacard_validator/__init__.pyFinding/Datacardmodel, HTML + human renderersdatacard_validator/__main__.pypython -m datacard_validatorscripts/validate_datacard.pypython scripts/validate_datacard.py card.mdinvocation workingtests/test_validator.pypyproject.tomlimport datacard_validatorPublic API:
validate_file(path, offline=True, level=None) -> dict,build_summary(results) -> dict, plusload_datacard,run_checks,get/walk, theharvest_*helpers and all renderers.Checks
[!TODO]/<REPLACE:…>template placeholdersYYYY-MM-DDdates and date monotonicity, enum membership (level, sensitivity tier, access level, release status, stewardship, update frequency, OSTI dataset type), SPDX license whitelisttitlevs body H1,access_level: openwithout a license, and a critical finding when nothing in the card points at the actual data (no repository, DOI, or URL)Severity ladder is
critical > error > warning > info. A card with no declared level is validated as L1 and the omission is itself reported.Output modes
--offline(skip network),--json,--sidecar(<card>.validation.json),--html(self-contained per-card report),--summary-outfor multi-file runs,--level Nto override.Multi-file runs print a per-file roll-up plus a "top issues" block ranked by files affected, and with
--htmlwrite avalidation_summary.htmldashboard (totals, per-card table linking to each sidecar, issue bars).Exit codes:
0clean,1errors present,2script/input error.Verification
CLI,
python -mand library entry points all verified to produce identical payloads.Notes for review
mainhas since moved the skill to Genesis v1.2 with its own Pydantic/LinkML-basedskills/datacard-generator/scripts/validate_datacard.py. The two are independent — different paths, different templates, no collision — but a follow-up should decide whether this one gets ported to v1.2 or kept as the v1-era checker.integrate-validatorbranch ofBASE-data-render-cards/datacard-explorerimports this package (its own PR is separate).