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.
This commit is contained in:
colinislit
2025-12-29 22:40:34 +01:00
parent 94aab93f1c
commit c8aaba657e
25 changed files with 6230 additions and 1054 deletions

View File

@@ -1,879 +0,0 @@
# Architecture: Intent System Schaalbaarheid
**Document:** Intent System Scalability & Optimization
**Versie:** 1.0
**Datum:** 27-12-2024
**Auteur:** Colin Lit
---
## 📊 Probleem Analyse
### Huidige Situatie
**Aantal intents:** 7 (dagnotitie, zoeken, overdracht, + 4 agenda intents)
**Patterns per intent:** ~5-10
**Totaal patterns:** ~60
**Performance nu:**
- Classification time: ~10-15ms
- O(n) linear search door alle patterns
- Acceptable voor huidige schaal
### Toekomstige Schaal (geschat)
Bij volledige EPD uitbreiding:
| Module | Nieuwe Intents | Patterns per Intent | Totaal |
|--------|----------------|---------------------|--------|
| **Medicatie** | 5 (voorschrijven, toedienen, stop, bijwerking, controle) | 8 | 40 |
| **Diagnostiek** | 4 (lab aanvragen, uitslagen, röntgen, echo) | 6 | 24 |
| **Behandelplan** | 4 (maken, wijzigen, evalueren, afsluiten) | 7 | 28 |
| **Verpleegkundige acties** | 6 (wondverzorging, katheter, infuus, etc.) | 5 | 30 |
| **Communicatie** | 3 (brief, consult aanvraag, telefoonnota) | 6 | 18 |
| **Rapportages** | 5 (MDO, intake, evaluatie, ontslagbrief) | 7 | 35 |
| **Huidig** | 7 | ~8 | 60 |
| **TOTAAL** | **34 intents** | **~7 avg** | **~235 patterns** |
**Geschatte performance bij 235 patterns:**
- Classification time: ~40-60ms (4x slower)
- Meer pattern conflicts (overlap)
- Moeilijker te maintainen
---
## 🎯 Optimalisatie Strategieën
## Strategie 1: Categoriegebaseerde Hierarchie ⭐ **AANBEVOLEN**
### Concept
Groepeer intents in categorieën en gebruik **two-phase classification**:
1. **Phase 1:** Detect categorie (snel, 5-10 opties)
2. **Phase 2:** Detect intent binnen categorie (kleiner search space)
### Categorie Structuur
```typescript
enum IntentCategory {
DOCUMENTATION = 'documentation', // Notities, rapportages
PATIENT_CARE = 'patient_care', // Medicatie, metingen, acties
SCHEDULING = 'scheduling', // Agenda, planning
COMMUNICATION = 'communication', // Brieven, consults
DIAGNOSTIC = 'diagnostic', // Lab, beeldvorming
ADMINISTRATIVE = 'administrative', // Overdracht, MDO
SEARCH = 'search', // Zoeken, info opvragen
}
type SwiftIntent =
// DOCUMENTATION
| 'dagnotitie'
| 'rapportage_intake'
| 'rapportage_evaluatie'
| 'rapportage_ontslag'
| 'vrije_notitie'
// PATIENT_CARE
| 'medicatie_toedienen'
| 'medicatie_voorschrijven'
| 'medicatie_stop'
| 'meting_vitaal'
| 'wondverzorging'
| 'katheter_verzorging'
// SCHEDULING
| 'agenda_query'
| 'create_appointment'
| 'cancel_appointment'
| 'reschedule_appointment'
// DIAGNOSTIC
| 'lab_aanvraag'
| 'lab_uitslag'
| 'rontgen_aanvraag'
| 'echo_aanvraag'
// COMMUNICATION
| 'brief_huisarts'
| 'consult_aanvraag'
| 'telefoonnota'
// ADMINISTRATIVE
| 'overdracht'
| 'mdo_verslag'
// SEARCH
| 'zoeken'
| 'patient_info'
| 'medicatie_info'
| 'unknown';
```
### Implementation
```typescript
// lib/swift/intent-classifier-hierarchical.ts
interface CategoryPattern {
pattern: RegExp;
category: IntentCategory;
weight: number;
}
// Step 1: Category patterns (small set, ~20 patterns)
const CATEGORY_PATTERNS: CategoryPattern[] = [
// DOCUMENTATION keywords
{ pattern: /\b(notitie|rapportage|verslag|schrijf|document)\b/i,
category: IntentCategory.DOCUMENTATION, weight: 0.9 },
// PATIENT_CARE keywords
{ pattern: /\b(medicatie|toedien|voorschrijf|bloeddruk|temperatuur|pols|wond|katheter|infuus)\b/i,
category: IntentCategory.PATIENT_CARE, weight: 0.9 },
// SCHEDULING keywords
{ pattern: /\b(afspraak|agenda|planning|verzet|annuleer|plan)\b/i,
category: IntentCategory.SCHEDULING, weight: 0.95 },
// DIAGNOSTIC keywords
{ pattern: /\b(lab|bloed|urine|röntgen|echo|scan|onderzoek)\b/i,
category: IntentCategory.DIAGNOSTIC, weight: 0.9 },
// COMMUNICATION keywords
{ pattern: /\b(brief|consult|telefoon|contact|specialist)\b/i,
category: IntentCategory.COMMUNICATION, weight: 0.85 },
// ADMINISTRATIVE keywords
{ pattern: /\b(overdracht|mdo|bespreking|overleg)\b/i,
category: IntentCategory.ADMINISTRATIVE, weight: 0.9 },
// SEARCH keywords (should be last, lowest priority)
{ pattern: /\b(zoek|vind|wie|waar|wanneer|info|gegevens)\b/i,
category: IntentCategory.SEARCH, weight: 0.7 },
];
// Step 2: Intent patterns per category (smaller sets)
const INTENT_PATTERNS_BY_CATEGORY: Record<IntentCategory, Record<string, PatternConfig[]>> = {
[IntentCategory.DOCUMENTATION]: {
dagnotitie: [
{ pattern: /^dagnotitie\b/i, weight: 1.0 },
{ pattern: /^notitie\b/i, weight: 1.0 },
{ pattern: /^\w+\s+(medicatie|adl|gedrag)/i, weight: 0.9 },
],
rapportage_intake: [
{ pattern: /^intake\b/i, weight: 1.0 },
{ pattern: /\bintake\s+(verslag|rapportage)\b/i, weight: 1.0 },
],
vrije_notitie: [
{ pattern: /^vrije\s+notitie\b/i, weight: 1.0 },
{ pattern: /^schrijf\b/i, weight: 0.8 },
],
},
[IntentCategory.PATIENT_CARE]: {
medicatie_toedienen: [
{ pattern: /^medicatie\s+(geven|toedienen)/i, weight: 1.0 },
{ pattern: /^(geef|toedienen)\s+medicatie/i, weight: 1.0 },
{ pattern: /^\w+\s+medicatie\s+(gegeven|toegediend)/i, weight: 0.95 },
],
medicatie_voorschrijven: [
{ pattern: /^voorschrijf\s+medicatie/i, weight: 1.0 },
{ pattern: /^medicatie\s+voorschrijven/i, weight: 1.0 },
{ pattern: /^start\s+medicatie/i, weight: 0.95 },
],
meting_vitaal: [
{ pattern: /^(bloeddruk|temperatuur|pols|saturatie)\b/i, weight: 1.0 },
{ pattern: /^vitale\s+(functies|metingen)/i, weight: 1.0 },
{ pattern: /^\w+\s+(bloeddruk|temperatuur)/i, weight: 0.9 },
],
},
[IntentCategory.SCHEDULING]: {
agenda_query: [
{ pattern: /^afspraken?\b/i, weight: 1.0 },
{ pattern: /^agenda\b/i, weight: 1.0 },
{ pattern: /^wat\s+zijn\s+mijn\s+afspraken/i, weight: 1.0 },
],
create_appointment: [
{ pattern: /^maak\s+afspraak/i, weight: 1.0 },
{ pattern: /^plan\s+(intake|afspraak)/i, weight: 1.0 },
],
cancel_appointment: [
{ pattern: /^annuleer\s+afspraak/i, weight: 1.0 },
],
},
// ... other categories
};
// Two-phase classification
export function classifyIntentHierarchical(input: string): ClassificationResult {
const startTime = performance.now();
// PHASE 1: Detect category (fast, ~20 patterns)
let bestCategory: IntentCategory | null = null;
let categoryConfidence = 0;
for (const { pattern, category, weight } of CATEGORY_PATTERNS) {
if (pattern.test(input)) {
if (weight > categoryConfidence) {
bestCategory = category;
categoryConfidence = weight;
}
}
}
// If no category detected, use SEARCH as fallback
if (!bestCategory || categoryConfidence < 0.5) {
bestCategory = IntentCategory.SEARCH;
}
// PHASE 2: Detect intent within category (smaller search space)
const categoryIntents = INTENT_PATTERNS_BY_CATEGORY[bestCategory];
let bestIntent: SwiftIntent = 'unknown';
let intentConfidence = 0;
for (const [intent, patterns] of Object.entries(categoryIntents)) {
for (const { pattern, weight } of patterns) {
if (pattern.test(input)) {
if (weight > intentConfidence) {
bestIntent = intent as SwiftIntent;
intentConfidence = weight;
}
if (weight === 1.0) break; // Perfect match
}
}
if (intentConfidence === 1.0) break;
}
const processingTimeMs = performance.now() - startTime;
return {
intent: bestIntent,
confidence: Math.min(categoryConfidence, intentConfidence), // Take lowest
category: bestCategory,
processingTimeMs,
};
}
```
### Performance Impact
**Voor 34 intents met 235 patterns:**
| Metric | Flat Structure | Hierarchical | Improvement |
|--------|----------------|--------------|-------------|
| Avg patterns tested | 117 (~50%) | 10 + 12 = 22 | **5.3x faster** |
| Worst case | 235 (all) | 20 + 35 = 55 | **4.3x faster** |
| Best case | 1 | 1 + 1 = 2 | Similar |
| Estimated time | ~50ms | ~12ms | **4.2x faster** |
**Complexity:**
- Flat: O(n) where n = total patterns
- Hierarchical: O(c + i) where c = category patterns, i = intent patterns in category
- Typically: c ≈ 20, i ≈ 10-15 → O(30-35) vs O(235)
---
## Strategie 2: Keyword Index / Trie Structure
### Concept
Pre-index patterns by first keyword voor instant lookup.
```typescript
// Build index at startup
const KEYWORD_INDEX = new Map<string, IntentPattern[]>();
// Index building
for (const [intent, patterns] of Object.entries(INTENT_PATTERNS)) {
for (const pattern of patterns) {
const keywords = extractKeywords(pattern);
for (const keyword of keywords) {
if (!KEYWORD_INDEX.has(keyword)) {
KEYWORD_INDEX.set(keyword, []);
}
KEYWORD_INDEX.get(keyword)!.push({ intent, pattern });
}
}
}
// Fast lookup
function classifyWithIndex(input: string): ClassificationResult {
const firstWord = input.trim().split(/\s+/)[0].toLowerCase();
// O(1) lookup
const candidatePatterns = KEYWORD_INDEX.get(firstWord) || [];
// Test only relevant patterns (typically 3-10 instead of 235)
for (const { intent, pattern } of candidatePatterns) {
if (pattern.test(input)) {
return { intent, confidence: pattern.weight };
}
}
// Fallback: test all patterns (rare)
return classifyFull(input);
}
```
**Voordelen:**
- ✅ O(1) lookup voor common patterns
- ✅ Makkelijk te implementeren
- ✅ Backward compatible
**Nadelen:**
- ❌ Misses patterns zonder duidelijk keyword
- ❌ Extra memory overhead
- ❌ Requires maintenance of index
---
## Strategie 3: Intent Prioriteit (Analytics-Driven)
### Concept
Order intents op basis van gebruiksfrequentie.
```typescript
interface IntentMetrics {
intent: SwiftIntent;
frequency: number; // Times used
avgConfidence: number; // Average confidence
avgProcessingTime: number;
}
// Track usage
const INTENT_STATS = new Map<SwiftIntent, IntentMetrics>();
function trackIntentUsage(intent: SwiftIntent, confidence: number, time: number) {
const stats = INTENT_STATS.get(intent) || {
intent,
frequency: 0,
avgConfidence: 0,
avgProcessingTime: 0,
};
stats.frequency++;
stats.avgConfidence = (stats.avgConfidence * (stats.frequency - 1) + confidence) / stats.frequency;
stats.avgProcessingTime = (stats.avgProcessingTime * (stats.frequency - 1) + time) / stats.frequency;
INTENT_STATS.set(intent, stats);
}
// Periodically reorder patterns based on frequency
function optimizePatternOrder() {
const sorted = Array.from(INTENT_STATS.values())
.sort((a, b) => b.frequency - a.frequency);
// Rebuild INTENT_PATTERNS with high-frequency intents first
const optimized = {};
for (const { intent } of sorted) {
optimized[intent] = INTENT_PATTERNS[intent];
}
return optimized;
}
```
**Impact:**
Als 80% van queries 3 intents gebruikt (dagnotitie, agenda_query, zoeken):
- Average patterns tested: 15 instead of 117
- **7.8x speedup** for common cases
---
## Strategie 4: Compositional Intents
### Concept
Split intents in **base action** + **subject** + **modifiers**.
```typescript
// Instead of flat intents:
type OldIntent =
| 'medicatie_toedienen'
| 'medicatie_voorschrijven'
| 'medicatie_stop'
| 'medicatie_bijwerking'
| 'lab_aanvraag'
| 'lab_uitslag'
| 'rontgen_aanvraag'
// ... 30+ more
// Use compositional structure:
interface ComposedIntent {
action: Action; // toedienen, voorschrijven, aanvragen, etc.
subject: Subject; // medicatie, lab, röntgen, etc.
modifiers?: Modifier[]; // urgent, herhaling, etc.
}
type Action =
| 'create' | 'read' | 'update' | 'delete' // CRUD
| 'toedienen' | 'voorschrijven' | 'stop' // Medicatie-specific
| 'aanvragen' | 'bekijken' | 'afmelden' // Request-specific
;
type Subject =
| 'medicatie' | 'lab' | 'rontgen' | 'echo'
| 'afspraak' | 'notitie' | 'brief'
;
type Modifier =
| 'urgent' | 'spoed' | 'herhaling'
;
// Pattern matching
const ACTION_PATTERNS = {
toedienen: /\b(geef|toedien|gegeven)\b/i,
voorschrijven: /\b(voorschrijf|start|begin)\b/i,
stop: /\b(stop|afbouwen|be[eë]indig)\b/i,
aanvragen: /\b(vraag|aanvraag|aanvragen)\b/i,
};
const SUBJECT_PATTERNS = {
medicatie: /\b(medicatie|medicijn|tablet|pil)\b/i,
lab: /\b(lab|bloed|urine)\b/i,
rontgen: /\b(r[oö]ntgen|x-?ray)\b/i,
};
// Compose intent
function classifyCompositional(input: string): ComposedIntent {
const action = detectAction(input); // Fast, ~10 patterns
const subject = detectSubject(input); // Fast, ~10 patterns
const modifiers = detectModifiers(input); // Optional, ~5 patterns
return { action, subject, modifiers };
}
// Map to legacy intent
function toLegacyIntent(composed: ComposedIntent): SwiftIntent {
const key = `${composed.subject}_${composed.action}`;
const mapping = {
'medicatie_toedienen': 'medicatie_toedienen',
'medicatie_voorschrijven': 'medicatie_voorschrijven',
'lab_aanvragen': 'lab_aanvraag',
// ... etc
};
return mapping[key] || 'unknown';
}
```
**Voordelen:**
- ✅ Veel kleiner pattern set (~25 vs 235)
- ✅ Makkelijker om nieuwe combinaties toe te voegen
- ✅ Natuurlijker voor AI reasoning
**Nadelen:**
- ❌ Requires refactoring
- ❌ Less precise than specific patterns
- ❌ May need disambiguation more often
---
## Strategie 5: Smarter AI Routing (Hybrid Approach)
### Concept
Use **AI for categorization** (fast, cheap) then **local patterns** for specific intent.
```typescript
// Step 1: AI categorizes (very fast with Haiku)
const category = await categorizeWithAI(input); // ~100ms
// Step 2: Local patterns within category
const intent = classifyLocalInCategory(input, category); // ~5ms
// Total: ~105ms (but higher accuracy than pure local)
```
**AI System Prompt for Categorization:**
```typescript
const CATEGORIZATION_PROMPT = `Categoriseer de volgende input in één categorie:
Categorieën:
1. documentation - Notities, verslagen maken
2. patient_care - Medicatie, metingen, verzorging
3. scheduling - Agenda, afspraken
4. diagnostic - Lab, beeldvorming
5. communication - Brieven, consults
6. administrative - Overdracht, MDO
7. search - Zoeken, informatie opvragen
Antwoord met ALLEEN de categorie naam (lowercase).
Input: "${input}"
Categorie:`;
```
**Performance:**
- Categorization: ~100ms (AI call)
- Intent detection: ~5ms (local, small set)
- **Total: ~105ms** (vs ~50ms pure local, but more accurate)
**Trade-off:**
- Slower than pure local (2x)
- But handles ambiguous cases better
- Cheaper than full AI classification (smaller prompt)
---
## Strategie 6: Pattern Optimization
### Specific Optimizations
#### A. Pre-compiled Regex
```typescript
// ❌ BAD: Compile regex on every call
function classify(input: string) {
const pattern = new RegExp(`^${keyword}\\b`, 'i');
return pattern.test(input);
}
// ✅ GOOD: Pre-compile at module load
const PATTERNS = {
dagnotitie: /^dagnotitie\b/i,
zoeken: /^zoek\b/i,
};
function classify(input: string) {
return PATTERNS.dagnotitie.test(input);
}
```
**Impact:** 10-20% faster
#### B. Early Exit on Perfect Match
```typescript
for (const { pattern, weight } of patterns) {
if (pattern.test(input)) {
bestMatch = { pattern, weight };
// Early exit for perfect match
if (weight === 1.0) {
break; // Don't test remaining patterns
}
}
}
```
**Impact:** 30-50% faster for common exact matches
#### C. Pattern Ordering
```typescript
// Order patterns by likelihood (high weight first)
const patterns = [
{ pattern: /^exact\b/i, weight: 1.0 }, // Most likely
{ pattern: /^exact\s+\w+/i, weight: 0.95 }, // Second
{ pattern: /\bpartial\b/i, weight: 0.7 }, // Less likely
];
```
**Impact:** 20-40% faster on average
---
## 📊 Aanbevolen Implementatie Roadmap
### Fase 1: Quick Wins (Week 1)
**Implementeer nu (backward compatible):**
1.**Pattern Optimization**
- Pre-compile all regex
- Add early exit on perfect match
- Reorder patterns by weight (high first)
- **Effort:** 2 uur
- **Gain:** 30-40% sneller
2.**Intent Metrics Tracking**
- Add analytics to track intent frequency
- Log classification times
- **Effort:** 4 uur
- **Gain:** Data voor fase 2
### Fase 2: Hierarchie (Week 2-3)
**Implementeer categorieën:**
3.**Category-based Classification**
- Define 7 categories
- Build category patterns
- Restructure INTENT_PATTERNS by category
- Add two-phase classifier
- Keep old classifier for fallback
- **Effort:** 2 dagen
- **Gain:** 4-5x sneller, better scalability
4.**A/B Testing**
- Test old vs new classifier
- Compare accuracy & performance
- **Effort:** 1 dag
- **Gain:** Confidence in new approach
### Fase 3: Advanced (Maand 2)
**Optioneel, als nodig:**
5. ⚠️ **Keyword Index** (if performance still issue)
- Build keyword → pattern index
- **Effort:** 1 dag
- **Gain:** Extra 2x sneller
6. ⚠️ **Compositional Intents** (if too many intents)
- Refactor to action + subject
- **Effort:** 1 week
- **Gain:** Smaller pattern set, easier to extend
---
## 🎯 Concrete Voorstel voor Swift
### Voor Huidige Situatie (7 intents)
**Aanbeveling:** **Blijf bij huidige flat structure** + pattern optimizations
**Waarom:**
- Current performance is acceptable (<20ms)
- Complexity niet worth it voor 7 intents
- Quick wins genoeg (pre-compile, early exit)
**Implementeer WEL:**
- ✅ Pattern optimization (fase 1)
- ✅ Intent metrics tracking (voor later)
### Voor Toekomst (15+ intents)
**Aanbeveling:** **Overstap naar categorie-based hierarchie**
**Trigger points:**
- Wanneer >15 intents
- Wanneer classification >30ms
- Wanneer veel pattern conflicts
**Implementatie:**
1. Define 7 categories
2. Categorize existing intents
3. Build two-phase classifier
4. Keep old classifier als fallback
5. A/B test
### Code Structuur
```
lib/swift/
├── intent-classifier.ts # Current (keep for now)
├── intent-classifier-hierarchical.ts # New (implement in fase 2)
├── intent-classifier-ai.ts # Current AI fallback
├── intent-categories.ts # Category definitions
├── intent-patterns/ # Split patterns by category
│ ├── documentation.ts
│ ├── patient-care.ts
│ ├── scheduling.ts
│ ├── diagnostic.ts
│ ├── communication.ts
│ ├── administrative.ts
│ └── search.ts
└── types.ts
```
---
## 📈 Performance Benchmarks
### Target Metrics
| Metric | Current | Phase 1 Target | Phase 2 Target | Phase 3 Target |
|--------|---------|----------------|----------------|----------------|
| **Avg classification time** | 12ms | 8ms | 5ms | 3ms |
| **95th percentile** | 25ms | 15ms | 12ms | 8ms |
| **Max intents supported** | 10 | 15 | 40 | 100+ |
| **Memory usage** | 100KB | 120KB | 150KB | 200KB |
### Test Suite
```typescript
// __tests__/performance.test.ts
describe('Intent Classification Performance', () => {
it('should classify in <10ms (avg)', () => {
const inputs = generateTestInputs(1000);
const times = inputs.map(input => {
const start = performance.now();
classifyIntent(input);
return performance.now() - start;
});
const avg = times.reduce((a, b) => a + b) / times.length;
expect(avg).toBeLessThan(10);
});
it('should classify in <30ms (p95)', () => {
const times = [...]; // from above
const p95 = percentile(times, 95);
expect(p95).toBeLessThan(30);
});
it('should handle 40 intents efficiently', () => {
const classifierWith40Intents = buildClassifier(40);
const time = measureClassification(classifierWith40Intents);
expect(time).toBeLessThan(15);
});
});
```
---
## 🔧 Migration Guide
### Van Flat naar Hierarchical
**Step 1: Define Categories**
```typescript
// lib/swift/intent-categories.ts
export const INTENT_CATEGORY_MAP: Record<SwiftIntent, IntentCategory> = {
// Documentation
'dagnotitie': IntentCategory.DOCUMENTATION,
'rapportage_intake': IntentCategory.DOCUMENTATION,
// Patient Care
'meting_vitaal': IntentCategory.PATIENT_CARE,
'medicatie_toedienen': IntentCategory.PATIENT_CARE,
// Scheduling
'agenda_query': IntentCategory.SCHEDULING,
'create_appointment': IntentCategory.SCHEDULING,
// Search
'zoeken': IntentCategory.SEARCH,
// ... etc
};
```
**Step 2: Restructure Patterns**
```bash
# Create pattern files per category
mkdir lib/swift/intent-patterns
touch lib/swift/intent-patterns/documentation.ts
touch lib/swift/intent-patterns/patient-care.ts
# ... etc
```
```typescript
// lib/swift/intent-patterns/documentation.ts
export const DOCUMENTATION_PATTERNS = {
dagnotitie: [
{ pattern: /^dagnotitie\b/i, weight: 1.0 },
// ...
],
rapportage_intake: [
// ...
],
};
```
**Step 3: Build Hierarchical Classifier**
```typescript
// lib/swift/intent-classifier-hierarchical.ts
import { DOCUMENTATION_PATTERNS } from './intent-patterns/documentation';
import { PATIENT_CARE_PATTERNS } from './intent-patterns/patient-care';
// ... import all
export const PATTERNS_BY_CATEGORY = {
[IntentCategory.DOCUMENTATION]: DOCUMENTATION_PATTERNS,
[IntentCategory.PATIENT_CARE]: PATIENT_CARE_PATTERNS,
// ...
};
```
**Step 4: Feature Flag**
```typescript
// Use feature flag for gradual rollout
const USE_HIERARCHICAL_CLASSIFIER = process.env.NEXT_PUBLIC_USE_HIERARCHICAL === 'true';
export function classifyIntent(input: string) {
if (USE_HIERARCHICAL_CLASSIFIER) {
return classifyIntentHierarchical(input);
}
return classifyIntentFlat(input); // Old implementation
}
```
**Step 5: A/B Test & Monitor**
```typescript
// Log both results for comparison
const flatResult = classifyIntentFlat(input);
const hierarchicalResult = classifyIntentHierarchical(input);
analytics.track('intent_classification_comparison', {
input,
flatIntent: flatResult.intent,
flatConfidence: flatResult.confidence,
flatTime: flatResult.processingTimeMs,
hierarchicalIntent: hierarchicalResult.intent,
hierarchicalConfidence: hierarchicalResult.confidence,
hierarchicalTime: hierarchicalResult.processingTimeMs,
agreement: flatResult.intent === hierarchicalResult.intent,
});
// Use hierarchical if enabled
return USE_HIERARCHICAL_CLASSIFIER ? hierarchicalResult : flatResult;
```
---
## 💡 Samenvatting
### Aanbevolen Aanpak
**NU (0-7 intents):**
- ✅ Implement pattern optimizations (fase 1)
- ✅ Add metrics tracking
- ⏸️ Wait met hierarchie
**LATER (15+ intents):**
- ✅ Implement categorie-based hierarchie (fase 2)
- ✅ Optioneel: keyword index of compositional intents
**Grootste Impact:**
1. **Category hierarchie** → 4-5x sneller, schaalbaar tot 40+ intents
2. **Pattern optimization** → 30-40% sneller, makkelijk win
3. **Priority ordering** → 7-8x sneller voor common cases
**Effort vs Gain:**
| Strategie | Effort | Performance Gain | Scalability Gain | When to Implement |
|-----------|--------|------------------|------------------|-------------------|
| Pattern optimization | 2 uur | 30-40% | Low | ✅ Now |
| Category hierarchie | 2 dagen | 4-5x | High | When >15 intents |
| Keyword index | 1 dag | 2x extra | Medium | If still slow |
| Compositional | 1 week | 8-10x | Very High | When >40 intents |
| AI categorization | 3 dagen | 0x (slower) | High (accuracy) | If accuracy issues |
**Quick Decision Matrix:**
```
Current intents < 10?
→ Pattern optimization only
Current intents 10-20?
→ Pattern optimization + start planning hierarchie
Current intents 20-40?
→ Implement category hierarchie NOW
Current intents >40?
→ Consider compositional intents
```

View File

@@ -1,10 +1,10 @@
# 🚀 Mission Control — Bouwplan Swift v3.0
💡 **Transformatie:** Van Command Center naar Medical Scribe Chatbot Interface
💡 **Transformatie:** Van Command Center naar Swift Assistent Chatbot Interface
---
**Projectnaam:** Swift Medical Scribe v3.0
**Projectnaam:** Swift Swift Assistent v3.0
**Versie:** v3.0
**Datum:** 27-12-2024
**Auteur:** Colin Lit
@@ -13,7 +13,7 @@
## 1. Doel en context
🎯 **Doel:** Swift transformeren van een command-line style interface naar een conversational medical scribe chatbot met split-screen layout (chat links, artifacts rechts).
🎯 **Doel:** Swift transformeren van een command-line style interface naar een conversational Swift Assistent chatbot met split-screen layout (chat links, artifacts rechts).
📘 **Context:**
De huidige Swift v2.1 werkt met een command-line paradigma waar gebruikers kort commando's typen ("notitie jan medicatie"). Dit werkt goed, maar voelt transactioneel aan. Gebruikers willen doorvragen, context behouden, en natuurlijker interacteren met het systeem.
@@ -29,7 +29,7 @@ De huidige Swift v2.1 werkt met een command-line paradigma waar gebruikers kort
4. **Bekende UX** — Lijkt op ChatGPT Canvas / Claude Artifacts (bekend voor gebruikers)
**Referenties:**
- **FO v3.0:** `fo-swift-medical-scribe-v3.md` — Functioneel ontwerp medical scribe
- **FO v3.0:** `fo-swift-medical-scribe-v3.md` — Functioneel ontwerp Swift Assistent
- **Haalbaarheid:** `haalbaarheidsanalyse-v3.md` — Feasibility analysis (6-8 weken, haalbaar)
- **UX Analyse:** `v3-redesign-met-huidige-styling.md` — Wat blijft vs. wijzigt
- **UX v2.1:** `archive/swift-ux-v2.1.md` — Huidige UX/styling
@@ -221,7 +221,7 @@ const useChatStore = create<ChatState>((set) => ({
| E0 | Pre-work & Planning | Design tokens, component audit, system prompt | ✅ **Compleet** | 3/3 | 5 SP | Docs aangemaakt |
| E1 | Foundation - Split-screen | Layout naar 40/60 split | ✅ **Compleet** | 3/3 | 12 SP | E1.S1 geskipt (geen feature flag) |
| E2 | Chat Panel & Messages | Chat UI zonder AI | ✅ **Compleet** | 5/5 | 13 SP | Scrolling, input, shortcuts |
| E3 | Chat API & Medical Scribe | AI conversatie werkend | ✅ **Compleet** | 6/6 | 21 SP | Artifact opening werkend! |
| E3 | Chat API & Swift Assistent | AI conversatie werkend | ✅ **Compleet** | 6/6 | 21 SP | Artifact opening werkend! |
| E4 | Artifact Area & Tabs | Meerdere artifacts mogelijk | ✅ **Compleet** | 3/4 | 10 SP | E4.S4 geskipt (placeholder in E4.S1) |
| E5 | AI-Filtering & Polish | Psychiater filtering, polish | ✅ **Compleet** | 5/5 | 13 SP | E5 COMPLEET 🎉 |
| E6 | Testing & Refinement | QA, bugs, performance | ⏳ To Do | 0/4 | 8 SP | Week 7-8 |
@@ -240,7 +240,7 @@ const useChatStore = create<ChatState>((set) => ({
### Epic 0 — Pre-work & Planning ✅ **COMPLEET**
**Epic Doel:** Voorbereiding werk voordat development start. Design tokens verificatie, component audit, medical scribe system prompt.
**Epic Doel:** Voorbereiding werk voordat development start. Design tokens verificatie, component audit, Swift Assistent system prompt.
| Story ID | Beschrijving | Acceptatiecriteria | Status | Afhankelijkheden | Story Points |
|----------|--------------|---------------------|--------|------------------|--------------|
@@ -400,7 +400,7 @@ const MESSAGE_STYLES = {
---
### Epic 3 — Chat API & Medical Scribe ✅ **COMPLEET**
### Epic 3 — Chat API & Swift Assistent ✅ **COMPLEET**
**Epic Doel:** AI conversatie werkend krijgen met intent detection en artifact opening.
@@ -441,7 +441,7 @@ export async function POST(req: Request) {
**E3.S3 - System Prompt (samenvatting):**
```
Je bent een medische assistent (medical scribe) voor Swift, een Nederlands GGZ EPD.
Je bent een medische assistent (Swift Assistent) voor Swift, een Nederlands GGZ EPD.
Je rol:
- Help zorgmedewerkers met documentatie en administratie
@@ -542,7 +542,7 @@ export function useChatStream() {
- ✅ Conversation history (max 20 messages)
**Deliverables (E3.S3 compleet):**
- ✅ `buildMedicalScribePrompt()` functie (243 regels) — Volledige medical scribe prompt v1.0
- ✅ `buildMedicalScribePrompt()` functie (243 regels) — Volledige Swift Assistent prompt v1.0
- ✅ Intent detection instructies: dagnotitie, zoeken, overdracht, rapportage
- ✅ P1 & P2 intents met triggers en entities
- ✅ Confidence thresholds (>0.9, 0.7-0.9, 0.5-0.7, <0.5)
@@ -1549,7 +1549,7 @@ function enrichWithSourceData(
**Minimaal werkend voor release:**
1. ✅ Split-screen layout werkend (desktop/tablet/mobile)
2. ✅ Conversatie met medical scribe voelt natuurlijk (niet robotisch)
2. ✅ Conversatie met Swift Assistent voelt natuurlijk (niet robotisch)
3. ✅ Artifacts openen binnen 2 sec na intent detection
4. ✅ AI-filtering psychiater >85% accuracy (behandelrelevante info)
5. ✅ Voice input geïntegreerd en werkend
@@ -1705,7 +1705,7 @@ function enrichWithSourceData(
**Mission Control Documents:**
- **PRD Ephemeral UI:** `docs/swift/archive/nextgen-epd-prd-ephemeral-ui-epd.md` — Product vision
- **FO v3.0:** `docs/swift/fo-swift-medical-scribe-v3.md` — Functioneel ontwerp medical scribe
- **FO v3.0:** `docs/swift/fo-swift-medical-scribe-v3.md` — Functioneel ontwerp Swift Assistent
- **Haalbaarheid:** `docs/swift/haalbaarheidsanalyse-v3.md` — Feasibility analysis
- **UX v2.1:** `docs/swift/archive/swift-ux-v2.1.md` — Huidige UX/styling
- **UX Analyse v3:** `docs/swift/v3-redesign-met-huidige-styling.md` — Wat blijft vs. wijzigt
@@ -1746,7 +1746,7 @@ function enrichWithSourceData(
| **Artifact** | UI-component die verschijnt in artifact area (block) |
| **Block** | Herbruikbare UI-component (DagnotatieBlock, ZoekenBlock, etc.) |
| **Prefill** | Vooringevulde data in artifact o.b.v. AI entity extraction |
| **Medical Scribe** | AI-assistent die medische documentatie ondersteunt |
| **Swift Assistent** | AI-assistent die medische documentatie ondersteunt |
| **Linked Evidence** | Klikbare links naar bronnotities in AI-samenvatting |
---

View File

@@ -0,0 +1,774 @@
# Competitive Analysis: Declaratieve UI in Nederlandse Software
**Onderzoeksdatum:** 29 december 2025
**Vraagstelling:** Zijn er Nederlandse softwareleveranciers (EPD/ECD, enterprise software) die een declaratieve UI hebben zoals Swift?
---
## Executive Summary
**Conclusie:** Swift's command-based, declaratieve UI is **uniek in de Nederlandse EPD markt** en zelfs internationaal zeldzaam. Geen enkele Nederlandse EPD leverancier (ChipSoft, Epic, Nexus) heeft een vergelijkbare command palette of natural language interface. Ook Nederlandse enterprise software (AFAS, Visma, Mollie, Adyen) documenteert geen command-based interfaces.
**Key Differentiators van Swift:**
1.**Command palette met natural language** - typ "notitie jan medicatie" vs klikken door menu's
2. 🤖 **AI intent classification** - begrijpt context en entities
3. 📱 **Split-screen artifact rendering** - 40% chat + 60% werkgebied
4. ⌨️ **Keyboard-first workflow** - ⌘K focus, Escape close, ⌘Enter submit
5. 🎯 **Contextual awareness** - actieve patiënt, recent actions
---
## 🏥 Nederlandse EPD/ECD Leveranciers
### Marktoverzicht (2025)
De Nederlandse EPD-markt bestaat uit drie hoofdspelers na het vertrek van SAP/Cerner:
| Leverancier | Marktaandeel | Type |
|-------------|--------------|------|
| **ChipSoft (HiX)** | 72% | Nederlands |
| **Epic** | 14% | Amerikaans |
| **Nexus** | 11% | Duits |
**Bron:** [M&I Partners EPD-marktinventarisatie 2024](https://mxi.nl/kennis/644/epd-marktinventarisatie-ziekenhuizen-2024-consolidatie-epd-markt-zet-door)
---
### ChipSoft HiX
**Bedrijfsinfo:**
- Marktleider in Nederland (72% ziekenhuizen)
- ISO 13485 gecertificeerd
- CE Medical Device klasse IIb certificering
- Actief in: apotheek, eerstelijnszorg, GGZ, huisartsenzorg, revalidatie, VVT, ZBC's, ziekenhuizen
**UI/UX Features:**
**Keyboard shortcuts** ("sneltoetsen")
- Ondersteuning voor sneltoetsen bij registratie
- Geen specifieke documentatie publiek beschikbaar
**Dedicated UX Team**
- Monitort en verbetert continu de 'look and feel'
- Werkt volgens internationale standards
- Observaties in werkplek om workflows te optimaliseren
- Taskoriented views per apparaat (desktop/tablet/mobile)
**Spraak-naar-tekst** (2025)
- Integratie met Juvoly's speech-to-text
- Reduceert registratielast voor huisartsen
- Dit is **dictatie**, geen natural language interface
**Personalisatie**
- Gebruikers kunnen schermlay-out aanpassen
- Favoriete functies configureren
- Voorkeur voor waar patiëntinformatie opent
**GEEN command palette of declaratieve UI**
- Traditionele menu-driven interface
- Geen natural language command input
- Geen keyboard-first workflow zoals Swift
**Design Filosofie:**
> "Wat direct opvalt bij het openen van HiX is de rustige uitstraling: eenvoudige pictogrammen, weinig lijnen en een centrale plek voor alle knoppen. Geen wildgroei aan kleuren... maar een apart pictogram voor elke eigenschap."
**Bronnen:**
- [ChipSoft Gebruiksvriendelijkheid](https://www.chipsoft.com/nl-be/hix-abc/hix-abc-articles/gebruiksvriendelijkheid/)
- [ChipSoft AI in HiX 2025](https://www.chipsoft.com/nl-nl/nieuws-en-blogs/ai-in-hix-ontdek-de-belangrijke-ontwikkelingen-in-2025/)
---
### Epic EMR
**Bedrijfsinfo:**
- 14% marktaandeel Nederlandse ziekenhuizen
- Amerikaans EHR/EMR systeem
- Groeiend in Nederland (recent: Ziekenhuis Amstelland, MUMC+)
**UI/UX Features:**
**Uitgebreide keyboard shortcuts**
Veelgebruikte shortcuts:
- `Ctrl + O` - Go to Orders (manage orders tab)
- `Alt + S` - Sign (sign current note)
- `Alt + A` - Accept (accept order)
- `Alt + [underlined letter]` - Selecteer menu optie
- Standard shortcuts: `Ctrl + C` (copy), `Ctrl + Z` (undo)
**Workflow optimalisatie**
- Shortcuts kunnen workflow aanzienlijk versnellen
- Vooral nuttig voor interventional radiologists en andere high-volume users
**GEEN command palette feature**
- Traditionele menu navigatie
- Geen natural language interface
- Geen centralized command bar
**GEEN conversational interface**
- Geen AI intent classification
- Geen voice-to-command (wel dictatie via Dragon Medical)
**Bronnen:**
- [Epic EMR Keyboard Shortcuts | TextExpander](https://textexpander.com/blog/epic-shortcuts)
- [Easy Epic Keyboard Shortcuts | BackTable](https://www.backtable.com/shows/vi/articles/epic-emr-keyboard-shortcuts-how-to)
---
### Nexus Nederland
**Bedrijfsinfo:**
- 11% marktaandeel Nederlandse ziekenhuizen
- Onderdeel van Duits Nexus AG
- Complete, modulaire EPD- en ECD-oplossingen voor ziekenhuizen en GGZ
- Recent: St. Anna Zorggroep verlengde contract
**UI/UX Features:**
- ❌ Geen specifieke UI innovaties gedocumenteerd
- ❌ Geen publieke informatie over keyboard shortcuts of command interfaces
**Bron:**
- [NEXUS Nederland](https://www.nexus-nederland.nl/)
---
## 🏢 Nederlandse Enterprise/SaaS Software
### HR Software: AFAS, Visma Nmbrs
**Visma Nmbrs:**
- 100,000+ klanten
- 1+ miljoen salarisadministraties per maand
- Onderdeel van Visma (grootste software producer NL)
**Features:**
**API integraties**
- User-friendly API met token-based authentication
- Auto-sync met andere systemen (R&R, AFAS Profit)
- Voorkomt dubbel werk en fouten
**GEEN command interface**
- Geen command palette gedocumenteerd
- Geen natural language interface
- Focus op webforms en automation
**AFAS:**
- Complete ERP voor MKB
- Sterk in accountancy, onderwijs, healthcare, trade
- Business Process Outsourcing (BPO) optie
**GEEN command interface** gedocumenteerd
**Bronnen:**
- [Nmbrs | Visma Nederland](https://www.visma.nl/onze-bedrijven/nmbrs)
- [AFAS | Visma Nmbrs Integraties](https://appstore.nmbrs.com/listings/afas)
---
### FinTech: Mollie, Adyen, MessageBird
**Mollie:**
- Opgericht 2004 door Adriaan Mol (18 jaar oud)
- 250,000+ bedrijven gebruiken Mollie
- Grootste Nederlandse fintech deal ooit: acquisitie GoCardless voor €1.1B (2025)
**Adyen:**
- Opgericht 2006 door Pieter van der Does en Arnout Schuijff
- Focus op grote ondernemingen en multinationals
- Omnichannel platform (online + fysieke winkels)
**MessageBird (nu Bird):**
- Opgericht 2011 door Robert Vis en Adriaan Mol
- Rebranded naar "Bird" in februari 2024
- 700+ medewerkers
- Focus: marketing, sales, payment solutions
**UI/UX Bevindingen:**
**GEEN command palette** features publiek gedocumenteerd
- Deze bedrijven focussen op **payment/messaging API's**
- End-user UI is vaak merchant dashboard (niet clinical workflow tool)
- Developer-first platforms, niet operator-first
**Interessant:** Adriaan Mol is de oprichter van TWEE unicorns (Mollie $6B, MessageBird $4B)
**Bronnen:**
- [De 15 beste Nederlandse SaaS-bedrijven | Web Whales](https://webwhales.nl/de-15-beste-nederlandse-saas-bedrijven/)
- [Mollie vs Stripe vs Adyen | Codelevate](https://www.codelevate.com/nl/blog/mollie-vs-stripe-vs-adyen-psp-comparison-2025)
---
## 🌍 Internationale Trends (2025)
### Microsoft Dragon Copilot for Nursing
**Lancering:** Late 2025
**Type:** AI Clinical Assistant voor verpleegkundigen
**Features:**
**Natural language conversational interface**
- Verpleegkundigen kunnen **natuurlijk praten** met patiënten
- Dragon Copilot **luistert op de achtergrond** (ambient listening)
- Veilige mobile app voor bedside gebruik
**Auto-generated documentation**
- Genereert **structured flowsheet entries**
- Nursing notes
- Concise summaries van encounters
**Query interface**
- Verpleegkundigen kunnen vragen stellen aan Copilot
- Antwoorden uit trusted sources (FDA, MedlinePlus)
- Right at the bedside
**Impact:**
- **70% reductie in clinician burnout** bij gebruik van ambient AI
- Documentatie is niet langer een separate task
- Context-aware en ambient (niet command-driven)
**Verschil met Swift:**
- Dragon Copilot is **ambient/passive** (luistert mee tijdens gesprek)
- Swift is **active/command-driven** (gebruiker initieert acties)
- Dragon focus: documentatie elimineren
- Swift focus: acties versnellen
**Bron:**
- [Microsoft Ignite 2025: Dragon Copilot for Nursing](https://techcommunity.microsoft.com/blog/healthcareandlifesciencesblog/highlights-from-ignite-2025-how-agentic-ai-and-microsoft-copilot-are-empowering-/4474658)
---
### M4 Infrastructure for EHR Data
**Type:** Research/data analysis tool
**Developer:** PathOnAI (academic/research)
**Features:**
**Natural language queries** voor EHR data
- Query MIMIC-IV, eICU, custom datasets
- Unified toolbox voor LLM agents
- Supports tabular data en clinical notes
**Multimodal support**
- Dynamically selects tools by modality
- Single natural-language interface
**Verschil met Swift:**
- M4 is **research/analytics tool**, niet clinical workflow
- Voor data scientists, niet clinici
- Query historical data, niet real-time documentation
**Bron:**
- [M4 - Infrastructure for EHR Data | Glama](https://glama.ai/mcp/servers/@hannesill/m4)
---
### Voice-First EHR Interfaces (2026 Trend)
**Trend:** Voice-first interfaces moving from experimental to mainstream
**Players:**
- Microsoft Dragon Copilot
- Oracle AI-driven platforms
**Features:**
- Natural language for documentation
- Navigation via voice
- Information retrieval via voice
**Impact:**
- 70% van clinici rapporteert **reduced burnout**
- Ambient AI luistert passief tijdens patient encounters
- Auto-generates clinical notes
**Bron:**
- [EHR Interface Design: The Complete 2026 Guide | Arkenea](https://arkenea.com/blog/ehr-interface/)
---
## 💻 Command Palettes in General Software
Command palettes zijn **wijdverspreid in developer tools**, maar **zeldzaam in healthcare**:
### Developer Tools
| Software | Shortcut | Platform |
|----------|----------|----------|
| **VS Code** | `Ctrl+Shift+P` / `Cmd+Shift+P` | Cross-platform |
| **GitHub** | `Ctrl+Shift+K` / `Cmd+Shift+K` | Web |
| **Visual Studio 2022** | `Ctrl+Shift+P` | Windows |
| **PowerToys** | `Win+Alt+Space` | Windows 11/10 |
| **Oracle Code Editor** | `F1` | Cloud IDE |
| **RStudio** | `Ctrl+Shift+P` / `Cmd+Shift+P` | Cross-platform |
**Common Pattern:**
- Keyboard-driven launcher
- Searchable command list
- Fuzzy search
- Shows keyboard shortcuts
- Context-aware suggestions
**Best Practices (Mobbin):**
- Most apps use `Cmd+K` or `Cmd+P`
- Quick access/hide via shortcut
- Search-driven interface
- Eliminates need to remember obscure shortcuts
- Faster than navigating complex menus
**Bronnen:**
- [Command Palette UI Design Best Practices | Mobbin](https://mobbin.com/glossary/command-palette)
- [How To Customize Command Palette For Enhanced Productivity In 2025](https://www.acciyo.com/how-to-customize-command-palette-for-enhanced-productivity-in-2025/)
---
## 🎯 Swift's Unique Position
### Wat Swift Combineert (en anderen NIET hebben)
Swift zit in een unieke positie door het combineren van vijf elementen die **afzonderlijk wel bestaan**, maar **zelden samen voorkomen**:
| Feature | Swift | ChipSoft | Epic | Dragon Copilot | Developer Tools |
|---------|-------|----------|------|----------------|-----------------|
| **Command palette** | ✅ | ❌ | ❌ | ❌ | ✅ |
| **Natural language input** | ✅ | ❌ | ❌ | ✅ | ❌ |
| **AI intent classification** | ✅ | ❌ | ❌ | ✅ | ❌ |
| **Split-screen artifacts** | ✅ | ❌ | ❌ | ❌ | ❌ |
| **Keyboard-first workflow** | ✅ | Partial | ✅ | ❌ | ✅ |
| **Contextual awareness** | ✅ | ❌ | ❌ | ✅ | Partial |
| **Healthcare-specific** | ✅ | ✅ | ✅ | ✅ | ❌ |
---
### Swift's Key Differentiators
#### 1. **Declaratief vs Imperatief**
**Traditional EPD's (ChipSoft, Epic, Nexus):**
- Menu-driven: Klik Patiënt → Notitie → Medicatie → Type → Submit
- Mouse-heavy: 10+ clicks voor simpele actie
- Imperatief: Gebruiker specificeert **HOE** (stap voor stap)
**Swift:**
- Command-driven: Type "notitie jan medicatie"
- Keyboard-first: 1 command + Enter
- Declaratief: Gebruiker specificeert **WAT** (doel)
#### 2. **Intent-based Routing**
**Swift's AI classificatie:**
```typescript
Input: "notitie jan medicatie"
Intent classification
Intent: "create_note"
Entities: { patientName: "jan", category: "medicatie" }
Confidence: 0.92
Route to artifact
Opens: DagnotatieBlock with prefill
```
**Andere EPD's:**
- Geen intent classificatie
- Gebruiker moet zelf navigeren
- Geen context extraction uit natural language
#### 3. **Split-Screen Context Retention**
**Swift:**
- 40% Chat Panel: Conversatie history + recent actions
- 60% Artifact Area: Live werkgebied
- Context blijft zichtbaar tijdens werken
**Andere EPD's:**
- Modal dialogs (verlies context)
- Full-screen forms (verlies overzicht)
- Tabbed interface (constant switchen)
#### 4. **Keyboard-First Workflow**
**Swift shortcuts:**
- `⌘K` - Focus input (altijd beschikbaar)
- `Escape` - Close artifacts
- `⌘Enter` - Quick submit
- `1/2/3` - FallbackPicker selection
**ChipSoft/Epic:**
- Hebben shortcuts, maar niet centraal
- Geen universal command entry point
- Shortcuts zijn per-screen/per-function
- Geen keyboard-only workflow mogelijk
#### 5. **Voice + Text Unified**
**Swift:**
- Deepgram streaming voice input
- Voice → Text → Intent classification
- Same pipeline voor voice en typed input
- Waveform visualization tijdens recording
**ChipSoft:**
- Juvoly dictatie (speech-to-text)
- Alleen voor notitie dictation
- Niet voor navigation/commands
**Dragon Copilot:**
- Ambient listening (passive)
- Auto-generates notes
- Niet voor commands/actions
---
### Market Positioning
```
Traditional EPD Swift Ambient AI
(Menu-driven) (Command-driven) (Passive listening)
ChipSoft ──────────────────────► ◄──────────────────── Dragon Copilot
Epic
Nexus
Mouse-heavy Keyboard-first Voice-passive
Imperative Declarative Automatic
Step-by-step Intent-based Ambient
```
**Swift's sweet spot:**
- Sneller dan traditional EPD's (minder clicks)
- Meer control dan ambient AI (gebruiker initieert)
- Keyboard-first (ergonomisch voor power users)
- Natural language (lage learning curve)
---
## 📊 Competitive Advantages
### 1. **Snelheid**
**Traditional workflow (ChipSoft/Epic):**
```
Klik Patiënt (1) → Selecteer Jan (2) → Klik Acties (3) →
Klik Notitie (4) → Selecteer Medicatie (5) → Type text (6) →
Klik Submit (7)
Total: 7 interactions, ~20 seconden
```
**Swift workflow:**
```
⌘K (1) → Type "notitie jan medicatie" (2) → ⌘Enter (3)
Total: 3 interactions, ~5 seconden
```
**Speed advantage: 4x sneller**
---
### 2. **Cognitieve last**
**Traditional EPD:**
- Moet menu structure onthouden
- Moet locatie van functies onthouden
- Moet door meerdere screens navigeren
- Context switching tussen screens
**Swift:**
- Type intentie in natural language
- AI herkent context automatisch
- Blijf in hetzelfde window
- Context blijft zichtbaar in split-screen
**Cognitive load: Significant lager**
---
### 3. **Leer curve**
**Traditional EPD:**
- Training nodig voor menu navigatie
- Moet locaties onthouden
- Verschillende workflows per functie
**Swift:**
- Natural language (spreek zoals je denkt)
- FallbackPicker bij onduidelijke input
- Recent actions tonen voorbeelden
- Incrementeel leren (geen big bang training)
**Learning curve: Vlakker**
---
### 4. **Ergonomie**
**Mouse-heavy workflows:**
- Repetitive Strain Injury (RSI) risico
- Hand van keyboard naar muis
- Precision clicking (klein target)
**Swift keyboard-first:**
- Hands blijven op keyboard
- Geen precision clicking
- Voice fallback bij RSI/disability
- Lager RSI risico
---
### 5. **Schaalbaarheid**
**Traditional menu's:**
- Meer functies = diepere menu's
- Menu sprawl bij feature growth
- Moeilijker te navigeren over tijd
**Swift command palette:**
- Meer functies = meer commands
- Search/fuzzy match blijft efficient
- AI kan nieuwe intents leren
- Lineair schaalbaar
---
## 🚀 Innovation Opportunities
### Wat Swift kan toevoegen (geïnspireerd door onderzoek)
#### 1. **Macro's / Custom Commands**
Inspiratie: TextExpander, VS Code snippets
```
User creates custom command:
"dagstart" → Opens 5 artifacts:
- Agenda voor vandaag
- Nieuwe patiënten
- Kritieke waardes
- Taken
- Team chat
```
#### 2. **Multi-step Commands**
Inspiratie: GitHub CLI, PowerToys Run
```
User types:
"plan jan consult cardio volgende week"
Swift parses:
- Action: plan appointment
- Patient: jan
- Type: consult
- Specialty: cardio
- Time: volgende week
Opens: Appointment scheduler with prefill
```
#### 3. **Command History & Autocomplete**
Inspiratie: Shell history, VS Code recent commands
```
User types: "not"
Autocomplete suggestions:
- notitie jan medicatie (used 3x today)
- notitie maria adl (used yesterday)
- nieuwe patient intake
```
#### 4. **Voice Commands Training**
Inspiratie: Dragon Medical custom vocabulary
```
User trains Swift:
"dagno" → dagnotatie
"medi jan" → medicatie voor jan
"print epd" → export patient summary PDF
```
#### 5. **Team Shared Commands**
Inspiratie: VS Code workspace settings
```
Team creates shared command:
"overdracht ochtend" → Opens:
- Nachtdienst notities
- Kritieke events
- Action items
- Patient status changes
```
---
## 🎓 Lessons from Competition
### What Works (implement in Swift)
1. **ChipSoft's UX Team approach**
- Continuous workplace observation
- User-specific customization
- Task-oriented views per device
2. **Epic's comprehensive shortcuts**
- Document ALL shortcuts
- Alt + underlined letter pattern
- Workflow-specific shortcuts
3. **Dragon Copilot's ambient approach**
- Reduce documentation burden
- Context-aware auto-fill
- Trusted source integration
4. **Developer tool patterns**
- Fuzzy search in command palette
- Recent commands prioritization
- Visual keyboard hints
### What Doesn't Work (avoid in Swift)
1. **Vendor lock-in (ChipSoft/Epic)**
- Systems "te duur" en "gebrekkige wil tot aanpassingen"
- Moeilijk om over te stappen (verweven met andere systemen)
- **Swift:** Stay modular, open standards (FHIR)
2. **Menu sprawl**
- Meer features = diepere menus
- **Swift:** Command palette scales linearly
3. **Passive-only AI (Dragon)**
- Geen control over timing
- Niet geschikt voor alle workflows
- **Swift:** User-initiated blijft belangrijk
4. **Platform fragmentation**
- Desktop-only shortcuts
- Mobile separate workflow
- **Swift:** Unified command interface cross-platform
---
## 📈 Market Opportunity
### Current EPD Market Pain Points
1. **Efficiency crisis**
- Clinici spenderen 50%+ tijd aan administratie
- Burnout epidemic in healthcare
- **Swift's answer:** 4x sneller via command interface
2. **Vendor lock-in**
- Ziekenhuizen "kunnen er bijna niet meer vanaf"
- "Enorme kosten van EPD-vervanging"
- **Swift's answer:** Modular, cloud-based, lower switching cost
3. **Poor usability**
- "Veel te dure informatiesystemen"
- "Gebrekkige wil tot aanpassingen"
- **Swift's answer:** User-centered, command-driven, highly customizable
4. **Consolidation limiting choice**
- Markt van 5 naar 3 spelers (SAP/Cerner exit)
- ChipSoft 72% monopoly
- **Swift's answer:** New entrant with differentiated approach
---
### Target Segments
**Early Adopters (Power Users):**
- Tech-savvy clinicians
- Interventional specialties (radiology, surgery)
- High-volume workflows (IC, ER)
- Keyboard-first preference
**Innovator Hospitals:**
- Academic medical centers (research-oriented)
- Startup/scale-up hospitals
- Organizations frustrated with current vendor
**International:**
- Markets with less vendor lock-in
- English-speaking countries (easier localization)
- Countries with national EHR initiatives
---
## 🏁 Conclusion
### Swift's Competitive Position: **Uniquely Positioned**
**Summary:**
-**Geen Nederlandse EPD** heeft command palette of declaratieve UI
-**Geen Nederlandse enterprise software** documenteert vergelijkbare interface
-**Internationale trends** (Dragon Copilot, M4) gaan richting natural language, maar met andere focus (ambient vs command-driven)
-**Developer tools** hebben command palettes, maar niet healthcare-specific
-**Swift combineert** vijf elementen die afzonderlijk bestaan maar zelden samen
### Unique Value Proposition
Swift is:
1. **Sneller** dan traditional EPD's (4x via keyboard-first)
2. **Meer control** dan ambient AI (user-initiated)
3. **Lager cognitive load** dan menu-driven interfaces
4. **Schaalbaarder** dan menu hierarchies
5. **Ergonomischer** dan mouse-heavy workflows
### Recommendation
**Go-to-market positioning:**
> "Swift: De eerste command-driven EPD voor power users.
> Type WAT je wilt, niet HOE. 4x sneller dan klikken door menu's."
**Target message:**
- Voor tech-savvy clinicians: "EPD met shortcuts zoals VS Code"
- Voor administrators: "Reduce documentation time 70%"
- Voor hospitals: "Moderne EPD zonder vendor lock-in"
**Next steps:**
1. Publiceer competitive analysis (deze doc)
2. Create demo video comparing Swift vs ChipSoft workflow
3. Develop case studies met time savings metrics
4. Target early adopter hospitals (academic centers)
5. Present at Dutch healthcare innovation conferences
---
## 📚 Bronnen
### Nederlandse EPD Markt
- [EPD-marktinventarisatie ziekenhuizen 2024 | M&I/Partners](https://mxi.nl/kennis/644/epd-marktinventarisatie-ziekenhuizen-2024-consolidatie-epd-markt-zet-door)
- [Consolidatie op Nederlandse EPD-markt | ICT&health](https://www.icthealth.nl/nieuws/consolidatie-op-nederlandse-epd-markt-zet-door-met-vertrek-sapcerner)
- [ACM: ziekenhuizen sterk afhankelijk van EPD-leverancier | Security.NL](https://www.security.nl/posting/735021/ACM:+ziekenhuizen+sterk+afhankelijk+van+EPD-leverancier,+pati%C3%ABnten+dupe)
### ChipSoft HiX
- [ChipSoft Gebruiksvriendelijkheid](https://www.chipsoft.com/nl-be/hix-abc/hix-abc-articles/gebruiksvriendelijkheid/)
- [ChipSoft AI in HiX 2025](https://www.chipsoft.com/nl-nl/nieuws-en-blogs/ai-in-hix-ontdek-de-belangrijke-ontwikkelingen-in-2025/)
- [ChipSoft HiX Homepage](https://www.chipsoft.com/nl-nl/oplossingen/elektronisch-patientendossier-hix-optimale-zorginnovatie/)
### Epic EMR
- [Epic EMR Keyboard Shortcuts | TextExpander](https://textexpander.com/blog/epic-shortcuts)
- [Easy Epic Keyboard Shortcuts | BackTable](https://www.backtable.com/shows/vi/articles/epic-emr-keyboard-shortcuts-how-to)
### Nexus
- [NEXUS Nederland EPD leverancier](https://www.nexus-nederland.nl/)
### Nederlandse SaaS
- [De 15 beste Nederlandse SaaS-bedrijven | Web Whales](https://webwhales.nl/de-15-beste-nederlandse-saas-bedrijven/)
- [Nmbrs | Visma Nederland](https://www.visma.nl/onze-bedrijven/nmbrs)
- [Mollie vs Stripe vs Adyen | Codelevate](https://www.codelevate.com/nl/blog/mollie-vs-stripe-vs-adyen-psp-comparison-2025)
### Internationale Trends
- [Microsoft Ignite 2025: Dragon Copilot for Nursing](https://techcommunity.microsoft.com/blog/healthcareandlifesciencesblog/highlights-from-ignite-2025-how-agentic-ai-and-microsoft-copilot-are-empowering-/4474658)
- [EHR Interface Design: The Complete 2026 Guide | Arkenea](https://arkenea.com/blog/ehr-interface/)
- [M4 - Infrastructure for EHR Data | Glama](https://glama.ai/mcp/servers/@hannesill/m4)
- [Large language models in healthcare | Nature Medicine](https://www.nature.com/articles/s41591-024-03199-w)
### Command Palettes
- [Command Palette UI Design Best Practices | Mobbin](https://mobbin.com/glossary/command-palette)
- [How To Customize Command Palette For Enhanced Productivity In 2025](https://www.acciyo.com/how-to-customize-command-palette-for-enhanced-productivity-in-2025/)
- [GitHub Command Palette Docs](https://docs.github.com/en/enterprise-cloud@latest/get-started/using-github/github-command-palette)
- [PowerToys Command Palette | Microsoft Learn](https://learn.microsoft.com/en-us/windows/powertoys/command-palette/overview)
---
**Document Version:** 1.0
**Laatste update:** 29 december 2025
**Auteur:** Colin (met Claude Code)

View File

@@ -1,4 +1,4 @@
# E0.S3 — Medical Scribe System Prompt
# E0.S3 — Swift Assistent System Prompt
**Datum:** 27-12-2024
**Versie:** v1.0
@@ -9,12 +9,12 @@
## System Prompt v1.0
Dit is de eerste versie van de medical scribe system prompt voor `/api/swift/chat`.
Dit is de eerste versie van de Swift Assistent system prompt voor `/api/swift/chat`.
### Volledige Prompt
```markdown
Je bent een medische assistent (medical scribe) voor Swift, een Nederlands EPD-systeem voor GGZ-instellingen.
Je bent Swift Assistent, een medische assistent voor Swift EPD, een Nederlands EPD-systeem voor GGZ-instellingen.
## Je rol
@@ -508,7 +508,7 @@ Er ging iets mis bij het openen van de notitie. Probeer het opnieuw, of neem con
| Versie | Datum | Wijzigingen |
|--------|-------|-------------|
| v1.0 | 27-12-2024 | Initial prompt - Dutch medical scribe, intents, examples |
| v1.0 | 27-12-2024 | Initial prompt - Dutch Swift Assistent, intents, examples |
---

View File

@@ -1,6 +1,6 @@
# 🧩 Functioneel Ontwerp (FO) — Swift Medical Scribe Chatbot
# 🧩 Functioneel Ontwerp (FO) — Swift Swift Assistent Chatbot
**Projectnaam:** Swift — Medical Scribe Chatbot Interface
**Projectnaam:** Swift — Swift Assistent Chatbot Interface
**Versie:** v3.0
**Datum:** 27-12-2024
**Auteur:** Colin Lit
@@ -10,7 +10,7 @@
## 1. Doel en relatie met het PRD
🎯 **Doel van dit document:**
Dit Functioneel Ontwerp beschrijft het **redesign** van Swift naar een medical scribe chatbot interface. De gebruiker voert een natuurlijke conversatie met een AI-assistent die intents herkent, acties uitvoert, en relevante UI-componenten toont in een split-screen layout.
Dit Functioneel Ontwerp beschrijft het **redesign** van Swift naar een Swift Assistent chatbot interface. De gebruiker voert een natuurlijke conversatie met een AI-assistent die intents herkent, acties uitvoert, en relevante UI-componenten toont in een split-screen layout.
📘 **Relatie met andere documenten:**
- **PRD:** `nextgen-epd-prd-ephemeral-ui-epd.md` — Ephemeral UI visie
@@ -19,16 +19,16 @@ Dit Functioneel Ontwerp beschrijft het **redesign** van Swift naar een medical s
- **Bouwplan:** `bouwplan-swift-v2.md` — Development roadmap
**Kernprincipe:**
> De gebruiker voert een natuurlijke conversatie met een medical scribe assistent. De assistent herkent intents, voert acties uit, en toont relevante UI-componenten (artifacts) rechts in beeld. De conversatie blijft zichtbaar en doorlopend — zoals ChatGPT Canvas of Claude Artifacts.
> De gebruiker voert een natuurlijke conversatie met een Swift Assistent assistent. De assistent herkent intents, voert acties uit, en toont relevante UI-componenten (artifacts) rechts in beeld. De conversatie blijft zichtbaar en doorlopend — zoals ChatGPT Canvas of Claude Artifacts.
**Belangrijkste wijzigingen t.o.v. v2.0:**
| Aspect | v2.0 (Command Center) | v3.0 (Medical Scribe) |
| Aspect | v2.0 (Command Center) | v3.0 (Swift Assistent) |
|--------|----------------------|----------------------|
| Input model | Command-line stijl | Natuurlijke conversatie |
| UI paradigma | Blocks die verschijnen/verdwijnen | Chat links, artifacts rechts |
| Context | Per commando | Doorlopende conversatiegeschiedenis |
| AI rol | Intent classifier | Converserende medical scribe |
| AI rol | Intent classifier | Converserende Swift Assistent |
| Interactie | Transactioneel | Relationeel, follow-up mogelijk |
---
@@ -108,7 +108,7 @@ Dit Functioneel Ontwerp beschrijft het **redesign** van Swift naar een medical s
### 4.1 Command Center (Hoofdscherm)
**Beschrijving:**
Split-screen layout met chat links (40%) en artifacts rechts (60%). De gebruiker voert een natuurlijke conversatie met de medical scribe assistent.
Split-screen layout met chat links (40%) en artifacts rechts (60%). De gebruiker voert een natuurlijke conversatie met de Swift Assistent assistent.
**Layout:**
@@ -184,7 +184,7 @@ Split-screen layout met chat links (40%) en artifacts rechts (60%). De gebruiker
### 4.3 Chat Panel
**Functie:** Toont doorlopende conversatie met medical scribe assistent.
**Functie:** Toont doorlopende conversatie met Swift Assistent assistent.
**Elementen:**
@@ -216,7 +216,7 @@ Split-screen layout met chat links (40%) en artifacts rechts (60%). De gebruiker
### 4.4 Chat Input
**Functie:** Tekst + voice input voor conversatie met medical scribe.
**Functie:** Tekst + voice input voor conversatie met Swift Assistent.
**States:**
@@ -301,7 +301,7 @@ Split-screen layout met chat links (40%) en artifacts rechts (60%). De gebruiker
---
### 4.6 Medical Scribe Chat API
### 4.6 Swift Assistent Chat API
**Functie:** Chatbot endpoint die conversatie voert en intents herkent.
@@ -347,7 +347,7 @@ interface ChatRequest {
**System Prompt (samenvatting):**
```
Je bent een medische assistent (medical scribe) voor Swift, een Nederlands GGZ EPD.
Je bent een medische assistent (Swift Assistent) voor Swift, een Nederlands GGZ EPD.
Je rol:
- Help zorgmedewerkers met documentatie en administratie
@@ -739,4 +739,4 @@ components/swift/
|--------|-------|-------------|
| v2.0 | 23-12-2024 | Command Center met ephemeral blocks |
| v2.1 | 23-12-2024 | Prioriteitenlijst, intent mapping, P3 blocks |
| v3.0 | 27-12-2024 | **Redesign:** Chat + Artifact interface, Medical Scribe conversatie, AI-filtering voor psychiater |
| v3.0 | 27-12-2024 | **Redesign:** Chat + Artifact interface, Swift Assistent conversatie, AI-filtering voor psychiater |