POST /v1/threads/resolve + GET /v1/threads/catalog #87

Closed
opened 2026-06-26 19:40:06 +00:00 by Mark · 0 comments
Owner

Phase 1: POST /v1/threads/resolve + GET /v1/threads/catalog

ΔE-2000 thread palette lookup. Two endpoints:

  • POST /v1/threads/resolve — input: array of hex colors, output:
    nearest catalog entries.
  • GET /v1/threads/catalog — output: the embedded Brother PR-10
    thread catalog (one-shot fetch, client caches).

Files:

  • Modify: src/service/app.py (add the two routes)
  • Modify: src/service/models.py (ResolveRequest, ResolveResponse,
    CatalogResponse)
  • New: src/service/handlers/threads.py

Acceptance:

  • POST /v1/threads/resolve with ["#aabbcc", "#112233"] returns
    the nearest 2 catalog entries with deltaE values.
  • GET /v1/threads/catalog returns the full PR-10 catalog as JSON
    (~79 entries).
  • The catalog is loaded once at startup, not per-request (response
    time < 50ms for resolve).
  • The ΔE-2000 implementation is the same as
    src/embroidery_converter/thread_manager.py — no new algorithm.

Depends on: P1 (skeleton). Independent of P2/P3 (different code
path).

Note: requires the Brother PR-10 profile from #36 so the catalog
source is correct. The catalog can be sourced separately if #36 is
in flight.



Decomposed from easystitch#31


Decomposed from easystitch#49

## Phase 1: POST /v1/threads/resolve + GET /v1/threads/catalog ΔE-2000 thread palette lookup. Two endpoints: - `POST /v1/threads/resolve` — input: array of hex colors, output: nearest catalog entries. - `GET /v1/threads/catalog` — output: the embedded Brother PR-10 thread catalog (one-shot fetch, client caches). **Files:** - Modify: `src/service/app.py` (add the two routes) - Modify: `src/service/models.py` (ResolveRequest, ResolveResponse, CatalogResponse) - New: `src/service/handlers/threads.py` **Acceptance:** - `POST /v1/threads/resolve` with `["#aabbcc", "#112233"]` returns the nearest 2 catalog entries with `deltaE` values. - `GET /v1/threads/catalog` returns the full PR-10 catalog as JSON (~79 entries). - The catalog is loaded once at startup, not per-request (response time < 50ms for resolve). - The ΔE-2000 implementation is the same as `src/embroidery_converter/thread_manager.py` — no new algorithm. **Depends on:** P1 (skeleton). Independent of P2/P3 (different code path). **Note:** requires the Brother PR-10 profile from #36 so the catalog source is correct. The catalog can be sourced separately if #36 is in flight. --- --- _Decomposed from [easystitch#31](https://forgejo.tail018ac4.ts.net/Mark/easystitch/issues/31)_ --- _Decomposed from [easystitch#49](https://forgejo.tail018ac4.ts.net/Mark/easystitch/issues/49)_
Mark closed this issue 2026-06-26 19:40:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/easystitch#87
No description provided.