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)
This commit is contained in:
ZenQuality committed 2026-05-17 07:06:59 +02:00
1 parent 4c465a5743
commit b5b2e163c9
20 files changed
+1383 -41

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 800" role="img" aria-label="Cheval vu de dessus">
<g id="illustration" pointer-events="none">
<ellipse cx="500" cy="160" rx="55" ry="80" fill="#e6ede0" stroke="#4a7c59" stroke-width="2"/>
<path d="M460 230 Q500 240 540 230 L555 290 L555 720 Q500 740 445 720 L445 290 Z" fill="#e6ede0" stroke="#4a7c59" stroke-width="2"/>
<line x1="500" y1="240" x2="500" y2="720" stroke="#4a7c59" stroke-width="1" stroke-dasharray="4 4"/>
</g>
<g id="zones">
<path id="zone-head" data-zone="head" d="M455 90 L545 90 L555 230 L445 230 Z" fill="transparent"/>
<path id="zone-neck" data-zone="neck" d="M450 235 L550 235 L555 305 L445 305 Z" fill="transparent"/>
<path id="zone-withers" data-zone="withers" d="M455 305 L545 305 L545 360 L455 360 Z" fill="transparent"/>
<path id="zone-shoulder-l" data-zone="shoulder-l" d="M395 305 L445 305 L445 380 L395 375 Z" fill="transparent"/>
<path id="zone-shoulder-r" data-zone="shoulder-r" d="M555 305 L605 305 L605 375 L555 380 Z" fill="transparent"/>
<path id="zone-thoracic-back" data-zone="thoracic-back" d="M455 360 L545 360 L545 540 L455 540 Z" fill="transparent"/>
<path id="zone-lumbar" data-zone="lumbar" d="M455 540 L545 540 L545 620 L455 620 Z" fill="transparent"/>
<path id="zone-sacro-iliac-l" data-zone="sacro-iliac-l" d="M420 620 L495 620 L495 670 L420 670 Z" fill="transparent"/>
<path id="zone-sacro-iliac-r" data-zone="sacro-iliac-r" d="M505 620 L580 620 L580 670 L505 670 Z" fill="transparent"/>
<path id="zone-sacrum" data-zone="sacrum" d="M455 660 L545 660 L545 720 L455 720 Z" fill="transparent"/>
<path id="zone-hip-l" data-zone="hip-l" d="M395 620 L450 620 L450 720 L395 720 Z" fill="transparent"/>
<path id="zone-hip-r" data-zone="hip-r" d="M550 620 L605 620 L605 720 L550 720 Z" fill="transparent"/>
<path id="zone-tail" data-zone="tail" d="M470 720 L530 720 L530 770 L470 770 Z" fill="transparent"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

+24
View File
@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 600" role="img" aria-label="Cheval vu de la gauche">
<g id="illustration" pointer-events="none">
<path d="M120 320 Q180 280 260 290 L320 200 Q360 170 400 195 L430 240 Q480 245 550 250 L620 260 Q700 260 760 285 L820 320 L860 350 L860 410 L830 420 L810 470 L780 475 L765 530 L740 540 L720 470 L700 470 L685 530 L660 540 L640 470 L470 470 L450 530 L425 540 L405 470 L385 470 L365 530 L340 540 L320 470 L300 470 L285 530 L260 540 L240 470 L220 460 L180 400 L140 380 Z" fill="#e6ede0" stroke="#4a7c59" stroke-width="2"/>
<circle cx="345" cy="220" r="6" fill="#2d4a35"/>
</g>
<g id="zones">
<path id="zone-head" data-zone="head" d="M310 175 L380 175 L390 235 L320 240 Z" fill="transparent"/>
<path id="zone-neck" data-zone="neck" d="M390 235 L470 245 L460 290 L380 295 Z" fill="transparent"/>
<path id="zone-withers" data-zone="withers" d="M460 245 L530 245 L530 280 L455 280 Z" fill="transparent"/>
<path id="zone-thoracic-back" data-zone="thoracic-back" d="M530 250 L680 260 L680 295 L530 290 Z" fill="transparent"/>
<path id="zone-lumbar" data-zone="lumbar" d="M680 260 L760 280 L760 315 L680 300 Z" fill="transparent"/>
<path id="zone-sacrum" data-zone="sacrum" d="M760 285 L820 320 L815 355 L755 325 Z" fill="transparent"/>
<path id="zone-tail" data-zone="tail" d="M820 320 L870 320 L880 360 L825 360 Z" fill="transparent"/>
<path id="zone-shoulder-l" data-zone="shoulder-l" d="M460 280 L520 290 L505 360 L455 350 Z" fill="transparent"/>
<path id="zone-elbow-l" data-zone="elbow-l" d="M460 360 L505 360 L500 400 L460 400 Z" fill="transparent"/>
<path id="zone-knee-l" data-zone="knee-l" d="M450 400 L500 400 L495 445 L450 445 Z" fill="transparent"/>
<path id="zone-fetlock-front-l" data-zone="fetlock-front-l" d="M445 445 L495 445 L490 480 L445 480 Z" fill="transparent"/>
<path id="zone-hip-l" data-zone="hip-l" d="M710 285 L770 290 L760 360 L705 355 Z" fill="transparent"/>
<path id="zone-stifle-l" data-zone="stifle-l" d="M700 360 L760 360 L755 405 L700 405 Z" fill="transparent"/>
<path id="zone-hock-l" data-zone="hock-l" d="M700 405 L755 405 L750 450 L700 450 Z" fill="transparent"/>
<path id="zone-fetlock-rear-l" data-zone="fetlock-rear-l" d="M700 450 L750 450 L745 485 L700 485 Z" fill="transparent"/>
<path id="zone-sacro-iliac-l" data-zone="sacro-iliac-l" d="M740 285 L795 290 L790 320 L735 315 Z" fill="transparent"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

+24
View File
@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 600" role="img" aria-label="Cheval vu de la droite">
<g id="illustration" pointer-events="none" transform="translate(1000,0) scale(-1,1)">
<path d="M120 320 Q180 280 260 290 L320 200 Q360 170 400 195 L430 240 Q480 245 550 250 L620 260 Q700 260 760 285 L820 320 L860 350 L860 410 L830 420 L810 470 L780 475 L765 530 L740 540 L720 470 L700 470 L685 530 L660 540 L640 470 L470 470 L450 530 L425 540 L405 470 L385 470 L365 530 L340 540 L320 470 L300 470 L285 530 L260 540 L240 470 L220 460 L180 400 L140 380 Z" fill="#e6ede0" stroke="#4a7c59" stroke-width="2"/>
<circle cx="345" cy="220" r="6" fill="#2d4a35"/>
</g>
<g id="zones" transform="translate(1000,0) scale(-1,1)">
<path id="zone-head" data-zone="head" d="M310 175 L380 175 L390 235 L320 240 Z" fill="transparent"/>
<path id="zone-neck" data-zone="neck" d="M390 235 L470 245 L460 290 L380 295 Z" fill="transparent"/>
<path id="zone-withers" data-zone="withers" d="M460 245 L530 245 L530 280 L455 280 Z" fill="transparent"/>
<path id="zone-thoracic-back" data-zone="thoracic-back" d="M530 250 L680 260 L680 295 L530 290 Z" fill="transparent"/>
<path id="zone-lumbar" data-zone="lumbar" d="M680 260 L760 280 L760 315 L680 300 Z" fill="transparent"/>
<path id="zone-sacrum" data-zone="sacrum" d="M760 285 L820 320 L815 355 L755 325 Z" fill="transparent"/>
<path id="zone-tail" data-zone="tail" d="M820 320 L870 320 L880 360 L825 360 Z" fill="transparent"/>
<path id="zone-shoulder-r" data-zone="shoulder-r" d="M460 280 L520 290 L505 360 L455 350 Z" fill="transparent"/>
<path id="zone-elbow-r" data-zone="elbow-r" d="M460 360 L505 360 L500 400 L460 400 Z" fill="transparent"/>
<path id="zone-knee-r" data-zone="knee-r" d="M450 400 L500 400 L495 445 L450 445 Z" fill="transparent"/>
<path id="zone-fetlock-front-r" data-zone="fetlock-front-r" d="M445 445 L495 445 L490 480 L445 480 Z" fill="transparent"/>
<path id="zone-hip-r" data-zone="hip-r" d="M710 285 L770 290 L760 360 L705 355 Z" fill="transparent"/>
<path id="zone-stifle-r" data-zone="stifle-r" d="M700 360 L760 360 L755 405 L700 405 Z" fill="transparent"/>
<path id="zone-hock-r" data-zone="hock-r" d="M700 405 L755 405 L750 450 L700 450 Z" fill="transparent"/>
<path id="zone-fetlock-rear-r" data-zone="fetlock-rear-r" d="M700 450 L750 450 L745 485 L700 485 Z" fill="transparent"/>
<path id="zone-sacro-iliac-r" data-zone="sacro-iliac-r" d="M740 285 L795 290 L790 320 L735 315 Z" fill="transparent"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB