Commit Graph

74 Commits

Author SHA1 Message Date
colinislit
d08db12765 fix(build): resolve type errors blocking production build
- agenda-create-form: capture prefilled patient name in const so the
  async closure sees a narrowed string type
- tsconfig: exclude tests/ from next build typecheck (Cypress/Playwright
  files have their own type context)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 23:07:00 +02:00
colinislit
cdeea793bd feat(cortex): update chat/nudge flow, deepgram streaming and agenda form
Refines chat panel, nudge messages and artifact rendering, reworks
deepgram token/streaming handling, and adds test tooling deps
(playwright, cypress) to package.json.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 22:37:46 +02:00
colinislit
91b61d215b feat(cortex): add intake suggestions to chat UI
Add intake-related suggestions to both chat interfaces:

1. Cortex Command Center (lib/cortex/suggestions.ts):
   - New "Intake" category with status, risico, diagnose examples
   - Triggers intake_status, risico_query, diagnose_query, intake_navigeer

2. Docs Chat Widget (components/docs-chat/chat-suggestions.tsx):
   - Updated CLIENT_SUGGESTION_CATEGORIES with intake options
   - Categories: Intake Status, Risicotaxatie, Diagnoses, Navigatie

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:14:53 +01:00
colinislit
601ad8c3f0 fix(cortex): integrate intake intents into full chat + artifact flow
Fixes 4 bugs preventing intake blocks from working:

1. Chat API validation: Add 'nudge' to message type enum, allow empty
   content for streaming messages
2. AI chat recognition: Add P3 intake intents (intake_status,
   risico_query, diagnose_query, intake_navigeer) to system prompt
   with triggers, entities, and JSON examples
3. Artifact rendering: Add intake block imports and switch cases
   to artifact-container.tsx
4. API 400 error: Convert null to undefined for optional Zod params
   (searchParams.get returns null, Zod .optional() expects undefined)

Also adds:
- Testplan for E2E testing (60+ test cases)
- Session log with lessons learned and new intent checklist

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:07:10 +01:00
colinislit
a41a500fe3 feat(cortex): add intake_navigeer navigation handler (E5.S2)
- Add intake intents to action-parser schema and routing
- Add navigation handler in command-center for intake_navigeer intent
- Navigate to patient intakes page with toast feedback
- Update bouwplan: E5 now complete (6/7 epics done)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:30:15 +01:00
colinislit
b095b1e492 feat(cortex): add Intake Blocks MVP for voice/text commands
Adds 4 new intents for intake workflow:
- intake_status: shows completion percentage and section checklist
- intake_navigeer: navigation to specific intake tabs
- risico_query: displays risk assessments with severity indicators
- diagnose_query: shows primary/secondary diagnoses

New components:
- IntakeStatusBlock, RisicoBlock, DiagnoseBlock
- Shared block components (BlockLoading, BlockError, BlockEmpty, BlockSection, BlockItem, BlockFooter)
- useBlockData and useIntakeContext hooks

New API routes:
- GET /api/cortex/intake/status
- GET /api/cortex/intake/risico
- GET /api/cortex/intake/diagnose

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:21:18 +01:00
colinislit
05836c5c6a feat(cortex): implement activePatient fallback in various components
- Updated DagnotatieBlock to use activePatient for prefill if no patientId is provided.
- Enhanced PatientDashboardBlock to fallback to activePatient for patientId and name.
- Adjusted usePatientSelection to handle pending actions and re-route after patient selection.
- Refined chat components to manage nudge messages and integrate them into the chat flow.
- Improved UI elements for better patient selection experience.

This update enhances user experience by ensuring that the active patient context is utilized across multiple components, streamlining workflows and reducing manual input.
2026-01-03 22:18:30 +01:00
colinislit
6cc813aa58 chore: remove dead code command-input.tsx (376 lines)
Component was exported but never imported/used anywhere.
v3.0 architecture uses chat-input.tsx instead.

Voice features (useCortexVoice hook) remain available for future use.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 12:46:20 +01:00
colinislit
54e54d6d7e fix(cortex): add @mention detection to ChatInput (not just CommandInput)
The @mention dropdown was only in command-input.tsx but users type in
chat-input.tsx (the v3.0 chat textarea). Added @mention support there:

- @mention state and detection logic
- PatientMentionDropdown rendering
- handleMentionSelect with activePatient setting
- Escape key closes dropdown before clearing input

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 12:27:48 +01:00
colinislit
73894ac879 feat(cortex): Epic 2 - @Mention Systeem (E2.S1-S3)
Inline patient selectie via @naam in de chat input.

YAGNI Versimpeling: 8→4 SP, 5→3 stories
- Geen selectedMentions array (activePatient is al beschikbaar)
- Geen API payload wijziging nodig
- Geen meerdere mentions tracking

E2.S1 - @-detectie:
- Detecteer laatste @ in input
- Track query en startIndex
- Actief als geen space na @ en minimaal 1 char

E2.S2 - PatientMentionDropdown:
- Hergebruik usePatientSearch (debounce 150ms, limit 5)
- Hergebruik PatientListItem (size="sm")
- Positioned above input (bottom-full)
- Escape sluit dropdown

E2.S3 - Selectie flow:
- Vervang @query met @naam in input
- Zet activePatient via usePatientSelection
- Sluit dropdown automatisch

Bouwplan v1.4: Epic 2 compleet (14/19 SP - 74%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 12:11:14 +01:00
colinislit
9b0352de44 feat(cortex): Epic 1 - Patient Sidebar (E1.S1-S4)
Collapsible overlay sidebar voor snelle patient selectie met search en recent patients.

E1.S1 - Store uitbreiding:
- recentPatients: Patient[] (max 5, nieuwste eerst, geen duplicaten)
- patientSidebarOpen: boolean
- addRecentPatient, togglePatientSidebar, setPatientSidebarOpen actions

E1.S2 - PatientSidebar component:
- Overlay sidebar (w-80, z-50) met backdrop
- Search input met debounce (200ms)
- Recent patients sectie
- Hergebruik usePatientSearch, usePatientSelection hooks
- Hergebruik PatientListItem component

E1.S3 - Toggle button + shortcut:
- Users icon button in ContextBar
- Cmd/Ctrl+P keyboard shortcut
- Escape sluit sidebar (prioriteit boven artifacts)

E1.S4 - Click-to-select flow:
- Selectie zet activePatient
- Voegt toe aan recentPatients
- Sluit sidebar automatisch

Bouwplan v1.3: Epic 1 compleet (10/23 SP - 43%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 11:52:13 +01:00
colinislit
983807d833 refactor(cortex): Epic 0 - Extract patient search hooks & components (E0.S1-S4)
DRY refactor: Extract reusable patient search logic from ZoekenBlock.

New files:
- lib/cortex/hooks/use-patient-search.ts (116 lines)
  Debounced patient search with abort controller
- lib/cortex/hooks/use-patient-selection.ts (98 lines)
  FHIR fetch + store update flow
- lib/fhir/patient-mapper.ts (109 lines)
  FHIR Patient to DB Patient mapping + utilities
- components/cortex/shared/patient-list-item.tsx (114 lines)
  Reusable patient list item with loading states

Refactored:
- ZoekenBlock: 349 -> 127 lines (-64%)

Documentation:
- docs/intent/patient-search/ux-analyse-patient-selectie.md
- docs/intent/patient-search/bouwplan-patient-selectie-v1.md

CLAUDE.md updated with Cortex architecture documentation.

Epic 0 complete: 4/4 stories (4 SP)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 11:40:23 +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
6add89dc51 feat(cortex): Epic 5 - Integration & Polish complete (MVP DONE)
Epic 5 completes the Cortex V2 MVP with end-to-end integration:

E5.S1 - Feature Flag Guards
- ActionChainCard wrapped with CORTEX_MULTI_INTENT flag
- ClarificationCard wrapped with CORTEX_V2_ENABLED flag
- NudgeToast wrapped with CORTEX_NUDGE flag
- V1 UI remains functional when flags disabled

E5.S2 - Chain Execution Flow
- handleConfirmAction routes actions to artifacts via routeIntentToArtifact()
- Nudge evaluation triggered after successful action completion
- Sequential chain execution with auto-advance useEffect
- Chain auto-completes when all actions done

E5.S3 - Integration Tests (21 tests)
- Scenario 1: Simple input → Reflex handles (4 tests)
- Scenario 2: Multi-intent → Orchestrator handles (4 tests)
- Scenario 3: Context-dependent → Pronoun resolution (4 tests)
- Scenario 4: Wondzorg → Nudge suggestion (4 tests)
- Scenario 5: Graceful fallback (3 tests)
- Scenario 6: Chain building (2 tests)

E5.S4 - Demo Script
- 5-minute demo flow with exact phrases
- 5 scenes: Reflex speed, Multi-intent, Pronoun, Nudge, Clarification
- Backup scenarios documented
- Test phrases reference included

Files changed:
- components/cortex/chat/chat-panel.tsx (feature flags + execution)
- components/cortex/command-center/command-center.tsx (NudgeToast flag)
- lib/cortex/__tests__/cortex-v2.test.ts (NEW - 21 integration tests)
- docs/intent/demo-script-cortex-v2.md (NEW - demo documentation)
- docs/intent/bouwplan-cortex-v2.md (v1.5 - MVP complete)

MVP Status: 26/26 stories, 48/48 SP - 100% COMPLETE

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 13:16:20 +01:00
colinislit
4b759c9b3d feat(cortex): Epic 4 - Nudge MVP (Layer 3) complete
Proactive suggestions after successful actions - proof of concept.

E4.S1 - Protocol Rules (lib/cortex/nudge.ts)
- ProtocolRule and ProtocolCondition types
- Condition operators: equals, contains, matches, exists
- 2 hardcoded rules: wondzorg-controle, medicatie-controle

E4.S2 - evaluateNudge Function
- evaluateNudge(input) returns NudgeSuggestion[]
- checkCondition() helper for rule matching
- Priority sorting (high → medium → low)

E4.S3 - NudgeToast Component
- Countdown progress bar with auto-dismiss (5 min)
- Priority-based styling (low/medium/high)
- Accept and dismiss buttons
- Framer Motion animations

E4.S4 - Integration
- NudgeToast rendered in CommandCenter (fixed position)
- Trigger added in DagnotatieBlock after successful save
- Accept opens corresponding artifact with prefilled data

Demo flow:
1. Create dagnotitie with "wond" in content
2. Save → NudgeToast appears
3. Click "Ja, inplannen" → Appointment artifact opens

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 12:42:49 +01:00
colinislit
42d64761ec feat(cortex): Epic 3 - UI Components complete
Epic 3 delivers the visual layer for multi-intent flows and clarification:

E3.S1 - ActionChainCard (3 SP)
- Container for multi-intent chain display
- Header with AI/Local source badge and action count
- Original user input context
- Stacked ActionItems with Framer Motion animations
- Collapsible AI reasoning section
- Status-dependent styling (pending/executing/completed/partial/failed)

E3.S2 - ActionItem (2 SP)
- 6 status icons (pending, confirming, executing, success, failed, skipped)
- Dutch intent labels via shared intent-labels.ts
- Confidence badge with color coding (green ≥90%, amber ≥70%, red <70%)
- Entity summary formatting
- Confirmation buttons for confirming status
- Retry button for failed + recoverable actions

E3.S3 - ClarificationCard (2 SP)
- Amber-themed styling for question context
- Header with HelpCircle icon
- Original user input display
- Responsive options grid (2 cols desktop, 1 col mobile)
- Dismiss button and cancel link
- Framer Motion entry/exit animations

E3.S4 - ProcessingIndicator (1 SP)
- 3 variants: spinner, skeleton, pulse
- 3 sizes: sm, md, lg
- Configurable message
- InlineSpinner export for buttons

Integration in ChatPanel (v4.0):
- V2 store hooks for activeChain, pendingClarification
- Event handlers for confirm/skip/retry/dismiss
- Conditional rendering with AnimatePresence

New files:
- lib/cortex/intent-labels.ts
- components/cortex/chat/action-chain-card.tsx
- components/cortex/chat/action-item.tsx
- components/cortex/chat/clarification-card.tsx
- components/cortex/chat/processing-indicator.tsx

Modified:
- components/cortex/chat/chat-panel.tsx (v3.0 → v4.0)
- docs/intent/bouwplan-cortex-v2.md (v1.2 → v1.3)

Progress: 35/48 SP (73%) - E0, E1, E2, E3 complete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 12:02:15 +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
94aab93f1c feat: wire agenda artifacts 2025-12-28 14:54:32 +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
a6b63665e1 feat(swift): implement agenda planning module (Epic 4 UI)
- Add AgendaBlock core component with list, create, cancel, reschedule modes
- Implement AgendaListView with patient/type/location details and actions
- Implement AgendaCreateForm with fuzzy patient search and validation
- Implement AgendaCancelView with disambiguation support
- Implement AgendaRescheduleForm with date/time picker
- Integrate with server actions (create, cancel, reschedule)
- Add radio-group UI component
- Update documentation and status
2025-12-27 22:29:11 +01:00
colinislit
6460b4361f feat: add agenda intent scaffolding 2025-12-27 21:46:24 +01:00
colinislit
43467f07fa feat: show patient dashboard artifact on selection 2025-12-27 20:50:39 +01:00
colinislit
eed3c8c80c fix: point swift backlink to epd clients 2025-12-27 20:02:41 +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
f6c422bb14 feat(swift): implementeer artifact lifecycle management (E4.S2)
Epic 4 Story 2 compleet: Meerdere artifacts met open/close/switch werken!

E4.S2 - Artifact Lifecycle Management (3 SP)
- Store state: openArtifacts[], activeArtifactId
- Store actions met max 3 artifacts logica
- ArtifactArea refactor naar ArtifactContainer
- CommandCenter integration met nieuwe artifact system

Store Updates (stores/swift-store.ts):
- openArtifacts: Artifact[] — Array van open artifacts
- activeArtifactId: string | null — Currently active artifact
- Initial state: [], null

Store Actions:
```typescript
openArtifact(artifact: Omit<Artifact, 'id' | 'createdAt'>) {
  // Auto-generate ID + timestamp
  // Max 3 artifacts: remove oldest if at capacity
  // Set new artifact as active
}

closeArtifact(id: string) {
  // Filter out artifact
  // Auto-switch to last remaining if closing active
}

switchArtifact(id: string) {
  // Verify artifact exists
  // Set activeArtifactId
}

closeAllArtifacts() {
  // Clear all artifacts + active ID
}
```

Features:
- Max 3 artifacts enforced (oldest removed at capacity)
- Auto-switch when closing active artifact
- Console logging voor debugging
- ID generation met crypto.randomUUID()
- Timestamp tracking met createdAt

Components Updated:
- components/swift/artifacts/artifact-area.tsx (30 regels)
  - Simplified: alleen ArtifactContainer rendering
  - Props: openArtifacts, activeArtifactId, switchArtifact, closeArtifact

- components/swift/command-center/command-center.tsx
  - openArtifact() i.p.v. openBlock()
  - getArtifactTitle() voor dynamic titles
  - Escape: closeAllArtifacts() i.p.v. closeBlock()
  - Artifact opening met title generation

Integration Flow:
1. Chat: AI genereert action met artifact data
2. ChatPanel: setPendingAction(action)
3. CommandCenter: useEffect detecteert pendingAction
4. CommandCenter: getArtifactTitle(type, prefill)
5. CommandCenter: openArtifact({ type, prefill, title })
6. Store: Auto-generate ID, check max 3, add to array
7. ArtifactArea: Renders ArtifactContainer met artifacts
8. ArtifactContainer: Shows tabs (if >1), renders active block

Console Logging:
- "[Store] Max 3 artifacts reached, removing oldest"
- "[Store] Opening artifact: dagnotitie Dagnotitie - Jan"
- "[Store] Closing artifact: [id] New active: [id]"
- "[Store] Switching to artifact: [id]"
- "[Store] Cannot switch to artifact: [id] (not found)"

Build Status:
-  pnpm build succesvol (geen type errors)
- Alleen bekende warnings (Supabase realtime, useCallback)

Voortgang: 56 SP / 85 SP (66%) - 18/31 stories compleet, 2 geskipt

Next: E4.S3 (Slide-in animatie) - 200ms ease-out transitions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:33:56 +01:00
colinislit
855744c927 feat(swift): implementeer ArtifactContainer met tabs (E4.S1)
Epic 4 Story 1 compleet: Basis structuur voor meerdere artifacts met tabs.

E4.S1 - ArtifactContainer Component (5 SP)
- Artifact interface gedefineerd in store
- ArtifactTab component met active state en close button
- ArtifactContainer met conditional tab rendering
- Helper functies voor artifact rendering en titels

Nieuwe Components:
- components/swift/artifacts/artifact-tab.tsx (60 regels)
  - Tab UI met title, active state, close button
  - Hover effects en opacity animations
  - Min/max width, title truncation met tooltip
  - Stop propagation op close click

- components/swift/artifacts/artifact-container.tsx (127 regels)
  - Props: artifacts[], activeArtifactId, onSelect, onClose
  - Tabs alleen bij >1 artifact
  - renderArtifactBlock(): switch op artifact type
  - getArtifactTitle(): user-friendly titles met patient naam
  - Placeholder state wanneer geen artifacts

Artifact Interface:
```typescript
interface Artifact {
  id: string;
  type: BlockType;
  prefill: BlockPrefillData;
  title: string;
  createdAt: Date;
}
```

Features:
- Tab rendering: alleen bij meerdere artifacts
- Active tab styling: amber-500 border bottom
- Close button: opacity 0 → 100 on hover/active
- Title generation: "Dagnotitie - Jan" voor context
- Block rendering: dagnotitie, zoeken, overdracht, fallback
- Placeholder: "Artifacts verschijnen hier" met voorbeelden
- Responsive: min-w-[140px] max-w-[200px] per tab

Tab Styling:
- Active: bg-white + border-b-2 border-b-amber-500
- Hover: bg-slate-50
- Close button: group-hover:opacity-100
- Text: text-sm font-medium truncate

Build Status:
-  pnpm build succesvol (geen type errors)
- Alleen bekende warnings (Supabase realtime, useCallback)

Note: E4.S1 definieert structuur. E4.S2 voegt store management toe
(openArtifacts[], activeArtifactId, openArtifact(), closeArtifact()).

Voortgang: 53 SP / 85 SP (62%) - 17/31 stories compleet, 2 geskipt

Next: E4.S2 (Artifact lifecycle management) - Store state & actions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:29:01 +01:00
colinislit
3814189934 feat(swift): implementeer artifact opening from chat (E3.S6) 🎉
Epic 3 Story 6 compleet: Artifacts openen automatisch vanuit chat!
🎉 EPIC 3 COMPLEET - Medical Scribe Chat werkt end-to-end!

E3.S6 - Artifact Opening from Chat (2 SP)
- PendingAction state triggers artifact opening
- useEffect in CommandCenter luistert naar pendingAction
- Automatische block opening met prefill data
- Visual flow: Chat → AI → Action → Artifact verschijnt rechts

Components Updated:
- components/swift/artifacts/artifact-area.tsx (86 regels)
  - Renders DagnotatieBlock, ZoekenBlock, OverdrachtBlock
  - Placeholder state wanneer geen block actief
  - Conditional rendering based on activeBlock state

- components/swift/command-center/command-center.tsx
  - useEffect voor pendingAction handling
  - openBlock(type, prefill) aanroep
  - setPendingAction(null) cleanup
  - Console logging voor debugging

Artifact Opening Flow:
1. User: "Notitie voor Jan: medicatie gegeven"
2. AI response met JSON action (confidence 0.95)
3. ChatPanel: parseActionFromResponse()
4. ChatPanel: setPendingAction(action) if confidence ≥ 0.7
5. CommandCenter: useEffect triggers op pendingAction
6. CommandCenter: openBlock('dagnotitie', { patientName: 'Jan', ... })
7. ArtifactArea: Renders DagnotatieBlock met prefill
8. setPendingAction(null) cleanup

Features:
- Automatische artifact opening bij high confidence (≥0.7)
- Prefill data van AI naar block (patientName, category, content, etc.)
- Console logging voor debugging:
  - "[CommandCenter] Processing pending action: {...}"
  - "[CommandCenter] Opening artifact: dagnotitie with prefill: {...}"
- Placeholder state met voorbeelden wanneer geen artifact actief
- Overflow-y-auto voor scrollable artifacts

Blocks Supported:
- dagnotitie → DagnotatieBlock
- zoeken → ZoekenBlock
- overdracht → OverdrachtBlock
- fallback → FallbackPicker

Build Status:
-  pnpm build succesvol (geen type errors)
- Alleen bekende warnings (Supabase realtime, useCallback)

Epic 3 Summary (Chat API & Medical Scribe):
-  E3.S1 — Chat API endpoint skeleton (3 SP)
-  E3.S2 — Streaming response logic (5 SP)
-  E3.S3 — Medical scribe system prompt (3 SP)
-  E3.S4 — Intent detection in response (5 SP)
-  E3.S5 — Frontend streaming (GESKIPT - 3 SP)
-  E3.S6 — Artifact opening from chat (2 SP)

Epic 3 Stats: 5/6 stories (18 SP), 1 geskipt (3 SP)

Voortgang: 48 SP / 85 SP (56%) - 16/31 stories compleet, 2 geskipt

Next Epic: E4 (Artifact Area & Tabs) - Meerdere artifacts, tabs, animaties

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:23:00 +01:00
colinislit
9b85448a43 feat(swift): implementeer intent detection & action parsing (E3.S4)
Epic 3 Story 4 compleet: AI action objects worden geparsed en gevalideerd.

E3.S4 - Intent Detection in Response (5 SP)
- Action parser met JSON extraction uit markdown code blocks
- Zod validatie voor action schema (intent, entities, confidence, artifact)
- Confidence-based artifact opening (≥0.7 threshold)
- Visual feedback met action badges in chat messages
- Console logging voor debugging

Nieuwe Components:
- lib/swift/action-parser.ts (149 regels)
  - parseActionFromResponse(): Extract & validate JSON actions
  - extractJsonBlock(): Regex matching voor ```json blocks
  - removeJsonBlocks(): Clean text zonder JSON
  - shouldOpenArtifact(): Confidence check (≥0.7)
  - getConfidenceLabel(): "Zeer zeker", "Redelijk zeker", etc.
  - validateArtifactType(): Intent/artifact type matching

Components Updated:
- components/swift/chat/chat-panel.tsx
  - Action parsing in onDone callback
  - setPendingAction voor artifact opening (E3.S6)
  - Console logging: "[ChatPanel] Action detected"

- components/swift/chat/chat-message.tsx
  - Action badge met Sparkles icon
  - Intent label (Dagnotitie, Patiënt zoeken, Overdracht)
  - CheckCircle icon voor high confidence (≥0.7)
  - Confidence label display

- stores/swift-store.ts
  - updateLastMessage(): Optional action parameter
  - Type-safe action assignment (null/undefined handling)

Features:
- JSON extraction via regex: /```json\s*\n([\s\S]*?)\n```/
- Zod schema: type, intent, entities, confidence, artifact
- Confidence thresholds: >0.9, 0.7-0.9, 0.5-0.7, <0.5
- Visual feedback: Sparkles + CheckCircle icons
- Cleaned text content (JSON removed from display)
- Action stored in message.action en pendingAction state

Action Schema:
```typescript
{
  type: "action",
  intent: "dagnotitie" | "zoeken" | "overdracht" | "unknown",
  entities: {
    patientName?: string,
    patientId?: string,
    category?: "medicatie" | "adl" | "gedrag" | "incident" | "observatie",
    content?: string,
    query?: string
  },
  confidence: number, // 0-1
  artifact?: {
    type: BlockType,
    prefill: Record<string, any>
  }
}
```

Build Status:
-  pnpm build succesvol (geen type errors)
- Alleen bekende warnings (Supabase realtime, useCallback)

Voortgang: 46 SP / 85 SP (54%) - E3.S4 compleet

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:11:43 +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
colinislit
d2931a36f8 feat(swift): voeg keyboard shortcuts toe aan chat (E2.S5)
E2.S5 - Keyboard shortcuts (1 SP)
- ⌘K / Ctrl+K om chat input te focussen (global)
- Escape om input te clearen (local)
- Enter om bericht te versturen (al in E2.S4)
- Shift+Enter voor nieuwe regel (al in E2.S4)

ChatInput Updates:
- forwardRef toegevoegd voor ref support
- useImperativeHandle voor focus() en clear() methods
- ChatInputHandle interface geëxporteerd
- Escape key handler (clears input + resets height)
- Helper text updated: "⌘K focus • Esc clear • Enter versturen"

ChatPanel Updates:
- chatInputRef toegevoegd (ChatInputHandle type)
- Global keyboard event listener voor ⌘K/Ctrl+K
- Cross-platform support (metaKey voor macOS, ctrlKey voor Windows/Linux)
- preventDefault() om browser conflicts te voorkomen
- Cleanup listener bij unmount

Keyboard Shortcuts:
- ⌘K / Ctrl+K: Focus chat input (global window listener)
- Escape: Clear input (local textarea handler)
- Enter: Submit message (E2.S4)
- Shift+Enter: New line (E2.S4)

Cross-platform:
- macOS: ⌘K (e.metaKey)
- Windows/Linux: Ctrl+K (e.ctrlKey)
- Both: Escape, Enter, Shift+Enter

Components Updated:
- components/swift/chat/chat-input.tsx (+17 regels)
- components/swift/chat/chat-panel.tsx (+15 regels)

🎉 Epic 2 Compleet! 5/5 stories (13 SP / 13 SP = 100%)

Epic 2 Deliverables:
- E2.S1: Chat state in store (chatMessages, isStreaming, actions)
- E2.S2: ChatMessage component (4 message types met styling)
- E2.S3: Scrolling (auto-scroll, scroll-lock, scroll-to-bottom button)
- E2.S4: ChatInput (textarea, Enter submit, auto-resize)
- E2.S5: Keyboard shortcuts (⌘K focus, Escape clear)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:10:38 +01:00
colinislit
8f6f24f757 feat(swift): voeg chat input met keyboard shortcuts toe (E2.S4)
E2.S4 - ChatInput component (2 SP)
- Textarea met multi-line support en auto-resize
- Enter to submit functionaliteit
- Shift+Enter voor nieuwe regel
- Integration met store (addChatMessage)
- Send en Mic buttons (Lucide icons)
- Helper text met keyboard shortcuts

Input Features:
- Auto-resize textarea (max 8 lines / 128px)
- Focus management (auto-focus na submit)
- Disabled state support
- Brand colors voor focus/hover states
- Placeholder: "Typ of spreek wat je wilt doen..."

Keyboard Shortcuts:
- Enter: verstuur bericht (preventDefault als niet Shift)
- Shift+Enter: nieuwe regel (default textarea behavior)
- Auto-clear input na submit

UI Components:
- Send button (rechts, alleen enabled met content)
- Mic button placeholder (voor E5.S3 voice input)
- Helper text met <kbd> tags voor shortcuts
- Smooth transitions en hover effects

ChatPanel Integration:
- ChatInput component vervangen placeholder
- Demo messages verwijderd (nu echte chatMessages uit store)
- Auto-scroll werkt met nieuwe user messages

Components Created:
- components/swift/chat/chat-input.tsx (153 regels)

Components Updated:
- components/swift/chat/chat-panel.tsx (-108 demo messages, +ChatInput)

Epic 2 Progress: 4/5 stories compleet (12 SP / 13 SP = 92%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:06:38 +01:00
colinislit
b5e245e0fb feat(swift): voeg scrolling functionaliteit toe aan chat (E2.S3)
E2.S3 - ChatPanel scrolling (5 SP)
- Scrollable message list met refs (scrollContainerRef, messagesEndRef)
- Auto-scroll naar laatste message bij nieuwe berichten
- Scroll-lock detection (100px threshold)
- "Scroll naar beneden" button tijdens scroll-lock
- Initial scroll to bottom bij mount

Scrolling Logic:
- useRef voor scroll container en messages end tracking
- useState voor isScrolledUp en showScrollButton state
- handleScroll() detecteert wanneer user omhoog scrollt
- scrollToBottom() met smooth/auto behavior support
- Auto-scroll alleen wanneer NIET scrolled up (scroll-lock)

Scroll Button:
- ArrowDown icon (Lucide)
- Positioned absolute bottom-4 right-4
- Shadow + hover effects, smooth transitions
- Verschijnt alleen bij scroll-lock en messages present
- Aria-label voor accessibility

Testing:
- 12 demo messages voor scrolling behavior test
- Conversatie flow: notitie, zoeken, overdracht
- Scroll threshold: 100px vanaf bottom

Components Updated:
- components/swift/chat/chat-panel.tsx (+68 regels)

Epic 2 Progress: 3/5 stories compleet (10 SP / 13 SP = 77%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:00:47 +01:00
colinislit
e3ff72cd9c feat(swift): voeg chat messages en styling toe (E2.S1-S2)
E2.S1 - Store uitbreiding (2 SP)
- ChatMessage, ChatAction, ChatMessageType types toegevoegd
- chatMessages[], isStreaming, pendingAction state
- addChatMessage, updateLastMessage, clearChat, setStreaming actions

E2.S2 - ChatMessage component (3 SP)
- Herbruikbare ChatMessage component met 4 message types
- MESSAGE_STYLES config (user/assistant/system/error)
- User: amber bubble rechts, rounded-tr-sm
- Assistant: slate bubble links, rounded-tl-sm
- System: centered, transparent, italic
- Error: red bubble links
- Optional timestamp support (NL locale)
- Demo messages in ChatPanel voor testing

Components Created:
- components/swift/chat/chat-message.tsx (77 regels)
- components/swift/chat/chat-panel.tsx (102 regels)

Store Updated:
- stores/swift-store.ts (+87 regels) - Chat state en actions

Epic 2 Progress: 2/5 stories compleet (5 SP / 13 SP = 38%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 13:55:35 +01:00
colinislit
c77f1eb554 redesigdn docs 2025-12-27 13:17:00 +01:00
colinislit
33c6698870 feat(swift): Epic 5 Progress - Error Handling & Keyboard Shortcuts (E5.S2-S3)
Epic 5 deels compleet: Error handling en keyboard shortcuts geïmplementeerd.
Voortgang: 62 SP / 72 SP (86%) - Nog 1 story voor MVP compleet!

E5.S2 - Error Handling (2 SP)
- Gecentraliseerde error handler utility (lib/swift/error-handler.ts)
- isOffline(), isNetworkError(), getErrorInfo() functies
- safeFetch() wrapper met 30s timeout en retry logic
- retryFetch() met exponential backoff (max 3 retries)
- User-friendly Nederlandse error messages voor alle HTTP status codes
- OfflineBanner component met online/offline detection
- Alle blocks en CommandInput gebruiken nieuwe error handler
- Context bar margin adjustment voor offline banner
- parseErrorResponse() voor HTML error detection

E5.S3 - Keyboard Shortcuts (2 SP)
- ⌘Enter / Ctrl+Enter quick submit in CommandInput
- ⌘Enter / Ctrl+Enter quick save in DagnotatieBlock
- Visual hints (⌘↵) op submit button in DagnotatieBlock
- Geverifieerd: ⌘K focus, Escape close, 1-3 FallbackPicker
- Cross-platform support (macOS + Windows/Linux)
- preventDefault() voor browser conflict preventie

Components Updated:
- DagnotatieBlock: safeFetch, getErrorInfo, retryFetch, ⌘Enter save
- OverdrachtBlock: safeFetch, retryFetch voor AI generation
- ZoekenBlock: safeFetch, getErrorInfo voor patient search
- CommandInput: safeFetch, getErrorInfo, ⌘Enter submit
- CommandCenter: OfflineBanner integration
- ContextBar: useOffline hook voor margin adjustment

Nieuwe Files:
- lib/swift/error-handler.ts (301 regels) - Error handling utilities
- components/swift/command-center/offline-banner.tsx (72 regels)
- docs/swift/keyboard-shortcuts-reference.md (200+ regels)
- docs/swift/test-plan-e5-s2-error-handling.md (350+ regels)
- docs/swift/test-plan-e5-s3-keyboard-shortcuts.md (350+ regels)
- docs/swift/PROJECT-STATUS-2024-12-27.md (500+ regels) - Status report

Documentatie:
- Bouwplan bijgewerkt naar v2.5
- Epic completion details toegevoegd met progress bars
- Manual test checklist bijgewerkt (17/20 scenarios)
- Risico's sectie bijgewerkt (alle major risks gemitigeerd)
- Sprint planning status: E5 75% compleet (6/8 SP)

Technische verbeteringen:
- Offline detection met visual feedback
- Network error retry met exponential backoff
- HTTP 401/404/500/503 error messages in Nederlands
- Timeout protection (30s) op alle API calls
- Keyboard shortcuts met visual hints
- Cross-platform shortcut support

Testing:
- Error handling test plan met 8 categorieën
- Keyboard shortcuts test plan met 6 categorieën
- 40+ test scenarios gedocumenteerd
- Quick smoke test checklists

Voortgang: 62 SP / 72 SP (86%) - E5.S2 en E5.S3 compleet

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 09:27:32 +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
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
3e94271827 feat: complete E2.S5 Input → Block wiring
- Implementeer handleSubmit met API call naar /api/intent/classify
- Voeg error handling en fallback naar dagnotitie toe
- Integreer openBlock en addRecentAction
- Update bouwplan: Epic 2 compleet (33 SP done, 46%)
2025-12-24 08:44:40 +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
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
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
621e1c90f9 | Epic | Status | Wat is gedaan |
|---------------------|---------------|---------------------|
  | E0: Foundation      |  Afgerond    | Types + DB migratie |
  | E1: Leefgebieden    |  Afgerond    | 3 componenten       |
  | E2: AI Generatie    |  Nog te doen | -                   |
  | E3: Behandelplan UI |  Nog te doen | -                   |

  Gemaakte bestanden:
  - lib/types/leefgebieden.ts - 7 domeinen met kleuren/emoji's
  - lib/types/behandelplan.ts - SMART doelen, interventies, Zod schemas
  - components/behandelplan/leefgebieden-form.tsx - Intake formulier
  - components/behandelplan/leefgebieden-scores.tsx - Score weergave
  - components/behandelplan/leefgebieden-badge.tsx - Domain badges
  - components/behandelplan/index.ts - Exports
2025-12-04 09:09:23 +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
aacada2197 chat suggestions, SEo integration, and more 2025-12-02 13:37:45 +01:00