feat(schema): add LateralSideSchema and Bone.lateral for laterality support

Exports LateralSideSchema (z.enum left/right) and LateralSide type.
Adds optional side field to ObservationZoneSchema for bilateral zone distinction.
Covers new schema with 6 dedicated tests (accepts/rejects for both types).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude committed 2026-05-23 22:15:33 +02:00
1 parent db50c67bb6
commit e0abb1efa1
2 files changed
+49

No files matched your search

+5
View File
@@ -15,6 +15,9 @@ export const VertebraSchema = z.object({
export type Vertebra = z.infer<typeof VertebraSchema>
export const LateralSideSchema = z.enum(['left', 'right'])
export type LateralSide = z.infer<typeof LateralSideSchema>
export const ObservationZoneSchema = z.object({
/** Must match data-anno-id attribute on the SVG element */
boneId: z.string().min(1),
@@ -22,6 +25,8 @@ export const ObservationZoneSchema = z.object({
detailSourceId: z.string().optional(),
/** Set when boneId is a spine-zone; replaces the block semantically */
vertebrae: z.array(VertebraSchema).optional(),
/** Set for bilateral zones to distinguish left from right */
side: LateralSideSchema.optional(),
})
export type ObservationZone = z.infer<typeof ObservationZoneSchema>