colinislit
43d4d095ce
fix: case-insensitive voornaam zoeken door capitalize toe te passen
...
Voornaam zoeken werkte niet omdat name_given array case-sensitive is.
Capitalize nu de zoekterm (eerste letter hoofdletter) voordat deze
wordt gebruikt in de array search, zodat 'jan' matcht met 'Jan'.
Aangepast in beide search endpoints:
- /api/patients/search
- /api/cortex/patients/search
2026-01-03 11:47:12 +01:00
colinislit
7b9de4ada2
feat(ui): mobile responsiveness audit + type fixes
...
Mobile Responsiveness:
- Viewport meta tags toegevoegd in layout.tsx
- EPD header: patient details verborgen op mobiel, zoekbalk responsive
- Agenda: auto-switch naar dagview op mobiel, mini-kalender verborgen
- Agenda toolbar: verticale stacking, Week/Werkweek knoppen verborgen
- Patiëntenlijst: compact icoon-only button op mobiel
- Verpleegrapportage: verticale flow i.p.v. twee-koloms layout
- Cortex: artifact overlay met slide-in animatie op mobiel
- Cortex: "Terug" knop toegevoegd aan artifact panels
- Toast feedback bij succesvolle afspraak creatie
Code Quality Fixes (KISS/DRY):
- Resize listener vervangen door bestaande useMediaQuery hook
- Dubbele flex class opgeschoond in epd-header.tsx
- userScalable: false verwijderd (accessibility)
Type Fixes:
- actions.ts: status literal type met 'as const'
- agenda-block.tsx: dateRange start/end optioneel
- chat-empty-state.tsx: framer-motion ease type
- cortex-store.ts: ChatEntities.dateRange consistent met Zod schema
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-03 10:28:04 +01:00
colinislit
52e07aaf80
fix(cortex): update date handling in API and UI components
...
- Adjusted date handling in the agenda API to ensure optional parameters for start, end, and label are correctly processed.
- Enhanced chat input and action parser to support optional date labels for relative dates.
- Updated agenda components to handle date ranges and loading states more effectively.
- Improved error handling and loading indicators in the agenda block for better user experience.
This commit ensures consistency in date handling across the application, aligning with the new requirements for relative date inputs.
2026-01-02 09:21:37 +01:00
colinislit
011815072b
refactor(cortex): consistente datumbepaling met referenceDate parameter
...
SOC: Parser en entity-extractor accepteren nu optionele referenceDate
parameter. Caller bepaalt wat "nu" is, niet de functies intern.
Wijzigingen:
- parseRelativeDate(input, referenceDate?) - referenceDate parameter
- extractEntities(input, intent, referenceDate?) - doorgeeft aan parser
- API routes gebruiken new Date() als referenceDate
Verwijderd (YAGNI):
- lib/utils/server-date.ts - wrapper om new Date() was overbodig
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-02 08:49:20 +01:00
colinislit
b36df63d03
feat(cortex): Epic 2 - Intent Orchestrator (Layer 2) complete
...
Implements AI-powered multi-intent classification for Cortex V2.
When Reflex Arc (Layer 1) detects complexity, it escalates to
the Orchestrator for intelligent classification using Claude 3.5 Haiku.
E2.S1 - System prompt for Orchestrator
- ORCHESTRATOR_SYSTEM_PROMPT constant with Dutch instructions
- Multi-intent detection (en, daarna, ook, eerst, vervolgens)
- Pronoun resolution rules (hij/zij → active patient)
- JSON-only output format specification
E2.S2 - Context formatting for AI
- formatContextForPrompt() with emoji structure
- Dutch labels for shifts and views
- Graceful null handling, token limiting (max 5 agenda, 3 recent)
E2.S3 - AI classification endpoint
- classifyWithOrchestrator() calling Claude 3.5 Haiku
- Builds IntentChain from AI response
- Tracks tokens used and processing time
E2.S4 - IntentChain parsing with Zod
- parseAIResponse() with Zod schema validation
- Strips markdown code blocks
- Partial extraction for malformed responses
- Graceful fallback to intent: 'unknown'
E2.S5 - POST /api/cortex/classify hybrid endpoint
- Reflex first, escalate to Orchestrator if needed
- Response includes handledBy: 'reflex' | 'orchestrator'
- Auth check, feature flag check, request validation
E2.S6 - Graceful fallback
- buildFallbackChain() with confidence cap (0.6)
- buildChainFromReflex() for simple chains
- classifyWithTimeout() wrapper (5s default)
New files:
- lib/cortex/orchestrator.ts (~780 lines)
- app/api/cortex/classify/route.ts (~180 lines)
Key deliverable: "Zeg Jan af en maak notitie" correctly
parsed into 2 actions in an IntentChain.
Progress: 27 SP / 48 SP (56%) - E0, E1, E2 complete
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-01 11:28:14 +01:00
colinislit
7df92dd2fb
feat(blog): enhance blog functionality and SEO
...
- Added a new '/blog' route to middleware for improved navigation.
- Updated sitemap to dynamically include blog posts and series URLs.
- Enhanced blog page metadata with Open Graph and Twitter card information.
- Implemented structured data for blog posts and series to improve SEO.
- Removed outdated blog post "Week 1: De Kickoff" from content.
- Introduced optional OG image field in blog frontmatter for better sharing visuals.
2026-01-01 10:56:34 +01:00
colinislit
e7294e712f
feat(navigation): add Blog link to Dutch navigation
...
- Introduced a new link for "Blog" in the navigation JSON file, enhancing user access to blog content.
2026-01-01 09:39:30 +01:00
colinislit
cf26022583
feat(cortex): Epic 0 - Foundation & Context voor V2 architectuur
...
Implementeert de basis voor de Cortex V2 three-layer architecture.
E0.S1 - CortexContext Types (lib/cortex/types.ts):
- EscalationReason type voor Reflex → Orchestrator
- LocalClassificationResult met ambiguity detection
- CortexContext voor AI classificatie context
- IntentChain en IntentAction voor multi-intent flows
- NudgeSuggestion voor proactieve suggesties
- CONFIDENCE_THRESHOLD (0.7) en AMBIGUITY_THRESHOLD (0.1)
- getCurrentShift() utility (DRY - herbruikbaar)
E0.S2 - Context API (app/api/cortex/context/route.ts):
- GET endpoint voor huidige context
- Haalt agenda vandaag op uit database
- Retourneert CortexContext object
E0.S3 - Feature Flags (lib/config/feature-flags.ts):
- CORTEX_V2_ENABLED, CORTEX_MULTI_INTENT
- CORTEX_NUDGE, CORTEX_LOGGING
- isFeatureEnabled() helper
- Dev mode: default true
E0.S4 - CortexStore V2 (stores/cortex-store.ts):
- Types geïmporteerd uit lib/cortex (DRY)
- ChatEntities type voor AI responses (string-based)
- V2 state: context, activeChain, chainHistory, suggestions
- V2 actions: chain management, nudge management, clarification
E0.S5 - Classification Logging (lib/cortex/logger.ts):
- PII sanitization (BSN, tel, namen, email)
- logClassification(), logEscalation(), logNudge()
- logPerformance() met threshold checks
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-31 12:46:35 +01:00
colinislit
06287d49f4
refactor(login): update interface preference from 'swift' to 'cortex'
...
- Changed default interface preference in LoginForm component from 'klassiek' to 'cortex'.
- Updated redirect path logic to reflect the new 'cortex' preference.
- Modified button label and state management to align with the new interface preference terminology.
- Adjusted type definition for InterfacePreference to include 'cortex' instead of 'swift'.
2025-12-31 10:08:22 +01:00
colinislit
2170b23348
refactor: rename swift → cortex in code and documentation
...
Complete rename of "swift" terminology to "cortex" across the codebase:
Code Changes:
- Rename directories: lib/swift → lib/cortex, components/swift → components/cortex
- Rename API routes: /api/swift/* → /api/cortex/*
- Rename page routes: /epd/swift → /epd/cortex
- Rename store: swift-store.ts → cortex-store.ts
Type Renames:
- SwiftIntent → CortexIntent
- SwiftStore → CortexStore
- useSwiftStore → useCortexStore
- SwiftContext → CortexContext
- useSwiftVoice → useCortexVoice
Documentation Updates (docs/intent/):
- Safety Net → Nudge (Layer 3 rename)
- SafetySuggestion → NudgeSuggestion
- evaluateSafetyNet → evaluateNudge
- SWIFT_* feature flags → CORTEX_*
- All path references updated to match new structure
Files affected: 47 files, ~700 lines changed
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-30 09:18:06 +01:00
colinislit
c8aaba657e
refactor(swift): update references from Medical Scribe to Swift Assistent
...
- Updated comments and documentation to reflect the new branding of the chat API and related components.
- Renamed functions and variables to align with the Swift Assistent terminology.
- Enhanced UI components with animations using Framer Motion for a smoother user experience.
- Removed outdated architecture documentation related to the Medical Scribe system.
This change is part of the transition to the Swift Assistent branding, ensuring consistency across the application.
2025-12-29 22:40:34 +01:00
colinislit
14a9d34337
feat(swift): voeg chat orchestration toe (E5)
...
Epic 5 compleet: Chat orchestration voor Swift Agenda Planning.
Alle agenda intents worden nu correct gerouteerd naar AgendaBlock
met user-friendly error handling en fallback opties.
E5.S1 - Action Routing (2 SP)
- routeIntentToArtifact() functie in action-parser
- Maps agenda intents naar juiste AgendaBlock mode
- Confidence threshold enforcement (< 0.7 → fallback)
- Required entity validation (patient voor create, identifier voor reschedule)
- Command-input gebruikt nieuwe routing ipv legacy openBlock
- Migratie naar modern artifact systeem (openArtifact)
E5.S2 - Chat Prompt Update (2 SP)
- 4 agenda intents toegevoegd aan Swift chat system prompt
- agenda_query: afspraken opvragen op datumrange
- create_appointment: nieuwe afspraak maken (required: patient, datetime)
- cancel_appointment: afspraak annuleren (disambiguation support)
- reschedule_appointment: afspraak verzetten (required: identifier)
- Entity extraction rules gedocumenteerd (dateRange, datetime, identifier)
- 4 complete voorbeelden met JSON action format
- Clarification questions voor incomplete data
- Prompt size: ~325 → ~525 regels (+60%)
E5.S3 - Error States (2 SP)
- AgendaErrorState component voor full-page errors
- AgendaErrorAlert component voor inline form errors
- getUserFriendlyMessage() vertaalt technical → user-friendly Dutch
- Auto-redirect bij auth errors (401 → /login)
- Fallback link naar /epd/agenda in alle error states
- Context-aware messaging (query/create/cancel/reschedule)
- Retry functionaliteit voor recoverable errors
- Dev-only technical details collapsible
Error message mapping:
- 401 → "Je sessie is verlopen. Log opnieuw in." + auto-redirect
- 403 → "Je hebt geen toegang tot deze afspraak."
- 404 → "De gevraagde afspraak kon niet worden gevonden."
- 500 → "Er ging iets mis op de server. Probeer het opnieuw."
- Network → "Geen internetverbinding. Controleer je netwerkverbinding."
- Timeout → "De aanvraag duurde te lang. Probeer het opnieuw."
Components updated:
- command-input: gebruikt routeIntentToArtifact + openArtifact
- agenda-create-form: gebruikt AgendaErrorAlert met fallback link
- chat/route: uitgebreide system prompt met agenda sectie
Nieuwe files:
- lib/swift/action-parser.ts: routeIntentToArtifact() functie
- components/swift/artifacts/blocks/agenda-error-state.tsx (225 regels)
- docs/swift/implementation-e5-s1-action-routing.md
- docs/swift/implementation-e5-s2-chat-prompt.md
- docs/swift/implementation-e5-s3-error-states.md
Documentatie:
- Bouwplan bijgewerkt: Epic 5 → Done
- 3 implementation docs met API specs en testing scenarios
- Error handling best practices gedocumenteerd
Progress: 48 SP / 51 SP (94%) - Epic 6 (QA) remaining
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-27 22:44:18 +01:00
colinislit
d2ffccc22b
feat(swift): voeg agenda backend API's toe (E3)
...
Epic 3 compleet: Backend integratie voor Swift Agenda Planning.
Nieuwe endpoints:
- GET /api/swift/agenda - Query afspraken op datumrange
- POST /api/swift/agenda/create - Nieuwe afspraak aanmaken
- POST /api/swift/agenda/cancel - Afspraak annuleren
- POST /api/swift/agenda/reschedule - Afspraak verzetten
- GET /api/swift/patients/search - Fuzzy patiënt zoeken
Alle endpoints bevatten:
- Supabase authenticatie + resource ownership checks
- Zod validatie met Nederlandse foutmeldingen
- Hergebruik van bestaande agenda server actions
Test documentatie: docs/swift/test-plan-epic3-backend.md
Progress: 3/7 Epics compleet (E0, E1, E2, E3)
Story points: 11 SP (E3.S1: 3, E3.S2: 3, E3.S3: 3, E3.S4: 2)
2025-12-27 22:12:01 +01:00
colinislit
43467f07fa
feat: show patient dashboard artifact on selection
2025-12-27 20:50:39 +01:00
colinislit
812c41a042
feat: split swift into standalone module
2025-12-27 19:56:24 +01:00
colinislit
adf6c3fb96
feat(swift): implementeer linked evidence UI voor overdracht (E5.S2)
...
E5.S2 compleet: Bronnotitie links met hover preview in OverdrachtBlock.
Voortgang: 66 SP / 82 SP (80%) - Epic 5 40% compleet!
Implementatie:
- Bronverwijzingen nu klikbaar met hover popover voor volledige content
- Source data enrichment in API response
- Type-specific content display (observaties, rapportages, risico's)
- Visual feedback met icons en kleuren per bron type
Components & Types:
- LinkedEvidence component (160 regels) - Reusable popover voor alle bron types
- Aandachtspunt type extended met optionele sourceData field
- enrichWithSourceData() functie in API route (48 regels)
LinkedEvidence Features:
- Hover popover met volledige bron content
- Type-specific icons: Activity (observatie), FileText (rapportage), AlertTriangle (risico)
- Click/hover trigger met underline-dotted styling
- ExternalLink icon voor visual affordance
- Popover positioning: top-start voor beste UX
Source Data per Type:
- Observaties: value + unit + interpretation (HH/H/N/L/LL) met kleuren
- Rapportages/Verpleegkundig: content + createdBy
- Risico's: riskLevel + rationale met severity kleuren
API Enrichment Logic:
- enrichWithSourceData() lookup in context (vitals, reports, risks)
- Source data toegevoegd aan aandachtspunten vóór response
- Type-safe matching op bron.id en bron.type
- Backwards compatible: werkt met/zonder sourceData
UI/UX Improvements:
- Color-coded interpretations: Red (HH/LL kritiek), Amber (H/L), Teal (N)
- Color-coded risk levels: Red (zeer hoog/hoog), Amber (gemiddeld), Teal (laag)
- Formatted text display met bg-slate-50 border
- Responsive popover met max-width 96 (384px)
- Fallback: geen sourceData = plain text zonder popover
Integration in OverdrachtBlock:
- AandachtspuntItem gebruikt LinkedEvidence component
- Replaced: "bron.label • bron.datum" plain text
- Now: LinkedEvidence met hover preview
Files Changed:
- lib/types/overdracht.ts: +12 lines (sourceData interface)
- app/api/overdracht/generate/route.ts: +58 lines (enrichWithSourceData)
- components/swift/blocks/overdracht-block.tsx: +1/-3 lines (LinkedEvidence import/usage)
- components/swift/shared/linked-evidence.tsx: +160 lines (NEW)
Technical Details:
- Popover from shadcn/ui (@/components/ui/popover)
- Icons from lucide-react (Activity, FileText, AlertTriangle, ExternalLink)
- Type guards voor safe property access (sourceData?.value)
- Underline decoration-dotted cursor-help voor accessibility
Testing:
- Build succesvol (pnpm build)
- /epd/swift: 143 kB (+24 kB door LinkedEvidence component)
- Geen nieuwe type errors
- Popover trigger werkt met keyboard (accessible)
Voortgang: 66 SP / 82 SP (80%) - E5.S2 compleet (3 SP)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-27 18:38:45 +01:00
colinislit
c6616d85b2
feat(swift): implementeer AI-filtering psychiater voor overdracht (E5.S1)
...
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 >
2025-12-27 17:44:09 +01:00
colinislit
a10a4c3813
feat(swift): implementeer slide-in animaties + Epic 4 compleet (E4.S3)
...
Epic 4 volledig afgerond! Artifact systeem compleet met tabs, lifecycle, en animaties.
Voortgang: 58 SP / 82 SP (71%) - 21/31 stories compleet, 3 geskipt
E4.S3 - Slide-in Animatie (2 SP)
- artifact-enter keyframes in globals.css (200ms ease-out)
- Slide van rechts: translateX(100%) → translateX(0) met opacity fade
- Reduced motion support: animation: none bij prefers-reduced-motion
- ArtifactContainer: artifact-enter class op content wrapper
- Key prop (activeArtifact.id) triggert re-animation bij switch
- Smooth visuele feedback bij artifact opening/switching
- Build succesvol zonder errors
E4.S4 - GESKIPT (Placeholder State)
- Placeholder al volledig geïmplementeerd in E4.S1
- Bevat emoji (📋 ), titel, en voorbeelden zoals gespecificeerd
- 3 SP geannuleerd (totaal nu 82 SP i.p.v. 85 SP)
Epic 4 Samenvatting:
- ✅ E4.S1: ArtifactContainer met tabs (5 SP)
- ✅ E4.S2: Lifecycle management (3 SP)
- ✅ E4.S3: Slide-in animaties (2 SP)
- ❌ E4.S4: Placeholder (geskipt, in E4.S1)
Components Updated:
- app/globals.css: artifact-enter keyframes + reduced motion support
- artifact-container.tsx: animatie class op wrapper met key prop
Documentatie:
- Bouwplan bijgewerkt naar v3.0 (Epic 4 compleet)
- E4.S3 deliverables gedocumenteerd
- E4.S4 skip rationale toegevoegd
- Voortgang: 71% compleet (58/82 SP)
- Epic overzicht: 4/6 epics compleet
Volgende Epic: E5 (AI-Filtering & Polish) - 13 SP
🎉 Epic 4 compleet! Artifact systeem volledig functioneel!
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-27 16:39:46 +01:00
colinislit
8efac8483f
feat(swift): implementeer medical scribe system prompt (E3.S3)
...
Epic 3 Story 3 compleet: Volledige medical scribe prompt v1.0 geïmplementeerd.
E3.S3 - Medical Scribe System Prompt (3 SP)
- buildMedicalScribePrompt() functie (243 regels)
- Intent detection voor P1 intents: dagnotitie, zoeken, overdracht
- P2 intents: rapportage, agenda
- Confidence thresholds (>0.9, 0.7-0.9, 0.5-0.7, <0.5)
- JSON action object format met artifact prefill
- Context injection (activePatient, shift)
- Verduidelijkingsvragen en error handling
- Nederlands tone of voice (vriendelijk, professioneel, to-the-point)
- 4 voorbeelden: happy path, zoeken, verduidelijking, onduidelijke intent
Key Features:
- Intent herkenning met triggers en entities
- Automatische category detection (medicatie/adl/gedrag/incident/observatie)
- Slim gebruik van context (activePatient als default)
- Follow-up conversatie support
- Error handling met Nederlandse messages
Prompt Structuur:
- Je rol: medical scribe voor Swift GGZ EPD
- Wat je doet: intents herkennen, verduidelijken, actions genereren
- Wat je NIET doet: medisch advies, aannames, lange uitleg
- Context: activePatient, shift injection
- Voorbeelden: 4 concrete user flows
Components Updated:
- app/api/swift/chat/route.ts: buildMedicalScribePrompt() functie
Documentatie:
- docs/swift/e0-medical-scribe-system-prompt.md (519 regels)
- docs/swift/e0-design-tokens-and-components.md (E0.S1 & E0.S2)
- docs/swift/bouwplan-swift-v3.md: E3.S3 ✅ compleet
Build Status:
- ✅ pnpm build succesvol (geen type errors)
- Alleen bekende Supabase realtime warnings
Voortgang: 41 SP / 85 SP (48%) - E3.S3 compleet
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-27 14:46:26 +01:00
colinislit
a51acf6214
feat(swift): voeg chat API met Claude streaming toe (E3.S1-S2)
...
E3.S1 - Chat API endpoint skeleton (3 SP)
- /api/swift/chat route met SSE setup
- Zod validation (message, messages, context)
- Authentication check (session required)
- Rate limiting (20 requests per minute)
- Request body schema voor chat messages en context
E3.S2 - Streaming response logic (5 SP)
- Claude API integration (Anthropic Sonnet 4)
- Real-time streaming via Server-Sent Events
- Event parsing (content_block_delta, message_stop, error)
- Simple system prompt met context injection
- Error handling voor API failures
API Route Features:
- Model: claude-sonnet-4-20250514
- Max tokens: 2048, Temperature: 0.7
- Conversation history: max 20 messages
- Rate limiting per user (20 req/min)
- Request cancellation support
- Context: activePatient + shift
SSE Event Format:
- content_block_delta → {"type":"content","text":"..."}
- message_stop → {"type":"done"}
- error → {"type":"error","error":"..."}
Client Helper (lib/swift/chat-api.ts):
- sendChatMessage() function voor frontend
- SSE stream parsing met TextDecoder
- Callbacks: onChunk, onDone, onError
- Error handling en retry logic
ChatPanel Integration:
- Real-time streaming met updateLastMessage()
- isStreaming state voor UI feedback
- Context injection (patient, shift)
- Error messages in chat
System Prompt (Simple):
- Nederlandse medische assistent voor Swift GGZ EPD
- Context-aware (patiënt + dienst)
- Vriendelijk en professioneel
- Medical scribe functionaliteit komt in E3.S3
Files Created:
- app/api/swift/chat/route.ts (279 regels)
- lib/swift/chat-api.ts (113 regels)
Files Updated:
- components/swift/chat/chat-panel.tsx (+52 regels) - Streaming integration
Epic 3 Progress: 2/6 stories compleet (8 SP / 21 SP = 38%)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-27 14:26:16 +01:00
ikbenlit
5174b48f48
refactor(swift): Update UI styles and animations for improved consistency
...
- Changed background colors and text colors across various components to enhance readability and visual appeal.
- Updated animation properties for smoother transitions in CanvasArea and BlockContainer.
- Adjusted styles in FallbackPicker, OverdrachtBlock, and other components to align with the new design system.
- Improved accessibility by ensuring color contrasts meet standards.
This update aims to create a more cohesive user experience throughout the application.
2025-12-26 13:10:04 +01:00
colinislit
d67405df5f
feat(swift): Epic 4 - Navigation & Auth compleet
...
E4.S1 - Login form uitbreiden:
- Interface selector (Swift/Klassiek) toegevoegd
- Visuele keuze met icons (Layout/Zap)
- Redirect naar gekozen interface na login
E4.S2 - Preference opslag:
- updateInterfacePreference() in lib/auth/client.ts
- getInterfacePreference() voor ophalen
- Opslag in user_metadata.preferred_interface
E4.S3 - Redirect middleware:
- /epd → redirect naar preferred interface
- /login → redirect naar preferred interface (als ingelogd)
- Default: klassiek (/epd/clients)
E4.S4 - Fallback Picker:
- FallbackPicker component voor lage confidence
- Grid met 3 opties (Notitie, Zoeken, Overdracht)
- Keyboard shortcuts [1], [2], [3]
- Toont originele input voor context
Voortgang: Epic 4 compleet (8 SP)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-24 09:28:10 +01:00
ikbenlit
1e199bf6f7
feat(login): add interface preference selection and redirect logic
...
- Introduced interface preference options ('swift' and 'klassiek') in the login form.
- Implemented dynamic redirect paths based on the selected interface preference.
- Enhanced user experience with visual feedback for interface selection.
2025-12-24 09:08:04 +01:00
ikbenlit
2a67a0a2d9
git commit -m "feat(swift): implement Epic 3 - P1 Blocks (E3.S0-S6)" -m "Epic 3 compleet: Alle P1 blocks geïmplementeerd met volledige functionaliteit." -m "E3.S0 - CanvasArea block rendering" -m "- Switch/case voor block types met prefill data" -m "- AnimatePresence voor smooth transitions" -m "- PatientContextCard auto-display wanneer activePatient is gezet" -m "" -m "E3.S1 - Block Container animaties" -m "- Framer Motion animaties voor container, content en close button" -m "- Stagger effecten voor content children" -m "- Hover/tap animaties voor close button" -m "" -m "E3.S2 - DagnotatieBlock" -m "- Patient search met debounced FHIR API integratie" -m "- Category selector (medicatie, adl, gedrag, incident, observatie)" -m "- Textarea met character counter (max 500)" -m "- Opslaan naar /api/reports met validatie en error handling" -m "" -m "E3.S3 - Patient search API" -m "- GET /api/patients/search?q= met fuzzy search" -m "- Match score berekening voor resultaten" -m "- Auth check en error handling" -m "" -m "E3.S4 - ZoekenBlock" -m "- Debounced patient search met dropdown" -m "- Patient selectie → setActivePatient in store" -m "- Auto-close na selectie + recent action" -m "" -m "E3.S5 - PatientContextCard" -m "- Auto-open na patient selectie" -m "- Notities, vitals, diagnoses en risico's secties" -m "- API integratie met /api/overdracht/[patientId]" -m "" -m "E3.S6 - OverdrachtBlock" -m "- Lijst van patiënten met activiteit" -m "- Period selector (1d, 3d, 7d, 14d)" -m "- AI samenvatting generatie per patiënt" -m "- Aandachtspunten en actiepunten weergave" -m "" -m "Technische verbeteringen:" -m "- Technische debt opgelost: BlockContainer animaties, CanvasArea rendering" -m "- PatientContextCard toegevoegd aan blocks" -m "- Alle blocks gebruiken BlockContainer voor consistente styling" -m "" -m "Voortgang: 56 SP / 72 SP (78%) - Epic 3 compleet"
2025-12-24 09:06:39 +01:00
colinislit
db036a3d92
feat(swift): E2 Intent Classification voltooid
...
Epic 2 - Intent Classification (10 SP):
- E2.S1: Local classifier met regex patterns (<50ms)
- E2.S2: Entity extraction (patientName, category, content)
- E2.S3: AI fallback met Claude Haiku bij confidence <0.8
- E2.S4: POST /api/intent/classify API route
Two-tier systeem:
1. Lokale regex classificatie (snel, offline)
2. AI fallback voor lage confidence of complexe input
Bouwplan bijgewerkt naar v1.4 (31/68 SP, 46% done)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Colin Lit <colin@example.com >
2025-12-23 22:59:30 +01:00
colinislit
7f91e048f3
feat(swift): E1 Command Center voltooid
...
E1.S1 Command Center layout:
- 4-zone layout (context, canvas, recent, input)
- Keyboard shortcuts (⌘K focus, Escape close)
- CanvasArea met empty state + voorbeelden
E1.S2 Context Bar:
- Shift indicator met icons per dienst
- Patient chip met avatar + clear button
- Terug naar EPD link
E1.S3 Command Input:
- Dynamic placeholder op basis van context
- Send button (verschijnt bij input)
- Focus state met ring
E1.S4 Voice Input:
- useSwiftVoice hook (wraps Deepgram)
- Real-time waveform visualisatie
- Streaming transcript naar input
E1.S5 Recent Strip:
- Intent-based chips met icons + kleuren
- Relative time (zojuist, 5m, 2u)
- Click-to-repeat functionaliteit
- Quick hints bij lege state
Bouwplan bijgewerkt: E0+E1 done (21/68 SP, 31%)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-23 22:44:39 +01:00
colinislit
855b1e99ae
feat(swift): E0 Setup & Foundation + documentatie
...
Swift - Contextual UI EPD: "Van 12 klikken naar 1 zin"
Documentatie:
- PRD, FO, TO, UX specificaties
- Bouwplan met 6 epics, 27 stories (68 SP)
- Analyse en onderzoeksdocumenten
E0 Setup & Foundation:
- E0.S1: Zustand v5.0.9 geïnstalleerd
- E0.S2: Swift store met context, blocks, input state
- E0.S3: /epd/swift route met eigen layout (dark theme)
- E0.S4: Folder structuur components/swift/, lib/swift/
Components:
- CommandCenter (container)
- ContextBar (shift, patient)
- CommandInput (text + voice button)
- RecentStrip (laatste 5 acties)
- BlockContainer (wrapper voor blocks)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-23 22:28:41 +01:00
colinislit
4606a975aa
feat(diagnose): Master-detail layout en verbeterde ICD-10 combobox
...
Diagnose pagina:
- Master-detail layout (lijst links, formulier rechts)
- URL state voor selectie (?selected=uuid of ?selected=new)
- Inline CRUD zonder modals of navigatie
- Vereenvoudigde header (alleen actieve diagnoses teller)
ICD-10 Combobox:
- Vervangen cmdk/Command met simpele Popover + buttons (fix selectie bug)
- Direct typen in input veld (geen extra klik nodig)
- Auto-open dropdown bij focus/typen
Database:
- Fix FK constraint: conditions.encounter_id -> intakes (was encounters)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-18 09:17:18 +01:00
colinislit
56bea91d10
fix: Add dynamic export to overdracht/patients route
...
Next.js requires explicit dynamic marking for routes using request.url
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-12 15:29:20 +01:00
colinislit
0b2f55c1e4
perf: Performance optimalisaties (4 iteraties)
...
Iteratie 1 - Parallel Fetching:
- Patient dashboard: Promise.all voor 3 data fetches
- Resultaat: ~45% sneller (800ms → 440ms)
Iteratie 2 - Loading States:
- Skeleton loaders voor EPD, patient, agenda, rapportage
- Betere perceived performance tijdens laden
Iteratie 3 - Lazy Load FullCalendar:
- Dynamic import met next/dynamic (ssr: false)
- ~150KB minder in initiële bundle
Iteratie 4 - Reports API Optimalisatie:
- Selectieve kolommen (10 i.p.v. 20)
- Server-side pagination (limit/offset)
- Database indexes voor timeline queries
- Resultaat: 89% sneller (1671ms → 188ms)
Overige fixes:
- Type casts voor Json → Behandelstructuur/SmartGoal/etc.
- Metadata template fix in layout.tsx
Documentatie:
- docs/audit-rapport.md - PO-vriendelijk audit rapport
- docs/performance/baseline-2025-12-12.md - Metingen + resultaten
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-12 15:24:38 +01:00
colinislit
265d3a971f
feat(diagnose+agenda): Diagnose module met ICD-10 en agenda uitbreidingen
...
Diagnose Module:
- Diagnose overzicht pagina met alle patiënt diagnoses
- Diagnosis manager met ICD-10 combobox zoekfunctie
- Diagnose kaarten met hoofddiagnose markering
- Modal voor nieuwe/bewerkte diagnoses
- ICD-10 GGZ codes dataset (lib/data/)
- Zod schemas voor diagnose validatie
- TypeScript types voor ICD-10 (lib/types/icd10.ts)
- Complete documentatie (PRD, FO, TO, Bouwplan)
Agenda Uitbreidingen:
- Patient context card in afspraak modal
- Rapportage composer direct in afspraak modal
- Rapportage bewerken vanuit gekoppelde rapportages
- Verbeterde focus styling voor inputs
Behandelplan:
- Flat componenten structuur (behandeldoel-card, form, planning)
- Context header component
- Uitgebreide types (lib/types/behandelplan.ts)
- Actions voor behandelplan beheer
UI Componenten:
- Command component (shadcn/ui) voor combobox
- Popover component (shadcn/ui)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 13:29:59 +01:00
colinislit
593bef4dcf
feat(overdracht): Incident badges + expandable rapportage content
...
Incident telling:
- Nieuwe incident_count in PatientOverzicht alerts
- Telt type='incident', 'crisis' én verpleegkundig category='incident'
- Oranje badge in patiëntenlijst
- "Met alerts" filter includeert nu ook incidenten
Expandable content:
- Rapportages in timeline tonen nu volledige tekst
- "Lees meer" / "Minder tonen" toggle voor berichten >5 regels
- Behoudt whitespace/regeleinden in tekst
Opruiming:
- Oude screenshots verwijderd
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-08 14:26:07 +01:00
colinislit
75c7e284b9
feat(verpleegrapportage): Nieuwe module + opruiming codebase
...
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 >
2025-12-08 11:19:48 +01:00
colinislit
d9340ba296
fix(overdracht): Filter op rapportages i.p.v. encounters + report types
...
Overdracht dashboard:
- Patiënten nu gefilterd op rapportages (laatste 24u) i.p.v. encounters
- Reports-block toont correcte type labels en kleuren
Rapportage module:
- Alle report types toegevoegd aan centrale lib/types/report.ts
- Quick actions met alle 8 rapportage types en icons
- Default type gewijzigd naar 'voortgang'
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 01:05:38 +01:00
colinislit
9e4e16035b
feat(behandelplan): E3 UI componenten en documentatie updates
...
Behandelplan UI (E3):
- page-client.tsx: Client-side behandelplan pagina
- actions.ts: Server actions voor CRUD operaties
- behandelplan-view.tsx: Volledige behandelplan weergave
- behandelplan-list.tsx: Lijst van behandelplannen
- editable-section.tsx: Herbruikbare edit sectie component
- sections/: Goal, intervention en behandelstructuur forms
UI Componenten:
- components/ui/checkbox.tsx (shadcn)
- components/ui/input.tsx (shadcn)
- components/ui/select.tsx (shadcn)
Documentatie:
- agenda-systeem.mdx toegevoegd
- _index.json en metadata.json bijgewerkt
Dependencies:
- @radix-ui/react-checkbox toegevoegd
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 00:35:00 +01:00
colinislit
d965f69a9b
feat(overdracht): E4 + E5 + E6 - Overdracht UI compleet
...
Epic 4 - Overdracht Overzicht:
- /epd/overdracht pagina met patiënten grid
- PatientCard component met alert badges
- Filter tabs (Alle patiënten / Met alerts)
- Responsive grid layout
Epic 5 - Overdracht Detail:
- /epd/overdracht/[patientId] pagina
- VitalsBlock: vitale functies met interpretatie kleuren
- ReportsBlock: rapportages laatste 24 uur
- NursingLogsBlock: gemarkeerde dagnotities
- RisksBlock: actieve risico's gesorteerd op niveau
- AISummaryBlock: Claude AI samenvatting met bronverwijzingen
Epic 6 - Integratie & Polish:
- Overdracht link in EPD sidebar
- Navigatie links dagregistratie <-> overdracht
- Build en type check passed
Bouwplan v1.3: alle 19 stories afgerond
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 00:33:49 +01:00
colinislit
d622ac8035
feat(overdracht): E2 + E3 - API overdracht en dagregistratie UI
...
Epic 2 - API Overdracht:
- GET /api/overdracht/patients (patiënten met alerts)
- GET /api/overdracht/[patientId] (detail met vitals, reports, logs, risks)
- POST /api/overdracht/generate (AI samenvatting met bronverwijzingen)
- lib/ai/overdracht-prompt.ts (system + user prompt)
- lib/types/overdracht.ts (TypeScript types)
Epic 3 - Dagregistratie UI:
- /epd/dagregistratie/[patientId] pagina
- Quick entry form (categorie, tijd, tekst, overdracht checkbox)
- Edit/Delete functionaliteit met inline editing
- Confirm delete dialog
- Summary cards (totaal, overdracht, incidenten)
Bouwplan bijgewerkt naar v1.2 (10/19 stories voltooid)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 00:18:06 +01:00
colinislit
08cffd0245
feat(overdracht): E0 + E1 - Database setup en API nursing logs
...
Epic 0 - Database Setup:
- nursing_logs tabel met indexes en constraints
- RLS policies (SELECT/INSERT/UPDATE/DELETE)
- TypeScript types gegenereerd
Epic 1 - API Nursing Logs:
- GET/POST /api/nursing-logs (lijst + aanmaken)
- PATCH/DELETE /api/nursing-logs/[id] (bewerken + verwijderen)
- Zod validatie schemas
- Automatische shift_date berekening
Documentatie:
- PRD, FO, TO en Bouwplan voor Overdracht Dashboard
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 00:03:18 +01:00
colinislit
ac98070fe4
| E2.S1 | Prompt engineering | System prompt + user prompt templates, evidence-based mapping
...
| E2.S2 | Generate endpoint | `POST /api/behandelplan/generate` retourneert JSON, < 8 sec response
| E2.S3 | AI event logging | Calls loggen naar `ai_events` tabel
new file: app/api/behandelplan/generate/route.ts
modified: docs/specs/behandelplan/bouwplan-behandelplan-v1.md
modified: docs/templates/bouwplan_template.md
new file: lib/ai/behandelplan-prompt.ts
new file: lib/ai/intervention-mapping.ts
modified: lib/supabase/database.types.ts
2025-12-04 09:27:12 +01:00
colinislit
8e8a8e6f49
Samenvatting van de fixes:
...
1. min-w-0 en box-border toegevoegd aan inputClassName en selectClassName - dit voorkomt dat inputs buiten hun
grid-cellen groeien
2. overflow-hidden toegevoegd aan de DialogContent - voorkomt dat content buiten de modal zichtbaar is
3. overflow-hidden toegevoegd aan het form element
4. Grid layout verbeterd voor datum/tijd: grid-cols-[1fr_auto_auto] met vaste breedte (w-24) voor de tijd inputs,
zodat de datum meer ruimte krijgt
5. min-w-0 toegevoegd aan alle grid children voor Type/Locatie
Deze wijzigingen zorgen ervoor dat:
- Invoervelden nooit buiten hun containers groeien
- De modal content netjes binnen de grenzen blijft
- De datum input meer ruimte krijgt dan de tijd inputs
- Select dropdowns niet overflow veroorzaken
2025-12-03 17:02:27 +01:00
colinislit
f68fc088f7
logo
2025-12-03 15:04:46 +01:00
colinislit
56c4f1cedc
git minicalender-view, improved agenda-view
2025-12-03 14:30:40 +01:00
colinislit
b7b5a0888b
feat(agenda): Epic 4 - EPD Koppeling (appointment-report integration)
...
Implements bidirectional linking between appointments and reports:
- E4.S1: Create report from appointment modal with encounter pre-linked
- E4.S2: Link existing reports to appointments via EncounterSelector
- E4.S3: Show linked reports in appointment modal edit view
- E4.S4: Navigation between appointments and reports with deep linking
Also includes bug fixes for patient search:
- Fix FHIR to internal format mapping for patient data
- Fix debounced search interference after patient selection
- Fix UUID handling for optional practitioner_id
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-02 19:34:07 +01:00
colinislit
e661c97491
feat(agenda): Epic 1 - Calendar views with FullCalendar
...
- E1.S1: FullCalendar setup with React wrapper
- E1.S2: Day view (timeGridDay) with hourly slots
- E1.S3: Week view (timeGridWeek) with 7-day grid
- E1.S4: Workweek view (timeGridWorkWeek, Mon-Fri)
Features:
- View switcher toolbar (Dag/Week/Werkweek)
- Date navigation (prev/next/today)
- Dutch localization (nl)
- Business hours highlighting (08:00-18:00)
- Color-coded appointments by type
- Drag-and-drop rescheduling support
- Server actions for encounter CRUD
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-02 17:13:55 +01:00
colinislit
aacada2197
chat suggestions, SEo integration, and more
2025-12-02 13:37:45 +01:00
colinislit
9dc2b4f216
feat: add rate limiting with countdown timer for docs chat
...
- Add in-memory rate limiter (10 requests/minute per user)
- Show informative message when limit reached explaining demo context
- Display countdown timer showing when chat becomes available again
- Auto-reset rate limit when timer expires
- Update documentation with rate limit FAQ and category selection flow
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-01 18:00:51 +01:00
colinislit
54f2c36eba
finalize ai assistenat
2025-12-01 16:14:30 +01:00
colinislit
1782809599
feat: integrate docs chat widget in EPD layout (E4)
...
- Add DocsChatWidget to epd-layout-client.tsx
- Widget now visible for all authenticated EPD users
- Update bouwplan status: all epics complete
Completes AI Documentatie Assistent feature (E0-E4, 12 stories)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-01 15:51:00 +01:00
colinislit
183021718a
feat: add docs chat api
2025-12-01 15:29:29 +01:00
colinislit
56b66ae6ff
feat: improve streaming mic and deepgram token handling
2025-11-25 22:53:04 +01:00