proteobench.validation.report module#
Structured validation report objects for ProteoBench submission validation.
This module defines the data model returned by the validation layer
(proteobench.validation.validator.validate_submission()). The report is a
plain, framework-agnostic container so that it can be produced in the core
library and rendered by any front end (Streamlit, notebooks, CLI).
It exposes three objects: Severity (the issue severity enumeration),
ValidationIssue (a single machine- and human-readable finding), and
ValidationReport (a collection of issues with overall pass/fail helpers).
- class proteobench.validation.report.Severity(value)[source]#
-
Severity level of a validation issue.
Severity controls only display prominence and inclusion in the pull-request summary; it does not gate the Streamlit submission flow (no severity blocks submission). It also drives the optional programmatic
ValidationReport.raise_if_errors()path.- ERROR = 'error'#
- INFO = 'info'#
- WARNING = 'warning'#
- class proteobench.validation.report.ValidationIssue(code: str, severity: Severity, message: str, check: str, field: str | None = None, observed: Any = None, expected: Any = None, examples: List[Any] = <factory>)[source]#
Bases:
objectA single validation finding.
- observed#
Observed value (or a short summary of it).
- Type:
Any, optional
- expected#
Expected value or allowed range, where applicable.
- Type:
Any, optional
- class proteobench.validation.report.ValidationReport(issues: List[ValidationIssue] = <factory>)[source]#
Bases:
objectCollection of validation issues with overall status helpers.
- issues#
Issues collected during validation.
- Type:
- add(code: str, severity: Severity, message: str, check: str, field: str | None = None, observed: Any = None, expected: Any = None, examples: List[Any] | None = None) ValidationReport[source]#
Append a new issue to the report.
- Parameters:
code (str) – Machine-readable issue code.
severity (Severity) – Severity of the issue.
message (str) – Human-readable description.
check (str) – Name of the originating check.
field (str, optional) – Relevant field, file, or column name.
observed (Any, optional) – Observed value.
expected (Any, optional) – Expected value or allowed range.
examples (list, optional) – Example offending rows or identifiers.
- Returns:
The report itself, to allow chaining.
- Return type:
- add_error(code: str, message: str, check: str, **kwargs: Any) ValidationReport[source]#
Append an
ERRORissue.- Parameters:
- Returns:
The report itself, to allow chaining.
- Return type:
- add_info(code: str, message: str, check: str, **kwargs: Any) ValidationReport[source]#
Append an
INFOissue.- Parameters:
- Returns:
The report itself, to allow chaining.
- Return type:
- add_warning(code: str, message: str, check: str, **kwargs: Any) ValidationReport[source]#
Append a
WARNINGissue.- Parameters:
- Returns:
The report itself, to allow chaining.
- Return type:
- property errors: List[ValidationIssue]#
Return all
ERRORissues.- Returns:
The error-level issues.
- Return type:
- extend(issues: List[ValidationIssue]) ValidationReport[source]#
Append several issues at once.
- Parameters:
issues (list of ValidationIssue) – Issues to add.
- Returns:
The report itself, to allow chaining.
- Return type:
- property has_errors: bool#
Whether the report contains any
ERRORissue.- Returns:
Trueif at least one error is present.- Return type:
- property infos: List[ValidationIssue]#
Return all
INFOissues.- Returns:
The info-level issues.
- Return type:
- issues: List[ValidationIssue]#
- property passed: bool#
Overall pass status (no
ERRORissues).This is informational only: the Streamlit submission flow does not gate on it (submission is never blocked). It is used for display and by the optional
raise_if_errors()path.- Returns:
Truewhen there are noERRORissues (warnings allowed).- Return type:
- raise_if_errors() None[source]#
Raise
SubmissionValidationErrorif any error issue is present.- Raises:
SubmissionValidationError – If the report contains at least one
ERRORissue.
- summary(include_info: bool = False) str[source]#
Build a compact Markdown summary of the report.
Useful for embedding the findings into pull-request text or logs. The wording is neutral: submission validation does not block submission, it only surfaces points for the submitter and reviewers to consider.
- to_dict() Dict[str, Any][source]#
Convert the report to a JSON-serialisable dictionary.
- Returns:
Dictionary with overall status and the list of issues.
- Return type:
- property warnings: List[ValidationIssue]#
Return all
WARNINGissues.- Returns:
The warning-level issues.
- Return type: