diff --git a/API.md b/API.md index f84f3ae..7886a92 100644 --- a/API.md +++ b/API.md @@ -86,19 +86,49 @@ Add a weight/health log entry. Manage OFA clearances and veterinary records. +**Record types** (`record_type`): `ofa_clearance`, `vaccination`, `exam`, `surgery`, `medication`, `other`. + +**Valid `test_type` values** (OFA clearances only): `hip_ofa`, `hip_pennhip`, `elbow_ofa`, `patella_ofa`, `heart_ofa`, `heart_echo`, `eye_caer`, `thyroid_ofa`. +> DNA is **not** a health test type — DNA panels are managed exclusively by the Genetics module (`/api/genetics`). + ### `GET /dog/:dogId` Get all health records for a dog. ### `GET /dog/:dogId/clearance-summary` Get GRCA core clearance status (Hip, Elbow, Heart, Eyes). - **Response**: `{ summary, grca_eligible, age_eligible, chic_number }` +- Only recurring tests (CAER eyes, advanced/echo cardiac) carry an `expires_at`; permanent certifications (hip, elbow, etc.) never report `expired`/`expiring_soon`. ### `GET /dog/:dogId/chic-eligible` Check if a dog has all required CHIC tests. +### `GET /:id` +Get a single health record. + ### `POST /` Create health record. -- **Body**: `dog_id`, `record_type`, `test_date` (required), `test_type`, `test_name`, `ofa_result`, `ofa_number`, etc. +- **Body**: `dog_id`, `record_type`, `test_date` (all required), plus optional `test_type`, `test_name`, `ofa_result`, `ofa_number`, `performed_by`, `expires_at`, `result`, `next_due`, `document_url`, `notes`. +- **Validation**: `test_type`, if present, must be one of the valid values above (else `400`). +- **Note**: `performed_by` is the single clinician field (the legacy `vet_name` column is deprecated). + +### `PUT /:id` +Update an existing health record. Same body as `POST /` (minus `dog_id`). + +### `DELETE /:id` +Delete a health record. +- **Response**: `{ "message": "Health record deleted successfully" }` + +### `POST /upload` +Upload a supporting document (PDF or image, ≤ 15 MB) and get back a URL to store in a record's `document_url`. Record-agnostic — works before the record itself is saved. +- **Form-Data**: `document` (file) +- **Response**: `{ "url": "/uploads/..." }` + +### `GET /dog/:dogId/cancer-history` +Get cancer-history records for a dog. + +### `POST /cancer-history` +Add a cancer-history record. +- **Body**: `dog_id`, `cancer_type` (required), `age_at_diagnosis`, `age_at_death`, `cause_of_death`, `notes`. --- diff --git a/ROADMAP.md b/ROADMAP.md index 9727eda..b9d9ed9 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -52,6 +52,15 @@ - DNA genetic panel (PRA, ICH, NCL, DM, MD variants) - Cancer lineage & longevity tracking - Breeding eligibility checker (GRCA + CHIC gates) + - **Health Record modal overhaul** (July 6, 2026): + - [x] Per-record-type field sets (OFA / vaccination / exam / surgery / medication / other) + - [x] Result options scoped to the selected test; blank default (no fabricated clearances) + - [x] Added Thyroid & Patella OFA tests; expiry only shown for recurring tests (CAER, advanced cardiac) + - [x] Date & 24-month age validation on OFA hip/elbow + - [x] Unified clinician field (`performed_by`); deprecated `vet_name` + - [x] DNA removed as a health `test_type` (owned solely by Genetics module) + - [x] Delete action on the health records list + - [x] Document upload (PDF/image) via `POST /api/health/upload` - **v0.6.1** (March 10, 2026) - COI Direct-Relation Fix - Fixed `calculateCOI` to correctly compute coefficient for parent×offspring pairings (~25%)