E5.S1 compleet: AI filtert op behandelrelevantie voor psychiaters. Voortgang: 56 SP / 72 SP (78%) - Epic 5 in progress! Implementatie: - Twee-staps filtering: Server (include_in_handover=true) → AI (psychiater: behandelrelevant) - Role toggle UI: Verpleegkundige/Psychiater knoppen in OverdrachtBlock - buildSystemPrompt(role) functie met psychiater-specifieke filtering regels - filterForRole parameter toegevoegd aan GenerateOverdrachtSchema - API route verwerkt role parameter en stuurt door naar Claude AI Psychiater filtering regels: ✅ WEL RELEVANT: - Medicatie-issues: weigering, bijwerkingen, dosisaanpassingen - Stemming/gedrag: veranderingen, afwijkend gedrag, agitatie - Risico-signalen: suïcidaliteit, automutilatie, agressie - Psychotische symptomen: wanen, hallucinaties - Crisis/dwang: separatie, fixatie, dwangmedicatie - Afwijkende vitals: HH, LL met behandelimpact ❌ FILTER UIT: - Routine medicatie ("volgens schema", "zonder problemen") - ADL activiteiten (douchen, eten) tenzij significant afwijkend - Sociale activiteiten ("groepstherapie", "gesprek gehad") - Standaard observaties ("rustige dag", "geen bijzonderheden") - Routine vitals (normaal bereik, N interpretatie) - Dagstructuur ("dagprogramma gevolgd") UI/UX verbeteringen: - Role toggle met 2 knoppen (verpleegkundige/psychiater) - Visual hints: "Alle gemarkeerde items" vs "Behandelrelevante items" - Dynamic description tekst onder toggle - filterRole state + useCallback dependency update Files Changed: - lib/types/overdracht.ts: +1 line (filterForRole in schema) - lib/ai/overdracht-prompt.ts: +52 lines (buildSystemPrompt functie) - app/api/overdracht/generate/route.ts: +8/-8 lines (role parameter) - components/swift/blocks/overdracht-block.tsx: +43 lines (UI + logic) Technische details: - filterForRole default: 'verpleegkundige' - Psychiater max: 3 aandachtspunten, 2 actiepunten - Verpleegkundige max: 5 aandachtspunten, 3 actiepunten - Role parameter propageert van UI → API → Claude prompt Testing: - Build succesvol (pnpm build) - Geen nieuwe type errors - UI toggle functioneel Voortgang: 56 SP / 72 SP (78%) - E5.S1 compleet (5 SP) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
109 lines
2.5 KiB
TypeScript
109 lines
2.5 KiB
TypeScript
import { z } from 'zod';
|
|
import type { Json } from '@/lib/supabase/database.types';
|
|
|
|
// Patient overview for list view
|
|
export interface PatientOverzicht {
|
|
id: string;
|
|
name_given: string[];
|
|
name_family: string;
|
|
birth_date: string;
|
|
gender: string;
|
|
alerts: {
|
|
high_risk_count: number;
|
|
abnormal_vitals_count: number;
|
|
marked_logs_count: number;
|
|
incident_count: number;
|
|
total: number;
|
|
};
|
|
}
|
|
|
|
export interface PatientOverzichtResponse {
|
|
patients: PatientOverzicht[];
|
|
total: number;
|
|
date: string;
|
|
}
|
|
|
|
// Patient detail for detail view
|
|
export interface PatientDetail {
|
|
patient: {
|
|
id: string;
|
|
name_given: string[];
|
|
name_family: string;
|
|
name_prefix?: string;
|
|
birth_date: string;
|
|
gender: string;
|
|
};
|
|
vitals: VitalSign[];
|
|
reports: Report[];
|
|
risks: RiskAssessment[];
|
|
conditions: Condition[];
|
|
}
|
|
|
|
// Vital sign with interpretation
|
|
export interface VitalSign {
|
|
id: string;
|
|
code_display: string;
|
|
value_quantity_value: number | null;
|
|
value_quantity_unit: string | null;
|
|
interpretation_code?: string | null; // 'H' | 'L' | 'N'
|
|
effective_datetime: string;
|
|
}
|
|
|
|
// Report (rapportage) - now includes verpleegkundig type (was nursing_logs)
|
|
export interface Report {
|
|
id: string;
|
|
type: string;
|
|
content: string;
|
|
created_at: string;
|
|
created_by: string | null;
|
|
structured_data?: Json | null; // Contains category for verpleegkundig
|
|
include_in_handover?: boolean | null;
|
|
shift_date?: string | null;
|
|
}
|
|
|
|
// Risk assessment
|
|
export interface RiskAssessment {
|
|
id: string;
|
|
risk_type: string;
|
|
risk_level: string;
|
|
rationale?: string | null;
|
|
created_at: string | null;
|
|
}
|
|
|
|
// Condition (diagnose)
|
|
export interface Condition {
|
|
id: string;
|
|
code_display: string;
|
|
clinical_status: string;
|
|
onset_datetime?: string;
|
|
}
|
|
|
|
// AI Summary types
|
|
export interface AISamenvatting {
|
|
samenvatting: string;
|
|
aandachtspunten: Aandachtspunt[];
|
|
actiepunten: string[];
|
|
generatedAt: string;
|
|
durationMs: number;
|
|
}
|
|
|
|
export interface Aandachtspunt {
|
|
tekst: string;
|
|
urgent: boolean;
|
|
bron: {
|
|
type: 'observatie' | 'rapportage' | 'verpleegkundig' | 'risico';
|
|
id: string;
|
|
datum: string;
|
|
label: string;
|
|
};
|
|
}
|
|
|
|
// Zod schema for generate request
|
|
export const GenerateOverdrachtSchema = z.object({
|
|
patientId: z.string().uuid('Patient ID moet een geldige UUID zijn'),
|
|
period: z.enum(['1d', '3d', '7d', '14d']).optional().default('1d'),
|
|
filterForRole: z.enum(['psychiater', 'verpleegkundige']).optional().default('verpleegkundige'),
|
|
});
|
|
|
|
export type GenerateOverdrachtInput = z.infer<typeof GenerateOverdrachtSchema>;
|