Skip to main content
Version: 0.0.5 (stable)

agrag.candidates.patch.plan_patch

plan_patch(records:Sequence[CandidateRecord], *, schema:GraphSchema, labels_by_entity:Mapping[str, Sequence[str]], base:PatchBase, created_at:datetime) -> SchemaPatch

Plan sorted schema additions and evidence from candidate records.

Records with unresolved endpoints are excluded. Entity, relation, and property changes already covered by the schema are omitted. A stable patch identifier is derived from the base fingerprint and included record ids.

Parameters:

  • records (Sequence[CandidateRecord]) – Candidate records considered for inclusion.
  • schema (GraphSchema) – Current schema used to identify existing definitions.
  • labels_by_entity (Mapping[str, Sequence[str]]) – Graph labels keyed by entity id.
  • base (PatchBase) – Name, version, and fingerprint of the base schema.
  • created_at (datetime) – Timestamp recorded in the resulting patch.

Returns:

  • SchemaPatch – Patch with sorted additions, evidence totals, and included candidate ids.