feat(domain): canonical anatomical sheet document, integrity rules, tests
This commit is contained in:
1 parent
aea8902711
commit
36812f4625
13 files changed
+1849
No files matched your search
+443
@@ -0,0 +1,443 @@
|
||||
import {
|
||||
AnatomicalSheetDocumentSchema,
|
||||
type AnatomicalSheetDocument,
|
||||
type AnatomicalSheetDocumentInput,
|
||||
type FindingNodeInput,
|
||||
} from '../../src'
|
||||
|
||||
/**
|
||||
* Reduced equine sheet built from the real assets: labels come from
|
||||
* apps/app/public/species/equine/{Horse,Horse_head}.svg and from
|
||||
* apps/app/src/domain/species/equine/pathologies.json. It exercises two
|
||||
* views (one cropped detail), a trigger, a spine region, a bilateral joint,
|
||||
* the three finding kinds, a two-level tree, a vet referral and a source.
|
||||
* It references every finding zone, so it validates with zero issues.
|
||||
*/
|
||||
|
||||
export const HORSE_MAIN_ASSET_ID = '3f6c1b52-8a4e-4d17-9b0c-5e2a7d91c4f8'
|
||||
|
||||
function leaf(id: string, fr: string, en: string): FindingNodeInput {
|
||||
return { id, name: { fr, en } }
|
||||
}
|
||||
|
||||
const ANAMNESIS = {
|
||||
id: 'anamnesis',
|
||||
kind: 'anamnesis',
|
||||
name: {
|
||||
fr: 'Anamnèse / facteurs rapportés',
|
||||
en: 'Anamnesis / reported factors',
|
||||
},
|
||||
description: {
|
||||
fr: "Facteurs rapportés par le propriétaire lors de l'anamnèse",
|
||||
},
|
||||
} as const
|
||||
|
||||
const OBSERVATIONS_NAME = {
|
||||
fr: 'Observations / motifs de consultation',
|
||||
en: 'Observations / consultation reasons',
|
||||
}
|
||||
|
||||
const DYSFUNCTIONS_NAME = {
|
||||
fr: 'Dysfonctions ostéopathiques',
|
||||
en: 'Osteopathic dysfunctions',
|
||||
}
|
||||
|
||||
const TRAUMA = leaf(
|
||||
'trauma-direct',
|
||||
'Traumatisme rapporté (choc, chute)',
|
||||
'Reported trauma (blow, fall)',
|
||||
)
|
||||
|
||||
const STRESS = leaf(
|
||||
'stress-context',
|
||||
'Contexte de stress / changement',
|
||||
'Stress / change context',
|
||||
)
|
||||
|
||||
const HIP_ZONE = {
|
||||
id: 'hip',
|
||||
name: { fr: 'Hanche (coxo-fémorale)', en: 'Hip joint' },
|
||||
categories: [
|
||||
{
|
||||
id: 'hip-dysfunctions',
|
||||
kind: 'dysfunction',
|
||||
name: DYSFUNCTIONS_NAME,
|
||||
children: [
|
||||
{
|
||||
id: 'articular',
|
||||
name: {
|
||||
fr: 'Restrictions de mobilité articulaire',
|
||||
en: 'Articular mobility restrictions',
|
||||
},
|
||||
children: [
|
||||
leaf(
|
||||
'restriction-flexion',
|
||||
'Restriction en flexion',
|
||||
'Flexion restriction',
|
||||
),
|
||||
leaf(
|
||||
'restriction-extension',
|
||||
'Restriction en extension',
|
||||
'Extension restriction',
|
||||
),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'hip-observations',
|
||||
kind: 'observation',
|
||||
name: OBSERVATIONS_NAME,
|
||||
children: [
|
||||
{
|
||||
...leaf(
|
||||
'limb-lameness',
|
||||
'Boiterie rapportée (membre concerné)',
|
||||
'Reported lameness (affected limb)',
|
||||
),
|
||||
requires_vet_referral: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
...ANAMNESIS,
|
||||
children: [
|
||||
{
|
||||
...TRAUMA,
|
||||
sources: [
|
||||
{
|
||||
type: 'manual',
|
||||
citation: 'Legacy equine catalog (pathologies.json)',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
} satisfies AnatomicalSheetDocumentInput['finding_zones'][number]
|
||||
|
||||
const CERVICAL_ZONE = {
|
||||
id: 'cervical',
|
||||
name: { fr: 'Vertèbres cervicales', en: 'Cervical Vertebrae' },
|
||||
categories: [
|
||||
{
|
||||
id: 'cervical-dysfunctions',
|
||||
kind: 'dysfunction',
|
||||
name: DYSFUNCTIONS_NAME,
|
||||
children: [
|
||||
{
|
||||
id: 'muscular',
|
||||
name: {
|
||||
fr: 'Tensions musculaires paravertébrales',
|
||||
en: 'Paravertebral muscle tensions',
|
||||
},
|
||||
children: [
|
||||
leaf('splenius-tension', 'Tension du splénius', 'Splenius tension'),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'cervical-observations',
|
||||
kind: 'observation',
|
||||
name: OBSERVATIONS_NAME,
|
||||
children: [
|
||||
{
|
||||
...leaf(
|
||||
'stumbling-proprioceptive',
|
||||
'Trébuchements / déficit proprioceptif rapporté',
|
||||
'Reported stumbling / proprioceptive deficit',
|
||||
),
|
||||
requires_vet_referral: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{ ...ANAMNESIS, children: [TRAUMA] },
|
||||
],
|
||||
} satisfies AnatomicalSheetDocumentInput['finding_zones'][number]
|
||||
|
||||
const C7_T1_ZONE = {
|
||||
id: 'c7-t1',
|
||||
name: {
|
||||
fr: 'Charnière C7-T1 (cervico-thoracique)',
|
||||
en: 'C7-T1 (Cervicothoracic)',
|
||||
},
|
||||
categories: [
|
||||
{
|
||||
id: 'c7-t1-dysfunctions',
|
||||
kind: 'dysfunction',
|
||||
name: DYSFUNCTIONS_NAME,
|
||||
children: [
|
||||
leaf(
|
||||
'restriction-rotation',
|
||||
'Restriction en rotation',
|
||||
'Rotation restriction',
|
||||
),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'c7-t1-observations',
|
||||
kind: 'observation',
|
||||
name: OBSERVATIONS_NAME,
|
||||
children: [
|
||||
leaf(
|
||||
'base-neck-stiffness',
|
||||
"Raideur de la base de l'encolure",
|
||||
'Base-of-neck stiffness',
|
||||
),
|
||||
],
|
||||
},
|
||||
{ ...ANAMNESIS, children: [STRESS] },
|
||||
],
|
||||
} satisfies AnatomicalSheetDocumentInput['finding_zones'][number]
|
||||
|
||||
const ATM_ZONE = {
|
||||
id: 'atm',
|
||||
name: {
|
||||
fr: 'Articulation Temporo-Mandibulaire (ATM)',
|
||||
en: 'Temporomandibular Joint (TMJ)',
|
||||
},
|
||||
categories: [
|
||||
{
|
||||
id: 'atm-dysfunctions',
|
||||
kind: 'dysfunction',
|
||||
name: {
|
||||
fr: "Dysfonctions ostéopathiques de l'ATM",
|
||||
en: 'Osteopathic TMJ dysfunctions',
|
||||
},
|
||||
children: [
|
||||
leaf('masseter-tension', 'Tension du masséter', 'Masseter tension'),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'atm-observations',
|
||||
kind: 'observation',
|
||||
name: OBSERVATIONS_NAME,
|
||||
children: [
|
||||
leaf(
|
||||
'bit-defense',
|
||||
'Réactions de défense au mors',
|
||||
'Defense reactions to bit',
|
||||
),
|
||||
],
|
||||
},
|
||||
{
|
||||
...ANAMNESIS,
|
||||
children: [
|
||||
leaf(
|
||||
'dental-context',
|
||||
'Suite de soin dentaire récent',
|
||||
'Post recent dental care',
|
||||
),
|
||||
],
|
||||
},
|
||||
],
|
||||
} satisfies AnatomicalSheetDocumentInput['finding_zones'][number]
|
||||
|
||||
const SPHENOID_ZONE = {
|
||||
id: 'sphenoid',
|
||||
name: { fr: 'Sphénoïde', en: 'Sphenoid' },
|
||||
categories: [
|
||||
{
|
||||
id: 'ssb-dysfunctions',
|
||||
kind: 'dysfunction',
|
||||
name: DYSFUNCTIONS_NAME,
|
||||
children: [
|
||||
{
|
||||
id: 'physiological',
|
||||
name: {
|
||||
fr: 'Lésions physiologiques (SSB)',
|
||||
en: 'Physiological lesions (SBS)',
|
||||
},
|
||||
children: [
|
||||
leaf('torsion-right', 'Torsion droite', 'Right torsion'),
|
||||
leaf('torsion-left', 'Torsion gauche', 'Left torsion'),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'sphenoid-observations',
|
||||
kind: 'observation',
|
||||
name: OBSERVATIONS_NAME,
|
||||
children: [
|
||||
leaf(
|
||||
'post-trauma-head',
|
||||
'Suite de traumatisme crânien',
|
||||
'Post head trauma',
|
||||
),
|
||||
],
|
||||
},
|
||||
{ ...ANAMNESIS, children: [TRAUMA, STRESS] },
|
||||
],
|
||||
} satisfies AnatomicalSheetDocumentInput['finding_zones'][number]
|
||||
|
||||
const HORSE_SLICE_INPUT: AnatomicalSheetDocumentInput = {
|
||||
schema_version: 1,
|
||||
species_id: 'equine',
|
||||
name: { fr: 'Cheval (extrait)', en: 'Horse (slice)' },
|
||||
description: {
|
||||
fr: 'Extrait de la fiche équine pour les tests du modèle',
|
||||
en: 'Equine sheet slice for model tests',
|
||||
},
|
||||
scope_disclaimer: {
|
||||
fr:
|
||||
"Les éléments listés correspondent au périmètre légal de l'ostéopathie " +
|
||||
'animale : dysfonctions ostéopathiques palpées, observations cliniques ' +
|
||||
"et motifs de consultation. Aucun diagnostic médical n'est posé. " +
|
||||
'Toute pathologie organique relève du vétérinaire.',
|
||||
},
|
||||
attribution: { authors: ['Faunosteo'], license: 'MIT', notes: null },
|
||||
vertebral_config: {
|
||||
regions: [
|
||||
{ code: 'C', name: { fr: 'Cervicales', en: 'Cervical' }, count: 7 },
|
||||
{ code: 'T', name: { fr: 'Thoraciques', en: 'Thoracic' }, count: 18 },
|
||||
{ code: 'L', name: { fr: 'Lombaires', en: 'Lumbar' }, count: 6 },
|
||||
{ code: 'S', name: { fr: 'Sacrées', en: 'Sacral' }, count: 5 },
|
||||
{ code: 'Cd', name: { fr: 'Caudales', en: 'Caudal' }, count: 18 },
|
||||
],
|
||||
},
|
||||
categories: [
|
||||
{
|
||||
id: 'articulations',
|
||||
name: { fr: 'Articulations', en: 'Joints' },
|
||||
color: '#ff9500',
|
||||
},
|
||||
{
|
||||
id: 'zone-colonne',
|
||||
name: { fr: 'Zone colonne', en: 'Spine zone' },
|
||||
color: '#e100ff',
|
||||
},
|
||||
{
|
||||
id: 'charnieres-vertebrales',
|
||||
name: { fr: 'Charnières vertébrales', en: 'Vertebral junctions' },
|
||||
color: '#ff0000',
|
||||
},
|
||||
{
|
||||
id: 'cadrans-du-crane',
|
||||
name: { fr: 'Cadrans du crâne', en: 'Skull quadrants' },
|
||||
color: '#1baa08',
|
||||
},
|
||||
],
|
||||
views: [
|
||||
{
|
||||
id: 'view-main',
|
||||
kind: 'main',
|
||||
name: { fr: 'Cheval entier', en: 'Whole horse' },
|
||||
svg_asset_id: HORSE_MAIN_ASSET_ID,
|
||||
view_box: null,
|
||||
},
|
||||
{
|
||||
id: 'view-head',
|
||||
kind: 'detail',
|
||||
name: { fr: 'Tête', en: 'Head' },
|
||||
parent_view_id: 'view-main',
|
||||
svg_asset_id: null,
|
||||
view_box: { min_x: 60, min_y: 100, width: 500, height: 380 },
|
||||
},
|
||||
],
|
||||
annotations: [
|
||||
{
|
||||
id: 'hip',
|
||||
kind: 'point',
|
||||
view_id: 'view-main',
|
||||
category_id: 'articulations',
|
||||
laterality: 'bilateral',
|
||||
geometry: { type: 'circle', cx: 1516, cy: 695, r: 34 },
|
||||
name: { fr: 'Hanche (coxo-fémorale)', en: 'Hip joint' },
|
||||
finding_zone_id: 'hip',
|
||||
vertebral_region_code: null,
|
||||
},
|
||||
{
|
||||
id: 'cervical-vertebrae',
|
||||
kind: 'zone',
|
||||
view_id: 'view-main',
|
||||
category_id: 'zone-colonne',
|
||||
laterality: 'unpaired',
|
||||
geometry: {
|
||||
type: 'polygon',
|
||||
points: [
|
||||
[468, 276],
|
||||
[489, 216],
|
||||
[558, 248],
|
||||
[586, 339],
|
||||
[552, 461],
|
||||
[524, 370],
|
||||
],
|
||||
},
|
||||
name: { fr: 'Vertèbres cervicales', en: 'Cervical Vertebrae' },
|
||||
finding_zone_id: 'cervical',
|
||||
vertebral_region_code: 'C',
|
||||
},
|
||||
{
|
||||
id: 'hinge-c7-t1',
|
||||
kind: 'point',
|
||||
view_id: 'view-main',
|
||||
category_id: 'charnieres-vertebrales',
|
||||
laterality: 'unpaired',
|
||||
geometry: { type: 'circle', cx: 840.17, cy: 399.08, r: 30 },
|
||||
name: {
|
||||
fr: 'Charnière C7-T1 (cervico-thoracique)',
|
||||
en: 'C7-T1 (Cervicothoracic)',
|
||||
},
|
||||
finding_zone_id: 'c7-t1',
|
||||
vertebral_region_code: null,
|
||||
},
|
||||
{
|
||||
id: 'head-trigger',
|
||||
kind: 'detail_trigger',
|
||||
view_id: 'view-main',
|
||||
category_id: 'cadrans-du-crane',
|
||||
laterality: 'unpaired',
|
||||
geometry: {
|
||||
type: 'polygon',
|
||||
points: [
|
||||
[454, 332],
|
||||
[429, 202],
|
||||
[349, 154],
|
||||
[234, 279],
|
||||
[164, 384],
|
||||
[234, 468],
|
||||
],
|
||||
},
|
||||
name: null,
|
||||
opens_view_id: 'view-head',
|
||||
},
|
||||
{
|
||||
id: 'atm',
|
||||
kind: 'point',
|
||||
view_id: 'view-head',
|
||||
category_id: 'articulations',
|
||||
laterality: 'bilateral',
|
||||
geometry: { type: 'circle', cx: 384.94, cy: 314.02, r: 27 },
|
||||
name: {
|
||||
fr: 'Articulation Temporo-Mandibulaire (ATM)',
|
||||
en: 'Temporomandibular Joint (TMJ)',
|
||||
},
|
||||
finding_zone_id: 'atm',
|
||||
vertebral_region_code: null,
|
||||
},
|
||||
{
|
||||
id: 'sphenoid',
|
||||
kind: 'point',
|
||||
view_id: 'view-head',
|
||||
category_id: 'cadrans-du-crane',
|
||||
laterality: 'unpaired',
|
||||
geometry: { type: 'circle', cx: 299, cy: 298, r: 27 },
|
||||
name: { fr: 'Sphénoïde', en: 'Sphenoid' },
|
||||
finding_zone_id: 'sphenoid',
|
||||
vertebral_region_code: null,
|
||||
},
|
||||
],
|
||||
finding_zones: [HIP_ZONE, CERVICAL_ZONE, C7_T1_ZONE, ATM_ZONE, SPHENOID_ZONE],
|
||||
}
|
||||
|
||||
/** Lean authoring form, as a creator or the importer would write it. */
|
||||
export function horseSliceInput(): AnatomicalSheetDocumentInput {
|
||||
return structuredClone(HORSE_SLICE_INPUT)
|
||||
}
|
||||
|
||||
/** Parsed (total) document; a fresh copy so tests can mutate it freely. */
|
||||
export function horseSlice(): AnatomicalSheetDocument {
|
||||
return AnatomicalSheetDocumentSchema.parse(horseSliceInput())
|
||||
}
|
||||
Reference in new issue
Block a user