Files
romm/backend/endpoints/responses/recommendation.py
Georges-Antoine Assi e78a4aa1b9 chore(recommendations): cut the comments back to what the code cannot say
The engine carried its tuning history in its comments: measurement logs for
PIVOT_B, the weight a facet held before the company split, the shape of the
cold-start feed before the Bayesian average. None of that describes what the
code does now, and it belongs in the history rather than beside the values.

Also folds serving's ROM loader into feed's, which differed only by the
visibility filter applied afterwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 14:35:15 -04:00

31 lines
843 B
Python

from __future__ import annotations
from pydantic import BaseModel
from endpoints.responses.rom import SimpleRomSchema
from handler.recommendation.scoring import Facet
class SimilarityReasonSchema(BaseModel):
"""Why two games were linked, e.g. {"facet": "franchise", "value": "Metroid"}.
`value` is empty for facets with no value of their own, which the frontend
renders as a translated phrase instead.
"""
facet: Facet
value: str
class SimilarRomSchema(BaseModel):
rom: SimpleRomSchema
score: float
reasons: list[SimilarityReasonSchema]
class RecommendedRomSchema(SimilarRomSchema):
# The played game that pulled this recommendation in, for "Because you
# played X". Absent on cold-start results, which have no seed.
seed_rom_id: int | None = None
seed_rom_name: str | None = None