Skip to content
YosoiDocs

ContractOutcome

yosoi.contracts.ContractOutcome

class ContractOutcome[T: 'Contract'](_ReadOnlyView):

Pydantic validation report retaining accepted and rejected candidates.

Attributes: contract: Typed record definition used for validation. status: evaluated, no_match, indeterminate, locate_failed, extraction_rejected, or validation_rejected. document_id: Evidence document identity when available. failure: Typed phase or operation-budget rejection when present. completeness: Partial or unknown coverage for indeterminate outcomes. reason_code: Structural explanation of indeterminate coverage. candidates: All complete-candidate evidence retained by native extraction. records: Accepted Pydantic values paired with original candidates. issues: Rejected candidates with Pydantic error details and findings. extraction_diagnostics: Nonfatal grouping issues retained alongside accepted values; strict all-record access treats them as rejection facts.

Source: python/yosoi/contracts.py:879

Members below are declared on this class. Inherited Pydantic methods and generated constructor signatures are not expanded.

def __init__(self, extracted: Extracted[T], policy: ExtractionPolicy) -> None:

Validate each complete candidate under the supplied resource limits.

Args: extracted: Raw candidates from Rust’s bounded extraction stage. policy: Minimum acceptance and validation-work limits.

Source: python/yosoi/contracts.py:912

@property
def accepted_records(self) -> tuple[T, ...]:

Return the accepted model values without their evidence wrappers.

Source: python/yosoi/contracts.py:1031

@property
def meets_minimum_records(self) -> bool:

Return whether accepted values meet this report’s requested minimum.

Source: python/yosoi/contracts.py:1036

def require_all(self) -> list[T]:

Return bare values only when the report is fully acceptable.

Returns: A mutable list of accepted Pydantic models. The report keeps its evidence.

Raises: ContractIssues: Rejected candidates, terminal states, or an unmet minimum prevent an all-accepted result.

Source: python/yosoi/contracts.py:1040

def to_archived(self) -> ArchivedContractOutcome:

Reject Python-to-Rust archive conversion and name the portable API.

Source: python/yosoi/contracts.py:1066

def model_dump(self) -> dict[str, Any]:

Return report metadata and safe Pydantic validation details.

Source: python/yosoi/contracts.py:1073

def model_dump_json(self) -> str:

Return JSON report details without Pydantic error inputs.

Source: python/yosoi/contracts.py:1116