Merge pull request 'docs: update README with COI direct-relation fix (v0.6.1)' (#48) from fix/coi-direct-relation into master

Reviewed-on: #48
This commit was merged in pull request #48.
This commit is contained in:
2026-03-10 15:16:21 -05:00

View File

@@ -28,10 +28,15 @@ A reactive, interactive dog breeding genealogy mapping system for professional k
- **✅ Genetic Traits** - Inherited trait mapping - **✅ Genetic Traits** - Inherited trait mapping
- **✅ Settings Table** - Single-row kennel configuration with all contact/identity fields - **✅ 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 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 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 - **✅ 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 - **✅ 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 - **✅ 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 # Install dependencies
npm install npm install
# Run development server (frontend + backend) # Run development server (frontend + backend, nodemon auto-reload)
npm run dev npm run dev
# Build for production # Build for production
npm run build 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 ### Project Structure
``` ```
breedr/ breedr/
├── client/ # React frontend ├── client/ # React frontend
│ ├── src/ │ ├── src/
│ │ ├── pages/ │ │ ├── pages/
│ │ │ ├── BreedingCalendar.jsx # Heat cycle calendar + whelping identifiers │ │ │ ├── BreedingCalendar.jsx # Heat cycle calendar + whelping identifiers
@@ -175,19 +182,19 @@ breedr/
│ │ │ └── useSettings.jsx # SettingsProvider + useSettings context │ │ │ └── useSettings.jsx # SettingsProvider + useSettings context
│ │ └── App.jsx │ │ └── App.jsx
│ └── package.json │ └── package.json
├── server/ # Node.js backend ├── server/ # Node.js backend
│ ├── routes/ │ ├── routes/
│ │ ├── dogs.js # is_champion in all queries │ │ ├── dogs.js # is_champion in all queries
│ │ ├── settings.js # GET/PUT kennel settings (single-row schema) │ │ ├── settings.js # GET/PUT kennel settings (single-row schema)
│ │ ├── breeding.js # Heat cycles, whelping, suggestions │ │ ├── breeding.js # Heat cycles, whelping, suggestions
│ │ ├── pedigree.js # COI, trial pairing │ │ ├── pedigree.js # COI, trial pairing (v0.6.1 direct-relation fix)
│ │ ├── litters.js │ │ ├── litters.js
│ │ └── health.js │ │ └── health.js
│ ├── db/ │ ├── db/
│ │ └── init.js # Schema + ALTER TABLE migration guards │ │ └── init.js # Schema + ALTER TABLE migration guards
│ └── index.js │ └── index.js
├── static/ # Branding assets (br-logo.png, etc.) ├── static/ # Branding assets (br-logo.png, etc.)
├── docs/ # Documentation ├── docs/ # Documentation
├── ROADMAP.md ├── ROADMAP.md
├── DATABASE.md ├── DATABASE.md
├── Dockerfile ├── Dockerfile
@@ -210,6 +217,7 @@ breedr/
### Pedigree & Genetics ### Pedigree & Genetics
- `GET /api/pedigree/:id` - Generate pedigree tree - `GET /api/pedigree/:id` - Generate pedigree tree
- `POST /api/pedigree/trial-pairing` - COI + common ancestors + risk recommendation - `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 ### Breeding & Heat Cycles
- `GET /api/breeding/heat-cycles` - All heat cycles - `GET /api/breeding/heat-cycles` - All heat cycles
@@ -230,6 +238,9 @@ breedr/
## Troubleshooting ## 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` ### 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. 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] **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] **Champion Bloodline Tracking** (is_champion flag, DogForm toggle, offspring badge)
- [x] **Kennel Settings** (GET/PUT /api/settings, SettingsProvider, kennel name in navbar) - [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 ### 🔜 In Progress / Up Next
- [ ] Health Records System - [ ] 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 ## 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) ### 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:** `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:** 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:** Champion Bloodline badge on offspring cards/detail pages
- **Added:** `GET/PUT /api/settings` route — single-row column schema with `ALLOWED_KEYS` whitelist - **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 - **Added:** Full kennel settings columns in `settings` table with migration guards