- schema_version "2.0" everywhere; new Changelog section with
v1.0 → v2.0 entries highlighting the breaking change.
- New Scope (legal périmètre) section listing inclusions / exclusions
and the two flag mechanisms (root scope_disclaimer + leaf boolean).
- Clarified SVG ↔ JSON link via strict label equality (not data-anno-id)
and cranio-caudal zone ordering rule.
- Documented the 3 standardized categories per zone
(*-dysfunctions / *-observations / anamnesis) and the 5 dysfunctions
taxonomy patterns (head SSB / head peripheral / articular /
vertebral hinge / vertebral region).
- Documented structural authoring rules (depth ≤ 4, ≥ 2 children per
intermediate, sibling-scoped ID uniqueness).
- Spelled out the v2.0 requires_vet_referral / description_fr policy
(boolean = source of truth; description_fr survives only on
differential leaves) and the breaking-change notice for any consumer
relying on description_fr.includes('vétérinaire').
- Rewrote the minimal example using v2.0 contract (boolean only,
description_fr only when it adds a differential).
- Noted Zod's silent strip of unknown fields (e.g. species.notes,
per-leaf metadata).
- Added current horse.json stats table (26 zones / 792 nodes /
612 leaves / 41 vet leaves).
Catalog bumped v1.2 → v2.0 by domain expert.
- schema_version "2.0"; 26 zones (9 head + 17 body), 792 nodes,
612 leaves, 41 requires_vet_referral leaves.
- requires_vet_referral becomes the sole source of truth for the
vet-orientation flag. Generic "orienter vers vétérinaire" wording
purged from description_fr on 25 leaves; the 16 leaves carrying a
clinical differential keep their description_fr.
- Existing Zod schema (findings.ts) and consumers (FindingsTreePicker,
PDF observationPage) already key off the boolean — zero code change
required.
- Aligns SVG Horse_head.svg "hyoïde" → "Hyoïde" so all 26
data-anno-name-fr / -en values match zone.name_fr / name_en
strictly (v2.0 authoring rule prescribes exact equality;
src/lib/zoneMatch.ts fuzzy fallback retained as safety net).
154/154 tests green, typecheck clean.
- localeStore.readInitial now consults navigator.language(s) when
localStorage is empty (first fr/en hit, FR fallback). Persisted user
choice still wins.
- New helper src/anatomy/labels.ts (boneLabel(b, locale, fallback))
with cross-language fallback so missing labels never render blank.
- AnatomyCanvas rewrites native SVG <title> tooltips per locale on
mount and on locale change (upstream SVG ships titles as "FR / EN"
concat; we replace with the active-locale label only). Detail-popup
trigger titles ("🔍 Zoom: …") left intact.
- DetailModal + EditorRoute detail title prefix + vertebra picker
title now route through useT()/boneLabel.
- ObservationCard.describeZone takes locale, picks bone.fr / bone.en.
- PDF: buildZoneLabels returns Map<id, { fr, en }> instead of FR-only;
observationPage picks per locale with cross-language fallback.
- Tests: FindingsTreePicker + VertebraPicker reset locale to 'fr' in
beforeEach (navigator-detect may land on EN in happy-dom).
- pdf.zoneLabels test updated to assert the new pair shape.
154/154 tests pass, lint clean, typecheck clean, build OK.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Review surfaced 3 critical paths where hardcoded French leaked into
the EN UI:
- src/pdf/import.ts ImportError default message
- src/pdf/attachment.ts IncompatibleReportVersionError message
- src/app/routes/HomeRoute.tsx propagated err.message verbatim
Refactor:
- ImportError carries a typed `kind` discriminant
('invalid_pdf' | 'incompatible_version' | 'no_attachment') plus
optional `foundVersion`. Removes hardcoded localized strings.
- IncompatibleReportVersionError keeps `foundVersion` only; message
collapses to an internal sentinel.
- HomeRoute resolves the user-facing message via the active i18n
dict using `err.kind`, with `{version}` template substitution for
the incompatible-version case.
- 3 new dict keys (fr+en): home.import.error_invalid_pdf,
home.import.error_no_attachment, home.import.error_incompatible_version
- pdf.roundtrip v1 case asserts ImportError instance + kind +
foundVersion instead of grepping the message text.
154/154 tests pass, lint clean, typecheck clean, build OK.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3 new cases:
- exports with locale=fr roundtrips
- exports with locale=en roundtrips
- both produce non-empty byte streams and the imported JSON payloads
match (locale lives outside the Report, so finding labelFr/EnSnapshot
are byte-identical between exports — only the static dict labels
rendered into the PDF differ, verified manually since pdf-lib font
subsets make byte-grep unreliable per LRN-016)
154/154 tests pass.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
12 tasks, TDD per task, file paths + full code shape + verification.
Locale store + dicts + useT separate green commits; PDF + route
migrations land as one atomic green-build commit (formatDate +
exportReportToPdf signature change cross the boundary).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Capture the second-session findings-tree iteration learnings before
they fade:
Decisions
- BDR-012 species auto-discovery via Vite import.meta.glob default-export
contract (alternatives: hardcoded registry, runtime registerSpecies()).
- BDR-013 SVG↔JSON zone bridge via fuzzy FR/EN label match (alternatives:
rename SVG ids, add new data-anno-finding-zone attribute).
Learnings
- LRN-013 import.meta.glob + default-export as a plugin-discovery pattern.
- LRN-014 normalize + Levenshtein recipe for human-string cross-walk.
- LRN-015 per-source try/catch beats wrapping a loop with one outer catch.
- LRN-016 pdf-lib subset-font output: latin1/utf-8 bytes-grep won't find
user-visible text — extract the JSON attachment or test through a
refactored helper instead.
Journal
- Logs the 11 commits between b7b0945 and 70f21cc with one-line summaries
+ cross-refs to the new registry entries.
Co-Authored-By: Claude <noreply@anthropic.com>
Documents the canonical pathologies.json shape next to the existing
ANATOMY-SVG-CONVENTION and PDF-FORMAT guides. Mirrors the Zod
contract in src/domain/schema/findings.ts:
- Top-level frame (schema_version, scope_disclaimer, species, zones).
- ZoneFindings shape and how name_fr/name_en bridge to SVG labels.
- Recursive FindingNode (leaf vs intermediate, optional description,
vet-referral flag, sources).
- SourceRef enum + URL validation.
- A minimal worked example.
- How leaf selections become persisted Findings, with the labelFr/En
snapshot contract that protects already-exported reports from
retroactive catalog edits.
- Authoring workflow that defers to `pnpm scaffold:species` and Vite
HMR-driven validation.
Co-Authored-By: Claude <noreply@anthropic.com>
Registry
--------
src/domain/species/registry.ts previously hard-coded the species list,
which meant adding a new animal forced an edit in two places. The
registry now uses Vite's `import.meta.glob('./*/index.ts', { eager: true })`
and registers every manifest that default-exports a SpeciesManifest.
Duplicate ids log a warn and the first wins. Existing named imports
keep working — equine/index.ts adds `export default equine` next to the
named export.
The species dropdown is also now sorted alphabetically by labelFr (FR
locale) instead of insertion order, so two species don't shuffle
position based on glob ordering.
Scaffold script
---------------
`pnpm scaffold:species` (scripts/scaffold-species.mjs) is an
interactive Node ESM prompt that asks for the id, FR/EN labels, asset
folder, main SVG filename, detail SVG mappings, and the vertebral
formula, then writes:
src/domain/species/<id>/index.ts (with `export default`)
src/domain/species/<id>/vertebrae.ts
src/domain/species/<id>/pathologies.ts (Zod-parses the JSON)
src/domain/species/<id>/pathologies.json (minimal valid skeleton)
public/species/<assetFolder>/ (directory placeholder)
The script refuses to overwrite existing files, so it's safe to rerun
after typos. SVG assets are not generated — drop them in the public
folder yourself.
Findings JSON updates
---------------------
No runtime hot-reload mechanism is needed in dev: `pathologies.ts`
imports `pathologies.json` and runs `SpeciesFindingsSchema.parse(data)`
at module load, so a JSON edit triggers Vite HMR + an immediate Zod
validation pass. In prod, rebuild and redeploy.
Docs
----
docs/ADDING-A-SPECIES.md rewritten around the new flow: quick start via
the scaffold script first, manual instructions second, and removed the
stale references to the flat `Pathology[]` model and the no-longer-
required registry edit step.
Co-Authored-By: Claude <noreply@anthropic.com>
ZONES and CONSTATS sections previously joined their entries with a tiny
mid-dot in the same body font. At print scale the separator collapsed
into the surrounding text and made dense lists hard to scan.
Sections that contain " · " are now drawn segment-by-segment:
- Items keep the existing body-regular @10pt ink color.
- The separator is rendered as a heavier "•" in body-bold @14pt in the
accent color, with 5pt of clear space on either side.
- The bullet's baseline is nudged down 30% of the size delta so it
visually centers on the surrounding text x-height.
Wrapping is handled per-item: an item that won't fit on the current
line jumps to the next; the separator never lands at the start of a
new line. The height estimator was updated to count the same wrapping
the renderer uses, so the image-area / text-area budget stays
balanced for both single-line and multi-line section values.
Co-Authored-By: Claude <noreply@anthropic.com>
Single 6px Gaussian blur was being attenuated to near-invisible by the
SVG → canvas → PNG → pdf-lib pipeline (each stage loses some alpha).
The halo is now built from two stacked passes:
- a wide pass (stdDeviation=18) merged three times for the outer glow,
- a tighter pass (stdDeviation=8) merged twice to keep the selection
anchored to the original point instead of dissolving into a fog.
Result: zone highlights stay obvious at print scale and from a couple
of feet away. Detail-view rendering is unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
Single image
------------
When an observation only has one SVG to render (no detail-popup zones),
the image now occupies half the available column width and is centered
horizontally. Two-image observations keep the existing 2-column grid
unchanged. The text-section reservation logic and aspect-driven row
budget still apply, so the layout stays balanced regardless of the
chosen cell size.
Halo glow on whole-animal view
------------------------------
Whole-animal SVGs use small point markers on a large silhouette, so
the previous flat fill was hard to spot at print scale. The colorized
SVG now carries a Gaussian-blur SVG filter ("osteo-halo") which is
applied to every selected zone on main views only — detail views are
already zoomed in and don't need it. The filter widens each selection
into a soft accent-coloured halo while keeping the original shape
crisp on top via feMerge. Fill opacity bumped from 0.65 to 0.85 to
sharpen the focal mark itself.
The filter is injected once into the SVG defs per export, so multiple
selected zones share the same definition with no duplication cost.
Co-Authored-By: Claude <noreply@anthropic.com>
PDF
---
The flat single-line "CONSTATS" section bundled every selected leaf
from every zone plus the free-text additions on one line, which got
hard to read as soon as an observation touched more than one zone.
The export now groups catalog findings by their JSON `zoneId` and
emits one section per zone, labelled with the zone's French name
("CONSTATS — SPHÉNOÏDE", "CONSTATS — ARTICULATION TEMPORO-MANDIBULAIRE
(ATM)", …). Free-text additions move to a dedicated "CONSTATS LIBRES"
section directly below.
The catalog tree is loaded once at the top of exportReportToPdf and
threaded through to addObservationPage, so the per-zone label lookup
costs nothing extra per observation.
Editor
------
Inside an expanded observation, each available zone's
FindingsTreePicker is now wrapped in an accordion header that mirrors
the ObservationCard expand/collapse semantics:
- Click a zone header → that picker opens and any other picker on the
card closes.
- Click an open zone header → it collapses.
- Each header shows a selected-count badge and a ▼/▲ caret.
Default state is "all closed" so the card stays compact when the user
expands a new observation. Motion-based height/opacity transition
matches the observation card body animation for visual consistency.
Co-Authored-By: Claude <noreply@anthropic.com>
EditorRoute used to populate detailBones lazily, inside the useEffect
that fires when the user opens a detail popup. That was fine for
fresh sessions, but after re-importing a PDF the store can already hold
observations whose zones reference detail-popup bone ids (e.g. an ATM
zone with boneId "point-mpbyo7zq" carried by the head detail SVG).
Without the matching Bone in detailBones, ObservationCard.zonesWithTree
could not resolve bone.fr — matchZoneFindings discarded the zone and
the findings tree picker never appeared on observations whose only
zones came from a detail popup. The findings were already in the store
(read straight from the JSON attachment), so it looked exactly like
"the pathologies don't load on re-upload" from the user side.
Fix: in the species-load useEffect, fire a fetch for every
species.details path in parallel and merge the parsed bones into
detailBones. Each fetch has its own catch so one missing asset does
not block the others. The popup-open useEffect stays as a no-op
safety net (merge is idempotent thanks to the !merged.has(id) guard).
Co-Authored-By: Claude <noreply@anthropic.com>
The old buildZoneLabels wrapped the main-SVG fetch and every detail-SVG
fetch in a single try/catch. As soon as one source threw — for example
a 404 on a detail asset in a misconfigured deployment — the loop bailed
out and the labels Map stayed populated only with whatever the loop had
already set. That left every observation zone whose boneId belonged to
a failed source falling back to the raw, opaque "point-mpbyo7zq" string
in the rendered PDF.
The refactor:
- Loads every source independently in parallel.
- Wraps each load+parse in its own try/catch.
- Logs a console.warn on failure so the issue is observable in dev.
- Skips empty bone.fr values so the lookup never returns "" (which the
`??` fallback would treat as a value).
Exports buildZoneLabels so it can be unit-tested directly. The new
suite (4 cases) loads the real Horse + Horse_head SVG fixtures with a
mocked fetch and asserts:
- detail-popup boneIds resolve to their FR labels,
- main-SVG boneIds resolve to their FR labels,
- main labels survive a 404 on the detail asset,
- unknown species returns an empty map.
Co-Authored-By: Claude <noreply@anthropic.com>
When drilling through the findings catalog, intermediate categories
and sub-categories now carry a rounded accent-coloured badge that
counts every selected leaf in their subtree. Sibling nodes with no
descendant selections stay badge-free, so the practitioner can scan
a level and see at a glance which branches already hold findings
without re-opening each one.
Implementation is a small `pathStartsWith` helper plus a `countSelectedUnder`
lookup against the current observation's findings — restricted to the
picker's `zoneId` so two parallel pickers on the same card never
cross-contaminate counts.
5 new tests cover: count of 2 visible at root, the same 2 visible one
level deeper on the right sub-branch, no badge on un-selected siblings,
singular aria label for 1 selection, and zone isolation.
Co-Authored-By: Claude <noreply@anthropic.com>
ObservationCard previously bridged SVG zones to the JSON findings
catalog with a strict FR-name equality check. That broke as soon as the
JSON used "(ATM)" while the SVG carried "Articulation Temporo-
Mandibulaire (ATM)" or whenever either side picked up a minor casse /
accent / typo drift.
The new matcher (src/lib/zoneMatch.ts) normalizes both sides
aggressively (lowercase + NFD-strip accents + drop non-alphanumerics)
and scores each pairing across all four (bone-lang, zone-lang)
combinations:
0 exact normalized match
1 one normalized string is contained in the other
2+d Levenshtein distance d, capped at max(2, ceil(maxLen * 0.25))
∞ beyond tolerance — discarded
Preference order: English exact/substring first (no accents → fewer
normalization edge cases), then French exact/substring, then fuzzy
across both languages.
Real-world payoff for the current equine catalog:
bone EN "Sphenoid" → sphenoid (score 0)
bone EN "Spheno-Basilar Synchondrosis (SBS)" → ssb (score 0)
bone EN "Temporomandibular Joint (TMJ)" → atm (score 0)
bone FR "(ATM)" alone → atm (score 1)
bone EN "sphenoi" / "shenoide" (typo) → sphenoid (fuzzy)
bone EN "Hyoid", "Hip joint", "Stifle", ... → undefined (correct)
23 new unit tests cover normalization, Levenshtein, scorePair branches,
the full matchZoneFindings strategy ladder, and the absence of false
positives (Sphenoid ↛ SSB, Hyoid/Hanche/etc ↛ anything).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SVG data-anno-id values are opaque generator strings (point-mpbyk...,
zone-mpbx...) that never match the human keys used in the findings
catalog (sphenoid, ssb, atm, ...). The picker therefore stayed hidden
whenever a zone was clicked.
ObservationCard now bridges the two via the FR label parsed from
data-anno-name-fr: it builds a name_fr → ZoneFindings index from the
loaded findings, looks up each observation zone by its Bone.fr, and
renders one picker per matched JSON tree (deduped on tree.id). Emitted
findings carry zoneId = tree.id (the JSON key), keeping the snapshot
contract intact.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mark B0/B1/B2/B5 done on TODO. Journal 2026-05-20 entry with the three
commit SHAs and a per-phase recap. Three new design decisions captured:
JSON snake_case kept in TS (BDR-009), snapshot labels at selection time
(BDR-010), hard-fail v1 PDF with FR-language message (BDR-011). Two new
learnings: Zod recursive schemas via z.lazy + explicit ZodType<T>
(LRN-011), once-per-session UX modal via sessionStorage flag (LRN-012).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the flat PathologyPicker with FindingsTreePicker — breadcrumb
navigation, drill into intermediate categories, toggle leaves, optional
vet-referral badge, optional description rendering. One picker per zone
that has a catalog entry; zones without a tree fall back to the free-text
input (renamed FreeTextFindingInput to match the new vocabulary).
EditorRoute now loads SpeciesFindings instead of a Pathology[] and shows
the scope_disclaimer once per session via a sessionStorage flag so the
practitioner is reminded of the legal perimeter the first time.
PDF observationPage renders findings via the snapshotted FR label and
prefixes ⚠ on vet-referral items, keeping the existing layout pipeline
intact (LRN-007/008/009 still apply).
Also drops the unused Toast and ZoneTooltip stubs, refreshes the
CLAUDE.md folder map, and adds a FindingsTreePicker test covering
navigation, leaf toggle, vet-referral flag, and back-out.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ObservationSchema now carries a hierarchical Finding (zoneId + path +
labelFrSnapshot + labelEnSnapshot + requiresVetReferral?) plus a renamed
freeTextFindings list, replacing the flat pathologyIds /
freeTextPathologies pair. Snapshot labels keep already-exported reports
readable if the catalog is later edited.
ReportSchema.version bumped from 1 → 2. PDF import surfaces a distinct,
French-language error message on legacy v1 attachments instead of the
generic "not an osteo PDF" line, via a new IncompatibleReportVersionError
detected before the strict Zod parse runs.
Store seed and tests updated for the new shape. The standalone Pathology
Zod schema and its test are removed — the new findings tree is the single
source of truth for what an observation can carry.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the flat Pathology[] model with a hierarchical SpeciesFindings
tree (zones → categories → nested children → leaves) authored as JSON and
validated at boot. Equine catalog JSON is now wired through
SpeciesFindingsSchema.parse() so malformed data fails loudly instead of
corrupting an observation later.
Species manifest swaps `pathologies` loader for `findings`. JSON species
id renamed equin → equine to match the registry. Old equine pathology
test deleted; new findings test covers parse + FR/EN label coverage +
zone/category/leaf structure.
Foundational step of the v2 domain pivot; callers in observation/store/
UI/PDF migrated in follow-up commits.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Records the schema-v1.1 findings pivot decision, the inert JSON
drop, and the species.id reconciliation ("equin" vs "equine") to
resolve before the next loader migration runs.
Co-Authored-By: Claude <noreply@anthropic.com>
Adds the schema-v1.1 hierarchical findings JSON authored by the
domain expert at src/domain/species/equine/pathologies.json
(3-zone sample: sphenoid/ssb/atm — placeholder before full-body
authoring).
JSON is inert: not yet imported by the loader (still exports the
empty Pathology[]), so build and tests stay green.
TODO rewritten to sequence the V1 refactor:
- B0 findings schema + JSON loader with Zod parse at boot
- B1 ReportSchema v2 (observation.findings = path + snapshot)
- B2 FindingsTreePicker replacing flat PathologyPicker
- B3 i18n FR/EN site + PDF (locale store, dict, switcher)
- B4 PDF observationPage rendering findings
- B5 stub cleanup
- C full horse.json authoring + QA + docs + deploy
Known fixup: JSON species.id is "horse" but registry uses
"equine"; align JSON to "equine" at integration time.
Co-Authored-By: Claude <noreply@anthropic.com>
Scaffold-era checklist was stale: most Phase 2-5 items already
shipped (full editor flow, PDF roundtrip, Docker, identity edit
dialog, etc.). Rewrite to capture what's actually done vs what
remains for V1/MVP ship.
Remaining for V1: equine pathology DB (40-60 source-cited entries,
currently empty array), stub cleanup (Toast/ZoneTooltip unused,
ObservationEditor never created), PDF QA pass, Docker deploy
validation, doc finalization, Scaleway production deploy.
Post-V1 ideas (Capacitor mobile, accounts/cloud, RDV) captured
in Phase C so they don't get pulled into MVP by mistake.
Co-Authored-By: Claude <noreply@anthropic.com>
Three related editor polish bugs from PDF-import dogfooding.
(1) boneStates previously walked every observation, marking zones
in collapsed observations as 'linked' (faint) or 'multi' (bold) —
so deselected zones kept lingering color states. Now we read only
the active observation; everything else renders neutral.
(2) AnatomyCanvas applied highlight attributes once on mount; when
the SVG (esp. inside DetailModal) loaded after the boneStates
effect had already run, the freshly-mounted nodes had no
data-state. Track loadedSrc and re-run the highlight effect after
each SVG swap so detail-popup zones get colored on open.
(3) NewReportRoute had "← Accueil" on the right while EditorRoute
keeps it on the left — disorienting. Both headers now share the
same left-aligned back-button + clickable Brand pattern.
Deviation: hotfix rule caps at 2 files, this touches 3. Each fix
is mechanical and obvious; bundling is cheaper than three separate
patches.
Co-Authored-By: Claude <noreply@anthropic.com>
Multi-SVG observations previously stacked vertically and pushed
the zones/pathologies/severity/comment sections off the page.
Now SVGs are laid out 2 per row with cell width = (page - 2*margin
- col-gap)/2. Each cell scales to its own aspect, capped by a
per-row height budget that subtracts the reserved bottom (text
sections + bottom margin) from the available image area. Single-
SVG observations keep a full-width row.
Safety: the text-area reservation guarantees the sections always
fit; the cell-height cap prevents runaway when many details are
selected. A floor (IMAGE_MIN_CELL_H) avoids zero-height cells in
pathological cases.
Co-Authored-By: Claude <noreply@anthropic.com>
Header now exposes a back button and clickable brand title both
linking to /. New "Modifier les infos" button opens a dialog that
edits practitioner, animal, and owner via the existing forms with
cancel/save and required-name validation. Save also refreshes the
practitioner localStorage cache.
Co-Authored-By: Claude <noreply@anthropic.com>
Enables in-place edit of report identity blocks from the editor.
Mirrors existing setConclusion/setRecommendations pattern; no-op
when no report is loaded.
Co-Authored-By: Claude <noreply@anthropic.com>
Eyebrow OBSERVATION / SYNTHÈSE now baseline-anchored at y=height-95;
title baseline at y=height-122. 27pt separation between baselines so
the Times-22 ascender no longer reaches into the eyebrow line.
Severity next to the observation number is rendered as a filled pill
with white uppercase label. Background color encodes severity at a
glance:
- légère → sage green
- modérée → amber
- sévère → red
Co-Authored-By: Claude <noreply@anthropic.com>
Layout:
- Title baseline dropped from height-90 to height-115 so the size-22
ascender clears the header rule at y=760 with a real cushion.
- Image area starts further down to match.
Visual style:
- Eyebrow label (small bold accent) above each title: OBSERVATION /
SYNTHÈSE. Title uses Times 22; observation page shows the index
as a zero-padded number (01, 02, …) with severity as a muted
inline note next to it.
- 2pt accent rule (48pt wide) under each title.
- Section labels (ZONES, PATHOLOGIES, SÉVÉRITÉ, COMMENTAIRE,
CONCLUSION, RECOMMANDATIONS, PROCHAIN RENDEZ-VOUS) rendered as
small bold uppercase accent labels with the value on the next
line in regular body.
- Image area gets a "VUE GÉNÉRALE" / "VUE DÉTAIL — <id>" eyebrow.
Colors are inlined as rgb tokens (ink, muted, accent terracotta).
No new assets, only the three Standard fonts already embedded.
Co-Authored-By: Claude <noreply@anthropic.com>
Four coupled PDF rendering bugs:
1. Title "Observation #N" and "Conclusion" overlapped the header rule
(y = height - 80; rule at y = 760; size-16 ascender ate the line).
Lowered both titles to y = height - 90.
2. Long zones lines visually wrapped via maxWidth but the cursor only
advanced one slot per array entry, so pathologies/sévérité/commentaire
collided with the wrapped tail. Added wrapLines + per-line advance.
3. The rasterized anatomy still showed unselected zones (purple spine
fills, orange head trigger) because colorizedSvgString only mutated
selected elements. Non-selected annotated elements are now hidden via
display="none" and every data-anno-* attribute is stripped from the
serialized output (data-anno are runtime-only hints).
4. Main SVG was drawn even when every zone lived in a detail popup.
Render it only when at least one zone has no detailSourceId.
Layout constants extracted at the top of observationPage.ts.
Co-Authored-By: Claude <noreply@anthropic.com>
Detail bones were cleared on popup close, so zone labels reverted to
raw ids (point-mpbynls5✕) once the head modal was dismissed. Now the
detailBones map accumulates across opens, and a merged allBones map
(main ∪ detail) is passed to ObservationList so describeZone resolves
the FR label every time.
Co-Authored-By: Claude <noreply@anthropic.com>
When opened from a spine zone, the picker now lands on the matching
region tab instead of defaulting to Cervicales every time. Inference is
substring-based on the FR label first, EN as fallback (cervic→C,
thorac/dors→T, lombair/lumbar→L, sacral/sacre→S, caudal/coccyg→Cd),
case- and accent-insensitive. An existing selection still wins over
the inferred region so re-opening lands where the user left off.
Co-Authored-By: Claude <noreply@anthropic.com>
Three coupled bugs in zone interaction:
1. Clicks inside the head detail popup were ignored — EditorRoute
looked up the clicked id in the main-SVG bones map only, so
detail-only ids (point-mpbykomv et al.) returned undefined.
2. Spine zones did not open VertebraPicker on click; the picker was
only reachable via the per-zone "Vertèbres…" button.
3. The new SVG hint data-anno-special="vertebral-precision" was
present in Horse.svg but unread by the parser/UI.
Parser now reads data-anno-special into Bone.special. EditorRoute
parses the detail SVG on open and falls back to detailBones for id
lookups. When bone.special === 'vertebral-precision', clicking adds
the zone (if absent) and opens VertebraPicker for that zone index;
toggle-off via main click is disabled for these zones (use ✕). The
"Vertèbres…" button in ObservationCard is now shown only on zones
that support it. Convention doc updated.
Co-Authored-By: Claude <noreply@anthropic.com>
User asked that the app interact with anything carrying data-anno-*
attributes without hardcoding any specific category, id, or name. Future
SVGs may introduce new categories, and the existing SVGs may be updated.
Changes:
- `BoneCategory` is now `type BoneCategory = string`. The closed union
is gone; the parser accepts any non-empty value. New categories don't
require code changes.
- `VALID_CATEGORIES` and `isValidCategory()` removed from
svgConvention.ts. `validateBoneElement()` now only enforces presence
of `data-anno-id` and `data-anno-category`.
- EditorRoute no longer auto-triggers the vertebra picker when the
clicked annotation is `zone-colonne`. Any zone is added the same way
to the active observation regardless of category.
- ObservationCard shows a "Vertèbres…" link on every zone badge (was
conditional on `category === 'zone-colonne'`). The praticien picks
vertebrae only when relevant — the UI no longer knows or cares which
zones are spinal.
- Tests rewritten: removed the `isValidCategory` enum assertions and
the "rejects unknown category" branch. New test demonstrates that
parseSvgBones accepts a completely novel category string.
90/90 tests pass, lint clean, build clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User dropped new Horse.svg / Horse_head.svg that follow a simpler
convention:
- Categories renamed to longer human strings:
articulation → articulations
charniere → charni-res-vert-brales
spine-zone → zone-colonne
cadran-crane → cadrans-du-cr-ne
head, os-overlay → dropped (head zone is now category="os" + data-anno-opens-detail)
os → unchanged
- No more hitbox / visible class split; multiple elements may still share
the same data-anno-id but they all carry the same role.
- Trigger-only zones (`data-anno-opens-detail="head"`) may omit
`data-anno-name-fr/en`.
Changes:
- `Bone` now exposes a single `els: Element[]` instead of `hitboxEls +
visibleEls`.
- `parseSvgBones` accepts annotations without fr/en labels (defaults to
empty string) but still rejects unknown or missing categories.
- The "interactive vs decorative" filter is gone — every parsed
annotation is interactive, since the new SVGs only annotate the
clickable zones.
- Vertebra-picker trigger: `bone.category === 'zone-colonne'`
(EditorRoute + ObservationCard).
- PDF colorisation in `observationPage.colorizedSvgString` writes the
accent fill to every `els[]` entry (no more hitbox dual-pass).
- Dead `src/components/observation/ObservationEditor.tsx` removed (its
body lives inside ObservationCard since the accordion refactor).
- Tests rewritten for the new vocabulary; synthetic fixture uses the new
categories, real-SVG test asserts 18 + 9 unique zones.
92/92 tests pass, lint clean, build clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>