Skip to content

API Reference parrot_pipelines.planogram.comparison.scoring

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_pipelines.planogram.comparison.scoring

View source

Per-facing decision, multi-photo merge and scoring for migrated planogram types (FEAT-574).

Alias AssessmentStatus

Re-exported from parrot_pipelines.planogram.contracts.AssessmentStatus.

Alias ComparisonResult

Re-exported from parrot_pipelines.planogram.contracts.ComparisonResult.

Alias CompletenessPolicy

Re-exported from parrot_pipelines.planogram.comparison.definition.CompletenessPolicy.

Alias CreditPolicy

Re-exported from parrot_pipelines.planogram.contracts.CreditPolicy.

Alias EvidenceWeights

Re-exported from parrot_pipelines.planogram.contracts.EvidenceWeights.

Alias FacingDefinition

Re-exported from parrot_pipelines.planogram.comparison.definition.FacingDefinition.

Alias FacingStatus

Re-exported from parrot_pipelines.planogram.contracts.FacingStatus.

Alias Identification

Re-exported from parrot_pipelines.planogram.contracts.Identification.

Alias ImageRegistration

Re-exported from parrot_pipelines.planogram.comparison.registration.ImageRegistration.

Alias ObservationRef

Re-exported from parrot_pipelines.planogram.contracts.ObservationRef.

Alias PositionResult

Re-exported from parrot_pipelines.planogram.contracts.PositionResult.

Alias RuleBinding

Re-exported from parrot_pipelines.planogram.comparison.definition.RuleBinding.

Alias RuleOutcome

Re-exported from parrot_pipelines.planogram.contracts.RuleOutcome.

Alias ShelfDefinition

Re-exported from parrot_pipelines.planogram.comparison.definition.ShelfDefinition.

Alias ShelfScore

Re-exported from parrot_pipelines.planogram.contracts.ShelfScore.

Alias SlotsDefinition

Re-exported from parrot_pipelines.planogram.comparison.definition.SlotsDefinition.

Alias definition_coverage

Re-exported from parrot_pipelines.planogram.comparison.definition.definition_coverage.

Attribute logger

Function merge_positions

One PositionResult per expected facing, merging every image's registered observations.

Identification.product must already be the canonical product id of the definition. Ambiguous registrations contribute nothing (their facings stay not_visible / not_assessed). The deciding observation (when any) is the FIRST entry of PositionResult.observations; every other registered view follows, so all provenance is kept.

merge_positions(definition: SlotsDefinition, registrations: Sequence[ImageRegistration], identifications: Sequence[Identification], policy: CreditPolicy) -> List[PositionResult]

Parameter Type Default Description
definition SlotsDefinition The slots definition.
registrations Sequence[ImageRegistration] One registration per image.
identifications Sequence[Identification] Identifications of every image.
policy CreditPolicy Credit policy.

Returns: List[PositionResult] — Position results in definition order.

Function score_shelves

One ShelfScore per definition shelf, in definition order (formula of the task Scope).

ShelfScore.rule_results carries the outcomes that decide status/completeness: every MANDATORY binding (an unassessed placeholder when no outcome was supplied) plus every assessed illumination binding. Illumination penalties are the only penalties the formula applies. Outcomes of fact_tag_present bindings are carried in info_results and excluded from every score, coverage and status input.

score_shelves(positions: Sequence[PositionResult], definition: SlotsDefinition, bindings: Sequence[RuleBinding], rule_outcomes: Dict[str, RuleOutcome], description: PlanogramDescription, policy: CreditPolicy) -> List[ShelfScore]

Parameter Type Default Description
positions Sequence[PositionResult] Merged positions.
definition SlotsDefinition The slots definition.
bindings Sequence[RuleBinding] Validated rule bindings.
rule_outcomes Dict[str, RuleOutcome] Outcome per rule_id.
description PlanogramDescription The planogram description (weights, endcap).
policy CreditPolicy Credit policy (credits are already on the positions; kept for signature stability).

Returns: List[ShelfScore] — Shelf scores in definition order.

Function summarize

Global measures. compliance_results is left empty and overall_compliant False — the projection helper finalize_comparison sets both.

summarize(shelf_scores: Sequence[ShelfScore], positions: Sequence[PositionResult], definition: SlotsDefinition, weights: EvidenceWeights, *, completeness: Optional[CompletenessPolicy] = None) -> ComparisonResult

Parameter Type Default Description
shelf_scores Sequence[ShelfScore] Per-shelf scores.
positions Sequence[PositionResult] Merged positions.
definition SlotsDefinition The slots definition.
weights EvidenceWeights Evidence weights (evidence quality only — never credits).
completeness Optional[CompletenessPolicy] None Minimum resolved fraction for COMPLETE (default: every position resolved). Never changes scores or credits.

Returns: ComparisonResult — The comparison result (without projected compliance results).

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally