From df7d94ba9d4d58adbb2ac779452a7504e0002c96 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 10 Mar 2026 15:15:00 -0500 Subject: [PATCH] docs: update README with COI direct-relation fix (v0.6.1) --- README.md | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index dbcb5ea..0cc68a4 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,15 @@ A reactive, interactive dog breeding genealogy mapping system for professional k - **✅ Genetic Traits** - Inherited trait mapping - **✅ Settings Table** - Single-row kennel configuration with all contact/identity fields -### Recently Added (March 9, 2026 — v0.6.0) +### Recently Added (March 10, 2026 — v0.6.1) +- **✅ COI Direct-Relation Fix** — `calculateCOI` now correctly computes inbreeding coefficient for parent×offspring pairings. Previously returned `0.00%` due to blanket exclusion of `sid` from `commonIds`; sire now correctly appears as a common ancestor in the dam's ancestry map when they are parent×offspring +- **✅ pedigree.js Route Fix** — `commonIds` filter changed from `id !== sid && id !== did` → `id !== did` only; preserves parent×offspring COI path while still preventing reflexive dam self-loop +- **Expected COI for parent×offspring pairing:** ~25.00% (Wright's path coefficient method) + +### Previously Added (March 9, 2026 — v0.6.0) - **✅ Champion Flag** — `is_champion INTEGER DEFAULT 0` on `dogs` table; safe `ALTER TABLE` migration guard for existing DBs - **✅ Champion Toggle in DogForm** — amber-gold highlighted checkbox row with `Award` icon; marks dog as titled champion -- **✅ Champion ✪ in Parent Dropdowns** — sire/dam selects append `✪` to champion names for at-a-glance visibility +- **✅ Champion ⭐ in Parent Dropdowns** — sire/dam selects append `⭐` to champion names for at-a-glance visibility - **✅ Champion Bloodline Badge** — offspring of champion parents display a badge on dog cards and detail pages - **✅ Kennel Settings API** — `GET/PUT /api/settings` with single-row column schema and ALLOWED_KEYS whitelist - **✅ Settings Table Migration** — all kennel fields added with safe `ALTER TABLE` guards on existing DBs; default seed row auto-created @@ -147,18 +152,20 @@ For a **fresh install**, the database will automatically initialize with the cor # Install dependencies npm install -# Run development server (frontend + backend) +# Run development server (frontend + backend, nodemon auto-reload) npm run dev # Build for production npm run build ``` +> **Note:** `npm run dev` uses nodemon for auto-reload on the server. `npm start` (production) does **not** watch for changes — restart is required after pulling updates. + ### Project Structure ``` breedr/ -├── client/ # React frontend +├── client/ # React frontend │ ├── src/ │ │ ├── pages/ │ │ │ ├── BreedingCalendar.jsx # Heat cycle calendar + whelping identifiers @@ -175,19 +182,19 @@ breedr/ │ │ │ └── useSettings.jsx # SettingsProvider + useSettings context │ │ └── App.jsx │ └── package.json -├── server/ # Node.js backend +├── server/ # Node.js backend │ ├── routes/ -│ │ ├── dogs.js # is_champion in all queries -│ │ ├── settings.js # GET/PUT kennel settings (single-row schema) -│ │ ├── breeding.js # Heat cycles, whelping, suggestions -│ │ ├── pedigree.js # COI, trial pairing +│ │ ├── dogs.js # is_champion in all queries +│ │ ├── settings.js # GET/PUT kennel settings (single-row schema) +│ │ ├── breeding.js # Heat cycles, whelping, suggestions +│ │ ├── pedigree.js # COI, trial pairing (v0.6.1 direct-relation fix) │ │ ├── litters.js │ │ └── health.js │ ├── db/ -│ │ └── init.js # Schema + ALTER TABLE migration guards +│ │ └── init.js # Schema + ALTER TABLE migration guards │ └── index.js -├── static/ # Branding assets (br-logo.png, etc.) -├── docs/ # Documentation +├── static/ # Branding assets (br-logo.png, etc.) +├── docs/ # Documentation ├── ROADMAP.md ├── DATABASE.md ├── Dockerfile @@ -210,6 +217,7 @@ breedr/ ### Pedigree & Genetics - `GET /api/pedigree/:id` - Generate pedigree tree - `POST /api/pedigree/trial-pairing` - COI + common ancestors + risk recommendation +- `GET /api/pedigree/relations/:sireId/:damId` - Direct relation detection (parent/grandparent check) ### Breeding & Heat Cycles - `GET /api/breeding/heat-cycles` - All heat cycles @@ -230,6 +238,9 @@ breedr/ ## Troubleshooting +### COI shows 0.00% for parent×offspring pairings +Ensure you are on v0.6.1+ (merge PR #47). The fix removes a blanket `id !== sid` exclusion in `calculateCOI` that was silently zeroing the inbreeding coefficient when the sire is a direct ancestor of the dam. After merging, restart the server. + ### Server crashes with `SyntaxError: Unexpected end of input` on `settings.js` The settings route file may have been corrupted (double-encoded base64). Pull the latest code and rebuild. @@ -272,6 +283,7 @@ A breeding date must be logged on the cycle for whelp window cells to appear. Us - [x] **Projected Whelping Calendar Identifier** (whelp window cells, due label, active card range, live modal preview, whelping banner) - [x] **Champion Bloodline Tracking** (is_champion flag, DogForm toggle, offspring badge) - [x] **Kennel Settings** (GET/PUT /api/settings, SettingsProvider, kennel name in navbar) +- [x] **COI Direct-Relation Fix** (parent×offspring now correctly yields ~25% COI — v0.6.1) ### 🔜 In Progress / Up Next - [ ] Health Records System @@ -287,10 +299,16 @@ A breeding date must be logged on the cycle for whelp window cells to appear. Us ## Recent Updates +### March 10, 2026 - COI Direct-Relation Bug Fix (v0.6.1) +- **Fixed:** `calculateCOI` in `server/routes/pedigree.js` — removed `id !== sid` from `commonIds` filter +- **Root cause:** `getAncestorMap` includes each dog at `gen 0`; the sire (`sid`) correctly appears in the dam's ancestor map at `gen 1` for parent×offspring pairings, but `id !== sid` was filtering it out and returning `0.00%` +- **Result:** Parent×offspring pairings now correctly return ~25.00% COI; all other pairings unaffected +- **PR:** [#47](https://git.alwisp.com/jason/breedr/pulls/47) + ### March 9, 2026 - Champion Bloodline, Settings, Build Fixes (v0.6.0) - **Added:** `is_champion` column to `dogs` table with safe `ALTER TABLE` migration guard - **Added:** Champion toggle checkbox in DogForm with amber-gold highlight and `Award` icon -- **Added:** `✪` suffix on champion sire/dam in parent dropdowns +- **Added:** `⭐` suffix on champion sire/dam in parent dropdowns - **Added:** Champion Bloodline badge on offspring cards/detail pages - **Added:** `GET/PUT /api/settings` route — single-row column schema with `ALLOWED_KEYS` whitelist - **Added:** Full kennel settings columns in `settings` table with migration guards