Match prediction from the engine

Open
#261 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
8/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
fastapi, python, sqlalchemy
Domain
api, backend

Research direction

This is an open design stub: it asks for an ADR before any code, and its questions cover inputs, privacy under rating_visibility (ADR 0031), which snapshot to load through engine_adapter, labels, and caching. Read the existing ADRs and the engine_adapter module first, then agree the decisions with maintainers. Done means an accepted ADR, an adapter function, a GET operation with an explicit operation_id, a regenerated openapi/openapi.json, and tests including one hidden player.

Written by the indexing model from the issue text.

Description

area:api area:ratings enhancement triage

Stub: this issue holds the problem and the questions. It needs a decision (an ADR) and a full scope before work starts.

Problem: Players want to ask "what are my odds against this pair?" The engine already answers this (predict_win_probability and predict_point_share), but the API does not expose it. The backend must call the engine for it, never compute it (hard rule 2).

Questions to decide:

  • Inputs. Two teams of OPEN Codes, the rating format, the game format (target and scoring), and best-of. A GET with query parameters, so read-only clients such as the MCP server can call it.
  • Privacy. A prediction against a player whose rating the viewer knows reveals the other player's rating. So every player in the request must be visible to the viewer under rating_visibility, or the whole request gets the same 404 as an unknown code (ADR 0031). Never answer for a player aged 13 to 17 whose rating is hidden.
  • Which ratings. The engine instance built from the stored EngineSnapshot for the loaded config, through engine_adapter (the only module that imports the engine). What happens when the snapshot cannot load (an engine upgrade before a replay).
  • Labels. The answer carries each player's reliability, says it is a demonstration result, and says live ratings are provisional between replays.
  • Cost. Loading a snapshot per request may be slow. Decide on caching (#54's pattern) and the per-Account throttle.

Draft scope:

  • ADR for the questions above
  • An engine_adapter function that returns a plain prediction from the stored snapshot
  • The operation, with an explicit operation_id and the regenerated openapi/openapi.json
  • Tests, including a request with one hidden player

Out of scope:

  • Any prediction math in the backend (hard rule 2)
  • The MCP tool (#264)
Dominant language
Python
Stars
0
Forks
1
Avg merge
1h 7m
Merged PRs (30d)
206

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openpickleball/backend

All issues in openpickleball/backend

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.