Verpleegrapportage module: - Nieuwe /epd/verpleegrapportage met patiëntenoverzicht - Rapportage invoer workspace met timeline view - Overdracht overzicht met AI-samenvatting - API endpoints voor verpleegrapportage data Opruiming: - Oude /epd/overdracht en /epd/dagregistratie verwijderd (vervangen) - Oude /api/nursing-logs verwijderd (geconsolideerd naar reports) - Verouderde design docs en reports verwijderd - Fonts verplaatst van docs/ naar public/fonts/ Bugfixes: - Risk-manager: fix constraint violation (db values vs display labels) - Overdracht API: filter op rapportages i.p.v. encounters Database: - Migratie voor consolidatie nursing_logs naar reports tabel 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.7 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Mini-EPD Prototype - A Dutch electronic patient dossier (EPD) system for healthcare providers. Built with Next.js 14 App Router, Supabase (PostgreSQL + Auth), and Tailwind CSS. Primary language is Dutch for UI text.
Development Commands
pnpm dev # Development server at localhost:3000
pnpm build # Production build (fails on type errors)
pnpm lint # ESLint check
pnpm types:generate # Regenerate Supabase types after schema changes
Environment Variables
Required in .env.local:
NEXT_PUBLIC_SUPABASE_URL- Supabase project URLNEXT_PUBLIC_SUPABASE_ANON_KEY- Supabase anonymous keyANTHROPIC_API_KEY- Claude API for AI featuresDEEPGRAM_API_KEY- Deepgram for speech-to-text
Architecture
Data Layer
- Supabase for PostgreSQL database and authentication
- FHIR-inspired data model: patients, observations, conditions, encounters
- Row Level Security (RLS) on all tables - check policies before writing queries
- Types generated to
lib/supabase/database.types.ts - Server client:
lib/auth/server.ts(for Server Components/API routes) - Client:
lib/supabase/client.ts(for Client Components)
API Structure (app/api/)
/api/reports- Unified CRUD for all report types (verpleegkundig, observatie, incident, etc.)/api/overdracht- Handover data: patients, patient details, AI summary generation/api/verpleegrapportage- Patient data for nursing report views/api/behandelplan- Treatment plan management
API Route Pattern: All routes use Zod validation, return Dutch error messages, and get the current user via createClient() from lib/auth/server.ts.
EPD Modules (app/epd/)
/epd/verpleegrapportage- Overdracht overzicht (patiënten met AI-samenvatting)/epd/verpleegrapportage/rapportage- Rapportage invoer workspace (timeline view)/epd/patients/[id]- Patient dossier with intakes, conditions, observations/epd/agenda- Appointment calendar (FullCalendar)/epd/clients- Client management
Key Patterns
Report Types (stored in reports table):
type ReportType = 'voortgang' | 'observatie' | 'incident' | 'medicatie' |
'contact' | 'crisis' | 'intake' | 'behandeladvies' |
'vrije_notitie' | 'verpleegkundig';
Verpleegkundig Categories (in structured_data.category):
type Category = 'medicatie' | 'adl' | 'gedrag' | 'incident' | 'observatie';
Shift Date Logic: Reports created before 07:00 are assigned to the previous day's shift.
Soft Delete: Reports use deleted_at timestamp, not hard delete.
AI Integration
- Claude API for generating handover summaries (
/api/overdracht/generate) - Deepgram for speech-to-text (
/api/deepgram) - AI responses validated with Zod schemas
UI Components
- shadcn/ui components in
components/ui/ - Lucide React for icons
- date-fns with Dutch locale for date formatting
- Timeline views grouped by day and day-part (nacht/ochtend/middag/avond)
Database Migrations
Located in supabase/migrations/. Migration naming: YYYYMMDD_description.sql
After schema changes:
- Create migration file in
supabase/migrations/ - Apply with Supabase CLI or dashboard
- Run
pnpm types:generateto update TypeScript types
Type System
lib/supabase/database.types.ts- Auto-generated from Supabase schema (do not edit)lib/types/*.ts- Manual type definitions that extend/refine generated types
Documentation
- Specs in
docs/specs/organized by module - Release notes in
docs/releasenotes/