feat(match): reverse matching — designs a facility can produce#223
Merged
Conversation
Adds the inverse of forward matching (web-ui review note #7): given an OKW facility, return the OKH designs it can produce, ranked by confidence. - MatchingService.find_designs_for_facility(facility, manifests, ...) runs the existing per-facility matcher once per candidate design (single-facility pool) and returns designs clearing min_confidence, ranked by best score. Mirrors find_matches_with_manifest by taking the candidate manifests as an argument (decoupled from storage, unit-testable). - POST /api/match/facility (FacilityMatchRequest: okw_id + min_confidence + max_results + optional domain). Loads the full design catalog and the target facility, returns {designs[{okh_id, okh_title, confidence, rank}], total_designs, designs_considered, facility_name}. 404 on unknown facility. - CLI: `ohm match facility <okw-id>` (--min-confidence/--max-results/--domain). - Docs: reverse-matching example in the API routes reference. - Tests: service ranking/threshold/max-results (unit) + endpoint wiring (TestClient integration: 404 + envelope shape). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The inverse of forward matching (review note #7).
POST /api/matchfinds facilities for a design; this finds designs for a facility — given an OKW facility, return the OKH designs it can produce, ranked by confidence. Useful for a "what can this makerspace build?" view.Approach
Rather than new matching logic, this composes the existing matcher: for each design in the catalog, run the same per-facility matching against a single-facility pool (the target). A design is reported when it yields a solution at or above
min_confidence; results rank by best score. With the current corpus (~27 designs) this is cheap, and results stay consistent with forward matching by construction.Changes
MatchingService.find_designs_for_facility(facility, manifests, min_confidence, max_results, explicit_domain). Mirrorsfind_matches_with_manifestby taking the candidate manifests as an argument, so it's decoupled from storage and unit-testable.POST /api/match/facility(FacilityMatchRequest:okw_id+min_confidence+max_results+ optionaldomain). Loads the full design catalog and the target facility; returns{designs[{okh_id, okh_title, confidence, rank}], total_designs, designs_considered, facility_name}. 404 on unknown facility.ohm match facility <okw-id>(--min-confidence/--max-results/--domain), table or--jsonoutput.Verification
make ready— all gates green (535 passed, parity 4/4, docs ✓).The frontend "Designs this facility can make" section on the OKW detail page lands separately on
frontend-dev.🤖 Generated with Claude Code