Skip to main content
Version: latest

agrag.candidates.review.prune_candidates

prune_candidates(graph_store:GraphStore, *, rejected:bool = False, pending_older_than_days:int | None = None, pending_below_count:int | None = None, apply:bool = False, now:datetime | None = None) -> PruneReport

Count or delete groups matching the selected prune criteria.

Matching groups are only deleted when apply is true and at least one group matches. The report distinguishes a dry run from a deletion.

Parameters:

  • graph_store (GraphStore) – Store containing candidate groups.
  • rejected (bool) – Include rejected groups.
  • pending_older_than_days (int | None) – Include pending groups older than this many days.
  • pending_below_count (int | None) – Include pending groups below this sighting count.
  • apply (bool) – Whether to delete matching groups.
  • now (datetime | None) – Reference time, or the current UTC time when omitted.

Returns:

  • PruneReport – Counts of matched and deleted groups and whether deletion ran.

Raises:

  • ValueError – If no criterion is set or a numeric threshold is below one.