Files
faunosteo/src/species/equine/anatomy.ts
T
ZenQuality b5b2e163c9 feat: domain core — schemas, store, equine data, PDF roundtrip
Phase A — Domain & schemas (15 tests):
- Zod schemas: ReportSchema, FindingSchema, PractitionerSchema, SeveritySchema
- Types derived via z.infer (single source of truth)
- newId() helper with optional prefix

Phase B — Equine anatomy + pathology DB (7 tests):
- 26 macro zones, axial subzones C1-7/T1-18/L1-6/S1-5
- 31 pathologies, each citing Merck Vet Manual, PubMed, IMAIOS or LCAO
- Placeholder SVGs (lateral L/R + dorsal) with data-zone convention
- Species registry: equine registered, 8 others remain stubs

Phase C — Zustand store (8 tests):
- Single source of truth with persist middleware (localStorage key osteo-report-draft)
- Actions: hydrate, reset, toggleZone, addFinding, updateFinding, removeFinding, setConclusion/Recommendations/NextAppointment

Phase H/I — PDF export + import roundtrip (2 tests):
- A4 portrait, pdf-lib StandardFonts
- Header (practitioner + animal), anatomy pages (per used view), findings
  table, conclusion/recommendations/RDV page, page footer with date+page#
- Attachment: base64 data URI workaround (pdf-lib treats raw string as
  base64 input, and rejects cross-realm Uint8Array in jsdom tests)
- Import: walks Catalog→Names→EmbeddedFiles→Names array→F stream; inflates
  via pako directly (bypasses pdf-lib's reference-equality FlateDecode check
  which fails across module realms in vitest); validates with ReportSchema

Tooling:
- Add pako 2.x + @types/pako (already transitive of pdf-lib)
- Switch vitest 2 → 3 (already done in prior commit)
- Add 8 test files (34 tests total green)
2026-05-17 07:06:59 +02:00

55 lines
3.3 KiB
TypeScript

import type { SpeciesAnatomy, Subzone, Zone } from '../types';
const range = (prefix: string, count: number): Subzone[] =>
Array.from({ length: count }, (_, i) => ({
id: `${prefix}${i + 1}`,
label: `${prefix}${i + 1}`,
}));
const CERVICAL: Subzone[] = range('C', 7);
const THORACIC: Subzone[] = range('T', 18);
const LUMBAR: Subzone[] = range('L', 6);
const SACRAL: Subzone[] = range('S', 5);
const ZONES: Zone[] = [
{ id: 'head', label: 'Tête', category: 'head', views: ['lateral_left', 'lateral_right', 'dorsal'] },
{ id: 'neck', label: 'Encolure', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'], subzones: CERVICAL },
{ id: 'withers', label: 'Garrot', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'] },
{ id: 'thoracic-back', label: 'Dos thoracique', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'], subzones: THORACIC },
{ id: 'lumbar', label: 'Lombaire', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'], subzones: LUMBAR },
{ id: 'sacrum', label: 'Sacrum', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'], subzones: SACRAL },
{ id: 'sacro-iliac-l', label: 'Sacro-iliaque gauche', category: 'axial', views: ['lateral_left', 'dorsal'] },
{ id: 'sacro-iliac-r', label: 'Sacro-iliaque droite', category: 'axial', views: ['lateral_right', 'dorsal'] },
{ id: 'tail', label: 'Queue', category: 'tail', views: ['lateral_left', 'lateral_right', 'dorsal'] },
{ id: 'shoulder-l', label: 'Épaule gauche', category: 'limb', views: ['lateral_left', 'dorsal'] },
{ id: 'shoulder-r', label: 'Épaule droite', category: 'limb', views: ['lateral_right', 'dorsal'] },
{ id: 'elbow-l', label: 'Coude gauche', category: 'limb', views: ['lateral_left'] },
{ id: 'elbow-r', label: 'Coude droit', category: 'limb', views: ['lateral_right'] },
{ id: 'knee-l', label: 'Genou antérieur gauche', category: 'limb', views: ['lateral_left'] },
{ id: 'knee-r', label: 'Genou antérieur droit', category: 'limb', views: ['lateral_right'] },
{ id: 'fetlock-front-l', label: 'Boulet antérieur gauche', category: 'limb', views: ['lateral_left'] },
{ id: 'fetlock-front-r', label: 'Boulet antérieur droit', category: 'limb', views: ['lateral_right'] },
{ id: 'hip-l', label: 'Hanche gauche', category: 'limb', views: ['lateral_left', 'dorsal'] },
{ id: 'hip-r', label: 'Hanche droite', category: 'limb', views: ['lateral_right', 'dorsal'] },
{ id: 'stifle-l', label: 'Grasset gauche', category: 'limb', views: ['lateral_left'] },
{ id: 'stifle-r', label: 'Grasset droit', category: 'limb', views: ['lateral_right'] },
{ id: 'hock-l', label: 'Jarret gauche', category: 'limb', views: ['lateral_left'] },
{ id: 'hock-r', label: 'Jarret droit', category: 'limb', views: ['lateral_right'] },
{ id: 'fetlock-rear-l', label: 'Boulet postérieur gauche', category: 'limb', views: ['lateral_left'] },
{ id: 'fetlock-rear-r', label: 'Boulet postérieur droit', category: 'limb', views: ['lateral_right'] },
];
export const EQUINE_ANATOMY: SpeciesAnatomy = {
id: 'equine',
label: 'Cheval',
vertebralFormula: { cervical: 7, thoracic: 18, lumbar: 6, sacral: 5 },
zones: ZONES,
svg: {
lateral_left: '/species/equine/lateral-left.svg',
lateral_right: '/species/equine/lateral-right.svg',
dorsal: '/species/equine/dorsal.svg',
},
};