chore: initial scaffold + design spec + implementation plan
Skeleton for Osteo Report MVP. Build passes, 7 smoke tests green, real Horse.svg + Horse_head.svg in public/species/equine/. Zod schemas are the contract; store/anatomy/pdf modules are typed stubs throwing "not implemented" awaiting implementation. Spec: docs/superpowers/specs/2026-05-18-osteo-report-mvp-design.md Plan: docs/superpowers/plans/2026-05-18-osteo-report-mvp.md (23 phases, ~70 TDD tasks) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
12a3e48fdf
commit
8ca36b5ccd
104 files changed
+12448
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const AnimalSchema = z.object({
|
||||
/** Must match a registered species id (e.g. 'equine') */
|
||||
speciesId: z.string().min(1),
|
||||
name: z.string().min(1),
|
||||
breed: z.string().optional(),
|
||||
age: z.string().optional(),
|
||||
})
|
||||
|
||||
export type Animal = z.infer<typeof AnimalSchema>
|
||||
|
||||
export const OwnerSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
})
|
||||
|
||||
export type Owner = z.infer<typeof OwnerSchema>
|
||||
@@ -0,0 +1,38 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const SeveritySchema = z.enum(['légère', 'modérée', 'sévère'])
|
||||
|
||||
export type Severity = z.infer<typeof SeveritySchema>
|
||||
|
||||
export const VertebralRegionSchema = z.enum(['C', 'T', 'L', 'S', 'Cd'])
|
||||
|
||||
export type VertebralRegion = z.infer<typeof VertebralRegionSchema>
|
||||
|
||||
export const VertebraSchema = z.object({
|
||||
region: VertebralRegionSchema,
|
||||
index: z.number().int().positive(),
|
||||
})
|
||||
|
||||
export type Vertebra = z.infer<typeof VertebraSchema>
|
||||
|
||||
export const ObservationZoneSchema = z.object({
|
||||
/** Must match data-bone-id attribute on the SVG element */
|
||||
boneId: z.string().min(1),
|
||||
/** Set when zone originates from a detail popup SVG */
|
||||
detailSourceId: z.string().optional(),
|
||||
/** Set when boneId is a spine-zone; replaces the block semantically */
|
||||
vertebrae: z.array(VertebraSchema).optional(),
|
||||
})
|
||||
|
||||
export type ObservationZone = z.infer<typeof ObservationZoneSchema>
|
||||
|
||||
export const ObservationSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
zones: z.array(ObservationZoneSchema),
|
||||
pathologyIds: z.array(z.string()),
|
||||
freeTextPathologies: z.array(z.string()),
|
||||
severity: SeveritySchema.optional(),
|
||||
comment: z.string(),
|
||||
})
|
||||
|
||||
export type Observation = z.infer<typeof ObservationSchema>
|
||||
@@ -0,0 +1,47 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const PathologyCategorySchema = z.enum([
|
||||
'osseux',
|
||||
'articulaire',
|
||||
'musculaire',
|
||||
'tendino-ligamentaire',
|
||||
'fascial',
|
||||
'visceral',
|
||||
'cranio-sacre',
|
||||
'nerveux',
|
||||
'autre',
|
||||
])
|
||||
|
||||
export type PathologyCategory = z.infer<typeof PathologyCategorySchema>
|
||||
|
||||
export const PathologyRefTypeSchema = z.enum([
|
||||
'manual',
|
||||
'journal',
|
||||
'database',
|
||||
'web',
|
||||
])
|
||||
|
||||
export const PathologyRefSchema = z.object({
|
||||
type: PathologyRefTypeSchema,
|
||||
/** Human-readable citation — no raw URLs in PDF output */
|
||||
citation: z.string().min(1),
|
||||
url: z.string().url().optional(),
|
||||
})
|
||||
|
||||
export type PathologyRef = z.infer<typeof PathologyRefSchema>
|
||||
|
||||
export const PathologySchema = z.object({
|
||||
/** Stable kebab-case identifier */
|
||||
id: z.string().min(1),
|
||||
labelFr: z.string().min(1),
|
||||
description: z.string().min(1),
|
||||
category: PathologyCategorySchema,
|
||||
/** Empty array = applicable to all species */
|
||||
speciesIds: z.array(z.string()),
|
||||
/** Empty array = applicable to all zones */
|
||||
boneIds: z.array(z.string()),
|
||||
/** At least one source required */
|
||||
sources: z.array(PathologyRefSchema).min(1),
|
||||
})
|
||||
|
||||
export type Pathology = z.infer<typeof PathologySchema>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const PractitionerSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
cabinet: z.string().optional(),
|
||||
contact: z.string().optional(),
|
||||
/** SIRET — 14-digit French business identifier */
|
||||
siret: z.string().optional(),
|
||||
})
|
||||
|
||||
export type Practitioner = z.infer<typeof PractitionerSchema>
|
||||
@@ -0,0 +1,30 @@
|
||||
import { z } from 'zod'
|
||||
import { PractitionerSchema } from './practitioner'
|
||||
import { AnimalSchema, OwnerSchema } from './animal'
|
||||
import { ObservationSchema } from './observation'
|
||||
|
||||
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<typeof NextAppointmentSchema>
|
||||
|
||||
export const ReportSchema = z.object({
|
||||
/** Schema version — always 1 for MVP. Bump on breaking changes. */
|
||||
version: z.literal(1),
|
||||
id: z.string().min(1),
|
||||
/** ISO timestamp of report creation */
|
||||
createdAt: z.string(),
|
||||
/** ISO date of clinical encounter */
|
||||
date: z.string(),
|
||||
practitioner: PractitionerSchema,
|
||||
animal: AnimalSchema,
|
||||
owner: OwnerSchema,
|
||||
observations: z.array(ObservationSchema),
|
||||
conclusion: z.string(),
|
||||
recommendations: z.string(),
|
||||
nextAppointment: NextAppointmentSchema.optional(),
|
||||
})
|
||||
|
||||
export type Report = z.infer<typeof ReportSchema>
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { SpeciesManifest } from '@/domain/species/types'
|
||||
import { EQUINE_VERTEBRAL_FORMULA } from './vertebrae'
|
||||
|
||||
export const equine: SpeciesManifest = {
|
||||
id: 'equine',
|
||||
labelFr: 'Cheval',
|
||||
mainSvg: '/species/equine/Horse.svg',
|
||||
details: {
|
||||
head: '/species/equine/Horse_head.svg',
|
||||
},
|
||||
vertebralFormula: EQUINE_VERTEBRAL_FORMULA,
|
||||
pathologies: () => import('./pathologies'),
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { Pathology } from '@/domain/schema/pathology'
|
||||
|
||||
/**
|
||||
* Equine pathology database.
|
||||
* To be authored post-scaffold (40–60 entries, source-cited).
|
||||
* Each entry must pass PathologySchema.parse() and have ≥1 source.
|
||||
*/
|
||||
const EQUINE_PATHOLOGIES: Pathology[] = []
|
||||
|
||||
export default EQUINE_PATHOLOGIES
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { VertebralFormula } from '@/domain/species/types'
|
||||
|
||||
/**
|
||||
* Vertebral formula for the horse (Equus caballus).
|
||||
* Cd count capped at 18 for the picker — actual count varies 15–21.
|
||||
*/
|
||||
export const EQUINE_VERTEBRAL_FORMULA: VertebralFormula = {
|
||||
C: 7,
|
||||
T: 18,
|
||||
L: 6,
|
||||
S: 5,
|
||||
Cd: 18,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { SpeciesManifest } from './types'
|
||||
import { equine } from './equine'
|
||||
|
||||
/** Map of speciesId → manifest. Add new species here. */
|
||||
const SPECIES_REGISTRY: Record<string, SpeciesManifest> = {
|
||||
[equine.id]: equine,
|
||||
}
|
||||
|
||||
/** Returns a species manifest by id, or undefined if not registered. */
|
||||
export function getSpecies(id: string): SpeciesManifest | undefined {
|
||||
return SPECIES_REGISTRY[id]
|
||||
}
|
||||
|
||||
/** Returns all registered species manifests. */
|
||||
export function getAllSpecies(): SpeciesManifest[] {
|
||||
return Object.values(SPECIES_REGISTRY)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Pathology } from '@/domain/schema/pathology'
|
||||
|
||||
/** Vertebral formula defines segment counts for a species. */
|
||||
export interface VertebralFormula {
|
||||
C: number
|
||||
T: number
|
||||
L: number
|
||||
S: number
|
||||
Cd: number
|
||||
}
|
||||
|
||||
/** Lazy import returning a module with a default export of Pathology[]. */
|
||||
export type PathologiesLoader = () => Promise<{ default: Pathology[] }>
|
||||
|
||||
/** Species manifest — one per registered species. */
|
||||
export interface SpeciesManifest {
|
||||
id: string
|
||||
/** Display name in French */
|
||||
labelFr: string
|
||||
/** Absolute public path to the main anatomy SVG */
|
||||
mainSvg: string
|
||||
/**
|
||||
* Map of detail popup id → absolute public path to detail SVG.
|
||||
* Keys match data-opens-detail attribute values in the main SVG.
|
||||
*/
|
||||
details: Record<string, string>
|
||||
vertebralFormula: VertebralFormula
|
||||
/** Lazy-loaded pathology database for this species */
|
||||
pathologies: PathologiesLoader
|
||||
}
|
||||
Reference in new issue
Block a user