176 lines
4.3 KiB
TypeScript
176 lines
4.3 KiB
TypeScript
import type {
|
|
AnatomicalSheetDocumentInput,
|
|
FindingNodeInput,
|
|
Reference,
|
|
} from '@faunosteo/domain'
|
|
import type { ChangeInput, Changeset, Op } from '../../src'
|
|
import { ChangesetSchema } from '../../src'
|
|
|
|
/**
|
|
* Small synthetic sheet for the curation unit tests: two finding zones with
|
|
* nested nodes, two observable annotations, one detail view opened by a
|
|
* trigger. Lean input form, zero integrity issue as written.
|
|
*/
|
|
|
|
function leaf(
|
|
id: string,
|
|
extra: Partial<FindingNodeInput> = {},
|
|
): FindingNodeInput {
|
|
return { id, name: { fr: `${id} fr`, en: `${id} en` }, ...extra }
|
|
}
|
|
|
|
export const MINI_REFERENCES: Reference[] = [
|
|
{
|
|
id: 'atlas',
|
|
type: 'book',
|
|
citation: 'Atlas of anatomy',
|
|
url: null,
|
|
doi: null,
|
|
},
|
|
{
|
|
id: 'paper',
|
|
type: 'journal',
|
|
citation: 'A paper',
|
|
url: null,
|
|
doi: '10.1/x',
|
|
},
|
|
]
|
|
|
|
export function miniSheet(): AnatomicalSheetDocumentInput {
|
|
return {
|
|
schema_version: 2,
|
|
species_id: 'equine',
|
|
name: { fr: 'Mini', en: 'Mini' },
|
|
description: {},
|
|
scope_disclaimer: {},
|
|
attribution: { authors: [], license: null, notes: null },
|
|
vertebral_config: {
|
|
regions: [
|
|
{ code: 'C', name: { fr: 'Cervicales', en: 'Cervical' }, count: 7 },
|
|
{ code: 'T', name: { fr: 'Thoraciques', en: 'Thoracic' }, count: 18 },
|
|
],
|
|
},
|
|
references: [],
|
|
categories: [
|
|
{
|
|
id: 'joints',
|
|
name: { fr: 'Articulations', en: 'Joints' },
|
|
color: null,
|
|
},
|
|
{ id: 'bones', name: { fr: 'Os', en: 'Bones' }, color: null },
|
|
],
|
|
views: [
|
|
{
|
|
id: 'main',
|
|
kind: 'main',
|
|
name: { fr: 'Vue', en: 'View' },
|
|
svg_asset_id: '3f6c1b52-8a4e-4d17-9b0c-5e2a7d91c4f8',
|
|
view_box: null,
|
|
},
|
|
{
|
|
id: 'head',
|
|
kind: 'detail',
|
|
parent_view_id: 'main',
|
|
name: { fr: 'Tête', en: 'Head' },
|
|
svg_asset_id: null,
|
|
view_box: { min_x: 0, min_y: 0, width: 10, height: 10 },
|
|
},
|
|
],
|
|
annotations: [
|
|
{
|
|
id: 'hip',
|
|
kind: 'point',
|
|
view_id: 'main',
|
|
category_id: 'joints',
|
|
laterality: 'bilateral',
|
|
geometry: { type: 'circle', cx: 1, cy: 2, r: 3 },
|
|
name: { fr: 'Hanche', en: 'Hip' },
|
|
finding_zone_id: 'hip',
|
|
vertebral_region_code: null,
|
|
},
|
|
{
|
|
id: 'neck',
|
|
kind: 'zone',
|
|
view_id: 'main',
|
|
category_id: 'bones',
|
|
laterality: 'unpaired',
|
|
geometry: null,
|
|
name: { fr: 'Cou', en: 'Neck' },
|
|
finding_zone_id: 'neck',
|
|
vertebral_region_code: 'C',
|
|
},
|
|
{
|
|
id: 'head-trigger',
|
|
kind: 'detail_trigger',
|
|
view_id: 'main',
|
|
category_id: 'bones',
|
|
laterality: 'unpaired',
|
|
geometry: null,
|
|
name: null,
|
|
opens_view_id: 'head',
|
|
},
|
|
],
|
|
finding_zones: [
|
|
{
|
|
id: 'hip',
|
|
name: { fr: 'Hanche', en: 'Hip' },
|
|
categories: [
|
|
{
|
|
id: 'hip-dysfunctions',
|
|
kind: 'dysfunction',
|
|
name: { fr: 'Dysfonctions', en: 'Dysfunctions' },
|
|
children: [
|
|
leaf('mobility', {
|
|
children: [leaf('flexion'), leaf('extension')],
|
|
}),
|
|
leaf('pain'),
|
|
],
|
|
},
|
|
{
|
|
id: 'anamnesis',
|
|
kind: 'anamnesis',
|
|
name: { fr: 'Anamnèse', en: 'Anamnesis' },
|
|
children: [leaf('trauma')],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'neck',
|
|
name: { fr: 'Cou', en: 'Neck' },
|
|
categories: [
|
|
{
|
|
id: 'neck-dysfunctions',
|
|
kind: 'dysfunction',
|
|
name: { fr: 'Dysfonctions', en: 'Dysfunctions' },
|
|
children: [
|
|
leaf('stiffness'),
|
|
leaf('vet', { requires_vet_referral: true }),
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
}
|
|
}
|
|
|
|
/** One level A change carrying the given ops, parsed like changes.json. */
|
|
export function changesetOf(
|
|
ops: Op[],
|
|
extra: Partial<ChangeInput> = {},
|
|
): Changeset {
|
|
return ChangesetSchema.parse({
|
|
changes: [
|
|
{
|
|
id: 'CHG-001',
|
|
level: 'A',
|
|
kind: 'technical',
|
|
title: { fr: 'Essai', en: 'Test' },
|
|
rationale: 'Essai',
|
|
reference_ids: [],
|
|
ops,
|
|
...extra,
|
|
},
|
|
],
|
|
})
|
|
}
|