From 3114d679593e32eed3c880c5f48e41ee59cf5b8d Mon Sep 17 00:00:00 2001 From: bchanot Date: Tue, 13 Oct 2026 23:53:12 +0200 Subject: [PATCH] =?UTF-8?q?test(tests):=20R2=20freeze=20=E2=80=94=20archiv?= =?UTF-8?q?e=20envelopes=20of=20the=20three=20golden=20reports=20and=20the?= =?UTF-8?q?=20frozen=20N-1=20reader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Envelopes exported by the TypeScript domain before the Rust switch (FR, no logos, fixed export time) are the semantic oracle of the switch (D-R11: key order may change, values may not). The shipped Zod schemas are copied verbatim under packages/core-wasm/tests/n-1 (develop 1a7ee7d) so a rollback reader stays testable after packages/domain is deleted at R5. --- apps/app/package.json | 1 + .../goldens/r2/envelope.demo.fr.nologos.json | 1809 +++++++++++ .../r2/envelope.v2full.fr.nologos.json | 1575 ++++++++++ .../r2/envelope.v2unresolved.fr.nologos.json | 2712 +++++++++++++++++ apps/app/tests/helpers/goldenReports.ts | 60 + apps/app/tests/unit/archive.envelopes.test.ts | 83 + apps/app/tests/unit/pdf.goldens.test.ts | 47 +- packages/core-wasm/package.json | 9 +- .../n-1/domain/anatomical-sheet/create.ts | 44 + .../n-1/domain/anatomical-sheet/index.ts | 4 + .../n-1/domain/anatomical-sheet/schema.ts | 327 ++ .../domain/anatomical-sheet/sheet-index.ts | 127 + .../n-1/domain/anatomical-sheet/validate.ts | 494 +++ .../tests/n-1/domain/archive/branding.ts | 59 + .../tests/n-1/domain/archive/envelope.ts | 172 ++ .../tests/n-1/domain/archive/index.ts | 4 + .../tests/n-1/domain/archive/labels.ts | 57 + .../tests/n-1/domain/archive/snapshot.ts | 425 +++ packages/core-wasm/tests/n-1/domain/index.ts | 3 + .../tests/n-1/domain/report/identity.ts | 37 + .../tests/n-1/domain/report/index.ts | 32 + .../tests/n-1/domain/report/migrate.ts | 167 + .../tests/n-1/domain/report/migration-map.ts | 40 + .../tests/n-1/domain/report/rebase.ts | 137 + .../core-wasm/tests/n-1/domain/report/v2.ts | 72 + .../core-wasm/tests/n-1/domain/report/v3.ts | 97 + packages/core-wasm/tests/n-1/index.ts | 21 + .../core-wasm/tests/serialisation.test.ts | 2 +- pnpm-lock.yaml | 10 +- 29 files changed, 8581 insertions(+), 46 deletions(-) create mode 100644 apps/app/tests/fixtures/goldens/r2/envelope.demo.fr.nologos.json create mode 100644 apps/app/tests/fixtures/goldens/r2/envelope.v2full.fr.nologos.json create mode 100644 apps/app/tests/fixtures/goldens/r2/envelope.v2unresolved.fr.nologos.json create mode 100644 apps/app/tests/helpers/goldenReports.ts create mode 100644 apps/app/tests/unit/archive.envelopes.test.ts create mode 100644 packages/core-wasm/tests/n-1/domain/anatomical-sheet/create.ts create mode 100644 packages/core-wasm/tests/n-1/domain/anatomical-sheet/index.ts create mode 100644 packages/core-wasm/tests/n-1/domain/anatomical-sheet/schema.ts create mode 100644 packages/core-wasm/tests/n-1/domain/anatomical-sheet/sheet-index.ts create mode 100644 packages/core-wasm/tests/n-1/domain/anatomical-sheet/validate.ts create mode 100644 packages/core-wasm/tests/n-1/domain/archive/branding.ts create mode 100644 packages/core-wasm/tests/n-1/domain/archive/envelope.ts create mode 100644 packages/core-wasm/tests/n-1/domain/archive/index.ts create mode 100644 packages/core-wasm/tests/n-1/domain/archive/labels.ts create mode 100644 packages/core-wasm/tests/n-1/domain/archive/snapshot.ts create mode 100644 packages/core-wasm/tests/n-1/domain/index.ts create mode 100644 packages/core-wasm/tests/n-1/domain/report/identity.ts create mode 100644 packages/core-wasm/tests/n-1/domain/report/index.ts create mode 100644 packages/core-wasm/tests/n-1/domain/report/migrate.ts create mode 100644 packages/core-wasm/tests/n-1/domain/report/migration-map.ts create mode 100644 packages/core-wasm/tests/n-1/domain/report/rebase.ts create mode 100644 packages/core-wasm/tests/n-1/domain/report/v2.ts create mode 100644 packages/core-wasm/tests/n-1/domain/report/v3.ts create mode 100644 packages/core-wasm/tests/n-1/index.ts diff --git a/apps/app/package.json b/apps/app/package.json index b10b734f..770946bf 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -16,6 +16,7 @@ }, "dependencies": { "@faunosteo/anatomy": "workspace:*", + "@faunosteo/core-wasm": "workspace:*", "@faunosteo/domain": "workspace:*", "@faunosteo/pdf": "workspace:*", "@faunosteo/supabase": "workspace:*", diff --git a/apps/app/tests/fixtures/goldens/r2/envelope.demo.fr.nologos.json b/apps/app/tests/fixtures/goldens/r2/envelope.demo.fr.nologos.json new file mode 100644 index 00000000..5f4ebe3a --- /dev/null +++ b/apps/app/tests/fixtures/goldens/r2/envelope.demo.fr.nologos.json @@ -0,0 +1,1809 @@ +{ + "format": "faunosteo-report-archive", + "envelopeVersion": 1, + "exportedAt": "2026-10-13T09:00:00.000Z", + "locale": "fr", + "report": { + "version": 3, + "id": "fixture-demo-v3", + "createdAt": "2026-10-11T09:30:00.000Z", + "date": "2026-10-11", + "practitioner": { + "name": "Dr. Claire Dupont", + "cabinet": "Cabinet Équi-Ostéo", + "contact": "claire@example.test", + "siret": "12345678901234" + }, + "animal": { + "speciesId": "equine", + "name": "Mistral", + "breed": "Selle Français", + "age": "9 ans" + }, + "owner": { + "name": "Jean Martin" + }, + "sheet": { + "sheetId": "503dc301-a8b1-50d4-9e44-0919b2fc2916", + "versionId": null, + "documentSha256": "27c7383c445c73dc2001ebf4794a3ea63d416910bbbaa0d7848dd720de7c2660" + }, + "observations": [ + { + "id": "obs-demo-1", + "zones": [ + { + "annotationId": "c7-t1", + "viewId": "main", + "labelFrSnapshot": "Charnière C7-T1 (cervico-thoracique)", + "labelEnSnapshot": "C7-T1 junction (cervicothoracic)" + }, + { + "annotationId": "t18-l1", + "viewId": "main", + "labelFrSnapshot": "Charnière T18-L1 (thoraco-lombaire)", + "labelEnSnapshot": "T18-L1 junction (thoracolumbar)" + } + ], + "findings": [ + { + "findingZoneId": "c7-t1", + "path": [ + "c7-t1-dysfunctions", + "segmental", + "restriction-flexion" + ], + "labelFrSnapshot": "Restriction en flexion", + "labelEnSnapshot": "Flexion restriction" + }, + { + "findingZoneId": "c7-t1", + "path": [ + "c7-t1-dysfunctions", + "segmental", + "restriction-extension" + ], + "labelFrSnapshot": "Restriction en extension", + "labelEnSnapshot": "Extension restriction" + } + ], + "freeTextFindings": [], + "severity": "mild", + "comment": "Réagit à la palpation de la charnière." + }, + { + "id": "obs-demo-2", + "zones": [ + { + "annotationId": "hip", + "viewId": "main", + "side": "left", + "labelFrSnapshot": "Hanche (coxo-fémorale)", + "labelEnSnapshot": "Hip joint" + }, + { + "annotationId": "hip", + "viewId": "main", + "side": "right", + "labelFrSnapshot": "Hanche (coxo-fémorale)", + "labelEnSnapshot": "Hip joint" + } + ], + "findings": [ + { + "findingZoneId": "hip", + "path": [ + "hip-dysfunctions", + "articular", + "restriction-flexion" + ], + "labelFrSnapshot": "Restriction en flexion", + "labelEnSnapshot": "Flexion restriction", + "side": "left" + }, + { + "findingZoneId": "hip", + "path": [ + "hip-dysfunctions", + "articular", + "restriction-abduction-adduction" + ], + "labelFrSnapshot": "Restriction en abduction / adduction", + "labelEnSnapshot": "Abduction / adduction restriction", + "side": "right" + } + ], + "freeTextFindings": [], + "severity": "moderate", + "comment": "" + }, + { + "id": "obs-demo-3", + "zones": [ + { + "annotationId": "cervical", + "viewId": "main", + "vertebrae": [ + { + "region": "C", + "index": 3 + }, + { + "region": "C", + "index": 4 + } + ], + "labelFrSnapshot": "Vertèbres cervicales", + "labelEnSnapshot": "Cervical vertebrae" + } + ], + "findings": [ + { + "findingZoneId": "cervical", + "path": [ + "cervical-dysfunctions", + "segmental", + "localized-fixation" + ], + "labelFrSnapshot": "Fixation segmentaire localisée (C2–C7)", + "labelEnSnapshot": "Localized segmental fixation (C2–C7)" + } + ], + "freeTextFindings": [], + "severity": "severe", + "comment": "Fixation nette en latéroflexion droite." + }, + { + "id": "obs-demo-4", + "zones": [ + { + "annotationId": "atm", + "viewId": "head", + "labelFrSnapshot": "Articulation temporo-mandibulaire (ATM)", + "labelEnSnapshot": "Temporomandibular joint (TMJ)" + }, + { + "annotationId": "frontal", + "viewId": "head", + "labelFrSnapshot": "Frontal", + "labelEnSnapshot": "Frontal bone" + } + ], + "findings": [ + { + "findingZoneId": "frontal", + "path": [ + "frontal-consultation-reasons", + "head-rubbing" + ], + "labelFrSnapshot": "Frottements répétés de la tête rapportés", + "labelEnSnapshot": "Reported repeated head rubbing", + "requiresVetReferral": true + }, + { + "findingZoneId": "atm", + "path": [ + "atm-dysfunctions", + "articular", + "restriction-opening" + ], + "labelFrSnapshot": "Restriction à l'ouverture", + "labelEnSnapshot": "Opening restriction" + } + ], + "freeTextFindings": [], + "comment": "" + }, + { + "id": "obs-demo-5", + "zones": [ + { + "annotationId": "sacroiliac", + "viewId": "main", + "side": "right", + "labelFrSnapshot": "Articulation sacro-iliaque", + "labelEnSnapshot": "Sacroiliac joint" + }, + { + "annotationId": "occipital", + "viewId": "head", + "labelFrSnapshot": "Occipital", + "labelEnSnapshot": "Occipital bone" + } + ], + "findings": [], + "freeTextFindings": [ + "Sensibilité au garrot", + "Tension du ligament nuchal" + ], + "severity": "mild", + "comment": "Compensation probable." + }, + { + "id": "obs-demo-6", + "zones": [ + { + "annotationId": "lumbar", + "viewId": "main", + "vertebrae": [ + { + "region": "L", + "index": 2 + }, + { + "region": "L", + "index": 3 + } + ], + "labelFrSnapshot": "Vertèbres lombaires", + "labelEnSnapshot": "Lumbar vertebrae" + }, + { + "annotationId": "l6-s1", + "viewId": "main", + "labelFrSnapshot": "Charnière L6-S1 (lombo-sacrée)", + "labelEnSnapshot": "L6-S1 junction (lumbosacral joint)" + } + ], + "findings": [ + { + "findingZoneId": "lumbar", + "path": [ + "lumbar-dysfunctions", + "segmental", + "restriction-extension" + ], + "labelFrSnapshot": "Restriction en extension", + "labelEnSnapshot": "Extension restriction" + } + ], + "freeTextFindings": [ + "Raideur lombaire au pas" + ], + "comment": "" + } + ], + "conclusion": "Dysfonction cervico-thoracique avec compensation du bassin et tension crânienne associée.", + "recommendations": "Repos 3 jours puis reprise progressive ; contrôle vétérinaire pour les frottements de tête.", + "nextAppointment": { + "kind": "period", + "text": "6 à 8 semaines" + }, + "localAnnotations": [] + }, + "sheetSnapshot": { + "status": "draft", + "ref": { + "sheetId": "503dc301-a8b1-50d4-9e44-0919b2fc2916", + "versionId": null, + "documentSha256": "27c7383c445c73dc2001ebf4794a3ea63d416910bbbaa0d7848dd720de7c2660", + "schemaVersion": 2, + "speciesId": "equine" + }, + "document": { + "schema_version": 2, + "species_id": "equine", + "name": { + "fr": "Cheval", + "en": "Horse" + }, + "description": { + "fr": "Fiche anatomique officielle Faunosteo du cheval (Equus caballus)", + "en": "Official Faunosteo anatomical sheet of the horse (Equus caballus)" + }, + "scope_disclaimer": { + "fr": "Les éléments listés relèvent du périmètre légal de l'ostéopathie animale (art. L. 243-3 12° et R. 243-6 du Code rural et de la pêche maritime) : dysfonctions ostéopathiques palpées, observations cliniques et motifs de consultation rapportés. Aucun diagnostic médical n'est posé. Toute pathologie organique relève du vétérinaire ; conformément à l'art. R. 243-8, le propriétaire est orienté vers un vétérinaire lorsque les symptômes ou lésions nécessitent un diagnostic ou un traitement médical, persistent ou s'aggravent.", + "en": "The items listed fall within the legal scope of animal osteopathy in France (Articles L. 243-3 (12°) and R. 243-6 of the Code rural et de la pêche maritime): palpated osteopathic dysfunctions, clinical observations and reported reasons for consultation. No medical diagnosis is made. Any organic disease is a matter for a veterinarian; under Article R. 243-8 the owner is referred to a veterinarian whenever symptoms or lesions require a medical diagnosis or treatment, persist or worsen." + }, + "attribution": { + "authors": [ + "Faunosteo" + ], + "license": null, + "notes": "Import des données historiques: Horse.svg, Horse_head.svg, pathologies.json (schema 2.0)" + }, + "vertebral_config": { + "regions": [ + { + "code": "C", + "name": { + "fr": "Cervicales", + "en": "Cervical" + }, + "count": 7, + "count_range": null + }, + { + "code": "T", + "name": { + "fr": "Thoraciques", + "en": "Thoracic" + }, + "count": 18, + "count_range": { + "min": 17, + "max": 19 + } + }, + { + "code": "L", + "name": { + "fr": "Lombaires", + "en": "Lumbar" + }, + "count": 6, + "count_range": { + "min": 5, + "max": 6 + } + }, + { + "code": "S", + "name": { + "fr": "Sacrales", + "en": "Sacral" + }, + "count": 5, + "count_range": null + }, + { + "code": "Cd", + "name": { + "fr": "Caudales", + "en": "Caudal" + }, + "count": 18, + "count_range": { + "min": 15, + "max": 21 + } + } + ] + }, + "references": [], + "categories": [ + { + "id": "articulations", + "name": { + "fr": "Articulations", + "en": "Joints" + }, + "color": "#ff9500" + }, + { + "id": "os", + "name": { + "fr": "Os", + "en": "Bones" + }, + "color": "#a41e65" + }, + { + "id": "charnieres-vertebrales", + "name": { + "fr": "Charnières vertébrales", + "en": "Vertebral junctions" + }, + "color": "#ff0000" + }, + { + "id": "zone-colonne", + "name": { + "fr": "Segments vertébraux", + "en": "Vertebral segments" + }, + "color": "#e100ff" + }, + { + "id": "cadrans-du-crane", + "name": { + "fr": "Os du crâne", + "en": "Cranial bones" + }, + "color": "#1baa08" + } + ], + "views": [ + { + "id": "main", + "name": { + "fr": "Vue latérale gauche", + "en": "Left lateral view" + }, + "svg_asset_id": "7f767f74-3b36-51a7-8465-52dd7e2ead4a", + "view_box": null, + "kind": "main" + }, + { + "id": "head", + "name": { + "fr": "Tête (vue latérale gauche)", + "en": "Head (left lateral view)" + }, + "svg_asset_id": null, + "view_box": { + "min_x": 60, + "min_y": 100, + "width": 500, + "height": 380 + }, + "kind": "detail", + "parent_view_id": "main" + } + ], + "annotations": [ + { + "id": "hind-fetlock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1523, + "cy": 1397, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Boulet postérieur (métatarso-phalangien)", + "en": "Hind fetlock" + }, + "finding_zone_id": "hind-fetlock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1542, + "cy": 1159, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Jarret (tarso-crurale et intertarsiennes)", + "en": "Hock (tarsal joints)" + }, + "finding_zone_id": "hock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "stifle", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1464, + "cy": 918, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Grasset (fémoro-tibiale et fémoro-patellaire)", + "en": "Stifle joint" + }, + "finding_zone_id": "stifle", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hip", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1585, + "cy": 612, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Hanche (coxo-fémorale)", + "en": "Hip joint" + }, + "finding_zone_id": "hip", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "sacroiliac", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1450, + "cy": 578, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Articulation sacro-iliaque", + "en": "Sacroiliac joint" + }, + "finding_zone_id": "sacroiliac", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "shoulder", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 784, + "cy": 907, + "r": 34 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Épaule (scapulo-humérale)", + "en": "Shoulder joint" + }, + "finding_zone_id": "shoulder", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "elbow", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 743.0451049804688, + "cy": 1193, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Coude (huméro-radio-ulnaire)", + "en": "Elbow joint" + }, + "finding_zone_id": "elbow", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "carpus", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 745, + "cy": 1252, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Carpe (antébrachio-carpienne, médio-carpienne)", + "en": "Carpus (carpal joints)" + }, + "finding_zone_id": "carpus", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "fore-fetlock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 736, + "cy": 1379, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Boulet antérieur (métacarpo-phalangien)", + "en": "Fore fetlock" + }, + "finding_zone_id": "fore-fetlock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "fore-sesamoids", + "view_id": "main", + "category_id": "os", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 784, + "cy": 1371, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Sésamoïdes antérieurs (boulet)", + "en": "Forelimb sesamoids" + }, + "finding_zone_id": "fore-sesamoids", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "l6-s1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 1424, + "cy": 515, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière L6-S1 (lombo-sacrée)", + "en": "L6-S1 junction (lumbosacral joint)" + }, + "finding_zone_id": "l6-s1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "t18-l1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 1118, + "cy": 528, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière T18-L1 (thoraco-lombaire)", + "en": "T18-L1 junction (thoracolumbar)" + }, + "finding_zone_id": "t18-l1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "c7-t1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 865, + "cy": 528, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière C7-T1 (cervico-thoracique)", + "en": "C7-T1 junction (cervicothoracic)" + }, + "finding_zone_id": "c7-t1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "caudal", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1655, + 545 + ], + [ + 1662, + 513 + ], + [ + 1742, + 565 + ], + [ + 1780, + 618 + ], + [ + 1763, + 628 + ], + [ + 1724, + 590 + ], + [ + 1682, + 569 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres caudales", + "en": "Caudal vertebrae" + }, + "finding_zone_id": "caudal", + "vertebral_region_code": "Cd", + "kind": "zone" + }, + { + "id": "sacral", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1438, + 461 + ], + [ + 1418.5, + 556.2 + ], + [ + 1510.8, + 539.5 + ], + [ + 1595, + 538.2 + ], + [ + 1641, + 552 + ], + [ + 1641, + 510 + ], + [ + 1606, + 485 + ], + [ + 1515, + 468 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres sacrales", + "en": "Sacral vertebrae" + }, + "finding_zone_id": "sacral", + "vertebral_region_code": "S", + "kind": "zone" + }, + { + "id": "lumbar", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1401.3, + 457.1 + ], + [ + 1386, + 562 + ], + [ + 1232, + 562 + ], + [ + 1130, + 552 + ], + [ + 1131.4, + 503.2 + ], + [ + 1260, + 475 + ], + [ + 1361, + 454.4 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres lombaires", + "en": "Lumbar vertebrae" + }, + "finding_zone_id": "lumbar", + "vertebral_region_code": "L", + "kind": "zone" + }, + { + "id": "thoracic", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1109.9, + 497.7 + ], + [ + 1103, + 558.9 + ], + [ + 1010.3, + 558.9 + ], + [ + 915, + 552 + ], + [ + 873.9, + 530.7 + ], + [ + 826.8, + 509.5 + ], + [ + 841, + 422 + ], + [ + 960, + 482 + ], + [ + 1068, + 496 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres thoraciques", + "en": "Thoracic vertebrae" + }, + "finding_zone_id": "thoracic", + "vertebral_region_code": "T", + "kind": "zone" + }, + { + "id": "cervical", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 468, + 276 + ], + [ + 489, + 216 + ], + [ + 558, + 248 + ], + [ + 586, + 339 + ], + [ + 607, + 401 + ], + [ + 625, + 447 + ], + [ + 649, + 510 + ], + [ + 695.1, + 528.4 + ], + [ + 728.9, + 520.1 + ], + [ + 765.3, + 472.8 + ], + [ + 816.8, + 453 + ], + [ + 796.5, + 543.7 + ], + [ + 730, + 600 + ], + [ + 646, + 604 + ], + [ + 593, + 565 + ], + [ + 552, + 461 + ], + [ + 524, + 370 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres cervicales", + "en": "Cervical vertebrae" + }, + "finding_zone_id": "cervical", + "vertebral_region_code": "C", + "kind": "zone" + }, + { + "id": "head-trigger", + "view_id": "main", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 454, + 332 + ], + [ + 429, + 202 + ], + [ + 408, + 150 + ], + [ + 349, + 154 + ], + [ + 300, + 188 + ], + [ + 269, + 216 + ], + [ + 234, + 279 + ], + [ + 192, + 318 + ], + [ + 164, + 384 + ], + [ + 175, + 457 + ], + [ + 234, + 468 + ], + [ + 265, + 450 + ], + [ + 328, + 419 + ], + [ + 405, + 394 + ], + [ + 443, + 408 + ] + ] + }, + "review_status": "inherited", + "color": null, + "kind": "detail_trigger", + "name": null, + "opens_view_id": "head" + }, + { + "id": "parietal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 348, + "cy": 161, + "r": 27 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Pariétal", + "en": "Parietal bone" + }, + "finding_zone_id": "parietal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "frontal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 277, + "cy": 214, + "r": 27 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Frontal", + "en": "Frontal bone" + }, + "finding_zone_id": "frontal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "sphenoid", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 352, + "cy": 300, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Sphénoïde", + "en": "Sphenoid bone" + }, + "finding_zone_id": "sphenoid", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "temporal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 366, + "cy": 214, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Temporal", + "en": "Temporal bone" + }, + "finding_zone_id": "temporal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "occipital", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 441, + "cy": 190, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Occipital", + "en": "Occipital bone" + }, + "finding_zone_id": "occipital", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "atm", + "view_id": "head", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 400, + "cy": 258, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#ff8800", + "name": { + "fr": "Articulation temporo-mandibulaire (ATM)", + "en": "Temporomandibular joint (TMJ)" + }, + "finding_zone_id": "atm", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "ssb", + "view_id": "head", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 437, + "cy": 300, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#ff8800", + "name": { + "fr": "Synchondrose sphéno-occipitale (SSB)", + "en": "Spheno-occipital synchondrosis (SBS)" + }, + "finding_zone_id": "ssb", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hyoid", + "view_id": "head", + "category_id": "os", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 376, + "cy": 399, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#d507c4", + "name": { + "fr": "Appareil hyoïdien", + "en": "Hyoid apparatus" + }, + "finding_zone_id": "hyoid", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "c0-c1", + "view_id": "head", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 482, + "cy": 332, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière C0-C1 (atlanto-occipitale)", + "en": "C0-C1 junction (atlanto-occipital joint)" + }, + "finding_zone_id": "c0-c1", + "vertebral_region_code": null, + "kind": "point" + } + ], + "finding_zones": [ + { + "id": "parietal", + "name": { + "fr": "Pariétal", + "en": "Parietal bone" + }, + "categories": [] + }, + { + "id": "frontal", + "name": { + "fr": "Frontal", + "en": "Frontal bone" + }, + "categories": [ + { + "id": "frontal-consultation-reasons", + "kind": "consultation_reason", + "name": { + "fr": "Observations / motifs de consultation", + "en": "Observations / consultation reasons" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "head-rubbing", + "name": { + "fr": "Frottements répétés de la tête rapportés", + "en": "Reported repeated head rubbing" + }, + "description": {}, + "requires_vet_referral": true, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + }, + { + "id": "sphenoid", + "name": { + "fr": "Sphénoïde", + "en": "Sphenoid bone" + }, + "categories": [] + }, + { + "id": "temporal", + "name": { + "fr": "Temporal", + "en": "Temporal bone" + }, + "categories": [] + }, + { + "id": "occipital", + "name": { + "fr": "Occipital", + "en": "Occipital bone" + }, + "categories": [] + }, + { + "id": "ssb", + "name": { + "fr": "Synchondrose sphéno-occipitale (SSB, sphéno-basilaire)", + "en": "Spheno-occipital synchondrosis (SBS, sphenobasilar)" + }, + "categories": [] + }, + { + "id": "atm", + "name": { + "fr": "Articulation temporo-mandibulaire (ATM)", + "en": "Temporomandibular joint (TMJ)" + }, + "categories": [ + { + "id": "atm-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "articular", + "name": { + "fr": "Restrictions de mobilité articulaire", + "en": "Articular mobility restrictions" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [ + { + "id": "restriction-opening", + "name": { + "fr": "Restriction à l'ouverture", + "en": "Opening restriction" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + } + ] + }, + { + "id": "hyoid", + "name": { + "fr": "Appareil hyoïdien", + "en": "Hyoid apparatus" + }, + "categories": [] + }, + { + "id": "c0-c1", + "name": { + "fr": "Charnière C0-C1 (atlanto-occipitale)", + "en": "C0-C1 junction (atlanto-occipital joint)" + }, + "categories": [] + }, + { + "id": "cervical", + "name": { + "fr": "Vertèbres cervicales", + "en": "Cervical vertebrae" + }, + "categories": [ + { + "id": "cervical-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "segmental", + "name": { + "fr": "Restrictions / fixations segmentaires", + "en": "Segmental restrictions / fixations" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "localized-fixation", + "name": { + "fr": "Fixation segmentaire localisée (C2–C7)", + "en": "Localized segmental fixation (C2–C7)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + } + ] + } + ] + } + ] + }, + { + "id": "c7-t1", + "name": { + "fr": "Charnière C7-T1 (cervico-thoracique)", + "en": "C7-T1 junction (cervicothoracic)" + }, + "categories": [ + { + "id": "c7-t1-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "segmental", + "name": { + "fr": "Restrictions / fixations de la charnière", + "en": "Junction restrictions / fixations" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [ + { + "id": "restriction-flexion", + "name": { + "fr": "Restriction en flexion", + "en": "Flexion restriction" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "restriction-extension", + "name": { + "fr": "Restriction en extension", + "en": "Extension restriction" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + } + ] + }, + { + "id": "shoulder", + "name": { + "fr": "Épaule (scapulo-humérale)", + "en": "Shoulder joint" + }, + "categories": [] + }, + { + "id": "elbow", + "name": { + "fr": "Coude (huméro-radio-ulnaire)", + "en": "Elbow joint" + }, + "categories": [] + }, + { + "id": "carpus", + "name": { + "fr": "Carpe (antébrachio-carpienne, médio-carpienne)", + "en": "Carpus (carpal joints)" + }, + "categories": [] + }, + { + "id": "fore-fetlock", + "name": { + "fr": "Boulet antérieur (métacarpo-phalangien)", + "en": "Fore fetlock" + }, + "categories": [] + }, + { + "id": "fore-sesamoids", + "name": { + "fr": "Sésamoïdes antérieurs (boulet)", + "en": "Forelimb sesamoids" + }, + "categories": [] + }, + { + "id": "thoracic", + "name": { + "fr": "Vertèbres thoraciques", + "en": "Thoracic vertebrae" + }, + "categories": [] + }, + { + "id": "t18-l1", + "name": { + "fr": "Charnière T18-L1 (thoraco-lombaire)", + "en": "T18-L1 junction (thoracolumbar)" + }, + "categories": [] + }, + { + "id": "lumbar", + "name": { + "fr": "Vertèbres lombaires", + "en": "Lumbar vertebrae" + }, + "categories": [ + { + "id": "lumbar-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "segmental", + "name": { + "fr": "Restrictions / fixations segmentaires", + "en": "Segmental restrictions / fixations" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "restriction-extension", + "name": { + "fr": "Restriction en extension", + "en": "Extension restriction" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + } + ] + }, + { + "id": "l6-s1", + "name": { + "fr": "Charnière L6-S1 (lombo-sacrée)", + "en": "L6-S1 junction (lumbosacral joint)" + }, + "categories": [] + }, + { + "id": "sacral", + "name": { + "fr": "Vertèbres sacrales", + "en": "Sacral vertebrae" + }, + "categories": [] + }, + { + "id": "sacroiliac", + "name": { + "fr": "Articulation sacro-iliaque", + "en": "Sacroiliac joint" + }, + "categories": [] + }, + { + "id": "hip", + "name": { + "fr": "Hanche (coxo-fémorale)", + "en": "Hip joint" + }, + "categories": [ + { + "id": "hip-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "articular", + "name": { + "fr": "Restrictions de mobilité articulaire", + "en": "Articular mobility restrictions" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "restriction-flexion", + "name": { + "fr": "Restriction en flexion", + "en": "Flexion restriction" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "restriction-abduction-adduction", + "name": { + "fr": "Restriction en abduction / adduction", + "en": "Abduction / adduction restriction" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + } + ] + }, + { + "id": "stifle", + "name": { + "fr": "Grasset (fémoro-tibiale et fémoro-patellaire)", + "en": "Stifle joint" + }, + "categories": [] + }, + { + "id": "hock", + "name": { + "fr": "Jarret (tarso-crurale et intertarsiennes)", + "en": "Hock (tarsal joints)" + }, + "categories": [] + }, + { + "id": "hind-fetlock", + "name": { + "fr": "Boulet postérieur (métatarso-phalangien)", + "en": "Hind fetlock" + }, + "categories": [] + }, + { + "id": "caudal", + "name": { + "fr": "Vertèbres caudales", + "en": "Caudal vertebrae" + }, + "categories": [] + } + ] + }, + "assets": [ + { + "svgAssetId": "7f767f74-3b36-51a7-8465-52dd7e2ead4a", + "sha256": "0ea5202fa3b95bac167b87c12ee969ab0272e085b60c2d34dbca6202c5f08541", + "svg": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n" + } + ] + }, + "branding": { + "siteUrl": "https://faunosteo.com", + "headerLogo": null, + "footerLogo": null, + "poweredBy": { + "logo": null, + "url": "https://zenquality.fr", + "fallbackText": "zenquality.fr" + }, + "partner": { + "logo": null, + "url": "https://www.instagram.com/paws.iin.harmony", + "fallbackText": "@paws.iin.harmony" + } + }, + "labels": { + "fr": { + "pdf.eyebrow.observation": "OBSERVATION", + "pdf.eyebrow.synthesis": "SYNTHÈSE", + "pdf.title.conclusion": "Conclusion", + "pdf.section.zones": "ZONES", + "pdf.section.findings_prefix": "CONSTATS — ", + "pdf.section.free_findings": "CONSTATS LIBRES", + "pdf.section.severity": "SÉVÉRITÉ", + "pdf.section.comment": "COMMENTAIRE", + "pdf.section.conclusion": "CONCLUSION", + "pdf.section.recommendations": "RECOMMANDATIONS", + "pdf.section.next_appointment": "PROCHAIN RENDEZ-VOUS", + "pdf.view.general": "VUE GÉNÉRALE", + "pdf.view.detail_prefix": "VUE DÉTAIL — ", + "pdf.empty": "—", + "pdf.owner_prefix": "Propriétaire : ", + "pdf.siret_prefix": "SIRET ", + "pdf.title.suffix.bilan": "Bilan ostéo — ", + "pdf.subject": "Bilan d'ostéopathie animalière", + "severity.mild": "légère", + "severity.moderate": "modérée", + "severity.severe": "sévère", + "lateral.left": "Gauche", + "lateral.right": "Droite", + "footer.powered_by": "Propulsé par", + "footer.in_partnership": "En partenariat avec" + }, + "en": { + "pdf.eyebrow.observation": "OBSERVATION", + "pdf.eyebrow.synthesis": "SYNTHESIS", + "pdf.title.conclusion": "Conclusion", + "pdf.section.zones": "ZONES", + "pdf.section.findings_prefix": "FINDINGS — ", + "pdf.section.free_findings": "FREE FINDINGS", + "pdf.section.severity": "SEVERITY", + "pdf.section.comment": "COMMENT", + "pdf.section.conclusion": "CONCLUSION", + "pdf.section.recommendations": "RECOMMENDATIONS", + "pdf.section.next_appointment": "NEXT APPOINTMENT", + "pdf.view.general": "GENERAL VIEW", + "pdf.view.detail_prefix": "DETAIL VIEW — ", + "pdf.empty": "—", + "pdf.owner_prefix": "Owner: ", + "pdf.siret_prefix": "SIRET ", + "pdf.title.suffix.bilan": "Osteo report — ", + "pdf.subject": "Animal osteopathic report", + "severity.mild": "mild", + "severity.moderate": "moderate", + "severity.severe": "severe", + "lateral.left": "Left", + "lateral.right": "Right", + "footer.powered_by": "Powered by", + "footer.in_partnership": "In partnership with" + } + } +} \ No newline at end of file diff --git a/apps/app/tests/fixtures/goldens/r2/envelope.v2full.fr.nologos.json b/apps/app/tests/fixtures/goldens/r2/envelope.v2full.fr.nologos.json new file mode 100644 index 00000000..9df14d93 --- /dev/null +++ b/apps/app/tests/fixtures/goldens/r2/envelope.v2full.fr.nologos.json @@ -0,0 +1,1575 @@ +{ + "format": "faunosteo-report-archive", + "envelopeVersion": 1, + "exportedAt": "2026-10-13T09:00:00.000Z", + "locale": "fr", + "report": { + "version": 3, + "id": "fixture-full-v2", + "createdAt": "2026-06-01T09:00:00.000Z", + "date": "2026-06-01", + "practitioner": { + "name": "Dr. Claire Dupont", + "cabinet": "Cabinet Équi-Ostéo", + "contact": "claire@example.test", + "siret": "12345678901234" + }, + "animal": { + "speciesId": "equine", + "name": "Mistral", + "breed": "Selle Français", + "age": "9 ans" + }, + "owner": { + "name": "Jean Martin" + }, + "sheet": { + "sheetId": "503dc301-a8b1-50d4-9e44-0919b2fc2916", + "versionId": null, + "documentSha256": "27c7383c445c73dc2001ebf4794a3ea63d416910bbbaa0d7848dd720de7c2660" + }, + "observations": [ + { + "id": "obs-1", + "zones": [ + { + "annotationId": "c7-t1", + "viewId": "main", + "labelFrSnapshot": "Charnière C7-T1 (cervico-thoracique)", + "labelEnSnapshot": "C7-T1 (Cervicothoracic)" + }, + { + "annotationId": "hip", + "viewId": "main", + "side": "left", + "labelFrSnapshot": "Hanche (coxo-fémorale)", + "labelEnSnapshot": "Hip joint" + }, + { + "annotationId": "hip", + "viewId": "main", + "side": "right", + "labelFrSnapshot": "Hanche (coxo-fémorale)", + "labelEnSnapshot": "Hip joint" + } + ], + "findings": [ + { + "findingZoneId": "c7-t1", + "path": [ + "c7-t1-dysfunctions", + "segmental", + "fixation" + ], + "labelFrSnapshot": "Fixation de la charnière", + "labelEnSnapshot": "Junction fixation" + }, + { + "findingZoneId": "hip", + "path": [ + "hip-dysfunctions", + "articular", + "restriction-flexion" + ], + "labelFrSnapshot": "Restriction en flexion", + "labelEnSnapshot": "Flexion restriction", + "side": "left" + } + ], + "freeTextFindings": [ + "Sensibilité au garrot" + ], + "severity": "moderate", + "comment": "Réagit à la palpation du garrot." + }, + { + "id": "obs-2", + "zones": [ + { + "annotationId": "cervical", + "viewId": "main", + "vertebrae": [ + { + "region": "C", + "index": 3 + }, + { + "region": "C", + "index": 4 + } + ], + "labelFrSnapshot": "Vertèbres cervicales", + "labelEnSnapshot": "Cervical Vertebrae" + } + ], + "findings": [ + { + "findingZoneId": "cervical", + "path": [ + "cervical-consultation-reasons", + "stumbling-proprioceptive" + ], + "labelFrSnapshot": "Trébuchements / déficit proprioceptif rapporté", + "labelEnSnapshot": "Reported stumbling / proprioceptive deficit", + "requiresVetReferral": true + } + ], + "freeTextFindings": [], + "severity": "severe", + "comment": "" + }, + { + "id": "obs-3", + "zones": [ + { + "annotationId": "atm", + "viewId": "head", + "labelFrSnapshot": "Articulation Temporo-Mandibulaire (ATM)", + "labelEnSnapshot": "Temporomandibular Joint (TMJ)" + } + ], + "findings": [ + { + "findingZoneId": "atm", + "path": [ + "atm-consultation-reasons", + "headshaking" + ], + "labelFrSnapshot": "Headshaking (secouement de tête)", + "labelEnSnapshot": "Headshaking", + "requiresVetReferral": true + } + ], + "freeTextFindings": [], + "comment": "Vue détail tête." + } + ], + "conclusion": "Dysfonction cervico-thoracique avec compensation du bassin.", + "recommendations": "Repos 3 jours puis reprise progressive.", + "nextAppointment": { + "kind": "date", + "date": "2026-07-01" + }, + "localAnnotations": [] + }, + "sheetSnapshot": { + "status": "draft", + "ref": { + "sheetId": "503dc301-a8b1-50d4-9e44-0919b2fc2916", + "versionId": null, + "documentSha256": "27c7383c445c73dc2001ebf4794a3ea63d416910bbbaa0d7848dd720de7c2660", + "schemaVersion": 2, + "speciesId": "equine" + }, + "document": { + "schema_version": 2, + "species_id": "equine", + "name": { + "fr": "Cheval", + "en": "Horse" + }, + "description": { + "fr": "Fiche anatomique officielle Faunosteo du cheval (Equus caballus)", + "en": "Official Faunosteo anatomical sheet of the horse (Equus caballus)" + }, + "scope_disclaimer": { + "fr": "Les éléments listés relèvent du périmètre légal de l'ostéopathie animale (art. L. 243-3 12° et R. 243-6 du Code rural et de la pêche maritime) : dysfonctions ostéopathiques palpées, observations cliniques et motifs de consultation rapportés. Aucun diagnostic médical n'est posé. Toute pathologie organique relève du vétérinaire ; conformément à l'art. R. 243-8, le propriétaire est orienté vers un vétérinaire lorsque les symptômes ou lésions nécessitent un diagnostic ou un traitement médical, persistent ou s'aggravent.", + "en": "The items listed fall within the legal scope of animal osteopathy in France (Articles L. 243-3 (12°) and R. 243-6 of the Code rural et de la pêche maritime): palpated osteopathic dysfunctions, clinical observations and reported reasons for consultation. No medical diagnosis is made. Any organic disease is a matter for a veterinarian; under Article R. 243-8 the owner is referred to a veterinarian whenever symptoms or lesions require a medical diagnosis or treatment, persist or worsen." + }, + "attribution": { + "authors": [ + "Faunosteo" + ], + "license": null, + "notes": "Import des données historiques: Horse.svg, Horse_head.svg, pathologies.json (schema 2.0)" + }, + "vertebral_config": { + "regions": [ + { + "code": "C", + "name": { + "fr": "Cervicales", + "en": "Cervical" + }, + "count": 7, + "count_range": null + }, + { + "code": "T", + "name": { + "fr": "Thoraciques", + "en": "Thoracic" + }, + "count": 18, + "count_range": { + "min": 17, + "max": 19 + } + }, + { + "code": "L", + "name": { + "fr": "Lombaires", + "en": "Lumbar" + }, + "count": 6, + "count_range": { + "min": 5, + "max": 6 + } + }, + { + "code": "S", + "name": { + "fr": "Sacrales", + "en": "Sacral" + }, + "count": 5, + "count_range": null + }, + { + "code": "Cd", + "name": { + "fr": "Caudales", + "en": "Caudal" + }, + "count": 18, + "count_range": { + "min": 15, + "max": 21 + } + } + ] + }, + "references": [], + "categories": [ + { + "id": "articulations", + "name": { + "fr": "Articulations", + "en": "Joints" + }, + "color": "#ff9500" + }, + { + "id": "os", + "name": { + "fr": "Os", + "en": "Bones" + }, + "color": "#a41e65" + }, + { + "id": "charnieres-vertebrales", + "name": { + "fr": "Charnières vertébrales", + "en": "Vertebral junctions" + }, + "color": "#ff0000" + }, + { + "id": "zone-colonne", + "name": { + "fr": "Segments vertébraux", + "en": "Vertebral segments" + }, + "color": "#e100ff" + }, + { + "id": "cadrans-du-crane", + "name": { + "fr": "Os du crâne", + "en": "Cranial bones" + }, + "color": "#1baa08" + } + ], + "views": [ + { + "id": "main", + "name": { + "fr": "Vue latérale gauche", + "en": "Left lateral view" + }, + "svg_asset_id": "7f767f74-3b36-51a7-8465-52dd7e2ead4a", + "view_box": null, + "kind": "main" + }, + { + "id": "head", + "name": { + "fr": "Tête (vue latérale gauche)", + "en": "Head (left lateral view)" + }, + "svg_asset_id": null, + "view_box": { + "min_x": 60, + "min_y": 100, + "width": 500, + "height": 380 + }, + "kind": "detail", + "parent_view_id": "main" + } + ], + "annotations": [ + { + "id": "hind-fetlock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1523, + "cy": 1397, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Boulet postérieur (métatarso-phalangien)", + "en": "Hind fetlock" + }, + "finding_zone_id": "hind-fetlock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1542, + "cy": 1159, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Jarret (tarso-crurale et intertarsiennes)", + "en": "Hock (tarsal joints)" + }, + "finding_zone_id": "hock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "stifle", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1464, + "cy": 918, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Grasset (fémoro-tibiale et fémoro-patellaire)", + "en": "Stifle joint" + }, + "finding_zone_id": "stifle", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hip", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1585, + "cy": 612, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Hanche (coxo-fémorale)", + "en": "Hip joint" + }, + "finding_zone_id": "hip", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "sacroiliac", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1450, + "cy": 578, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Articulation sacro-iliaque", + "en": "Sacroiliac joint" + }, + "finding_zone_id": "sacroiliac", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "shoulder", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 784, + "cy": 907, + "r": 34 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Épaule (scapulo-humérale)", + "en": "Shoulder joint" + }, + "finding_zone_id": "shoulder", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "elbow", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 743.0451049804688, + "cy": 1193, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Coude (huméro-radio-ulnaire)", + "en": "Elbow joint" + }, + "finding_zone_id": "elbow", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "carpus", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 745, + "cy": 1252, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Carpe (antébrachio-carpienne, médio-carpienne)", + "en": "Carpus (carpal joints)" + }, + "finding_zone_id": "carpus", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "fore-fetlock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 736, + "cy": 1379, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Boulet antérieur (métacarpo-phalangien)", + "en": "Fore fetlock" + }, + "finding_zone_id": "fore-fetlock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "fore-sesamoids", + "view_id": "main", + "category_id": "os", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 784, + "cy": 1371, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Sésamoïdes antérieurs (boulet)", + "en": "Forelimb sesamoids" + }, + "finding_zone_id": "fore-sesamoids", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "l6-s1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 1424, + "cy": 515, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière L6-S1 (lombo-sacrée)", + "en": "L6-S1 junction (lumbosacral joint)" + }, + "finding_zone_id": "l6-s1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "t18-l1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 1118, + "cy": 528, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière T18-L1 (thoraco-lombaire)", + "en": "T18-L1 junction (thoracolumbar)" + }, + "finding_zone_id": "t18-l1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "c7-t1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 865, + "cy": 528, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière C7-T1 (cervico-thoracique)", + "en": "C7-T1 junction (cervicothoracic)" + }, + "finding_zone_id": "c7-t1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "caudal", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1655, + 545 + ], + [ + 1662, + 513 + ], + [ + 1742, + 565 + ], + [ + 1780, + 618 + ], + [ + 1763, + 628 + ], + [ + 1724, + 590 + ], + [ + 1682, + 569 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres caudales", + "en": "Caudal vertebrae" + }, + "finding_zone_id": "caudal", + "vertebral_region_code": "Cd", + "kind": "zone" + }, + { + "id": "sacral", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1438, + 461 + ], + [ + 1418.5, + 556.2 + ], + [ + 1510.8, + 539.5 + ], + [ + 1595, + 538.2 + ], + [ + 1641, + 552 + ], + [ + 1641, + 510 + ], + [ + 1606, + 485 + ], + [ + 1515, + 468 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres sacrales", + "en": "Sacral vertebrae" + }, + "finding_zone_id": "sacral", + "vertebral_region_code": "S", + "kind": "zone" + }, + { + "id": "lumbar", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1401.3, + 457.1 + ], + [ + 1386, + 562 + ], + [ + 1232, + 562 + ], + [ + 1130, + 552 + ], + [ + 1131.4, + 503.2 + ], + [ + 1260, + 475 + ], + [ + 1361, + 454.4 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres lombaires", + "en": "Lumbar vertebrae" + }, + "finding_zone_id": "lumbar", + "vertebral_region_code": "L", + "kind": "zone" + }, + { + "id": "thoracic", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1109.9, + 497.7 + ], + [ + 1103, + 558.9 + ], + [ + 1010.3, + 558.9 + ], + [ + 915, + 552 + ], + [ + 873.9, + 530.7 + ], + [ + 826.8, + 509.5 + ], + [ + 841, + 422 + ], + [ + 960, + 482 + ], + [ + 1068, + 496 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres thoraciques", + "en": "Thoracic vertebrae" + }, + "finding_zone_id": "thoracic", + "vertebral_region_code": "T", + "kind": "zone" + }, + { + "id": "cervical", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 468, + 276 + ], + [ + 489, + 216 + ], + [ + 558, + 248 + ], + [ + 586, + 339 + ], + [ + 607, + 401 + ], + [ + 625, + 447 + ], + [ + 649, + 510 + ], + [ + 695.1, + 528.4 + ], + [ + 728.9, + 520.1 + ], + [ + 765.3, + 472.8 + ], + [ + 816.8, + 453 + ], + [ + 796.5, + 543.7 + ], + [ + 730, + 600 + ], + [ + 646, + 604 + ], + [ + 593, + 565 + ], + [ + 552, + 461 + ], + [ + 524, + 370 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres cervicales", + "en": "Cervical vertebrae" + }, + "finding_zone_id": "cervical", + "vertebral_region_code": "C", + "kind": "zone" + }, + { + "id": "head-trigger", + "view_id": "main", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 454, + 332 + ], + [ + 429, + 202 + ], + [ + 408, + 150 + ], + [ + 349, + 154 + ], + [ + 300, + 188 + ], + [ + 269, + 216 + ], + [ + 234, + 279 + ], + [ + 192, + 318 + ], + [ + 164, + 384 + ], + [ + 175, + 457 + ], + [ + 234, + 468 + ], + [ + 265, + 450 + ], + [ + 328, + 419 + ], + [ + 405, + 394 + ], + [ + 443, + 408 + ] + ] + }, + "review_status": "inherited", + "color": null, + "kind": "detail_trigger", + "name": null, + "opens_view_id": "head" + }, + { + "id": "parietal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 348, + "cy": 161, + "r": 27 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Pariétal", + "en": "Parietal bone" + }, + "finding_zone_id": "parietal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "frontal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 277, + "cy": 214, + "r": 27 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Frontal", + "en": "Frontal bone" + }, + "finding_zone_id": "frontal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "sphenoid", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 352, + "cy": 300, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Sphénoïde", + "en": "Sphenoid bone" + }, + "finding_zone_id": "sphenoid", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "temporal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 366, + "cy": 214, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Temporal", + "en": "Temporal bone" + }, + "finding_zone_id": "temporal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "occipital", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 441, + "cy": 190, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Occipital", + "en": "Occipital bone" + }, + "finding_zone_id": "occipital", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "atm", + "view_id": "head", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 400, + "cy": 258, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#ff8800", + "name": { + "fr": "Articulation temporo-mandibulaire (ATM)", + "en": "Temporomandibular joint (TMJ)" + }, + "finding_zone_id": "atm", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "ssb", + "view_id": "head", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 437, + "cy": 300, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#ff8800", + "name": { + "fr": "Synchondrose sphéno-occipitale (SSB)", + "en": "Spheno-occipital synchondrosis (SBS)" + }, + "finding_zone_id": "ssb", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hyoid", + "view_id": "head", + "category_id": "os", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 376, + "cy": 399, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#d507c4", + "name": { + "fr": "Appareil hyoïdien", + "en": "Hyoid apparatus" + }, + "finding_zone_id": "hyoid", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "c0-c1", + "view_id": "head", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 482, + "cy": 332, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière C0-C1 (atlanto-occipitale)", + "en": "C0-C1 junction (atlanto-occipital joint)" + }, + "finding_zone_id": "c0-c1", + "vertebral_region_code": null, + "kind": "point" + } + ], + "finding_zones": [ + { + "id": "parietal", + "name": { + "fr": "Pariétal", + "en": "Parietal bone" + }, + "categories": [] + }, + { + "id": "frontal", + "name": { + "fr": "Frontal", + "en": "Frontal bone" + }, + "categories": [] + }, + { + "id": "sphenoid", + "name": { + "fr": "Sphénoïde", + "en": "Sphenoid bone" + }, + "categories": [] + }, + { + "id": "temporal", + "name": { + "fr": "Temporal", + "en": "Temporal bone" + }, + "categories": [] + }, + { + "id": "occipital", + "name": { + "fr": "Occipital", + "en": "Occipital bone" + }, + "categories": [] + }, + { + "id": "ssb", + "name": { + "fr": "Synchondrose sphéno-occipitale (SSB, sphéno-basilaire)", + "en": "Spheno-occipital synchondrosis (SBS, sphenobasilar)" + }, + "categories": [] + }, + { + "id": "atm", + "name": { + "fr": "Articulation temporo-mandibulaire (ATM)", + "en": "Temporomandibular joint (TMJ)" + }, + "categories": [ + { + "id": "atm-consultation-reasons", + "kind": "consultation_reason", + "name": { + "fr": "Observations / motifs de consultation", + "en": "Observations / consultation reasons" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "headshaking", + "name": { + "fr": "Headshaking (secouement de tête)", + "en": "Headshaking" + }, + "description": {}, + "requires_vet_referral": true, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + } + ] + } + ] + }, + { + "id": "hyoid", + "name": { + "fr": "Appareil hyoïdien", + "en": "Hyoid apparatus" + }, + "categories": [] + }, + { + "id": "c0-c1", + "name": { + "fr": "Charnière C0-C1 (atlanto-occipitale)", + "en": "C0-C1 junction (atlanto-occipital joint)" + }, + "categories": [] + }, + { + "id": "cervical", + "name": { + "fr": "Vertèbres cervicales", + "en": "Cervical vertebrae" + }, + "categories": [ + { + "id": "cervical-consultation-reasons", + "kind": "consultation_reason", + "name": { + "fr": "Observations / motifs de consultation", + "en": "Observations / consultation reasons" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "stumbling-proprioceptive", + "name": { + "fr": "Trébuchements / déficit proprioceptif rapporté", + "en": "Reported stumbling / proprioceptive deficit" + }, + "description": {}, + "requires_vet_referral": true, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + }, + { + "id": "c7-t1", + "name": { + "fr": "Charnière C7-T1 (cervico-thoracique)", + "en": "C7-T1 junction (cervicothoracic)" + }, + "categories": [ + { + "id": "c7-t1-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "segmental", + "name": { + "fr": "Restrictions / fixations de la charnière", + "en": "Junction restrictions / fixations" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [ + { + "id": "fixation", + "name": { + "fr": "Fixation de la charnière", + "en": "Junction fixation" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + } + ] + } + ] + } + ] + }, + { + "id": "shoulder", + "name": { + "fr": "Épaule (scapulo-humérale)", + "en": "Shoulder joint" + }, + "categories": [] + }, + { + "id": "elbow", + "name": { + "fr": "Coude (huméro-radio-ulnaire)", + "en": "Elbow joint" + }, + "categories": [] + }, + { + "id": "carpus", + "name": { + "fr": "Carpe (antébrachio-carpienne, médio-carpienne)", + "en": "Carpus (carpal joints)" + }, + "categories": [] + }, + { + "id": "fore-fetlock", + "name": { + "fr": "Boulet antérieur (métacarpo-phalangien)", + "en": "Fore fetlock" + }, + "categories": [] + }, + { + "id": "fore-sesamoids", + "name": { + "fr": "Sésamoïdes antérieurs (boulet)", + "en": "Forelimb sesamoids" + }, + "categories": [] + }, + { + "id": "thoracic", + "name": { + "fr": "Vertèbres thoraciques", + "en": "Thoracic vertebrae" + }, + "categories": [] + }, + { + "id": "t18-l1", + "name": { + "fr": "Charnière T18-L1 (thoraco-lombaire)", + "en": "T18-L1 junction (thoracolumbar)" + }, + "categories": [] + }, + { + "id": "lumbar", + "name": { + "fr": "Vertèbres lombaires", + "en": "Lumbar vertebrae" + }, + "categories": [] + }, + { + "id": "l6-s1", + "name": { + "fr": "Charnière L6-S1 (lombo-sacrée)", + "en": "L6-S1 junction (lumbosacral joint)" + }, + "categories": [] + }, + { + "id": "sacral", + "name": { + "fr": "Vertèbres sacrales", + "en": "Sacral vertebrae" + }, + "categories": [] + }, + { + "id": "sacroiliac", + "name": { + "fr": "Articulation sacro-iliaque", + "en": "Sacroiliac joint" + }, + "categories": [] + }, + { + "id": "hip", + "name": { + "fr": "Hanche (coxo-fémorale)", + "en": "Hip joint" + }, + "categories": [ + { + "id": "hip-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "articular", + "name": { + "fr": "Restrictions de mobilité articulaire", + "en": "Articular mobility restrictions" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "restriction-flexion", + "name": { + "fr": "Restriction en flexion", + "en": "Flexion restriction" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + } + ] + }, + { + "id": "stifle", + "name": { + "fr": "Grasset (fémoro-tibiale et fémoro-patellaire)", + "en": "Stifle joint" + }, + "categories": [] + }, + { + "id": "hock", + "name": { + "fr": "Jarret (tarso-crurale et intertarsiennes)", + "en": "Hock (tarsal joints)" + }, + "categories": [] + }, + { + "id": "hind-fetlock", + "name": { + "fr": "Boulet postérieur (métatarso-phalangien)", + "en": "Hind fetlock" + }, + "categories": [] + }, + { + "id": "caudal", + "name": { + "fr": "Vertèbres caudales", + "en": "Caudal vertebrae" + }, + "categories": [] + } + ] + }, + "assets": [ + { + "svgAssetId": "7f767f74-3b36-51a7-8465-52dd7e2ead4a", + "sha256": "0ea5202fa3b95bac167b87c12ee969ab0272e085b60c2d34dbca6202c5f08541", + "svg": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n" + } + ] + }, + "branding": { + "siteUrl": "https://faunosteo.com", + "headerLogo": null, + "footerLogo": null, + "poweredBy": { + "logo": null, + "url": "https://zenquality.fr", + "fallbackText": "zenquality.fr" + }, + "partner": { + "logo": null, + "url": "https://www.instagram.com/paws.iin.harmony", + "fallbackText": "@paws.iin.harmony" + } + }, + "labels": { + "fr": { + "pdf.eyebrow.observation": "OBSERVATION", + "pdf.eyebrow.synthesis": "SYNTHÈSE", + "pdf.title.conclusion": "Conclusion", + "pdf.section.zones": "ZONES", + "pdf.section.findings_prefix": "CONSTATS — ", + "pdf.section.free_findings": "CONSTATS LIBRES", + "pdf.section.severity": "SÉVÉRITÉ", + "pdf.section.comment": "COMMENTAIRE", + "pdf.section.conclusion": "CONCLUSION", + "pdf.section.recommendations": "RECOMMANDATIONS", + "pdf.section.next_appointment": "PROCHAIN RENDEZ-VOUS", + "pdf.view.general": "VUE GÉNÉRALE", + "pdf.view.detail_prefix": "VUE DÉTAIL — ", + "pdf.empty": "—", + "pdf.owner_prefix": "Propriétaire : ", + "pdf.siret_prefix": "SIRET ", + "pdf.title.suffix.bilan": "Bilan ostéo — ", + "pdf.subject": "Bilan d'ostéopathie animalière", + "severity.mild": "légère", + "severity.moderate": "modérée", + "severity.severe": "sévère", + "lateral.left": "Gauche", + "lateral.right": "Droite", + "footer.powered_by": "Propulsé par", + "footer.in_partnership": "En partenariat avec" + }, + "en": { + "pdf.eyebrow.observation": "OBSERVATION", + "pdf.eyebrow.synthesis": "SYNTHESIS", + "pdf.title.conclusion": "Conclusion", + "pdf.section.zones": "ZONES", + "pdf.section.findings_prefix": "FINDINGS — ", + "pdf.section.free_findings": "FREE FINDINGS", + "pdf.section.severity": "SEVERITY", + "pdf.section.comment": "COMMENT", + "pdf.section.conclusion": "CONCLUSION", + "pdf.section.recommendations": "RECOMMENDATIONS", + "pdf.section.next_appointment": "NEXT APPOINTMENT", + "pdf.view.general": "GENERAL VIEW", + "pdf.view.detail_prefix": "DETAIL VIEW — ", + "pdf.empty": "—", + "pdf.owner_prefix": "Owner: ", + "pdf.siret_prefix": "SIRET ", + "pdf.title.suffix.bilan": "Osteo report — ", + "pdf.subject": "Animal osteopathic report", + "severity.mild": "mild", + "severity.moderate": "moderate", + "severity.severe": "severe", + "lateral.left": "Left", + "lateral.right": "Right", + "footer.powered_by": "Powered by", + "footer.in_partnership": "In partnership with" + } + } +} \ No newline at end of file diff --git a/apps/app/tests/fixtures/goldens/r2/envelope.v2unresolved.fr.nologos.json b/apps/app/tests/fixtures/goldens/r2/envelope.v2unresolved.fr.nologos.json new file mode 100644 index 00000000..086b9c1c --- /dev/null +++ b/apps/app/tests/fixtures/goldens/r2/envelope.v2unresolved.fr.nologos.json @@ -0,0 +1,2712 @@ +{ + "format": "faunosteo-report-archive", + "envelopeVersion": 1, + "exportedAt": "2026-10-13T09:00:00.000Z", + "locale": "fr", + "report": { + "version": 3, + "id": "all-leaves", + "createdAt": "2026-10-10T00:00:00Z", + "date": "2026-10-10", + "practitioner": { + "name": "Synthetic" + }, + "animal": { + "speciesId": "equine", + "name": "Synthetic" + }, + "owner": { + "name": "Synthetic" + }, + "sheet": { + "sheetId": "503dc301-a8b1-50d4-9e44-0919b2fc2916", + "versionId": null, + "documentSha256": "27c7383c445c73dc2001ebf4794a3ea63d416910bbbaa0d7848dd720de7c2660" + }, + "observations": [ + { + "id": "obs-sphenoid", + "zones": [], + "findings": [ + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "physiological", + "flexion" + ], + "labelFrSnapshot": "Flexion", + "labelEnSnapshot": "Flexion", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "physiological", + "extension" + ], + "labelFrSnapshot": "Extension", + "labelEnSnapshot": "Extension", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "physiological", + "torsion-right" + ], + "labelFrSnapshot": "Torsion droite", + "labelEnSnapshot": "Right torsion", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "physiological", + "torsion-left" + ], + "labelFrSnapshot": "Torsion gauche", + "labelEnSnapshot": "Left torsion", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "physiological", + "sidebending-rotation-right" + ], + "labelFrSnapshot": "Side-bending rotation droite", + "labelEnSnapshot": "Right side-bending rotation", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "physiological", + "sidebending-rotation-left" + ], + "labelFrSnapshot": "Side-bending rotation gauche", + "labelEnSnapshot": "Left side-bending rotation", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "traumatic", + "vertical-strain-superior" + ], + "labelFrSnapshot": "Strain vertical haut", + "labelEnSnapshot": "Superior vertical strain", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "traumatic", + "vertical-strain-inferior" + ], + "labelFrSnapshot": "Strain vertical bas", + "labelEnSnapshot": "Inferior vertical strain", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "traumatic", + "lateral-strain-right" + ], + "labelFrSnapshot": "Strain latéral droit", + "labelEnSnapshot": "Right lateral strain", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "traumatic", + "lateral-strain-left" + ], + "labelFrSnapshot": "Strain latéral gauche", + "labelEnSnapshot": "Left lateral strain", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "traumatic", + "compression" + ], + "labelFrSnapshot": "Compression SSB", + "labelEnSnapshot": "SBS compression", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "intraosseous", + "pre-post-sphenoid" + ], + "labelFrSnapshot": "Désengagement pré-sphénoïde / post-sphénoïde", + "labelEnSnapshot": "Pre-sphenoid / post-sphenoid disengagement", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "intraosseous", + "lesser-wings" + ], + "labelFrSnapshot": "Dysfonction des petites ailes", + "labelEnSnapshot": "Lesser wings dysfunction", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "intraosseous", + "greater-wings" + ], + "labelFrSnapshot": "Dysfonction des grandes ailes", + "labelEnSnapshot": "Greater wings dysfunction", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-dysfunctions", + "sutures", + "sphenopetrosal" + ], + "labelFrSnapshot": "Suture sphéno-pétreuse", + "labelEnSnapshot": "Sphenopetrosal suture" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-dysfunctions", + "sutures", + "sphenosquamous" + ], + "labelFrSnapshot": "Suture sphéno-squameuse", + "labelEnSnapshot": "Sphenosquamous suture" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-dysfunctions", + "sutures", + "sphenoparietal" + ], + "labelFrSnapshot": "Suture sphéno-pariétale", + "labelEnSnapshot": "Sphenoparietal suture" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "sutures", + "frontosphenoidal" + ], + "labelFrSnapshot": "Suture fronto-sphénoïdale", + "labelEnSnapshot": "Frontosphenoidal suture", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenozygomatic" + ], + "labelFrSnapshot": "Suture sphéno-zygomatique", + "labelEnSnapshot": "Sphenozygomatic suture", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-dysfunctions", + "sutures", + "sphenomaxillary" + ], + "labelFrSnapshot": "Suture sphéno-maxillaire", + "labelEnSnapshot": "Sphenomaxillary suture" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenovomerian" + ], + "labelFrSnapshot": "Suture sphéno-vomérienne", + "labelEnSnapshot": "Sphenovomerine suture", + "unresolved": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-dysfunctions", + "sutures", + "sphenopalatine" + ], + "labelFrSnapshot": "Suture sphéno-palatine", + "labelEnSnapshot": "Sphenopalatine suture" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-consultation-reasons", + "behavior-change", + "irritability" + ], + "labelFrSnapshot": "Irritabilité / agressivité nouvelle", + "labelEnSnapshot": "New irritability / aggressiveness" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-consultation-reasons", + "behavior-change", + "withdrawal" + ], + "labelFrSnapshot": "Apathie / repli", + "labelEnSnapshot": "Apathy / withdrawal" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-consultation-reasons", + "behavior-change", + "head-touch-hypersensitivity" + ], + "labelFrSnapshot": "Hypersensibilité au toucher de la tête", + "labelEnSnapshot": "Head touch hypersensitivity" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-consultation-reasons", + "performance-drop" + ], + "labelFrSnapshot": "Baisse de performance inexpliquée", + "labelEnSnapshot": "Unexplained performance drop" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-consultation-reasons", + "cycle-irregularity" + ], + "labelFrSnapshot": "Irrégularité de cyclicité rapportée", + "labelEnSnapshot": "Reported cycle irregularity", + "requiresVetReferral": true + }, + { + "findingZoneId": "sphenoid", + "path": [ + "sphenoid-consultation-reasons", + "post-trauma-head" + ], + "labelFrSnapshot": "Suite de traumatisme crânien", + "labelEnSnapshot": "Post head trauma" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "anamnesis", + "trauma-direct" + ], + "labelFrSnapshot": "Traumatisme rapporté (choc, chute)", + "labelEnSnapshot": "Reported trauma (blow, fall)" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "anamnesis", + "stress-context" + ], + "labelFrSnapshot": "Contexte de stress / changement", + "labelEnSnapshot": "Stress / change context" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "anamnesis", + "posture-context" + ], + "labelFrSnapshot": "Contexte postural (harnachement, position de travail)", + "labelEnSnapshot": "Postural context" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "anamnesis", + "dental-context" + ], + "labelFrSnapshot": "Suite de soin dentaire récent", + "labelEnSnapshot": "Post recent dental care" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "anamnesis", + "post-veterinary" + ], + "labelFrSnapshot": "Suite d'intervention vétérinaire", + "labelEnSnapshot": "Post veterinary intervention" + }, + { + "findingZoneId": "sphenoid", + "path": [ + "anamnesis", + "no-identified-cause" + ], + "labelFrSnapshot": "Pas de cause identifiée", + "labelEnSnapshot": "No identified cause" + } + ], + "freeTextFindings": [], + "comment": "" + }, + { + "id": "obs-ssb", + "zones": [], + "findings": [ + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "physiological", + "flexion" + ], + "labelFrSnapshot": "Flexion", + "labelEnSnapshot": "Flexion" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "physiological", + "extension" + ], + "labelFrSnapshot": "Extension", + "labelEnSnapshot": "Extension" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "physiological", + "torsion-right" + ], + "labelFrSnapshot": "Torsion droite", + "labelEnSnapshot": "Right torsion" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "physiological", + "torsion-left" + ], + "labelFrSnapshot": "Torsion gauche", + "labelEnSnapshot": "Left torsion" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "physiological", + "sidebending-rotation-right" + ], + "labelFrSnapshot": "Side-bending rotation droite", + "labelEnSnapshot": "Right side-bending rotation" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "physiological", + "sidebending-rotation-left" + ], + "labelFrSnapshot": "Side-bending rotation gauche", + "labelEnSnapshot": "Left side-bending rotation" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "traumatic", + "vertical-strain-superior" + ], + "labelFrSnapshot": "Strain vertical haut", + "labelEnSnapshot": "Superior vertical strain" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "traumatic", + "vertical-strain-inferior" + ], + "labelFrSnapshot": "Strain vertical bas", + "labelEnSnapshot": "Inferior vertical strain" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "traumatic", + "lateral-strain-right" + ], + "labelFrSnapshot": "Strain latéral droit", + "labelEnSnapshot": "Right lateral strain" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "traumatic", + "lateral-strain-left" + ], + "labelFrSnapshot": "Strain latéral gauche", + "labelEnSnapshot": "Left lateral strain" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "traumatic", + "compression" + ], + "labelFrSnapshot": "Compression SSB", + "labelEnSnapshot": "SBS compression" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "intraosseous", + "pre-post-sphenoid" + ], + "labelFrSnapshot": "Désengagement pré-sphénoïde / post-sphénoïde", + "labelEnSnapshot": "Pre-sphenoid / post-sphenoid disengagement", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "intraosseous", + "lesser-wings" + ], + "labelFrSnapshot": "Dysfonction des petites ailes", + "labelEnSnapshot": "Lesser wings dysfunction", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "intraosseous", + "greater-wings" + ], + "labelFrSnapshot": "Dysfonction des grandes ailes", + "labelEnSnapshot": "Greater wings dysfunction", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenopetrosal" + ], + "labelFrSnapshot": "Suture sphéno-pétreuse", + "labelEnSnapshot": "Sphenopetrosal suture", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenosquamous" + ], + "labelFrSnapshot": "Suture sphéno-squameuse", + "labelEnSnapshot": "Sphenosquamous suture", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenoparietal" + ], + "labelFrSnapshot": "Suture sphéno-pariétale", + "labelEnSnapshot": "Sphenoparietal suture", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "sutures", + "frontosphenoidal" + ], + "labelFrSnapshot": "Suture fronto-sphénoïdale", + "labelEnSnapshot": "Frontosphenoidal suture", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenozygomatic" + ], + "labelFrSnapshot": "Suture sphéno-zygomatique", + "labelEnSnapshot": "Sphenozygomatic suture", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenomaxillary" + ], + "labelFrSnapshot": "Suture sphéno-maxillaire", + "labelEnSnapshot": "Sphenomaxillary suture", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenovomerian" + ], + "labelFrSnapshot": "Suture sphéno-vomérienne", + "labelEnSnapshot": "Sphenovomerine suture", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-dysfunctions", + "sutures", + "sphenopalatine" + ], + "labelFrSnapshot": "Suture sphéno-palatine", + "labelEnSnapshot": "Sphenopalatine suture", + "unresolved": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-consultation-reasons", + "behavior-change", + "irritability" + ], + "labelFrSnapshot": "Irritabilité / agressivité nouvelle", + "labelEnSnapshot": "New irritability / aggressiveness" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-consultation-reasons", + "behavior-change", + "withdrawal" + ], + "labelFrSnapshot": "Apathie / repli", + "labelEnSnapshot": "Apathy / withdrawal" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-consultation-reasons", + "behavior-change", + "head-touch-hypersensitivity" + ], + "labelFrSnapshot": "Hypersensibilité au toucher de la tête", + "labelEnSnapshot": "Head touch hypersensitivity" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-consultation-reasons", + "performance-drop" + ], + "labelFrSnapshot": "Baisse de performance inexpliquée", + "labelEnSnapshot": "Unexplained performance drop" + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-consultation-reasons", + "cycle-irregularity" + ], + "labelFrSnapshot": "Irrégularité de cyclicité rapportée", + "labelEnSnapshot": "Reported cycle irregularity", + "requiresVetReferral": true + }, + { + "findingZoneId": "ssb", + "path": [ + "ssb-consultation-reasons", + "post-trauma-head" + ], + "labelFrSnapshot": "Suite de traumatisme crânien", + "labelEnSnapshot": "Post head trauma" + }, + { + "findingZoneId": "ssb", + "path": [ + "anamnesis", + "trauma-direct" + ], + "labelFrSnapshot": "Traumatisme rapporté (choc, chute)", + "labelEnSnapshot": "Reported trauma (blow, fall)" + }, + { + "findingZoneId": "ssb", + "path": [ + "anamnesis", + "stress-context" + ], + "labelFrSnapshot": "Contexte de stress / changement", + "labelEnSnapshot": "Stress / change context" + }, + { + "findingZoneId": "ssb", + "path": [ + "anamnesis", + "posture-context" + ], + "labelFrSnapshot": "Contexte postural (harnachement, position de travail)", + "labelEnSnapshot": "Postural context" + }, + { + "findingZoneId": "ssb", + "path": [ + "anamnesis", + "dental-context" + ], + "labelFrSnapshot": "Suite de soin dentaire récent", + "labelEnSnapshot": "Post recent dental care" + }, + { + "findingZoneId": "ssb", + "path": [ + "anamnesis", + "post-veterinary" + ], + "labelFrSnapshot": "Suite d'intervention vétérinaire", + "labelEnSnapshot": "Post veterinary intervention" + }, + { + "findingZoneId": "ssb", + "path": [ + "anamnesis", + "no-identified-cause" + ], + "labelFrSnapshot": "Pas de cause identifiée", + "labelEnSnapshot": "No identified cause" + } + ], + "freeTextFindings": [], + "comment": "" + }, + { + "id": "obs-frontal", + "zones": [], + "findings": [ + { + "findingZoneId": "frontal", + "path": [ + "frontal-dysfunctions", + "mobility", + "flexion-external-rotation" + ], + "labelFrSnapshot": "En flexion (rotation externe)", + "labelEnSnapshot": "Flexion (external rotation)" + } + ], + "freeTextFindings": [], + "comment": "" + } + ], + "conclusion": "", + "recommendations": "", + "localAnnotations": [] + }, + "sheetSnapshot": { + "status": "draft", + "ref": { + "sheetId": "503dc301-a8b1-50d4-9e44-0919b2fc2916", + "versionId": null, + "documentSha256": "27c7383c445c73dc2001ebf4794a3ea63d416910bbbaa0d7848dd720de7c2660", + "schemaVersion": 2, + "speciesId": "equine" + }, + "document": { + "schema_version": 2, + "species_id": "equine", + "name": { + "fr": "Cheval", + "en": "Horse" + }, + "description": { + "fr": "Fiche anatomique officielle Faunosteo du cheval (Equus caballus)", + "en": "Official Faunosteo anatomical sheet of the horse (Equus caballus)" + }, + "scope_disclaimer": { + "fr": "Les éléments listés relèvent du périmètre légal de l'ostéopathie animale (art. L. 243-3 12° et R. 243-6 du Code rural et de la pêche maritime) : dysfonctions ostéopathiques palpées, observations cliniques et motifs de consultation rapportés. Aucun diagnostic médical n'est posé. Toute pathologie organique relève du vétérinaire ; conformément à l'art. R. 243-8, le propriétaire est orienté vers un vétérinaire lorsque les symptômes ou lésions nécessitent un diagnostic ou un traitement médical, persistent ou s'aggravent.", + "en": "The items listed fall within the legal scope of animal osteopathy in France (Articles L. 243-3 (12°) and R. 243-6 of the Code rural et de la pêche maritime): palpated osteopathic dysfunctions, clinical observations and reported reasons for consultation. No medical diagnosis is made. Any organic disease is a matter for a veterinarian; under Article R. 243-8 the owner is referred to a veterinarian whenever symptoms or lesions require a medical diagnosis or treatment, persist or worsen." + }, + "attribution": { + "authors": [ + "Faunosteo" + ], + "license": null, + "notes": "Import des données historiques: Horse.svg, Horse_head.svg, pathologies.json (schema 2.0)" + }, + "vertebral_config": { + "regions": [ + { + "code": "C", + "name": { + "fr": "Cervicales", + "en": "Cervical" + }, + "count": 7, + "count_range": null + }, + { + "code": "T", + "name": { + "fr": "Thoraciques", + "en": "Thoracic" + }, + "count": 18, + "count_range": { + "min": 17, + "max": 19 + } + }, + { + "code": "L", + "name": { + "fr": "Lombaires", + "en": "Lumbar" + }, + "count": 6, + "count_range": { + "min": 5, + "max": 6 + } + }, + { + "code": "S", + "name": { + "fr": "Sacrales", + "en": "Sacral" + }, + "count": 5, + "count_range": null + }, + { + "code": "Cd", + "name": { + "fr": "Caudales", + "en": "Caudal" + }, + "count": 18, + "count_range": { + "min": 15, + "max": 21 + } + } + ] + }, + "references": [], + "categories": [ + { + "id": "articulations", + "name": { + "fr": "Articulations", + "en": "Joints" + }, + "color": "#ff9500" + }, + { + "id": "os", + "name": { + "fr": "Os", + "en": "Bones" + }, + "color": "#a41e65" + }, + { + "id": "charnieres-vertebrales", + "name": { + "fr": "Charnières vertébrales", + "en": "Vertebral junctions" + }, + "color": "#ff0000" + }, + { + "id": "zone-colonne", + "name": { + "fr": "Segments vertébraux", + "en": "Vertebral segments" + }, + "color": "#e100ff" + }, + { + "id": "cadrans-du-crane", + "name": { + "fr": "Os du crâne", + "en": "Cranial bones" + }, + "color": "#1baa08" + } + ], + "views": [ + { + "id": "main", + "name": { + "fr": "Vue latérale gauche", + "en": "Left lateral view" + }, + "svg_asset_id": "7f767f74-3b36-51a7-8465-52dd7e2ead4a", + "view_box": null, + "kind": "main" + }, + { + "id": "head", + "name": { + "fr": "Tête (vue latérale gauche)", + "en": "Head (left lateral view)" + }, + "svg_asset_id": null, + "view_box": { + "min_x": 60, + "min_y": 100, + "width": 500, + "height": 380 + }, + "kind": "detail", + "parent_view_id": "main" + } + ], + "annotations": [ + { + "id": "hind-fetlock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1523, + "cy": 1397, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Boulet postérieur (métatarso-phalangien)", + "en": "Hind fetlock" + }, + "finding_zone_id": "hind-fetlock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1542, + "cy": 1159, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Jarret (tarso-crurale et intertarsiennes)", + "en": "Hock (tarsal joints)" + }, + "finding_zone_id": "hock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "stifle", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1464, + "cy": 918, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Grasset (fémoro-tibiale et fémoro-patellaire)", + "en": "Stifle joint" + }, + "finding_zone_id": "stifle", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hip", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1585, + "cy": 612, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Hanche (coxo-fémorale)", + "en": "Hip joint" + }, + "finding_zone_id": "hip", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "sacroiliac", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 1450, + "cy": 578, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Articulation sacro-iliaque", + "en": "Sacroiliac joint" + }, + "finding_zone_id": "sacroiliac", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "shoulder", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 784, + "cy": 907, + "r": 34 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Épaule (scapulo-humérale)", + "en": "Shoulder joint" + }, + "finding_zone_id": "shoulder", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "elbow", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 743.0451049804688, + "cy": 1193, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Coude (huméro-radio-ulnaire)", + "en": "Elbow joint" + }, + "finding_zone_id": "elbow", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "carpus", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 745, + "cy": 1252, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Carpe (antébrachio-carpienne, médio-carpienne)", + "en": "Carpus (carpal joints)" + }, + "finding_zone_id": "carpus", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "fore-fetlock", + "view_id": "main", + "category_id": "articulations", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 736, + "cy": 1379, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Boulet antérieur (métacarpo-phalangien)", + "en": "Fore fetlock" + }, + "finding_zone_id": "fore-fetlock", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "fore-sesamoids", + "view_id": "main", + "category_id": "os", + "laterality": "bilateral", + "geometry": { + "type": "circle", + "cx": 784, + "cy": 1371, + "r": 34 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Sésamoïdes antérieurs (boulet)", + "en": "Forelimb sesamoids" + }, + "finding_zone_id": "fore-sesamoids", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "l6-s1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 1424, + "cy": 515, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière L6-S1 (lombo-sacrée)", + "en": "L6-S1 junction (lumbosacral joint)" + }, + "finding_zone_id": "l6-s1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "t18-l1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 1118, + "cy": 528, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière T18-L1 (thoraco-lombaire)", + "en": "T18-L1 junction (thoracolumbar)" + }, + "finding_zone_id": "t18-l1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "c7-t1", + "view_id": "main", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 865, + "cy": 528, + "r": 30 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière C7-T1 (cervico-thoracique)", + "en": "C7-T1 junction (cervicothoracic)" + }, + "finding_zone_id": "c7-t1", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "caudal", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1655, + 545 + ], + [ + 1662, + 513 + ], + [ + 1742, + 565 + ], + [ + 1780, + 618 + ], + [ + 1763, + 628 + ], + [ + 1724, + 590 + ], + [ + 1682, + 569 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres caudales", + "en": "Caudal vertebrae" + }, + "finding_zone_id": "caudal", + "vertebral_region_code": "Cd", + "kind": "zone" + }, + { + "id": "sacral", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1438, + 461 + ], + [ + 1418.5, + 556.2 + ], + [ + 1510.8, + 539.5 + ], + [ + 1595, + 538.2 + ], + [ + 1641, + 552 + ], + [ + 1641, + 510 + ], + [ + 1606, + 485 + ], + [ + 1515, + 468 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres sacrales", + "en": "Sacral vertebrae" + }, + "finding_zone_id": "sacral", + "vertebral_region_code": "S", + "kind": "zone" + }, + { + "id": "lumbar", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1401.3, + 457.1 + ], + [ + 1386, + 562 + ], + [ + 1232, + 562 + ], + [ + 1130, + 552 + ], + [ + 1131.4, + 503.2 + ], + [ + 1260, + 475 + ], + [ + 1361, + 454.4 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres lombaires", + "en": "Lumbar vertebrae" + }, + "finding_zone_id": "lumbar", + "vertebral_region_code": "L", + "kind": "zone" + }, + { + "id": "thoracic", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 1109.9, + 497.7 + ], + [ + 1103, + 558.9 + ], + [ + 1010.3, + 558.9 + ], + [ + 915, + 552 + ], + [ + 873.9, + 530.7 + ], + [ + 826.8, + 509.5 + ], + [ + 841, + 422 + ], + [ + 960, + 482 + ], + [ + 1068, + 496 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres thoraciques", + "en": "Thoracic vertebrae" + }, + "finding_zone_id": "thoracic", + "vertebral_region_code": "T", + "kind": "zone" + }, + { + "id": "cervical", + "view_id": "main", + "category_id": "zone-colonne", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 468, + 276 + ], + [ + 489, + 216 + ], + [ + 558, + 248 + ], + [ + 586, + 339 + ], + [ + 607, + 401 + ], + [ + 625, + 447 + ], + [ + 649, + 510 + ], + [ + 695.1, + 528.4 + ], + [ + 728.9, + 520.1 + ], + [ + 765.3, + 472.8 + ], + [ + 816.8, + 453 + ], + [ + 796.5, + 543.7 + ], + [ + 730, + 600 + ], + [ + 646, + 604 + ], + [ + 593, + 565 + ], + [ + 552, + 461 + ], + [ + 524, + 370 + ] + ] + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Vertèbres cervicales", + "en": "Cervical vertebrae" + }, + "finding_zone_id": "cervical", + "vertebral_region_code": "C", + "kind": "zone" + }, + { + "id": "head-trigger", + "view_id": "main", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "polygon", + "points": [ + [ + 454, + 332 + ], + [ + 429, + 202 + ], + [ + 408, + 150 + ], + [ + 349, + 154 + ], + [ + 300, + 188 + ], + [ + 269, + 216 + ], + [ + 234, + 279 + ], + [ + 192, + 318 + ], + [ + 164, + 384 + ], + [ + 175, + 457 + ], + [ + 234, + 468 + ], + [ + 265, + 450 + ], + [ + 328, + 419 + ], + [ + 405, + 394 + ], + [ + 443, + 408 + ] + ] + }, + "review_status": "inherited", + "color": null, + "kind": "detail_trigger", + "name": null, + "opens_view_id": "head" + }, + { + "id": "parietal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 348, + "cy": 161, + "r": 27 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Pariétal", + "en": "Parietal bone" + }, + "finding_zone_id": "parietal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "frontal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 277, + "cy": 214, + "r": 27 + }, + "review_status": "inherited", + "color": null, + "name": { + "fr": "Frontal", + "en": "Frontal bone" + }, + "finding_zone_id": "frontal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "sphenoid", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 352, + "cy": 300, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Sphénoïde", + "en": "Sphenoid bone" + }, + "finding_zone_id": "sphenoid", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "temporal", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 366, + "cy": 214, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Temporal", + "en": "Temporal bone" + }, + "finding_zone_id": "temporal", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "occipital", + "view_id": "head", + "category_id": "cadrans-du-crane", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 441, + "cy": 190, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Occipital", + "en": "Occipital bone" + }, + "finding_zone_id": "occipital", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "atm", + "view_id": "head", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 400, + "cy": 258, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#ff8800", + "name": { + "fr": "Articulation temporo-mandibulaire (ATM)", + "en": "Temporomandibular joint (TMJ)" + }, + "finding_zone_id": "atm", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "ssb", + "view_id": "head", + "category_id": "articulations", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 437, + "cy": 300, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#ff8800", + "name": { + "fr": "Synchondrose sphéno-occipitale (SSB)", + "en": "Spheno-occipital synchondrosis (SBS)" + }, + "finding_zone_id": "ssb", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "hyoid", + "view_id": "head", + "category_id": "os", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 376, + "cy": 399, + "r": 27 + }, + "review_status": "to_confirm", + "color": "#d507c4", + "name": { + "fr": "Appareil hyoïdien", + "en": "Hyoid apparatus" + }, + "finding_zone_id": "hyoid", + "vertebral_region_code": null, + "kind": "point" + }, + { + "id": "c0-c1", + "view_id": "head", + "category_id": "charnieres-vertebrales", + "laterality": "unpaired", + "geometry": { + "type": "circle", + "cx": 482, + "cy": 332, + "r": 27 + }, + "review_status": "to_confirm", + "color": null, + "name": { + "fr": "Charnière C0-C1 (atlanto-occipitale)", + "en": "C0-C1 junction (atlanto-occipital joint)" + }, + "finding_zone_id": "c0-c1", + "vertebral_region_code": null, + "kind": "point" + } + ], + "finding_zones": [ + { + "id": "parietal", + "name": { + "fr": "Pariétal", + "en": "Parietal bone" + }, + "categories": [] + }, + { + "id": "frontal", + "name": { + "fr": "Frontal", + "en": "Frontal bone" + }, + "categories": [ + { + "id": "frontal-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "mobility", + "name": { + "fr": "Dysfonctions de mobilité", + "en": "Mobility dysfunctions" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [ + { + "id": "flexion-external-rotation", + "name": { + "fr": "En flexion (rotation externe)", + "en": "Flexion (external rotation)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + } + ] + }, + { + "id": "sphenoid", + "name": { + "fr": "Sphénoïde", + "en": "Sphenoid bone" + }, + "categories": [ + { + "id": "sphenoid-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "to_confirm", + "children": [ + { + "id": "sutures", + "name": { + "fr": "Restrictions des sutures et synchondroses", + "en": "Suture and synchondrosis restrictions" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "sphenosquamous", + "name": { + "fr": "Suture sphéno-squameuse", + "en": "Sphenosquamous suture" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "reviewed", + "children": [] + }, + { + "id": "sphenoparietal", + "name": { + "fr": "Suture sphéno-pariétale (contact ponctuel)", + "en": "Sphenoparietal suture (point contact)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "reviewed", + "children": [] + }, + { + "id": "sphenopalatine", + "name": { + "fr": "Suture sphéno-palatine", + "en": "Sphenopalatine suture" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "reviewed", + "children": [] + }, + { + "id": "sphenomaxillary", + "name": { + "fr": "Suture sphéno-maxillaire (contact non documenté chez le cheval)", + "en": "Sphenomaxillary suture (contact not documented in the horse)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "sphenopetrosal", + "name": { + "fr": "Synchondrose sphéno-pétreuse", + "en": "Sphenopetrosal synchondrosis" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "reviewed", + "children": [] + } + ] + } + ] + }, + { + "id": "sphenoid-consultation-reasons", + "kind": "consultation_reason", + "name": { + "fr": "Observations / motifs de consultation", + "en": "Observations / consultation reasons" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "behavior-change", + "name": { + "fr": "Modifications comportementales rapportées", + "en": "Reported behavioral changes" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "irritability", + "name": { + "fr": "Irritabilité / agressivité nouvelle", + "en": "New irritability / aggressiveness" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "withdrawal", + "name": { + "fr": "Apathie / repli", + "en": "Apathy / withdrawal" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "head-touch-hypersensitivity", + "name": { + "fr": "Hypersensibilité au toucher de la tête", + "en": "Head touch hypersensitivity" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + }, + { + "id": "performance-drop", + "name": { + "fr": "Baisse de performance inexpliquée", + "en": "Unexplained performance drop" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "cycle-irregularity", + "name": { + "fr": "Irrégularité de cyclicité rapportée", + "en": "Reported cycle irregularity" + }, + "description": {}, + "requires_vet_referral": true, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "post-trauma-head", + "name": { + "fr": "Suite de traumatisme crânien", + "en": "Post head trauma" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + } + ] + }, + { + "id": "anamnesis", + "kind": "anamnesis", + "name": { + "fr": "Anamnèse / facteurs rapportés", + "en": "Anamnesis / reported factors" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "trauma-direct", + "name": { + "fr": "Traumatisme rapporté (choc, chute)", + "en": "Reported trauma (blow, fall)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "stress-context", + "name": { + "fr": "Contexte de stress / changement", + "en": "Stress / change context" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "posture-context", + "name": { + "fr": "Contexte postural (harnachement, position de travail)", + "en": "Postural context (tack, working position)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "dental-context", + "name": { + "fr": "Suite de soin dentaire récent", + "en": "Post recent dental care" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "post-veterinary", + "name": { + "fr": "Suite d'intervention vétérinaire", + "en": "Post veterinary intervention" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "no-identified-cause", + "name": { + "fr": "Pas de cause identifiée", + "en": "No identified cause" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + }, + { + "id": "temporal", + "name": { + "fr": "Temporal", + "en": "Temporal bone" + }, + "categories": [] + }, + { + "id": "occipital", + "name": { + "fr": "Occipital", + "en": "Occipital bone" + }, + "categories": [] + }, + { + "id": "ssb", + "name": { + "fr": "Synchondrose sphéno-occipitale (SSB, sphéno-basilaire)", + "en": "Spheno-occipital synchondrosis (SBS, sphenobasilar)" + }, + "categories": [ + { + "id": "ssb-dysfunctions", + "kind": "dysfunction", + "name": { + "fr": "Dysfonctions ostéopathiques", + "en": "Osteopathic dysfunctions" + }, + "description": {}, + "reference_ids": [], + "review_status": "to_confirm", + "children": [ + { + "id": "physiological", + "name": { + "fr": "Dysfonctions physiologiques (schémas de la SSB)", + "en": "Physiological dysfunctions (SBS patterns)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [ + { + "id": "flexion", + "name": { + "fr": "Flexion", + "en": "Flexion" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "extension", + "name": { + "fr": "Extension", + "en": "Extension" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "torsion-right", + "name": { + "fr": "Torsion droite", + "en": "Right torsion" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "torsion-left", + "name": { + "fr": "Torsion gauche", + "en": "Left torsion" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "sidebending-rotation-right", + "name": { + "fr": "Side-bending rotation droite", + "en": "Right side-bending rotation" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "sidebending-rotation-left", + "name": { + "fr": "Side-bending rotation gauche", + "en": "Left side-bending rotation" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + } + ] + }, + { + "id": "traumatic", + "name": { + "fr": "Dysfonctions non physiologiques / traumatiques", + "en": "Non-physiological / traumatic dysfunctions" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [ + { + "id": "vertical-strain-superior", + "name": { + "fr": "Strain vertical haut", + "en": "Superior vertical strain" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "vertical-strain-inferior", + "name": { + "fr": "Strain vertical bas", + "en": "Inferior vertical strain" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "lateral-strain-right", + "name": { + "fr": "Strain latéral droit", + "en": "Right lateral strain" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "lateral-strain-left", + "name": { + "fr": "Strain latéral gauche", + "en": "Left lateral strain" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "compression", + "name": { + "fr": "Compression SSB", + "en": "SBS compression" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + } + ] + } + ] + }, + { + "id": "ssb-consultation-reasons", + "kind": "consultation_reason", + "name": { + "fr": "Observations / motifs de consultation", + "en": "Observations / consultation reasons" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "behavior-change", + "name": { + "fr": "Modifications comportementales rapportées", + "en": "Reported behavioral changes" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "irritability", + "name": { + "fr": "Irritabilité / agressivité nouvelle", + "en": "New irritability / aggressiveness" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "withdrawal", + "name": { + "fr": "Apathie / repli", + "en": "Apathy / withdrawal" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "head-touch-hypersensitivity", + "name": { + "fr": "Hypersensibilité au toucher de la tête", + "en": "Head touch hypersensitivity" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + }, + { + "id": "performance-drop", + "name": { + "fr": "Baisse de performance inexpliquée", + "en": "Unexplained performance drop" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + }, + { + "id": "cycle-irregularity", + "name": { + "fr": "Irrégularité de cyclicité rapportée", + "en": "Reported cycle irregularity" + }, + "description": {}, + "requires_vet_referral": true, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "post-trauma-head", + "name": { + "fr": "Suite de traumatisme crânien", + "en": "Post head trauma" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "to_confirm", + "children": [] + } + ] + }, + { + "id": "anamnesis", + "kind": "anamnesis", + "name": { + "fr": "Anamnèse / facteurs rapportés", + "en": "Anamnesis / reported factors" + }, + "description": {}, + "reference_ids": [], + "review_status": "inherited", + "children": [ + { + "id": "trauma-direct", + "name": { + "fr": "Traumatisme rapporté (choc, chute)", + "en": "Reported trauma (blow, fall)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "stress-context", + "name": { + "fr": "Contexte de stress / changement", + "en": "Stress / change context" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "posture-context", + "name": { + "fr": "Contexte postural (harnachement, position de travail)", + "en": "Postural context (tack, working position)" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "dental-context", + "name": { + "fr": "Suite de soin dentaire récent", + "en": "Post recent dental care" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "post-veterinary", + "name": { + "fr": "Suite d'intervention vétérinaire", + "en": "Post veterinary intervention" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + }, + { + "id": "no-identified-cause", + "name": { + "fr": "Pas de cause identifiée", + "en": "No identified cause" + }, + "description": {}, + "requires_vet_referral": false, + "reference_ids": [], + "review_status": "inherited", + "children": [] + } + ] + } + ] + }, + { + "id": "atm", + "name": { + "fr": "Articulation temporo-mandibulaire (ATM)", + "en": "Temporomandibular joint (TMJ)" + }, + "categories": [] + }, + { + "id": "hyoid", + "name": { + "fr": "Appareil hyoïdien", + "en": "Hyoid apparatus" + }, + "categories": [] + }, + { + "id": "c0-c1", + "name": { + "fr": "Charnière C0-C1 (atlanto-occipitale)", + "en": "C0-C1 junction (atlanto-occipital joint)" + }, + "categories": [] + }, + { + "id": "cervical", + "name": { + "fr": "Vertèbres cervicales", + "en": "Cervical vertebrae" + }, + "categories": [] + }, + { + "id": "c7-t1", + "name": { + "fr": "Charnière C7-T1 (cervico-thoracique)", + "en": "C7-T1 junction (cervicothoracic)" + }, + "categories": [] + }, + { + "id": "shoulder", + "name": { + "fr": "Épaule (scapulo-humérale)", + "en": "Shoulder joint" + }, + "categories": [] + }, + { + "id": "elbow", + "name": { + "fr": "Coude (huméro-radio-ulnaire)", + "en": "Elbow joint" + }, + "categories": [] + }, + { + "id": "carpus", + "name": { + "fr": "Carpe (antébrachio-carpienne, médio-carpienne)", + "en": "Carpus (carpal joints)" + }, + "categories": [] + }, + { + "id": "fore-fetlock", + "name": { + "fr": "Boulet antérieur (métacarpo-phalangien)", + "en": "Fore fetlock" + }, + "categories": [] + }, + { + "id": "fore-sesamoids", + "name": { + "fr": "Sésamoïdes antérieurs (boulet)", + "en": "Forelimb sesamoids" + }, + "categories": [] + }, + { + "id": "thoracic", + "name": { + "fr": "Vertèbres thoraciques", + "en": "Thoracic vertebrae" + }, + "categories": [] + }, + { + "id": "t18-l1", + "name": { + "fr": "Charnière T18-L1 (thoraco-lombaire)", + "en": "T18-L1 junction (thoracolumbar)" + }, + "categories": [] + }, + { + "id": "lumbar", + "name": { + "fr": "Vertèbres lombaires", + "en": "Lumbar vertebrae" + }, + "categories": [] + }, + { + "id": "l6-s1", + "name": { + "fr": "Charnière L6-S1 (lombo-sacrée)", + "en": "L6-S1 junction (lumbosacral joint)" + }, + "categories": [] + }, + { + "id": "sacral", + "name": { + "fr": "Vertèbres sacrales", + "en": "Sacral vertebrae" + }, + "categories": [] + }, + { + "id": "sacroiliac", + "name": { + "fr": "Articulation sacro-iliaque", + "en": "Sacroiliac joint" + }, + "categories": [] + }, + { + "id": "hip", + "name": { + "fr": "Hanche (coxo-fémorale)", + "en": "Hip joint" + }, + "categories": [] + }, + { + "id": "stifle", + "name": { + "fr": "Grasset (fémoro-tibiale et fémoro-patellaire)", + "en": "Stifle joint" + }, + "categories": [] + }, + { + "id": "hock", + "name": { + "fr": "Jarret (tarso-crurale et intertarsiennes)", + "en": "Hock (tarsal joints)" + }, + "categories": [] + }, + { + "id": "hind-fetlock", + "name": { + "fr": "Boulet postérieur (métatarso-phalangien)", + "en": "Hind fetlock" + }, + "categories": [] + }, + { + "id": "caudal", + "name": { + "fr": "Vertèbres caudales", + "en": "Caudal vertebrae" + }, + "categories": [] + } + ] + }, + "assets": [ + { + "svgAssetId": "7f767f74-3b36-51a7-8465-52dd7e2ead4a", + "sha256": "0ea5202fa3b95bac167b87c12ee969ab0272e085b60c2d34dbca6202c5f08541", + "svg": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n" + } + ] + }, + "branding": { + "siteUrl": "https://faunosteo.com", + "headerLogo": null, + "footerLogo": null, + "poweredBy": { + "logo": null, + "url": "https://zenquality.fr", + "fallbackText": "zenquality.fr" + }, + "partner": { + "logo": null, + "url": "https://www.instagram.com/paws.iin.harmony", + "fallbackText": "@paws.iin.harmony" + } + }, + "labels": { + "fr": { + "pdf.eyebrow.observation": "OBSERVATION", + "pdf.eyebrow.synthesis": "SYNTHÈSE", + "pdf.title.conclusion": "Conclusion", + "pdf.section.zones": "ZONES", + "pdf.section.findings_prefix": "CONSTATS — ", + "pdf.section.free_findings": "CONSTATS LIBRES", + "pdf.section.severity": "SÉVÉRITÉ", + "pdf.section.comment": "COMMENTAIRE", + "pdf.section.conclusion": "CONCLUSION", + "pdf.section.recommendations": "RECOMMANDATIONS", + "pdf.section.next_appointment": "PROCHAIN RENDEZ-VOUS", + "pdf.view.general": "VUE GÉNÉRALE", + "pdf.view.detail_prefix": "VUE DÉTAIL — ", + "pdf.empty": "—", + "pdf.owner_prefix": "Propriétaire : ", + "pdf.siret_prefix": "SIRET ", + "pdf.title.suffix.bilan": "Bilan ostéo — ", + "pdf.subject": "Bilan d'ostéopathie animalière", + "severity.mild": "légère", + "severity.moderate": "modérée", + "severity.severe": "sévère", + "lateral.left": "Gauche", + "lateral.right": "Droite", + "footer.powered_by": "Propulsé par", + "footer.in_partnership": "En partenariat avec" + }, + "en": { + "pdf.eyebrow.observation": "OBSERVATION", + "pdf.eyebrow.synthesis": "SYNTHESIS", + "pdf.title.conclusion": "Conclusion", + "pdf.section.zones": "ZONES", + "pdf.section.findings_prefix": "FINDINGS — ", + "pdf.section.free_findings": "FREE FINDINGS", + "pdf.section.severity": "SEVERITY", + "pdf.section.comment": "COMMENT", + "pdf.section.conclusion": "CONCLUSION", + "pdf.section.recommendations": "RECOMMENDATIONS", + "pdf.section.next_appointment": "NEXT APPOINTMENT", + "pdf.view.general": "GENERAL VIEW", + "pdf.view.detail_prefix": "DETAIL VIEW — ", + "pdf.empty": "—", + "pdf.owner_prefix": "Owner: ", + "pdf.siret_prefix": "SIRET ", + "pdf.title.suffix.bilan": "Osteo report — ", + "pdf.subject": "Animal osteopathic report", + "severity.mild": "mild", + "severity.moderate": "moderate", + "severity.severe": "severe", + "lateral.left": "Left", + "lateral.right": "Right", + "footer.powered_by": "Powered by", + "footer.in_partnership": "In partnership with" + } + } +} \ No newline at end of file diff --git a/apps/app/tests/helpers/goldenReports.ts b/apps/app/tests/helpers/goldenReports.ts new file mode 100644 index 00000000..7855c142 --- /dev/null +++ b/apps/app/tests/helpers/goldenReports.ts @@ -0,0 +1,60 @@ +import { readFileSync } from 'node:fs' +import { resolve } from 'node:path' +import { + readReportDocument, + ReportSchema, + type Report, +} from '@faunosteo/domain' +import type { SheetIndex } from '@/services/sheetIndex' +import { FIXTURES_DIR } from './goldens' +import { + leavesAsV2Report, + legacyLeaves, + loadLegacyBaseline, +} from './legacyLeaves' + +/** + * The three reports the Step 6 goldens and the R2 envelope freeze are drawn + * from: the Step 5 v2 archive fixture migrated, the v3 demo report, and a v2 + * report whose sphenoid and ssb findings the migration cannot place. + */ + +export const GOLDEN_REPORTS = ['v2full', 'demo', 'v2unresolved'] as const +export type GoldenReportName = (typeof GOLDEN_REPORTS)[number] + +export interface GoldenReports { + reports: Record + /** Findings the migration flagged in `v2unresolved`. */ + unresolvedOfV2Unresolved: number +} + +const readJson = (name: string): unknown => + JSON.parse(readFileSync(resolve(FIXTURES_DIR, name), 'utf8')) + +/** sphenoid + ssb (the families the migration cannot place) plus one leaf that resolves. */ +function buildV2Unresolved(sheet: SheetIndex) { + const leaves = legacyLeaves(loadLegacyBaseline()) + const unresolvedFamilies = leaves.filter( + (l) => l.zoneId === 'sphenoid' || l.zoneId === 'ssb', + ) + const resolved = leaves.find((l) => l.zoneId === 'frontal')! + return readReportDocument( + leavesAsV2Report([...unresolvedFamilies, resolved]), + sheet.sheet.migrationMap, + ) +} + +export function buildGoldenReports(sheet: SheetIndex): GoldenReports { + const v2unresolved = buildV2Unresolved(sheet) + return { + reports: { + v2full: readReportDocument( + readJson('report-v2.full.json'), + sheet.sheet.migrationMap, + ).report, + demo: ReportSchema.parse(readJson('report-v3.demo.json')), + v2unresolved: v2unresolved.report, + }, + unresolvedOfV2Unresolved: v2unresolved.unresolvedFindings, + } +} diff --git a/apps/app/tests/unit/archive.envelopes.test.ts b/apps/app/tests/unit/archive.envelopes.test.ts new file mode 100644 index 00000000..54abb44a --- /dev/null +++ b/apps/app/tests/unit/archive.envelopes.test.ts @@ -0,0 +1,83 @@ +/** + * R2 freeze (RUST_ARCHITECTURE_REVIEW VI.1, VI.2 R2): the archive envelope + * (PDF attachment) of the three golden reports, exported by the application + * path with fixed inputs (FR, every logo slot empty, 1×1 raster, fixed + * export time), committed as the TypeScript domain wrote it before the + * switch to the Rust core. Whatever writes the attachment afterwards, it + * must parse with the frozen N-1 reader and be deep-equal to the frozen + * envelope; only the key order may differ (D-R11). `MAKE_R2_FREEZE=1` + * writes the files: never once the switch has landed without an owner + * decision. + */ +import { mkdirSync, readFileSync, writeFileSync } from 'node:fs' +import { resolve } from 'node:path' +import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' +import { readAttachmentBytes } from '@faunosteo/pdf' +import { + readArchiveDocument, + ReportArchiveEnvelopeSchema, +} from '@faunosteo/core-wasm/n-1' +import { exportReportToPdf } from '@/pdf/export' +import type { SheetIndex } from '@/services/sheetIndex' +import { loadTestSheet } from '../helpers/sheet' +import { FIXTURES_DIR, ONE_PX_PNG } from '../helpers/goldens' +import { + buildGoldenReports, + GOLDEN_REPORTS, + type GoldenReports, +} from '../helpers/goldenReports' + +vi.mock('@/pdf/browserRasterizer', () => ({ + browserRasterizer: vi.fn(async () => ONE_PX_PNG), +})) +vi.mock('@/pdf/branding', async () => { + const { brandingOf } = await import('../helpers/goldens') + return { loadBranding: vi.fn(() => brandingOf('nologos')) } +}) + +const FREEZE_DIR = resolve(FIXTURES_DIR, 'goldens/r2') +const MAKE_FREEZE = process.env.MAKE_R2_FREEZE === '1' +const EXPORTED_AT = new Date('2026-10-13T09:00:00.000Z') + +let sheet: SheetIndex +let golden: GoldenReports + +beforeAll(async () => { + sheet = await loadTestSheet() + golden = buildGoldenReports(sheet) + vi.spyOn(console, 'warn').mockImplementation(() => undefined) + vi.useFakeTimers({ toFake: ['Date'] }) + vi.setSystemTime(EXPORTED_AT) +}) +afterAll(() => { + vi.useRealTimers() + vi.restoreAllMocks() +}) + +async function exportedAttachment( + name: (typeof GOLDEN_REPORTS)[number], +): Promise { + const { pdf } = await exportReportToPdf(golden.reports[name], sheet, { + locale: 'fr', + }) + return new TextDecoder().decode(await readAttachmentBytes(pdf)) +} + +describe.each(GOLDEN_REPORTS)('archive envelope of %s', (name) => { + const file = resolve(FREEZE_DIR, `envelope.${name}.fr.nologos.json`) + + it('matches the frozen envelope and the N-1 reader accepts it', async () => { + const text = await exportedAttachment(name) + if (MAKE_FREEZE) { + mkdirSync(FREEZE_DIR, { recursive: true }) + writeFileSync(file, text) + } + const data: unknown = JSON.parse(text) + expect(data).toEqual(JSON.parse(readFileSync(file, 'utf8'))) + expect(ReportArchiveEnvelopeSchema.safeParse(data).success).toBe(true) + const outcome = readArchiveDocument(data, sheet.sheet.migrationMap) + expect(outcome.origin).toBe('envelope_v1') + expect(outcome.archive).not.toBeNull() + expect(outcome.snapshotRejected).toBeUndefined() + }, 30_000) +}) diff --git a/apps/app/tests/unit/pdf.goldens.test.ts b/apps/app/tests/unit/pdf.goldens.test.ts index b0952259..c0cd9cc9 100644 --- a/apps/app/tests/unit/pdf.goldens.test.ts +++ b/apps/app/tests/unit/pdf.goldens.test.ts @@ -12,22 +12,17 @@ import { describe, it, expect, vi, beforeAll, afterAll } from 'vitest' import { PDFDocument } from 'pdf-lib' import { readFileSync } from 'node:fs' import { resolve } from 'node:path' -import { - buildSheetSnapshot, - readReportDocument, - ReportSchema, - type Report, -} from '@faunosteo/domain' +import { buildSheetSnapshot, type Report } from '@faunosteo/domain' import { exportReportToPdf } from '@/pdf/export' import { importReportFromPdf } from '@/pdf/import' import type { SheetIndex } from '@/services/sheetIndex' import type { Locale } from '@/i18n/types' import { loadTestSheet } from '../helpers/sheet' import { - leavesAsV2Report, - legacyLeaves, - loadLegacyBaseline, -} from '../helpers/legacyLeaves' + buildGoldenReports, + GOLDEN_REPORTS, + type GoldenReportName, +} from '../helpers/goldenReports' import { checkGolden, FIXTURES_DIR, @@ -54,43 +49,17 @@ vi.mock('@/pdf/branding', async () => { return { loadBranding: vi.fn(() => brandingOf(logoMode.current)) } }) -const REPORTS = ['v2full', 'demo', 'v2unresolved'] as const -type ReportName = (typeof REPORTS)[number] +const REPORTS = GOLDEN_REPORTS const MODES: readonly LogoMode[] = ['nologos', 'logos'] const BARE_PDF = resolve(FIXTURES_DIR, 'report-v3.bare.pdf') -const readJson = (name: string): unknown => - JSON.parse(readFileSync(resolve(FIXTURES_DIR, name), 'utf8')) - let sheet: SheetIndex -let reports: Record +let reports: Record let unresolvedOfV2Unresolved = 0 -/** sphenoid + ssb (the families the migration cannot place) plus one leaf that resolves. */ -function buildV2Unresolved(): Report { - const leaves = legacyLeaves(loadLegacyBaseline()) - const unresolvedFamilies = leaves.filter( - (l) => l.zoneId === 'sphenoid' || l.zoneId === 'ssb', - ) - const resolved = leaves.find((l) => l.zoneId === 'frontal')! - const outcome = readReportDocument( - leavesAsV2Report([...unresolvedFamilies, resolved]), - sheet.sheet.migrationMap, - ) - unresolvedOfV2Unresolved = outcome.unresolvedFindings - return outcome.report -} - beforeAll(async () => { sheet = await loadTestSheet() - reports = { - v2full: readReportDocument( - readJson('report-v2.full.json'), - sheet.sheet.migrationMap, - ).report, - demo: ReportSchema.parse(readJson('report-v3.demo.json')), - v2unresolved: buildV2Unresolved(), - } + ;({ reports, unresolvedOfV2Unresolved } = buildGoldenReports(sheet)) vi.spyOn(console, 'warn').mockImplementation(() => undefined) }) afterAll(() => vi.restoreAllMocks()) diff --git a/packages/core-wasm/package.json b/packages/core-wasm/package.json index 91d05a5a..bdbb5c3e 100644 --- a/packages/core-wasm/package.json +++ b/packages/core-wasm/package.json @@ -2,12 +2,13 @@ "name": "@faunosteo/core-wasm", "version": "0.1.0", "private": true, - "description": "Faunosteo core compiled to WebAssembly: loader, generated TypeScript types of the contracts, and the R0 proofs (panic, serialisation, size)", + "description": "Faunosteo core compiled to WebAssembly: runtime loader, generated TypeScript types of the contracts, the frozen N-1 reader, and the R0 proofs (panic, serialisation, size)", "license": "MIT", "type": "module", "exports": { ".": "./src/index.ts", - "./types": "./types/index.ts" + "./types": "./types/index.ts", + "./n-1": "./tests/n-1/index.ts" }, "scripts": { "typecheck": "tsc -p tsconfig.json --noEmit", @@ -17,12 +18,14 @@ "build": "tsc -p tsconfig.json --noEmit" }, "devDependencies": { - "@faunosteo/domain": "workspace:*", "@types/node": "^20.19.41", "eslint": "^9.17.0", "globals": "^15.14.0", "typescript": "^5.7.2", "typescript-eslint": "^8.19.0", "vitest": "^3.2.7" + }, + "dependencies": { + "zod": "^3.24.1" } } diff --git a/packages/core-wasm/tests/n-1/domain/anatomical-sheet/create.ts b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/create.ts new file mode 100644 index 00000000..884f6524 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/create.ts @@ -0,0 +1,44 @@ +import { + AnatomicalSheetDocumentSchema, + SHEET_DOCUMENT_SCHEMA_VERSION, + type AnatomicalSheetDocument, + type LocalizedText, +} from './schema' + +export interface NewSheetDocumentParams { + species_id: string + name: LocalizedText +} + +export const MAIN_VIEW_ID = 'view-main' + +/** + * Starting point of a new sheet: shape-valid so it can be saved as a draft + * at once, but not publishable until the main view gets its SVG asset. + */ +export function createEmptySheetDocument( + params: NewSheetDocumentParams, +): AnatomicalSheetDocument { + return AnatomicalSheetDocumentSchema.parse({ + schema_version: SHEET_DOCUMENT_SCHEMA_VERSION, + species_id: params.species_id, + name: params.name, + description: {}, + scope_disclaimer: {}, + attribution: { authors: [], license: null, notes: null }, + vertebral_config: { regions: [] }, + references: [], + categories: [], + views: [ + { + id: MAIN_VIEW_ID, + kind: 'main', + name: { fr: 'Vue principale', en: 'Main view' }, + svg_asset_id: null, + view_box: null, + }, + ], + annotations: [], + finding_zones: [], + }) +} diff --git a/packages/core-wasm/tests/n-1/domain/anatomical-sheet/index.ts b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/index.ts new file mode 100644 index 00000000..c0c1d0e6 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/index.ts @@ -0,0 +1,4 @@ +export * from './schema' +export * from './validate' +export * from './create' +export * from './sheet-index' diff --git a/packages/core-wasm/tests/n-1/domain/anatomical-sheet/schema.ts b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/schema.ts new file mode 100644 index 00000000..9cf27a2e --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/schema.ts @@ -0,0 +1,327 @@ +import { z } from 'zod' + +/** + * Canonical anatomical sheet document, schema_version 2. + * + * Shape contract of docs/development/ANATOMICAL_SHEET_MODEL.md §2. Every + * object is strict: a canonical document must not silently carry fields no + * version of the schema defines. Cross-references (view ids, zone ids, + * reference ids…) are checked by validateSheetDocument, not here, so a + * draft with dangling references can still be saved. + * + * Version 2 (Step 4c): shared bibliographic `references` registry cited by + * `reference_ids`, `review_status` on findings and annotations, optional + * `count_range` on vertebral regions. No version 1 document was ever + * published, so version 1 is not read any more. + */ + +export const SHEET_DOCUMENT_SCHEMA_VERSION = 2 + +/** Ids are never derived from labels, so translations never move them. */ +export const STABLE_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{0,63}$/ + +export const StableIdSchema = z.string().regex(STABLE_ID_PATTERN) + +/** Region codes are free (C, T, L, S, Cd for the horse), case included. */ +export const RegionCodeSchema = z + .string() + .regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,15}$/) + +export const LocalizedTextSchema = z + .object({ fr: z.string().min(1), en: z.string().min(1) }) + .strict() + +export const LocalizedOptionalTextSchema = z + .object({ fr: z.string().optional(), en: z.string().optional() }) + .strict() + +/** + * How far the sheet content was checked against references. `inherited` = + * taken over from a previous source without review; `reviewed` = checked + * and cited; `to_confirm` = changed or added on documented grounds, still + * awaiting a professional's confirmation. + */ +export const ReviewStatusSchema = z.enum(['inherited', 'reviewed', 'to_confirm']) + +const CountRangeSchema = z + .object({ min: z.number().int().min(1), max: z.number().int().min(1) }) + .strict() + +/** + * `count` is the usual number of vertebrae (what the picker shows by + * default); `count_range` states the documented individual variation so a + * report may record a vertebra beyond the usual count. Null = no variation. + */ +export const VertebralRegionSchema = z + .object({ + code: RegionCodeSchema, + name: LocalizedTextSchema, + count: z.number().int().min(1), + count_range: CountRangeSchema.nullable().default(null), + }) + .strict() + +const HexColorSchema = z.string().regex(/^#[0-9a-fA-F]{6}$/) + +export const AnnotationCategorySchema = z + .object({ + id: StableIdSchema, + name: LocalizedTextSchema, + color: HexColorSchema.nullable(), + }) + .strict() + +const CoordinateSchema = z.number().finite() + +export const ViewBoxSchema = z + .object({ + min_x: CoordinateSchema, + min_y: CoordinateSchema, + width: CoordinateSchema.positive(), + height: CoordinateSchema.positive(), + }) + .strict() + +/** Null asset on a detail view means "parent asset cropped by view_box". */ +const viewCommon = { + id: StableIdSchema, + name: LocalizedTextSchema, + svg_asset_id: z.string().uuid().nullable(), + view_box: ViewBoxSchema.nullable(), +} + +const MainViewSchema = z + .object({ ...viewCommon, kind: z.literal('main') }) + .strict() + +const DetailViewSchema = z + .object({ + ...viewCommon, + kind: z.literal('detail'), + parent_view_id: StableIdSchema, + }) + .strict() + +/** Views form a tree: a detail names its parent, any depth. */ +export const SheetViewSchema = z.discriminatedUnion('kind', [ + MainViewSchema, + DetailViewSchema, +]) + +const CircleSchema = z + .object({ + type: z.literal('circle'), + cx: CoordinateSchema, + cy: CoordinateSchema, + r: CoordinateSchema.positive(), + }) + .strict() + +const PolygonSchema = z + .object({ + type: z.literal('polygon'), + points: z.array(z.tuple([CoordinateSchema, CoordinateSchema])).min(3), + }) + .strict() + +const PathSchema = z + .object({ type: z.literal('path'), d: z.string().min(1) }) + .strict() + +export const GeometrySchema = z.discriminatedUnion('type', [ + CircleSchema, + PolygonSchema, + PathSchema, +]) + +/** Explicit on every annotation: absence no longer carries meaning. */ +export const LateralitySchema = z.enum([ + 'unpaired', + 'bilateral', + 'left', + 'right', +]) + +const annotationCommon = { + id: StableIdSchema, + view_id: StableIdSchema, + category_id: StableIdSchema, + laterality: LateralitySchema, + geometry: GeometrySchema.nullable(), + review_status: ReviewStatusSchema.default('inherited'), + /** Marker colour of this annotation; null = the category colour. */ + color: HexColorSchema.nullable().default(null), +} + +/** Observable annotations link to findings through one explicit field. */ +const observableFields = { + ...annotationCommon, + name: LocalizedTextSchema, + finding_zone_id: StableIdSchema.nullable(), + vertebral_region_code: RegionCodeSchema.nullable(), +} + +const PointAnnotationSchema = z + .object({ ...observableFields, kind: z.literal('point') }) + .strict() + +const ZoneAnnotationSchema = z + .object({ ...observableFields, kind: z.literal('zone') }) + .strict() + +/** Navigation only: a trigger never carries findings. */ +const DetailTriggerAnnotationSchema = z + .object({ + ...annotationCommon, + kind: z.literal('detail_trigger'), + name: LocalizedTextSchema.nullable(), + opens_view_id: StableIdSchema, + }) + .strict() + +export const AnnotationSchema = z.discriminatedUnion('kind', [ + PointAnnotationSchema, + ZoneAnnotationSchema, + DetailTriggerAnnotationSchema, +]) + +/** Documents are shared across users: only web links, never javascript: URLs. */ +const HttpUrlSchema = z + .string() + .url() + .refine((url) => /^https?:\/\//i.test(url), 'http(s) URL expected') + +/** + * One bibliographic reference, declared once in the document and cited by + * id from any number of findings (an anatomy atlas backs hundreds of + * entries). `citation` is the human-readable form (author, title, edition, + * year, publisher or journal, location in the work when known). + */ +export const ReferenceSchema = z + .object({ + id: StableIdSchema, + type: z.enum(['book', 'journal', 'standard', 'legal', 'web', 'manual']), + citation: z.string().min(1), + url: HttpUrlSchema.nullable().default(null), + doi: z.string().min(1).nullable().default(null), + }) + .strict() + +export type Reference = z.infer +export type ReviewStatus = z.infer +export type LocalizedText = z.infer +export type LocalizedOptionalText = z.infer + +/** Parsed node: every optional key of the authoring form is filled in. */ +export interface FindingNode { + id: string + name: LocalizedText + description: LocalizedOptionalText + requires_vet_referral: boolean + reference_ids: string[] + review_status: ReviewStatus + children: FindingNode[] +} + +/** Authoring form: leaves stay lean, hundreds of them carry no empty keys. */ +export interface FindingNodeInput { + id: string + name: LocalizedText + description?: LocalizedOptionalText + requires_vet_referral?: boolean + reference_ids?: string[] + review_status?: ReviewStatus + children?: FindingNodeInput[] +} + +export const FindingNodeSchema: z.ZodType< + FindingNode, + z.ZodTypeDef, + FindingNodeInput +> = z.lazy(() => + z + .object({ + id: StableIdSchema, + name: LocalizedTextSchema, + description: LocalizedOptionalTextSchema.default({}), + requires_vet_referral: z.boolean().default(false), + reference_ids: z.array(StableIdSchema).default([]), + review_status: ReviewStatusSchema.default('inherited'), + children: z.array(FindingNodeSchema).default([]), + }) + .strict(), +) + +/** Typed business buckets; creators may add their own as 'custom'. */ +export const FindingCategoryKindSchema = z.enum([ + 'dysfunction', + 'consultation_reason', + 'anamnesis', + 'custom', +]) + +export const FindingCategorySchema = z + .object({ + id: StableIdSchema, + kind: FindingCategoryKindSchema, + name: LocalizedTextSchema, + description: LocalizedOptionalTextSchema.default({}), + reference_ids: z.array(StableIdSchema).default([]), + review_status: ReviewStatusSchema.default('inherited'), + children: z.array(FindingNodeSchema), + }) + .strict() + +export const FindingZoneSchema = z + .object({ + id: StableIdSchema, + name: LocalizedTextSchema, + categories: z.array(FindingCategorySchema), + }) + .strict() + +const AttributionSchema = z + .object({ + authors: z.array(z.string().min(1)), + license: z.string().min(1).nullable(), + notes: z.string().min(1).nullable(), + }) + .strict() + +const VertebralConfigSchema = z + .object({ regions: z.array(VertebralRegionSchema) }) + .strict() + +export const AnatomicalSheetDocumentSchema = z + .object({ + schema_version: z.literal(SHEET_DOCUMENT_SCHEMA_VERSION), + species_id: StableIdSchema, + name: LocalizedTextSchema, + description: LocalizedOptionalTextSchema, + scope_disclaimer: LocalizedOptionalTextSchema, + attribution: AttributionSchema, + vertebral_config: VertebralConfigSchema, + references: z.array(ReferenceSchema), + categories: z.array(AnnotationCategorySchema), + views: z.array(SheetViewSchema), + annotations: z.array(AnnotationSchema), + finding_zones: z.array(FindingZoneSchema), + }) + .strict() + +export type AnatomicalSheetDocument = z.output< + typeof AnatomicalSheetDocumentSchema +> +export type AnatomicalSheetDocumentInput = z.input< + typeof AnatomicalSheetDocumentSchema +> +export type VertebralRegion = z.infer +export type AnnotationCategory = z.infer +export type ViewBox = z.infer +export type SheetView = z.infer +export type Geometry = z.infer +export type Laterality = z.infer +export type Annotation = z.infer +export type FindingCategoryKind = z.infer +export type FindingCategory = z.output +export type FindingZone = z.output diff --git a/packages/core-wasm/tests/n-1/domain/anatomical-sheet/sheet-index.ts b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/sheet-index.ts new file mode 100644 index 00000000..5fa2fdd0 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/sheet-index.ts @@ -0,0 +1,127 @@ +import type { + AnatomicalSheetDocument, + Annotation, + FindingCategory, + FindingNode, + FindingZone, + LocalizedText, + SheetView, + VertebralRegion, +} from './schema' + +/** + * Read-only lookups over a sheet document. Everything the editor and the + * PDF engine derive from the sheet (zone names, finding paths, spine + * regions, trigger targets) comes from the document here, by stable id: + * no label drives logic. The index keeps the source it was built from so a + * caller gets back exactly what it passed (a loaded sheet with its migration + * map, or an archived snapshot). + */ + +/** The minimum a sheet source carries: provenance, document, SVG text by asset id. */ +export interface SheetIndexSource { + ref: { documentSha256: string } + document: AnatomicalSheetDocument + assets: Readonly> +} + +export type ObservableAnnotation = Extract< + Annotation, + { kind: 'point' | 'zone' } +> + +export interface SheetIndex { + sheet: S + mainView: SheetView + view(id: string): SheetView | undefined + annotation(id: string): Annotation | undefined + annotationsOfView(viewId: string): Annotation[] + findingZone(id: string): FindingZone | undefined + /** The category or node at a path, undefined when absent from the sheet. */ + nodeAt( + zoneId: string, + path: readonly string[], + ): FindingCategory | FindingNode | undefined + regions(): VertebralRegion[] + region(code: string): VertebralRegion | undefined + /** The annotation that opens the vertebra picker for a region on a view. */ + spineAnnotation( + regionCode: string, + viewId: string, + ): ObservableAnnotation | undefined + /** Whether an annotation opens the vertebra picker. */ + isSpine(annotationId: string): boolean + name(annotation: Annotation): LocalizedText +} + +/** The label in a locale, the other locale as fallback, '' when none. */ +export function pickLabel( + text: LocalizedText | null | undefined, + locale: 'fr' | 'en', +): string { + if (!text) return '' + return locale === 'en' ? text.en || text.fr : text.fr || text.en +} + +export function isObservable( + a: Annotation | undefined, +): a is ObservableAnnotation { + return a !== undefined && a.kind !== 'detail_trigger' +} + +function nodeAtPath( + zone: FindingZone | undefined, + path: readonly string[], +): FindingCategory | FindingNode | undefined { + if (!zone || path.length === 0) return undefined + let node: FindingCategory | FindingNode | undefined = zone.categories.find( + (c) => c.id === path[0], + ) + for (const segment of path.slice(1)) { + if (!node) return undefined + node = node.children.find((n) => n.id === segment) + } + return node +} + +export function buildSheetIndex( + sheet: S, +): SheetIndex { + const { document } = sheet + const views = new Map(document.views.map((v) => [v.id, v])) + const annotations = new Map(document.annotations.map((a) => [a.id, a])) + const zones = new Map(document.finding_zones.map((z) => [z.id, z])) + const regions = new Map( + document.vertebral_config.regions.map((r) => [r.code, r]), + ) + const mainView = document.views.find((v) => v.kind === 'main') + if (!mainView) throw new Error('sheet has no main view') + + return { + sheet, + mainView, + view: (id) => views.get(id), + annotation: (id) => annotations.get(id), + annotationsOfView: (viewId) => + document.annotations.filter((a) => a.view_id === viewId), + findingZone: (id) => zones.get(id), + nodeAt: (zoneId, path) => nodeAtPath(zones.get(zoneId), path), + regions: () => document.vertebral_config.regions, + region: (code) => regions.get(code), + spineAnnotation: (code, viewId) => + document.annotations.find( + (a): a is ObservableAnnotation => + isObservable(a) && + a.view_id === viewId && + a.vertebral_region_code === code, + ), + isSpine: (id) => { + const a = annotations.get(id) + return isObservable(a) && a.vertebral_region_code !== null + }, + name: (a) => + a.kind === 'detail_trigger' + ? (a.name ?? views.get(a.opens_view_id)?.name ?? { fr: '', en: '' }) + : a.name, + } +} diff --git a/packages/core-wasm/tests/n-1/domain/anatomical-sheet/validate.ts b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/validate.ts new file mode 100644 index 00000000..97aa6ead --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/anatomical-sheet/validate.ts @@ -0,0 +1,494 @@ +import type { + AnatomicalSheetDocument, + Annotation, + FindingNode, + SheetView, + VertebralRegion, +} from './schema' + +/** + * Integrity tier of the sheet model (ANATOMICAL_SHEET_MODEL.md §2.1). + * + * The shape tier (Zod) accepts dangling references so drafts can be saved + * mid-edit; this tier lists every inconsistency for the editor and gates + * publication. Each rule is one function; codes are part of the contract + * shared with the SQL re-check (private.sheet_document_issues). + */ + +export type SheetIssueSeverity = 'error' | 'warning' + +export interface SheetIssue { + code: string + severity: SheetIssueSeverity + path: string + message: string +} + +type Rule = (doc: AnatomicalSheetDocument) => SheetIssue[] + +type ObservableAnnotation = Exclude +type TriggerAnnotation = Extract +type DetailView = Extract + +/** A sibling level of the finding tree: categories or node children. */ +interface FindingLevelItem { + id: string + reference_ids: readonly string[] + children: readonly FindingNode[] +} + +function error(code: string, path: string, message: string): SheetIssue { + return { code, severity: 'error', path, message } +} + +function warning(code: string, path: string, message: string): SheetIssue { + return { code, severity: 'warning', path, message } +} + +/** Indexes of entries whose value already appeared earlier in the list. */ +function repeatedIndexes(values: readonly string[]): number[] { + const seen = new Set() + const repeated: number[] = [] + values.forEach((value, index) => { + if (seen.has(value)) repeated.push(index) + seen.add(value) + }) + return repeated +} + +function duplicateIssues( + values: readonly string[], + code: string, + pathOf: (index: number) => string, +): SheetIssue[] { + return repeatedIndexes(values).map((index) => + error(code, pathOf(index), `Duplicate id "${values[index]}"`), + ) +} + +function isObservable( + annotation: Annotation, +): annotation is ObservableAnnotation { + return annotation.kind !== 'detail_trigger' +} + +function isTrigger(annotation: Annotation): annotation is TriggerAnnotation { + return annotation.kind === 'detail_trigger' +} + +function viewsById(doc: AnatomicalSheetDocument): Map { + const byId = new Map() + for (const view of doc.views) if (!byId.has(view.id)) byId.set(view.id, view) + return byId +} + +/** Rendering starts from a single root drawing. */ +const checkMainViewCount: Rule = (doc) => { + const count = doc.views.filter((view) => view.kind === 'main').length + if (count === 1) return [] + return [ + error('view.main.count', 'views', `Expected 1 main view, found ${count}`), + ] +} + +const checkViewIdsUnique: Rule = (doc) => + duplicateIssues( + doc.views.map((view) => view.id), + 'view.id.duplicate', + (index) => `views[${index}].id`, + ) + +const checkViewParentsExist: Rule = (doc) => { + const byId = viewsById(doc) + return doc.views.flatMap((view, index) => + view.kind === 'detail' && !byId.has(view.parent_view_id) + ? [ + error( + 'view.parent.missing', + `views[${index}].parent_view_id`, + `Parent view "${view.parent_view_id}" does not exist`, + ), + ] + : [], + ) +} + +/** + * True when the parent chain loops before reaching the main view. A + * missing parent ends the walk: that case is view.parent.missing. + */ +function loopsBeforeMain(view: DetailView, byId: Map) { + const visited = new Set([view.id]) + let current: SheetView = view + while (current.kind === 'detail') { + const parent = byId.get(current.parent_view_id) + if (!parent) return false + if (visited.has(parent.id)) return true + visited.add(parent.id) + current = parent + } + return false +} + +const checkViewParentCycles: Rule = (doc) => { + const byId = viewsById(doc) + return doc.views.flatMap((view, index) => + view.kind === 'detail' && loopsBeforeMain(view, byId) + ? [ + error( + 'view.parent.cycle', + `views[${index}].parent_view_id`, + `Parent chain of "${view.id}" never reaches the main view`, + ), + ] + : [], + ) +} + +function isOpenedFromParent( + view: DetailView, + doc: AnatomicalSheetDocument, +): boolean { + return doc.annotations.some( + (annotation) => + isTrigger(annotation) && + annotation.opens_view_id === view.id && + annotation.view_id === view.parent_view_id, + ) +} + +/** A detail view nobody can open is dead content for the practitioner. */ +const checkViewsReachable: Rule = (doc) => { + const byId = viewsById(doc) + return doc.views.flatMap((view, index) => + view.kind === 'detail' && + byId.has(view.parent_view_id) && + !isOpenedFromParent(view, doc) + ? [ + error( + 'view.unreachable', + `views[${index}]`, + `No detail_trigger in "${view.parent_view_id}" opens "${view.id}"`, + ), + ] + : [], + ) +} + +/** Every view must have something to draw: its own asset or a crop. */ +function viewAssetIssue(view: SheetView, index: number): SheetIssue[] { + if (view.svg_asset_id !== null) return [] + if (view.kind === 'main') { + return [ + error( + 'view.asset.missing', + `views[${index}].svg_asset_id`, + `Main view "${view.id}" has no SVG asset`, + ), + ] + } + if (view.view_box !== null) return [] + return [ + error( + 'view.asset.missing', + `views[${index}].view_box`, + `Detail view "${view.id}" has neither an asset nor a view_box`, + ), + ] +} + +const checkViewAssets: Rule = (doc) => doc.views.flatMap(viewAssetIssue) + +/** Report points are keyed by annotation id across every view. */ +const checkAnnotationIdsUnique: Rule = (doc) => + duplicateIssues( + doc.annotations.map((annotation) => annotation.id), + 'annotation.id.duplicate', + (index) => `annotations[${index}].id`, + ) + +const checkAnnotationViews: Rule = (doc) => { + const byId = viewsById(doc) + return doc.annotations.flatMap((annotation, index) => + byId.has(annotation.view_id) + ? [] + : [ + error( + 'annotation.view.missing', + `annotations[${index}].view_id`, + `View "${annotation.view_id}" does not exist`, + ), + ], + ) +} + +const checkAnnotationCategories: Rule = (doc) => { + const ids = new Set(doc.categories.map((category) => category.id)) + return doc.annotations.flatMap((annotation, index) => + ids.has(annotation.category_id) + ? [] + : [ + error( + 'annotation.category.missing', + `annotations[${index}].category_id`, + `Category "${annotation.category_id}" does not exist`, + ), + ], + ) +} + +/** A trigger opens a direct child of the view it is drawn in. */ +function opensChildOfOwnView( + trigger: TriggerAnnotation, + byId: Map, +): boolean { + const target = byId.get(trigger.opens_view_id) + return target?.kind === 'detail' && target.parent_view_id === trigger.view_id +} + +const checkTriggerTargets: Rule = (doc) => { + const byId = viewsById(doc) + return doc.annotations.flatMap((annotation, index) => + isTrigger(annotation) && !opensChildOfOwnView(annotation, byId) + ? [ + error( + 'annotation.opens_view.invalid', + `annotations[${index}].opens_view_id`, + `"${annotation.opens_view_id}" is not a detail child of ` + + `"${annotation.view_id}"`, + ), + ] + : [], + ) +} + +const checkAnnotationFindingZones: Rule = (doc) => { + const ids = new Set(doc.finding_zones.map((zone) => zone.id)) + return doc.annotations.flatMap((annotation, index) => + isObservable(annotation) && + annotation.finding_zone_id !== null && + !ids.has(annotation.finding_zone_id) + ? [ + error( + 'annotation.finding_zone.missing', + `annotations[${index}].finding_zone_id`, + `Finding zone "${annotation.finding_zone_id}" does not exist`, + ), + ] + : [], + ) +} + +const checkAnnotationRegions: Rule = (doc) => { + const codes = new Set(doc.vertebral_config.regions.map((r) => r.code)) + return doc.annotations.flatMap((annotation, index) => + isObservable(annotation) && + annotation.vertebral_region_code !== null && + !codes.has(annotation.vertebral_region_code) + ? [ + error( + 'annotation.region.missing', + `annotations[${index}].vertebral_region_code`, + `Vertebral region "${annotation.vertebral_region_code}" ` + + 'is not configured', + ), + ] + : [], + ) +} + +/** Allowed in a draft, but a click on it would offer nothing to record. */ +const checkAnnotationsHaveFindings: Rule = (doc) => + doc.annotations.flatMap((annotation, index) => + isObservable(annotation) && annotation.finding_zone_id === null + ? [ + warning( + 'annotation.no_findings', + `annotations[${index}].finding_zone_id`, + `Annotation "${annotation.id}" is linked to no finding zone`, + ), + ] + : [], + ) + +const checkRegionCodesUnique: Rule = (doc) => + duplicateIssues( + doc.vertebral_config.regions.map((region) => region.code), + 'region.code.duplicate', + (index) => `vertebral_config.regions[${index}].code`, + ) + +const checkCategoryIdsUnique: Rule = (doc) => + duplicateIssues( + doc.categories.map((category) => category.id), + 'category.id.duplicate', + (index) => `categories[${index}].id`, + ) + +const checkFindingZoneIdsUnique: Rule = (doc) => + duplicateIssues( + doc.finding_zones.map((zone) => zone.id), + 'finding_zone.id.duplicate', + (index) => `finding_zones[${index}].id`, + ) + +/** + * Findings are addressed by (zone, path[]) as Finding.path does today, so + * ids only need to be unique among siblings, at every depth. + */ +function siblingIssues( + nodes: readonly FindingLevelItem[], + path: string, +): SheetIssue[] { + const own = duplicateIssues( + nodes.map((node) => node.id), + 'finding.id.duplicate', + (index) => `${path}[${index}].id`, + ) + const nested = nodes.flatMap((node, index) => + siblingIssues(node.children, `${path}[${index}].children`), + ) + return [...own, ...nested] +} + +const checkFindingSiblings: Rule = (doc) => + doc.finding_zones.flatMap((zone, index) => + siblingIssues(zone.categories, `finding_zones[${index}].categories`), + ) + +/** Allowed in a draft, but nothing on the drawing can reach this zone. */ +const checkFindingZonesReferenced: Rule = (doc) => { + const referenced = new Set( + doc.annotations.filter(isObservable).map((a) => a.finding_zone_id), + ) + return doc.finding_zones.flatMap((zone, index) => + referenced.has(zone.id) + ? [] + : [ + warning( + 'finding_zone.unreferenced', + `finding_zones[${index}]`, + `No annotation points to finding zone "${zone.id}"`, + ), + ], + ) +} + +const checkReferenceIdsUnique: Rule = (doc) => + duplicateIssues( + doc.references.map((reference) => reference.id), + 'reference.id.duplicate', + (index) => `references[${index}].id`, + ) + +/** A citation must point at a declared reference, at every depth. */ +function citationIssues( + nodes: readonly FindingLevelItem[], + path: string, + known: ReadonlySet, +): SheetIssue[] { + return nodes.flatMap((node, index) => { + const own = node.reference_ids.flatMap((id, refIndex) => + known.has(id) + ? [] + : [ + error( + 'finding.reference.missing', + `${path}[${index}].reference_ids[${refIndex}]`, + `Reference "${id}" is not declared in references`, + ), + ], + ) + const nested = citationIssues( + node.children, + `${path}[${index}].children`, + known, + ) + return [...own, ...nested] + }) +} + +const checkFindingReferences: Rule = (doc) => { + const known = new Set(doc.references.map((reference) => reference.id)) + return doc.finding_zones.flatMap((zone, index) => + citationIssues( + zone.categories, + `finding_zones[${index}].categories`, + known, + ), + ) +} + +/** The usual count must sit inside the documented variation. */ +function countRangeIssue(region: VertebralRegion, index: number): SheetIssue[] { + const range = region.count_range + if (range === null) return [] + if (range.min <= region.count && region.count <= range.max) return [] + return [ + error( + 'region.count_range.invalid', + `vertebral_config.regions[${index}].count_range`, + `Region "${region.code}": count ${region.count} outside ` + + `${range.min}–${range.max}`, + ), + ] +} + +const checkRegionCountRanges: Rule = (doc) => + doc.vertebral_config.regions.flatMap(countRangeIssue) + +const RULES: readonly Rule[] = [ + checkMainViewCount, + checkViewIdsUnique, + checkViewParentsExist, + checkViewParentCycles, + checkViewsReachable, + checkViewAssets, + checkAnnotationIdsUnique, + checkAnnotationViews, + checkAnnotationCategories, + checkTriggerTargets, + checkAnnotationFindingZones, + checkAnnotationRegions, + checkAnnotationsHaveFindings, + checkRegionCodesUnique, + checkCategoryIdsUnique, + checkFindingZoneIdsUnique, + checkFindingSiblings, + checkFindingZonesReferenced, + checkReferenceIdsUnique, + checkFindingReferences, + checkRegionCountRanges, +] + +/** Lists every integrity issue of a shape-valid document. */ +export function validateSheetDocument( + doc: AnatomicalSheetDocument, +): SheetIssue[] { + return RULES.flatMap((rule) => rule(doc)) +} + +/** Warnings never block publication; errors always do. */ +export function isPublishable(issues: readonly SheetIssue[]): boolean { + return !issues.some((issue) => issue.severity === 'error') +} + +export class SheetValidationError extends Error { + readonly issues: SheetIssue[] + + constructor(issues: SheetIssue[]) { + const errors = issues.filter((issue) => issue.severity === 'error') + super( + `Sheet document is not publishable: ${errors.length} error(s), ` + + `first: ${errors[0]?.code ?? 'none'}`, + ) + this.name = 'SheetValidationError' + this.issues = issues + } +} + +/** TypeScript-side publication gate, mirrored by SQL at publish time. */ +export function assertPublishable(doc: AnatomicalSheetDocument): void { + const issues = validateSheetDocument(doc) + if (!isPublishable(issues)) throw new SheetValidationError(issues) +} diff --git a/packages/core-wasm/tests/n-1/domain/archive/branding.ts b/packages/core-wasm/tests/n-1/domain/archive/branding.ts new file mode 100644 index 00000000..52b03f00 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/archive/branding.ts @@ -0,0 +1,59 @@ +import { z } from 'zod' + +/** + * The visual identity a PDF archive embeds so a re-export needs no network + * and no `public/` folder (STEP6 §3.4): logos as PNG base64 or SVG text, + * credits with the URL and the text printed when the logo fails. Caps are + * STEP6 §15 (branding row). + */ + +const KIB = 1024 +const BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/ + +/** + * `http(s)://` then printable ASCII without `"`, `'`, `(`, `)`, `<`, `>` + * or `\`: the URL is written into PDF link actions and must never be able + * to close a string literal or carry a control character. Expressed as the + * allowed ranges of printable ASCII (0x21-0x7e) minus those seven. + */ +const HTTP_URL_PATTERN = /^https?:\/\/[!#-&*-;=?-[\]-~]+$/ + +const HttpUrlSchema = z + .string() + .max(2048) + .url() + .regex(HTTP_URL_PATTERN, 'http(s) URL expected') + +export const ImageAssetSchema = z.discriminatedUnion('kind', [ + z + .object({ + kind: z.literal('png'), + base64: z + .string() + .max(512 * KIB) + .regex(BASE64_PATTERN), + }) + .strict(), + z.object({ kind: z.literal('svg'), svg: z.string().max(256 * KIB) }).strict(), +]) +export type ImageAsset = z.infer + +export const CreditSchema = z + .object({ + logo: ImageAssetSchema.nullable(), + url: HttpUrlSchema, + fallbackText: z.string().max(128), + }) + .strict() +export type Credit = z.infer + +export const BrandingSchema = z + .object({ + siteUrl: HttpUrlSchema, + headerLogo: ImageAssetSchema.nullable(), + footerLogo: ImageAssetSchema.nullable(), + poweredBy: CreditSchema.nullable(), + partner: CreditSchema.nullable(), + }) + .strict() +export type Branding = z.infer diff --git a/packages/core-wasm/tests/n-1/domain/archive/envelope.ts b/packages/core-wasm/tests/n-1/domain/archive/envelope.ts new file mode 100644 index 00000000..d2265ddd --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/archive/envelope.ts @@ -0,0 +1,172 @@ +import { z } from 'zod' +import { readReportDocument } from '../report/migrate' +import type { ReportMigrationMap } from '../report/migration-map' +import { REPORT_VERSION, ReportSchema, type Report } from '../report/v3' +import { BrandingSchema, type Branding } from './branding' +import { PdfLabelSetSchema, type PdfLabelSet } from './labels' +import { + SheetSnapshotSchema, + SnapshotError, + assertSnapshot, + type SheetSnapshot, + type SnapshotRejection, +} from './snapshot' + +/** + * Attachment of a Step 6 PDF: the report (v3, unchanged) wrapped with the + * sheet snapshot, the branding and the PDF labels it was printed with + * (STEP6 §2.3). Reading is layered (§4, §14 "Read"): the report is located + * and parsed first so it is never lost because of its wrapper; the wrapper + * is then validated or dropped with a reason. + */ + +export const ENVELOPE_FORMAT = 'faunosteo-report-archive' +export const ENVELOPE_VERSION = 1 + +export interface ReportArchiveEnvelope { + format: typeof ENVELOPE_FORMAT + envelopeVersion: typeof ENVELOPE_VERSION + /** ISO timestamp of the export. */ + exportedAt: string + locale: 'fr' | 'en' + /** As exported, never rebased. */ + report: Report + sheetSnapshot: SheetSnapshot + branding: Branding + labels: PdfLabelSet +} + +/** Metadata is not strict: an additive v1 field never breaks an older reader. */ +const EnvelopeMetadataSchema = z.object({ + format: z.literal(ENVELOPE_FORMAT), + envelopeVersion: z.literal(ENVELOPE_VERSION), + exportedAt: z.string(), + locale: z.enum(['fr', 'en']), +}) + +/** Everything but the report and the snapshot, which the reader checks itself. */ +const EnvelopeWrapperSchema = EnvelopeMetadataSchema.extend({ + branding: BrandingSchema, + labels: PdfLabelSetSchema, +}) + +export const ReportArchiveEnvelopeSchema: z.ZodType< + ReportArchiveEnvelope, + z.ZodTypeDef, + unknown +> = EnvelopeWrapperSchema.extend({ + report: ReportSchema, + sheetSnapshot: SheetSnapshotSchema, +}) + +export type ArchiveOrigin = 'envelope_v1' | 'bare_v3' | 'v2' + +export interface ArchiveReadOutcome { + report: Report + origin: ArchiveOrigin + migrated: boolean + /** From the v2 migration; 0 for a v3 report. */ + unresolvedZones: number + unresolvedFindings: number + /** The validated envelope, when accepted. */ + archive: ReportArchiveEnvelope | null + /** Envelope present but its snapshot dropped. */ + snapshotRejected?: SnapshotRejection +} + +type Wrapped = + | { archive: ReportArchiveEnvelope } + | { snapshotRejected: SnapshotRejection } + +function isRecord(value: unknown): value is Record { + return typeof value === 'object' && value !== null && !Array.isArray(value) +} + +/** An envelope of any version is recognised by a numeric envelopeVersion. */ +function envelopeVersionOf(data: unknown): number | null { + if (!isRecord(data)) return null + const version = data.envelopeVersion + return typeof version === 'number' ? version : null +} + +function reportVersionOf(data: unknown): number | null { + if (!isRecord(data)) return null + return typeof data.version === 'number' ? data.version : null +} + +function snapshotMatches(snapshot: SheetSnapshot, report: Report): boolean { + return ( + snapshot.ref.sheetId === report.sheet.sheetId && + snapshot.ref.documentSha256 === report.sheet.documentSha256 + ) +} + +/** Step 3 for a v1 envelope: wrapper schema → snapshot gate → sheet invariant. */ +function readEnvelopeV1( + data: Record, + report: Report, +): Wrapped { + const wrapper = EnvelopeWrapperSchema.safeParse(data) + if (!wrapper.success) return { snapshotRejected: 'schema' } + let snapshot: SheetSnapshot + try { + snapshot = assertSnapshot(data.sheetSnapshot) + } catch (error) { + if (error instanceof SnapshotError) { + return { snapshotRejected: error.reason } + } + throw error + } + if (!snapshotMatches(snapshot, report)) { + return { snapshotRejected: 'sheet_mismatch' } + } + return { + archive: { + format: wrapper.data.format, + envelopeVersion: wrapper.data.envelopeVersion, + exportedAt: wrapper.data.exportedAt, + locale: wrapper.data.locale, + report, + sheetSnapshot: snapshot, + branding: wrapper.data.branding, + labels: wrapper.data.labels, + }, + } +} + +/** + * Reads the JSON of a PDF attachment of any supported shape: bare Report v2 + * or v3, or an archive envelope. The report is parsed first and always + * returned (`readReportDocument` throws UnsupportedReportVersionError for an + * unknown report version); the envelope is accepted whole or dropped with + * `snapshotRejected`. + */ +export function readArchiveDocument( + data: unknown, + map: ReportMigrationMap, +): ArchiveReadOutcome { + const envelopeVersion = envelopeVersionOf(data) + const reportData = + envelopeVersion !== null ? (data as Record).report : data + const outcome = readReportDocument(reportData, map) + const migrated = reportVersionOf(reportData) !== REPORT_VERSION + const base: ArchiveReadOutcome = { + report: outcome.report, + origin: migrated ? 'v2' : 'bare_v3', + migrated, + unresolvedZones: outcome.unresolvedZones, + unresolvedFindings: outcome.unresolvedFindings, + archive: null, + } + if (envelopeVersion === null) return base + if (envelopeVersion !== ENVELOPE_VERSION) { + return { ...base, snapshotRejected: 'unsupported_envelope' } + } + const wrapped = readEnvelopeV1( + data as Record, + outcome.report, + ) + return 'archive' in wrapped + ? { ...base, origin: 'envelope_v1', archive: wrapped.archive } + : { ...base, origin: 'envelope_v1', ...wrapped } +} diff --git a/packages/core-wasm/tests/n-1/domain/archive/index.ts b/packages/core-wasm/tests/n-1/domain/archive/index.ts new file mode 100644 index 00000000..6b2bd63b --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/archive/index.ts @@ -0,0 +1,4 @@ +export * from './snapshot' +export * from './branding' +export * from './labels' +export * from './envelope' diff --git a/packages/core-wasm/tests/n-1/domain/archive/labels.ts b/packages/core-wasm/tests/n-1/domain/archive/labels.ts new file mode 100644 index 00000000..217b856f --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/archive/labels.ts @@ -0,0 +1,57 @@ +import { z } from 'zod' + +/** + * The static strings the PDF engine prints (section headings, metadata, + * severities, sides, footer credits), in both locales, frozen into the + * archive so a re-export renders the wording of the day. Exactly the dict + * keys apps/app/src/pdf read when Step 6 started. + */ + +export const PDF_LABEL_KEYS = [ + 'pdf.empty', + 'pdf.eyebrow.observation', + 'pdf.eyebrow.synthesis', + 'pdf.owner_prefix', + 'pdf.section.comment', + 'pdf.section.conclusion', + 'pdf.section.findings_prefix', + 'pdf.section.free_findings', + 'pdf.section.next_appointment', + 'pdf.section.recommendations', + 'pdf.section.severity', + 'pdf.section.zones', + 'pdf.siret_prefix', + 'pdf.subject', + 'pdf.title.conclusion', + 'pdf.title.suffix.bilan', + 'pdf.view.detail_prefix', + 'pdf.view.general', + 'severity.mild', + 'severity.moderate', + 'severity.severe', + 'lateral.left', + 'lateral.right', + 'footer.powered_by', + 'footer.in_partnership', +] as const + +export type PdfLabelKey = (typeof PDF_LABEL_KEYS)[number] +export type PdfLabels = Record + +export interface PdfLabelSet { + fr: PdfLabels + en: PdfLabels +} + +const labelShape = Object.fromEntries( + PDF_LABEL_KEYS.map((key) => [key, z.string().max(256)]), +) as Record + +export const PdfLabelsSchema: z.ZodType = z + .object(labelShape) + .strict() + +/** Strict: every key present in both locales, no extra key. */ +export const PdfLabelSetSchema: z.ZodType = z + .object({ fr: PdfLabelsSchema, en: PdfLabelsSchema }) + .strict() diff --git a/packages/core-wasm/tests/n-1/domain/archive/snapshot.ts b/packages/core-wasm/tests/n-1/domain/archive/snapshot.ts new file mode 100644 index 00000000..11402a26 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/archive/snapshot.ts @@ -0,0 +1,425 @@ +import { z } from 'zod' +import { + AnatomicalSheetDocumentSchema, + type AnatomicalSheetDocument, + type FindingCategory, + type FindingNode, + type FindingZone, + type SheetView, +} from '../anatomical-sheet/schema' +import { validateSheetDocument } from '../anatomical-sheet/validate' +import type { SheetIndexSource } from '../anatomical-sheet/sheet-index' +import { SheetRefSchema, type Report, type SheetRef } from '../report/v3' + +/** + * The sheet a report archive carries so an old bilan re-renders without the + * current catalog (STEP6 §2.2). The snapshot keeps the shape the renderer and + * the sheet index consume: a valid, lean `AnatomicalSheetDocument` (every + * view, annotation, category and region; finding trees pruned to the paths + * the report uses; bibliography emptied) plus the SVG text of every asset a + * view reaches. `assertSnapshot` is the single gate an imported snapshot + * passes (STEP6 §15 caps, integrity, reachable assets). + */ + +const SHA256_PATTERN = /^[0-9a-f]{64}$/ +const MIB = 1024 * 1024 + +/** Hard limits on an imported snapshot; every excess is a `caps` rejection. */ +export const SNAPSHOT_CAPS = { + views: 64, + annotations: 1024, + findingNodes: 8192, + findingDepth: 8, + labelChars: 512, + assets: 4, + assetBytes: 2 * MIB, + assetsTotalBytes: 6 * MIB, +} as const + +export type SheetSnapshotRef = SheetRef & { + schemaVersion: number + speciesId: string +} + +export interface SheetSnapshotAsset { + svgAssetId: string + /** Content address from the seed manifest; a provenance pointer, not a tamper check. */ + sha256: string | null + svg: string +} + +export interface SheetSnapshot { + status: 'draft' | 'published' + ref: SheetSnapshotRef + /** Lean, valid document (schema v2, strict). */ + document: AnatomicalSheetDocument + assets: SheetSnapshotAsset[] +} + +export const SheetSnapshotRefSchema: z.ZodType = + SheetRefSchema.extend({ + schemaVersion: z.number().int().positive(), + speciesId: z.string().min(1), + }).strict() + +const SheetSnapshotAssetSchema = z + .object({ + svgAssetId: z.string().uuid(), + sha256: z.string().regex(SHA256_PATTERN).nullable(), + svg: z.string().max(SNAPSHOT_CAPS.assetBytes), + }) + .strict() + +/** Shape tier only: caps beyond the schema and integrity live in assertSnapshot. */ +export const SheetSnapshotSchema: z.ZodType< + SheetSnapshot, + z.ZodTypeDef, + unknown +> = z + .object({ + status: z.enum(['draft', 'published']), + ref: SheetSnapshotRefSchema, + document: AnatomicalSheetDocumentSchema, + assets: z.array(SheetSnapshotAssetSchema).max(SNAPSHOT_CAPS.assets), + }) + .strict() + +/** What a loaded sheet provides to build a snapshot from. */ +export interface SnapshotSource { + status: 'draft' | 'published' + ref: SheetRef + speciesId: string + schemaVersion: number + document: AnatomicalSheetDocument + /** SVG text by `svg_asset_id`. */ + assets: Readonly> + /** sha256 by `svg_asset_id` (seed manifest); absent → null in the snapshot. */ + assetHashes?: Readonly> +} + +export type SnapshotRejection = + | 'unsupported_envelope' + | 'schema' + | 'caps' + | 'integrity' + | 'sheet_mismatch' + +/** Thrown by assertSnapshot; `reason` is what the import reports. */ +export class SnapshotError extends Error { + constructor( + public readonly reason: SnapshotRejection, + detail: string, + ) { + super(`snapshot rejected (${reason}): ${detail}`) + this.name = 'SnapshotError' + } +} + +/** Own-key lookup: ids come from documents (`__proto__` is not an entry). */ +function own( + record: Readonly>, + key: string, +): T | undefined { + return Object.hasOwn(record, key) ? record[key] : undefined +} + +/** The asset a view draws: its own, else the first one up its parent chain. */ +function assetOfView( + view: SheetView, + views: ReadonlyMap, +): string | null { + const visited = new Set() + let current: SheetView | undefined = view + while (current && !visited.has(current.id)) { + if (current.svg_asset_id !== null) return current.svg_asset_id + visited.add(current.id) + current = + current.kind === 'detail' ? views.get(current.parent_view_id) : undefined + } + return null +} + +/** Asset ids reachable from the views, in view order, each once. */ +function reachableAssetIds(document: AnatomicalSheetDocument): string[] { + const views = new Map(document.views.map((v) => [v.id, v])) + const ids: string[] = [] + for (const view of document.views) { + const id = assetOfView(view, views) + if (id !== null && !ids.includes(id)) ids.push(id) + } + return ids +} + +// --------------------------------------------------------------------------- +// Build + +/** Finding paths of the report grouped by zone, resolved and unresolved alike. */ +function pathsByZone(report: Report): Map { + const byZone = new Map() + for (const observation of report.observations) { + for (const finding of observation.findings) { + const paths = byZone.get(finding.findingZoneId) ?? [] + paths.push(finding.path) + byZone.set(finding.findingZoneId, paths) + } + } + return byZone +} + +/** Keeps, in document order, the nodes at `depth` of some path and their used descendants. */ +function pruneNodes( + nodes: readonly FindingNode[], + paths: readonly string[][], + depth: number, +): FindingNode[] { + return nodes + .filter((node) => paths.some((path) => path[depth] === node.id)) + .map((node) => ({ + id: node.id, + name: { ...node.name }, + description: {}, + requires_vet_referral: node.requires_vet_referral, + reference_ids: [], + review_status: node.review_status, + children: pruneNodes( + node.children, + paths.filter((path) => path[depth] === node.id), + depth + 1, + ), + })) +} + +function pruneCategories( + categories: readonly FindingCategory[], + paths: readonly string[][], +): FindingCategory[] { + return categories + .filter((category) => paths.some((path) => path[0] === category.id)) + .map((category) => ({ + id: category.id, + kind: category.kind, + name: { ...category.name }, + description: {}, + reference_ids: [], + review_status: category.review_status, + children: pruneNodes( + category.children, + paths.filter((path) => path[0] === category.id), + 1, + ), + })) +} + +function pruneZone(zone: FindingZone, paths: readonly string[][]): FindingZone { + return { + id: zone.id, + name: { ...zone.name }, + categories: pruneCategories(zone.categories, paths), + } +} + +function leanDocument( + document: AnatomicalSheetDocument, + report: Report, +): AnatomicalSheetDocument { + const used = pathsByZone(report) + return { + schema_version: document.schema_version, + species_id: document.species_id, + name: structuredClone(document.name), + description: structuredClone(document.description), + scope_disclaimer: structuredClone(document.scope_disclaimer), + attribution: structuredClone(document.attribution), + vertebral_config: structuredClone(document.vertebral_config), + references: [], + categories: structuredClone(document.categories), + views: structuredClone(document.views), + annotations: structuredClone(document.annotations), + finding_zones: document.finding_zones.map((zone) => + pruneZone(zone, used.get(zone.id) ?? []), + ), + } +} + +function snapshotAssets(sheet: SnapshotSource): SheetSnapshotAsset[] { + const assets: SheetSnapshotAsset[] = [] + for (const svgAssetId of reachableAssetIds(sheet.document)) { + const svg = own(sheet.assets, svgAssetId) + if (svg === undefined) continue + const sha256 = sheet.assetHashes + ? (own(sheet.assetHashes, svgAssetId) ?? null) + : null + assets.push({ svgAssetId, sha256, svg }) + } + return assets +} + +/** + * The snapshot of `sheet` a given report needs: pure, deterministic + * (document order everywhere), inputs untouched. Finding trees keep only the + * categories and nodes on a path some finding of the report names, as far as + * those nodes exist; a missing asset is left out and caught by assertSnapshot. + */ +export function buildSheetSnapshot( + sheet: SnapshotSource, + report: Report, +): SheetSnapshot { + return { + status: sheet.status, + ref: { + sheetId: sheet.ref.sheetId, + versionId: sheet.ref.versionId, + documentSha256: sheet.ref.documentSha256, + schemaVersion: sheet.schemaVersion, + speciesId: sheet.speciesId, + }, + document: leanDocument(sheet.document, report), + assets: snapshotAssets(sheet), + } +} + +// --------------------------------------------------------------------------- +// Assert + +function isRecord(value: unknown): value is Record { + return typeof value === 'object' && value !== null && !Array.isArray(value) +} + +function childrenOf(node: unknown): unknown[] { + if (!isRecord(node)) return [] + const children = node.children + return Array.isArray(children) ? children : [] +} + +/** + * Depth of the finding trees, checked on the raw input before Zod recurses + * into it (an attacker-sized tree must not drive the parser). Iterative: + * an explicit stack of (node, depth) pairs, categories at depth 1. + */ +function assertFindingDepth(input: unknown): void { + if (!isRecord(input) || !isRecord(input.document)) return + const zones = input.document.finding_zones + if (!Array.isArray(zones)) return + const stack: Array<[unknown, number]> = [] + for (const zone of zones) { + if (!isRecord(zone) || !Array.isArray(zone.categories)) continue + for (const category of zone.categories) stack.push([category, 1]) + } + while (stack.length > 0) { + const [node, depth] = stack.pop()! + if (depth > SNAPSHOT_CAPS.findingDepth) { + throw new SnapshotError( + 'caps', + `finding depth over ${SNAPSHOT_CAPS.findingDepth}`, + ) + } + for (const child of childrenOf(node)) stack.push([child, depth + 1]) + } +} + +function countFindingNodes(document: AnatomicalSheetDocument): number { + let count = 0 + const stack: Array = + document.finding_zones.flatMap((zone) => zone.categories) + while (stack.length > 0) { + count += 1 + stack.push(...stack.pop()!.children) + } + return count +} + +/** + * Longest `name` label (`fr` or `en`) anywhere in the document: sheet, views, + * annotations, categories, regions, finding zones and nodes. Free texts + * (`description`, `scope_disclaimer`) are not labels and carry no cap here. + */ +function longestName(document: AnatomicalSheetDocument): number { + let longest = 0 + const stack: unknown[] = [document] + while (stack.length > 0) { + const value = stack.pop() + if (Array.isArray(value)) stack.push(...value) + if (!isRecord(value)) continue + const name = value.name + if (isRecord(name)) { + for (const key of ['fr', 'en']) { + const text = name[key] + if (typeof text === 'string') longest = Math.max(longest, text.length) + } + } + stack.push(...Object.values(value)) + } + return longest +} + +function utf8Length(text: string): number { + return new TextEncoder().encode(text).byteLength +} + +function assertCaps(snapshot: SheetSnapshot): void { + const over = (what: string) => new SnapshotError('caps', `${what} over cap`) + const { document, assets } = snapshot + if (document.views.length > SNAPSHOT_CAPS.views) throw over('views') + if (document.annotations.length > SNAPSHOT_CAPS.annotations) { + throw over('annotations') + } + if (countFindingNodes(document) > SNAPSHOT_CAPS.findingNodes) { + throw over('finding nodes') + } + if (longestName(document) > SNAPSHOT_CAPS.labelChars) throw over('label') + if (assets.length > SNAPSHOT_CAPS.assets) throw over('assets') + const sizes = assets.map((asset) => utf8Length(asset.svg)) + if (sizes.some((size) => size > SNAPSHOT_CAPS.assetBytes)) throw over('asset') + const total = sizes.reduce((sum, size) => sum + size, 0) + if (total > SNAPSHOT_CAPS.assetsTotalBytes) throw over('assets total') +} + +function assertIntegrity(snapshot: SheetSnapshot): void { + const errors = validateSheetDocument(snapshot.document).filter( + (issue) => issue.severity === 'error', + ) + if (errors.length > 0) { + throw new SnapshotError('integrity', errors[0]!.code) + } + const present = new Set(snapshot.assets.map((asset) => asset.svgAssetId)) + const views = new Map(snapshot.document.views.map((v) => [v.id, v])) + for (const view of snapshot.document.views) { + const assetId = assetOfView(view, views) + if (assetId === null || !present.has(assetId)) { + throw new SnapshotError('integrity', `view "${view.id}" reaches no asset`) + } + } +} + +/** + * The single gate of an imported snapshot, in this order: finding depth on + * the raw input → shape (`schema`) → caps (§15) → sheet integrity rules and + * every view reaching an asset carried by the snapshot (`integrity`). + * Returns the parsed snapshot; throws SnapshotError with the reason. + */ +export function assertSnapshot(snapshot: unknown): SheetSnapshot { + assertFindingDepth(snapshot) + const parsed = SheetSnapshotSchema.safeParse(snapshot) + if (!parsed.success) { + throw new SnapshotError( + 'schema', + parsed.error.issues[0]?.message ?? 'invalid', + ) + } + assertCaps(parsed.data) + assertIntegrity(parsed.data) + return parsed.data +} + +/** Adapter: a snapshot as the sheet index reads it (assets array → record). */ +export function snapshotIndexSource( + snapshot: SheetSnapshot, +): SheetIndexSource & { ref: SheetSnapshotRef } { + return { + ref: snapshot.ref, + document: snapshot.document, + assets: Object.fromEntries( + snapshot.assets.map((asset) => [asset.svgAssetId, asset.svg]), + ), + } +} diff --git a/packages/core-wasm/tests/n-1/domain/index.ts b/packages/core-wasm/tests/n-1/domain/index.ts new file mode 100644 index 00000000..a0985a5c --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/index.ts @@ -0,0 +1,3 @@ +export * from './anatomical-sheet' +export * from './report' +export * from './archive' diff --git a/packages/core-wasm/tests/n-1/domain/report/identity.ts b/packages/core-wasm/tests/n-1/domain/report/identity.ts new file mode 100644 index 00000000..a472c925 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/report/identity.ts @@ -0,0 +1,37 @@ +import { z } from 'zod' + +/** + * Identity snapshots carried by every report version: who wrote it, on + * which animal, for which owner. Copied into the report at creation so a + * report stays readable when the underlying records change (BDR-010). + */ + +export const PractitionerSchema = z.object({ + name: z.string().min(1), + cabinet: z.string().optional(), + contact: z.string().optional(), + /** SIRET, 14-digit French business identifier (not validated). */ + siret: z.string().optional(), +}) +export type Practitioner = z.infer + +export const AnimalSchema = z.object({ + /** Species of the animal; the sheet the report references matches it. */ + speciesId: z.string().min(1), + name: z.string().min(1), + breed: z.string().optional(), + age: z.string().optional(), +}) +export type Animal = z.infer + +export const OwnerSchema = z.object({ name: z.string().min(1) }) +export type Owner = z.infer + +export const NextAppointmentSchema = z.discriminatedUnion('kind', [ + z.object({ kind: z.literal('date'), date: z.string() }), + z.object({ kind: z.literal('period'), text: z.string() }), +]) +export type NextAppointment = z.infer + +export const LateralSideSchema = z.enum(['left', 'right']) +export type LateralSide = z.infer diff --git a/packages/core-wasm/tests/n-1/domain/report/index.ts b/packages/core-wasm/tests/n-1/domain/report/index.ts new file mode 100644 index 00000000..f54991a1 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/report/index.ts @@ -0,0 +1,32 @@ +export * from './identity' +export * from './v3' +export { + FindingV2Schema, + ObservationV2Schema, + ObservationZoneV2Schema, + ReportV2Schema, + SeverityV2Schema, + VertebraV2Schema, + VertebralRegionV2Schema, + type FindingV2, + type ObservationV2, + type ObservationZoneV2, + type ReportV2, + type SeverityV2, +} from './v2' +export { + ReportMigrationMapSchema, + findingPathKey, + type ReportMigrationMap, +} from './migration-map' +export { + migrateReportV2ToV3, + readReportDocument, + UnsupportedReportVersionError, + type MigrationOutcome, +} from './migrate' +export { + rebaseReportOnSheet, + type RebaseIndex, + type RebaseOutcome, +} from './rebase' diff --git a/packages/core-wasm/tests/n-1/domain/report/migrate.ts b/packages/core-wasm/tests/n-1/domain/report/migrate.ts new file mode 100644 index 00000000..4274c410 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/report/migrate.ts @@ -0,0 +1,167 @@ +import { findingPathKey, type ReportMigrationMap } from './migration-map' +import { + ReportV2Schema, + type FindingV2, + type ObservationV2, + type ObservationZoneV2, + type ReportV2, + type SeverityV2, +} from './v2' +import { + REPORT_VERSION, + ReportSchema, + type Finding, + type Observation, + type Report, + type ReportZone, + type Severity, +} from './v3' + +/** + * Lifts a Report v2 (PDF attachment or sessionStorage draft of the deployed + * application) to v3 against the migration map of the reference sheet. + * Never throws on content: a zone or finding the map cannot place is kept + * verbatim with its snapshots and flagged `unresolved`, so the practitioner's + * data survives any catalog change and stays identifiable. + */ + +/** Own-key lookup: ids come from untrusted documents (`__proto__` is not an entry). */ +function own(record: Record, key: string): T | undefined { + return Object.hasOwn(record, key) ? record[key] : undefined +} + +const SEVERITY: Record = { + légère: 'mild', + modérée: 'moderate', + sévère: 'severe', +} + +export interface MigrationOutcome { + report: Report + /** Zones whose legacy id has no annotation in the map. */ + unresolvedZones: number + /** Findings whose legacy path no longer exists in the sheet. */ + unresolvedFindings: number +} + +function migrateZone( + zone: ObservationZoneV2, + map: ReportMigrationMap, +): ReportZone { + const entry = own(map.annotations, zone.boneId) + const viewId = zone.detailSourceId + ? (own(map.views, zone.detailSourceId) ?? zone.detailSourceId) + : map.main_view_id + const out: ReportZone = { annotationId: entry?.id ?? zone.boneId, viewId } + if (zone.side) out.side = zone.side + if (zone.vertebrae) out.vertebrae = zone.vertebrae.map((v) => ({ ...v })) + if (entry) { + out.labelFrSnapshot = entry.name.fr + out.labelEnSnapshot = entry.name.en + } else { + out.unresolved = true + } + return out +} + +function migrateFinding(finding: FindingV2, map: ReportMigrationMap): Finding { + const mapped = own( + map.finding_paths, + findingPathKey(finding.zoneId, finding.path), + ) + const out: Finding = { + findingZoneId: finding.zoneId, + path: [...finding.path], + labelFrSnapshot: finding.labelFrSnapshot, + labelEnSnapshot: finding.labelEnSnapshot, + } + if (finding.requiresVetReferral) out.requiresVetReferral = true + if (finding.side) out.side = finding.side + if (typeof mapped === 'string') { + const [zoneId, ...path] = mapped.split('/') + out.findingZoneId = zoneId! + out.path = path + } else { + // null = removed by curation; undefined = never part of the legacy catalog. + out.unresolved = true + } + return out +} + +function migrateObservation( + obs: ObservationV2, + map: ReportMigrationMap, +): Observation { + const out: Observation = { + id: obs.id, + zones: obs.zones.map((z) => migrateZone(z, map)), + findings: obs.findings.map((f) => migrateFinding(f, map)), + freeTextFindings: [...obs.freeTextFindings], + comment: obs.comment, + } + if (obs.severity) out.severity = SEVERITY[obs.severity] + return out +} + +export function migrateReportV2ToV3( + report: ReportV2, + map: ReportMigrationMap, +): MigrationOutcome { + const observations = report.observations.map((o) => + migrateObservation(o, map), + ) + const migrated: Report = { + version: REPORT_VERSION, + id: report.id, + createdAt: report.createdAt, + date: report.date, + practitioner: report.practitioner, + animal: report.animal, + owner: report.owner, + sheet: { ...map.sheet }, + observations, + conclusion: report.conclusion, + recommendations: report.recommendations, + localAnnotations: [], + } + if (report.nextAppointment) migrated.nextAppointment = report.nextAppointment + const zones = observations.flatMap((o) => o.zones) + const findings = observations.flatMap((o) => o.findings) + return { + report: ReportSchema.parse(migrated), + unresolvedZones: zones.filter((z) => z.unresolved).length, + unresolvedFindings: findings.filter((f) => f.unresolved).length, + } +} + +/** Thrown for a report whose version this code cannot read. */ +export class UnsupportedReportVersionError extends Error { + constructor(public readonly foundVersion: number | null) { + super(`unsupported report version: ${foundVersion ?? 'unknown'}`) + this.name = 'UnsupportedReportVersionError' + } +} + +function versionOf(data: unknown): number | null { + if (data === null || typeof data !== 'object') return null + const v = (data as { version?: unknown }).version + return typeof v === 'number' ? v : null +} + +/** + * Reads a report document of any supported version (2 or 3) and returns it + * as v3. Zod errors propagate: a document of a known version that does not + * parse is corrupt, not old. + */ +export function readReportDocument( + data: unknown, + map: ReportMigrationMap, +): MigrationOutcome { + const version = versionOf(data) + if (version === REPORT_VERSION) { + const report = ReportSchema.parse(data) + return { report, unresolvedZones: 0, unresolvedFindings: 0 } + } + if (version === 2) return migrateReportV2ToV3(ReportV2Schema.parse(data), map) + throw new UnsupportedReportVersionError(version) +} diff --git a/packages/core-wasm/tests/n-1/domain/report/migration-map.ts b/packages/core-wasm/tests/n-1/domain/report/migration-map.ts new file mode 100644 index 00000000..65326590 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/report/migration-map.ts @@ -0,0 +1,40 @@ +import { z } from 'zod' +import { SheetRefSchema } from './v3' + +/** + * Correspondence between the legacy identifiers a Report v2 carries and the + * canonical sheet a Report v3 references. Generated by the curation pipeline + * (`draft/report-migration-map.json`), never written by hand: annotations + * come from the legacy id map, finding paths from the applier's rename and + * removal records. A `null` finding path means "removed from the sheet": + * the migration keeps the finding with its snapshots and flags it. + */ + +const LocalizedNameSchema = z.object({ fr: z.string(), en: z.string() }) + +export const ReportMigrationMapSchema = z.object({ + schema_version: z.literal(1), + sheet: SheetRefSchema, + /** Id of the view a v2 zone without `detailSourceId` belongs to. */ + main_view_id: z.string().min(1), + /** Legacy detail popup key → view id. */ + views: z.record(z.string(), z.string().min(1)), + /** Legacy `data-anno-id` → annotation id and the legacy labels. */ + annotations: z.record( + z.string(), + z.object({ id: z.string().min(1), name: LocalizedNameSchema }), + ), + /** + * `/` of every legacy finding node → + * the same key in the sheet, or null when the node was removed. + */ + finding_paths: z.record(z.string(), z.string().nullable()), +}) +export type ReportMigrationMap = z.infer + +export function findingPathKey( + zoneId: string, + path: readonly string[], +): string { + return `${zoneId}/${path.join('/')}` +} diff --git a/packages/core-wasm/tests/n-1/domain/report/rebase.ts b/packages/core-wasm/tests/n-1/domain/report/rebase.ts new file mode 100644 index 00000000..626c2b65 --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/report/rebase.ts @@ -0,0 +1,137 @@ +import type { + SheetIndex, + SheetIndexSource, +} from '../anatomical-sheet/sheet-index' +import type { Annotation, LocalizedText } from '../anatomical-sheet/schema' +import type { SheetSnapshot } from '../archive/snapshot' +import { + ReportSchema, + type Finding, + type Observation, + type Report, + type ReportZone, + type SheetRef, +} from './v3' + +/** + * Moves an imported report onto the sheet the application has loaded + * (STEP6 §3.5). A report written on another revision of the sheet keeps + * every datum: a zone or finding the loaded sheet no longer holds is flagged + * `unresolved`, its labels taken from the archived snapshot when the report + * carries none, and the report now references the loaded sheet. Nothing + * happens when the report already sits on the loaded sheet. + */ + +/** An index whose source names its sheet (a loaded sheet or a snapshot). */ +export type RebaseIndex = SheetIndex + +export interface RebaseOutcome { + report: Report + /** Zones and findings newly flagged by this rebase. */ + unresolvedZones: number + unresolvedFindings: number + rebased: boolean +} + +interface Counters { + zones: number + findings: number +} + +/** The name the archived snapshot gives an annotation (a trigger: its view's). */ +function archivedName( + archived: SheetSnapshot | null, + annotationId: string, +): LocalizedText | undefined { + if (!archived) return undefined + const annotation: Annotation | undefined = archived.document.annotations.find( + (a) => a.id === annotationId, + ) + if (!annotation) return undefined + if (annotation.kind !== 'detail_trigger') return annotation.name + const view = archived.document.views.find( + (v) => v.id === annotation.opens_view_id, + ) + return annotation.name ?? view?.name +} + +function flagZone( + zone: ReportZone, + archived: SheetSnapshot | null, +): ReportZone { + const out: ReportZone = { ...zone, unresolved: true } + const name = archivedName(archived, zone.annotationId) + if (name) { + out.labelFrSnapshot ??= name.fr + out.labelEnSnapshot ??= name.en + } + return out +} + +function rebaseZone( + zone: ReportZone, + index: RebaseIndex, + archived: SheetSnapshot | null, + counters: Counters, +): ReportZone { + if (zone.unresolved) return { ...zone } + const known = + index.annotation(zone.annotationId) !== undefined && + index.view(zone.viewId) !== undefined + if (known) return { ...zone } + counters.zones += 1 + return flagZone(zone, archived) +} + +function rebaseFinding( + finding: Finding, + index: RebaseIndex, + counters: Counters, +): Finding { + if (finding.unresolved) return { ...finding } + if (index.nodeAt(finding.findingZoneId, finding.path)) return { ...finding } + counters.findings += 1 + return { ...finding, unresolved: true } +} + +function rebaseObservation( + observation: Observation, + index: RebaseIndex, + archived: SheetSnapshot | null, + counters: Counters, +): Observation { + return { + ...observation, + zones: observation.zones.map((z) => + rebaseZone(z, index, archived, counters), + ), + findings: observation.findings.map((f) => + rebaseFinding(f, index, counters), + ), + } +} + +export function rebaseReportOnSheet( + report: Report, + index: RebaseIndex, + archived: SheetSnapshot | null, +): RebaseOutcome { + if (report.sheet.documentSha256 === index.sheet.ref.documentSha256) { + return { report, unresolvedZones: 0, unresolvedFindings: 0, rebased: false } + } + const counters: Counters = { zones: 0, findings: 0 } + const { sheetId, versionId, documentSha256 } = index.sheet.ref + const rebased: Report = { + ...report, + sheet: { sheetId, versionId, documentSha256 }, + observations: report.observations.map((o) => + rebaseObservation(o, index, archived, counters), + ), + } + return { + report: ReportSchema.parse(rebased), + unresolvedZones: counters.zones, + unresolvedFindings: counters.findings, + rebased: true, + } +} diff --git a/packages/core-wasm/tests/n-1/domain/report/v2.ts b/packages/core-wasm/tests/n-1/domain/report/v2.ts new file mode 100644 index 00000000..9c6b958c --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/report/v2.ts @@ -0,0 +1,72 @@ +import { z } from 'zod' +import { + AnimalSchema, + LateralSideSchema, + NextAppointmentSchema, + OwnerSchema, + PractitionerSchema, +} from './identity' + +/** + * Report document version 2, exactly as the deployed application wrote it + * (PDF attachments of the practitioner's archive, sessionStorage drafts). + * Kept as an INPUT format only: nothing writes v2 any more, `migrate.ts` + * lifts it to v3. Field comments describe the legacy meaning. + */ + +export const SeverityV2Schema = z.enum(['légère', 'modérée', 'sévère']) +export type SeverityV2 = z.infer + +export const VertebralRegionV2Schema = z.enum(['C', 'T', 'L', 'S', 'Cd']) + +export const VertebraV2Schema = z.object({ + region: VertebralRegionV2Schema, + index: z.number().int().positive(), +}) + +export const ObservationZoneV2Schema = z.object({ + /** The legacy SVG `data-anno-id` (e.g. `point-mpbwtst0`). */ + boneId: z.string().min(1), + /** Legacy detail popup key (`head`) when the zone came from that view. */ + detailSourceId: z.string().optional(), + vertebrae: z.array(VertebraV2Schema).optional(), + side: LateralSideSchema.optional(), +}) +export type ObservationZoneV2 = z.infer + +export const FindingV2Schema = z.object({ + /** Legacy catalog zone key (equal to the canonical finding zone id). */ + zoneId: z.string().min(1), + /** Node ids from the zone's categories down to the leaf. */ + path: z.array(z.string().min(1)).min(1), + labelFrSnapshot: z.string().min(1), + labelEnSnapshot: z.string().min(1), + requiresVetReferral: z.boolean().optional(), + side: LateralSideSchema.optional(), +}) +export type FindingV2 = z.infer + +export const ObservationV2Schema = z.object({ + id: z.string().min(1), + zones: z.array(ObservationZoneV2Schema), + findings: z.array(FindingV2Schema), + freeTextFindings: z.array(z.string()), + severity: SeverityV2Schema.optional(), + comment: z.string(), +}) +export type ObservationV2 = z.infer + +export const ReportV2Schema = z.object({ + version: z.literal(2), + id: z.string().min(1), + createdAt: z.string(), + date: z.string(), + practitioner: PractitionerSchema, + animal: AnimalSchema, + owner: OwnerSchema, + observations: z.array(ObservationV2Schema), + conclusion: z.string(), + recommendations: z.string(), + nextAppointment: NextAppointmentSchema.optional(), +}) +export type ReportV2 = z.infer diff --git a/packages/core-wasm/tests/n-1/domain/report/v3.ts b/packages/core-wasm/tests/n-1/domain/report/v3.ts new file mode 100644 index 00000000..0609199e --- /dev/null +++ b/packages/core-wasm/tests/n-1/domain/report/v3.ts @@ -0,0 +1,97 @@ +import { z } from 'zod' +import { + AnimalSchema, + LateralSideSchema, + NextAppointmentSchema, + OwnerSchema, + PractitionerSchema, +} from './identity' + +/** + * Report document version 3: a report written on the canonical anatomical + * sheet. Zones name an annotation of a view of an exact sheet, findings a + * node path of a finding zone, both by stable ids; every label the report + * needs to stay readable without the sheet is snapshotted. Breaking change + * → version 4; additive optional fields keep the version. + */ + +export const REPORT_VERSION = 3 + +export const SeveritySchema = z.enum(['mild', 'moderate', 'severe']) +export type Severity = z.infer + +/** Region codes are the sheet's `vertebral_config` codes, checked at runtime. */ +export const VertebraSchema = z.object({ + region: z.string().min(1), + index: z.number().int().positive(), +}) +export type Vertebra = z.infer + +/** The sheet document a report was built on, by content. */ +export const SheetRefSchema = z.object({ + sheetId: z.string().min(1), + /** Database version id once the sheet lives in the database; null for a bundled draft. */ + versionId: z.string().min(1).nullable(), + /** sha256 of the document file the report was written against. */ + documentSha256: z.string().regex(/^[0-9a-f]{64}$/), +}) +export type SheetRef = z.infer + +export const ReportZoneSchema = z.object({ + annotationId: z.string().min(1), + viewId: z.string().min(1), + side: LateralSideSchema.optional(), + vertebrae: z.array(VertebraSchema).optional(), + /** Annotation name at selection time (or legacy name at migration). */ + labelFrSnapshot: z.string().optional(), + labelEnSnapshot: z.string().optional(), + /** Set by the migration when the legacy id has no canonical annotation. */ + unresolved: z.literal(true).optional(), +}) +export type ReportZone = z.infer + +export const FindingSchema = z.object({ + findingZoneId: z.string().min(1), + /** Node ids from the zone's categories down to the leaf. */ + path: z.array(z.string().min(1)).min(1), + labelFrSnapshot: z.string().min(1), + labelEnSnapshot: z.string().min(1), + requiresVetReferral: z.boolean().optional(), + side: LateralSideSchema.optional(), + /** Set by the migration when the path no longer exists in the sheet; data kept. */ + unresolved: z.literal(true).optional(), +}) +export type Finding = z.infer + +export const ObservationSchema = z.object({ + id: z.string().min(1), + zones: z.array(ReportZoneSchema), + findings: z.array(FindingSchema), + freeTextFindings: z.array(z.string()), + severity: SeveritySchema.optional(), + comment: z.string(), +}) +export type Observation = z.infer + +export const ReportSchema = z.object({ + version: z.literal(REPORT_VERSION), + id: z.string().min(1), + /** ISO timestamp of report creation. */ + createdAt: z.string(), + /** ISO date of the clinical encounter. */ + date: z.string(), + practitioner: PractitionerSchema, + animal: AnimalSchema, + owner: OwnerSchema, + sheet: SheetRefSchema, + observations: z.array(ObservationSchema), + conclusion: z.string(), + recommendations: z.string(), + nextAppointment: NextAppointmentSchema.optional(), + /** Reserved for report-only points (OPEN_QUESTIONS Q6); empty until defined. */ + localAnnotations: z.array(z.unknown()).max(0).default([]), +}) +export type Report = z.infer +export type ReportInput = z.input + +export type { LateralSide, NextAppointment } from './identity' diff --git a/packages/core-wasm/tests/n-1/index.ts b/packages/core-wasm/tests/n-1/index.ts new file mode 100644 index 00000000..c471ba3f --- /dev/null +++ b/packages/core-wasm/tests/n-1/index.ts @@ -0,0 +1,21 @@ +/** + * The N-1 reader (RUST_ARCHITECTURE_REVIEW III.3 rule 7, VI.3): the Zod schemas and readers + * the last TypeScript build shipped, copied verbatim from `packages/domain/src` at develop + * 1a7ee7d (the R2 starting point) into `./domain`. Never edited: a Rust-written report, draft, + * snapshot or envelope that these readers refuse would break a rollback to that build. + * Permanent, it outlives `packages/domain` (deleted at R5). + */ +export { + ReportSchema, + ReportArchiveEnvelopeSchema, + SheetSnapshotSchema, + AnatomicalSheetDocumentSchema, + BrandingSchema, + PdfLabelSetSchema, + readArchiveDocument, + readReportDocument, + assertSnapshot, + type Report, + type ReportArchiveEnvelope, + type ReportMigrationMap, +} from './domain' diff --git a/packages/core-wasm/tests/serialisation.test.ts b/packages/core-wasm/tests/serialisation.test.ts index d04d069d..6f854091 100644 --- a/packages/core-wasm/tests/serialisation.test.ts +++ b/packages/core-wasm/tests/serialisation.test.ts @@ -6,7 +6,7 @@ import { readFileSync } from 'node:fs' import { fileURLToPath } from 'node:url' -import { ReportZoneSchema, SheetRefSchema } from '@faunosteo/domain' +import { ReportZoneSchema, SheetRefSchema } from './n-1/domain' import type { ReportZone, SheetRef } from '../types/index' import { callCore, loadCore, type CoreModule } from '../src/index' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a06684e4..68c21f90 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: '@faunosteo/anatomy': specifier: workspace:* version: link:../../packages/anatomy + '@faunosteo/core-wasm': + specifier: workspace:* + version: link:../../packages/core-wasm '@faunosteo/domain': specifier: workspace:* version: link:../../packages/domain @@ -147,10 +150,11 @@ importers: version: 3.2.7(@types/node@20.19.41)(happy-dom@20.10.6)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.23.15) packages/core-wasm: + dependencies: + zod: + specifier: ^3.24.1 + version: 3.25.76 devDependencies: - '@faunosteo/domain': - specifier: workspace:* - version: link:../domain '@types/node': specifier: ^20.19.41 version: 20.19.41