# Adopter Matcher Phase 2: Scoring Rewire — Implementation Report Date: 2026-04-20 ## Changes ### 1. scoreHouseholdMatch — Enum-based compatibility (weight 0.25) **Before:** Read `notes.kidBehavior` and `notes.otherAnimalReaction` (legacy fields, always empty on new records). Household scoring was dead. **After:** Reads `goodWithKids_match`, `goodWithDogs_match`, `goodWithCats_match` enums. Deltas: - `yes` → +20 (kids) / +15 (dogs/cats) - `somewhat` → +5 - `no` → -30 (kids) / -25 (dogs/cats) - `unknown` → no change Now separately checks for dogs, cats, and generic "pet" mentions in householdMembers. Generic "pet" uses the worst of dog/cat scores. Apartment+large-dog penalty preserved. ### 2. scoreEnergyMatch — Enum-first with text fallback (weight 0.20) **Before:** Parsed freeform `notes.energyLevel` text to low/med/high via keyword scan. **After:** Reads `notes.energyLevel_match` enum first. If enum is `unknown` or missing, falls back to text parsing (same `parseEnergyLevel()` function). Scoring logic unchanged (same=100, adjacent=70, opposite=30). ### 3. scoreColorMatch — Profiler-first color (weight 0.10) **Before:** Read `animal.color` (SM's BASECOLOURNAME) only. **After:** Prefers `notes.color` (profiler, richer descriptions like "Orange tabby with white chest"), falls back to `animal.color` if profiler color missing. Keyword matching logic unchanged. ## Smoke Test Results ### Test 1: Cat, quiet, single adult with a dog, apartment | # | Name | Code | Score | Dogs | Cats | Kids | Energy | |---|---|---|---|---|---|---|---| | 1 | Abe (Louie) | S2025966 | 77 | yes | yes | yes | low | | 2 | Gertie | S20251170 | 74 | somewhat | yes | yes | low | | 3 | Myst | S20241225 | 73 | unknown | somewhat | unknown | low | | 4 | Zelda | A2023301 | 73 | unknown | yes | no | low | | 5 | Edna | S20251008 | 71 | yes | yes | yes | medium | ### Test 2: Cat, quiet, single adult with TWO DOGS, house (adversarial) | # | Name | Code | Score | Dogs | Energy | |---|---|---|---|---|---| | 1 | Abe (Louie) | S2025966 | 87 | yes | low | | 2 | Gertie | S20251170 | 74 | somewhat | low | | 3 | Myst | S20241225 | 73 | unknown | low | | 4 | Zelda | A2023301 | 73 | unknown | low | | 5 | Edna | S20251008 | 71 | yes | medium | Abe (dogs=yes) gets 87 in the dog-household query vs 77 in the single-adult query — the +15 bump for dog compatibility is working. Gertie (dogs=somewhat) gets +5 instead of +15. ### Ground truth - Abe (S2025966): dogs=yes, cats=yes, kids=yes, energy=low - Gertie (S20251170): dogs=somewhat, cats=yes, kids=yes, energy=low ## Files Modified - matchingEngine.ts: scoreHouseholdMatch, scoreEnergyMatch, scoreColorMatch + call sites REPORT COMPLETE