Decompose: Add HTTP service layer (FastAPI) exposing the EmbroideryPipeline — Phase 4: POST /v1/threads/resolve + GET /v1/threads/catalog #49

Closed
opened 2026-06-22 16:31:11 +00:00 by Mark · 2 comments
Owner

Phase 4: 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

## Phase 4: 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)_
Author
Owner

Cross-link: ThreadCraft #11 — this phase provides /v1/threads/resolve and /v1/threads/catalog used by ThreadCraft #10 (palette mapping).

**Cross-link:** ThreadCraft #11 — this phase provides /v1/threads/resolve and /v1/threads/catalog used by ThreadCraft #10 (palette mapping).
Author
Owner

This issue has been decomposed into the following sub-issues:

# Title Phase Scope
#87 POST /v1/threads/resolve + GET /v1/threads/catalog ΔE-2000 thread palette lookup. Two endpoints: - POST /v1/threads/resolve — inp

Each sub-issue awaits triage pipeline assessment before queue routing.

This issue has been decomposed into the following sub-issues: | # | Title | Phase Scope | |---|-------|-------------| | #87 | POST /v1/threads/resolve + GET /v1/threads/catalog | ΔE-2000 thread palette lookup. Two endpoints: - `POST /v1/threads/resolve` — inp | Each sub-issue awaits triage pipeline assessment before queue routing.
Mark closed this issue 2026-06-26 19:40:08 +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#49
No description provided.