docs: add architecture and intake intent documentation

- Add architecture overview, implementation plan, and intent overview
- Add intake intent process specs (gap analyse, bouwplan, testplan)
- Add swift architecture specs and visualization prompts
- Remove obsolete aispeedrun-manifesto template

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
colinislit
2026-02-04 19:26:14 +01:00
parent 91b61d215b
commit af88ac9446
18 changed files with 6905 additions and 756 deletions

View File

@@ -0,0 +1,379 @@
# Gap Analyse: Intake Proces × Cortex
**Datum:** 03-02-2026
**Status:** Analyse
**Bron:** `docs/intent/intake-process-intents.md`
---
## 1. Executive Summary
| Laag | Status | Conclusie |
|------|--------|-----------|
| **EPD Backend** | ✅ 90% compleet | Server actions, database, API's zijn uitgebreid aanwezig |
| **EPD UI** | ✅ 95% compleet | Alle 9 intake tabs + screening hebben werkende componenten |
| **Cortex Intents** | ❌ 0% | Geen van de 26 intake intents bestaat |
| **Cortex Blocks** | ❌ 0% | Geen intake-specifieke blocks |
| **Cortex API** | ❌ 0% | Geen /api/cortex/intake/* routes |
**Conclusie:** De EPD-functionaliteit is robuust gebouwd. De koppeling met Cortex ontbreekt volledig.
---
## 2. Wat Bestaat (✅)
### 2.1 Cortex Core (7 intents)
```typescript
// lib/cortex/types.ts
type CortexIntent =
| 'dagnotitie' // ✅ Block + patterns
| 'zoeken' // ✅ Block + patterns
| 'overdracht' // ✅ Block + patterns
| 'agenda_query' // ✅ Patterns (geen dedicated block)
| 'create_appointment' // ✅ Patterns
| 'cancel_appointment' // ✅ Patterns
| 'reschedule_appointment'// ✅ Patterns
| 'unknown';
```
### 2.2 Cortex Blocks (6 stuks)
| Block | Pad | Functie |
|-------|-----|---------|
| `dagnotitie-block.tsx` | `components/cortex/blocks/` | Notitie invoer |
| `zoeken-block.tsx` | `components/cortex/blocks/` | Patiënt zoeken |
| `overdracht-block.tsx` | `components/cortex/blocks/` | Overdracht samenvatting |
| `patient-dashboard-block.tsx` | `components/cortex/blocks/` | Patiënt overzicht |
| `patient-context-card.tsx` | `components/cortex/blocks/` | Context weergave |
| `fallback-picker.tsx` | `components/cortex/blocks/` | Unknown intent handler |
### 2.3 Cortex API Routes
| Route | Methode | Functie |
|-------|---------|---------|
| `/api/cortex/classify` | POST | Intent classificatie |
| `/api/cortex/chat` | POST | Streaming chat |
| `/api/cortex/context` | GET | Context ophalen |
| `/api/cortex/agenda` | GET | Agenda query |
| `/api/cortex/agenda/create` | POST | Afspraak maken |
| `/api/cortex/agenda/cancel` | POST | Afspraak annuleren |
| `/api/cortex/agenda/reschedule` | POST | Afspraak verzetten |
| `/api/cortex/patients/search` | GET | Patiënt zoeken |
### 2.4 EPD Screening (Volledig)
**UI Componenten:**
| Component | Status | Functie |
|-----------|--------|---------|
| `HelpRequestCard` | ✅ | Hulpvraag invoer (textarea) |
| `DecisionCard` | ✅ | Besluit: geschikt/niet_geschikt |
| `DocumentCard` | ✅ | Document upload |
| `ActivityLog` | ✅ | Activiteiten timeline |
**Server Actions:**
| Action | Status | Functie |
|--------|--------|---------|
| `getScreeningSummary()` | ✅ | Screening data ophalen |
| `saveHelpRequest()` | ✅ | Hulpvraag opslaan |
| `saveScreeningDecision()` | ✅ | Besluit opslaan |
| `addScreeningActivity()` | ✅ | Activiteit toevoegen |
### 2.5 EPD Intake (Volledig)
**9 Tabs met UI + Actions:**
| Tab | UI Component | GET Action | CREATE Action |
|-----|--------------|------------|---------------|
| Algemeen | `IntakePage` | `getIntakeById()` | `createIntake()` |
| Contactmomenten | `ContactManager` | `getContactMoments()` | `createContactMoment()` |
| Kindcheck | `KindcheckForm` | `getKindcheck()` | `saveKindcheck()` |
| Risicotaxatie | `RiskManager` | `getRiskAssessments()` | `createRiskAssessment()` |
| Anamnese | `AnamneseManager` | `getAnamneses()` | `createAnamnese()` |
| Onderzoeken | `ExaminationManager` | `getExaminations()` | `createExamination()` |
| ROM | `ExaminationManager` | `getExaminations()` | `createExamination()` |
| Diagnose | `DiagnosisManager` | `getDiagnoses()` | `createDiagnosis()` |
| Behandeladvies | `TreatmentAdviceForm` | `getTreatmentAdvice()` | `saveTreatmentAdvice()` |
---
## 3. Wat Ontbreekt (❌)
### 3.1 Intents (26 ontbreken)
Geen van de intake-gerelateerde intents uit `intake-process-intents.md` bestaat:
#### Screening Intents (4)
| Intent | Type | Patterns nodig |
|--------|------|----------------|
| `screening_query` | Query | `^(toon\s+)?screening`, `wat is de hulpvraag` |
| `hulpvraag_invoer` | Actie | `hulpvraag:`, `noteer hulpvraag` |
| `screening_besluit` | Actie | `geschikt voor behandeling`, `niet geschikt` |
| `screening_activiteit` | Actie | `gebeld met`, `verwijsbrief ontvangen` |
#### Intake Start Intents (2)
| Intent | Type | Patterns nodig |
|--------|------|----------------|
| `intake_starten` | Actie | `start intake`, `nieuwe intake` |
| `intake_lijst` | Query | `toon intakes`, `welke intakes` |
#### Intake Navigatie (3)
| Intent | Type | Patterns nodig |
|--------|------|----------------|
| `intake_navigeer` | Navigatie | `ga naar risico`, `open kindcheck` |
| `intake_volgende` | Navigatie | `volgende stap`, `ga verder` |
| `intake_vorige` | Navigatie | `vorige`, `terug` |
#### Intake Tab Intents (14)
| Intent | Type | Tab |
|--------|------|-----|
| `contact_toevoegen` | Actie | Contactmomenten |
| `contacten_query` | Query | Contactmomenten |
| `kindcheck_invullen` | Actie | Kindcheck |
| `kindcheck_query` | Query | Kindcheck |
| `risico_toevoegen` | Actie | Risicotaxatie |
| `risico_query` | Query | Risicotaxatie |
| `anamnese_toevoegen` | Actie | Anamnese |
| `anamnese_query` | Query | Anamnese |
| `onderzoek_toevoegen` | Actie | Onderzoeken |
| `onderzoeken_query` | Query | Onderzoeken |
| `rom_toevoegen` | Actie | ROM |
| `rom_query` | Query | ROM |
| `diagnose_toevoegen` | Actie | Diagnose |
| `diagnose_query` | Query | Diagnose |
| `behandeladvies_invoer` | Actie | Behandeladvies |
| `behandeladvies_query` | Query | Behandeladvies |
#### Intake Afsluiten (3)
| Intent | Type | Patterns nodig |
|--------|------|----------------|
| `intake_afsluiten` | Actie | `sluit intake af`, `intake afronden` |
| `intake_samenvatting` | Query | `samenvatting intake` |
| `intake_checklist` | Query | `wat moet ik nog doen`, `is intake compleet` |
### 3.2 Cortex Blocks (9 ontbreken)
| Block | Doel | Data bron |
|-------|------|-----------|
| `ScreeningBlock` | Screening overzicht | `getScreeningSummary()` |
| `IntakeListBlock` | Lijst intakes van patiënt | `getIntakesByPatientId()` |
| `IntakeStatusBlock` | Voortgang/checklist | Nieuwe functie nodig |
| `KindcheckBlock` | Kindcheck samenvatting | `getKindcheck()` |
| `RisicoBlock` | Risico's met levels | `getRiskAssessments()` |
| `AnamneseBlock` | Anamnese samenvatting | `getAnamneses()` |
| `DiagnoseBlock` | Diagnoses lijst | `getDiagnoses()` |
| `BehandeladviesBlock` | Behandeladvies tonen | `getTreatmentAdvice()` |
| `IntakeSamenvattingBlock` | AI samenvatting | Nieuwe AI functie nodig |
### 3.3 Cortex API Routes (ontbreken)
| Route | Methode | Functie |
|-------|---------|---------|
| `/api/cortex/screening` | GET | Screening data voor Cortex |
| `/api/cortex/intake` | GET | Intake lijst |
| `/api/cortex/intake/[id]` | GET | Intake details |
| `/api/cortex/intake/[id]/status` | GET | Intake voortgang/checklist |
| `/api/cortex/intake/[id]/risks` | GET | Risico's van intake |
| `/api/cortex/intake/[id]/diagnoses` | GET | Diagnoses van intake |
| `/api/cortex/intake/[id]/summary` | GET | AI samenvatting |
### 3.4 Reflex Patterns (ontbreken)
In `lib/cortex/reflex-classifier.ts` moeten patterns worden toegevoegd voor alle 26 intents.
---
## 4. Architectuur Gap
```
┌─────────────────────────────────────────────────────────────────────────┐
│ HUIDIGE SITUATIE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ CORTEX EPD │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ 7 Intents │ │ Screening UI │ │
│ │ 6 Blocks │ ❌ │ Intake UI (9) │ │
│ │ 8 API routes │ ─ ─ ─ ─ ─ ─ │ Server Actions │ │
│ └─────────────────┘ GEEN LINK └─────────────────┘ │
│ │
├─────────────────────────────────────────────────────────────────────────┤
│ GEWENSTE SITUATIE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ CORTEX EPD │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ 7 + 26 Intents │ │ Screening UI │ │
│ │ 6 + 9 Blocks │ ✅ │ Intake UI (9) │ │
│ │ 8 + 7 API routes│ ◀──────────▶ │ Server Actions │ │
│ └─────────────────┘ GEKOPPELD └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
```
---
## 5. Implementatie Roadmap
### Fase 1: Foundation (Query Intents)
**Doel:** Informatie opvragen via spraak
| # | Taak | Effort | Prioriteit |
|---|------|--------|------------|
| 1.1 | Intent types toevoegen aan `types.ts` | S | 🔴 |
| 1.2 | Patterns toevoegen aan `reflex-classifier.ts` | M | 🔴 |
| 1.3 | `IntakeStatusBlock` bouwen | M | 🔴 |
| 1.4 | `RisicoBlock` bouwen | S | 🔴 |
| 1.5 | `DiagnoseBlock` bouwen | S | 🟡 |
| 1.6 | `/api/cortex/intake/*` routes | M | 🔴 |
**Resultaat:** "Wat zijn de risico's?", "Is de intake compleet?" werken
### Fase 2: Navigation (Navigatie Intents)
**Doel:** Navigeren via spraak
| # | Taak | Effort | Prioriteit |
|---|------|--------|------------|
| 2.1 | `intake_navigeer` patterns | S | 🔴 |
| 2.2 | Navigation handler in orchestrator | M | 🔴 |
| 2.3 | Router integratie | M | 🟡 |
**Resultaat:** "Ga naar diagnose", "Open kindcheck" werken
### Fase 3: Actions (Actie Intents)
**Doel:** Data invoeren via spraak
| # | Taak | Effort | Prioriteit |
|---|------|--------|------------|
| 3.1 | `intake_starten` intent + handler | M | 🟡 |
| 3.2 | `risico_toevoegen` intent + handler | L | 🟡 |
| 3.3 | `diagnose_toevoegen` intent + handler | L | 🟡 |
| 3.4 | Confirmatie dialogen | M | 🟡 |
**Resultaat:** "Start intake", "Risico suïcidaliteit matig" werken
### Fase 4: Intelligence (AI Features)
**Doel:** Slimme AI functionaliteit
| # | Taak | Effort | Prioriteit |
|---|------|--------|------------|
| 4.1 | `IntakeSamenvattingBlock` met AI | L | 🔵 |
| 4.2 | Intake-gerelateerde nudges | M | 🔵 |
| 4.3 | Context-aware suggestions | L | 🔵 |
**Resultaat:** "Samenvatting intake", proactieve suggesties werken
---
## 6. Effort Schatting
| Fase | Items | Effort |
|------|-------|--------|
| Fase 1: Foundation | 6 taken | ~3-4 dagen |
| Fase 2: Navigation | 3 taken | ~1-2 dagen |
| Fase 3: Actions | 4 taken | ~3-4 dagen |
| Fase 4: Intelligence | 3 taken | ~2-3 dagen |
| **Totaal** | **16 taken** | **~10-13 dagen** |
---
## 7. Quick Wins
Snel te implementeren met hoge waarde:
### 7.1 `intake_status` Query (1 dag)
```typescript
// Input: "Wat moet ik nog doen?" / "Is de intake compleet?"
// Output: Checklist met voltooide/openstaande tabs
// Nieuwe functie nodig:
async function getIntakeCompletionStatus(intakeId: string) {
const intake = await getIntakeById(intakeId);
const kindcheck = await getKindcheck(intakeId);
const risks = await getRiskAssessments(intakeId);
const diagnoses = await getDiagnoses(intakeId);
// etc...
return {
algemeen: !!intake,
kindcheck: !!kindcheck.hasChildren !== undefined,
risicotaxatie: risks.length > 0,
diagnose: diagnoses.length > 0,
// ...
};
}
```
### 7.2 `risico_query` (0.5 dag)
```typescript
// Input: "Wat zijn de risico's?"
// Output: RisicoBlock met bestaande getRiskAssessments()
// Block template:
<RisicoBlock
risks={[
{ type: 'suicidaliteit', level: 'matig', rationale: '...' },
{ type: 'agressie', level: 'laag', rationale: '...' }
]}
/>
```
### 7.3 `intake_navigeer` (0.5 dag)
```typescript
// Input: "Ga naar diagnose"
// Output: router.push() naar juiste tab
// Pattern matching:
{ pattern: /^ga\s+naar\s+(risico|diagnose|kindcheck|anamnese)/i, weight: 1.0 }
```
---
## 8. Dependencies
```
types.ts (intent definitions)
reflex-classifier.ts (patterns)
/api/cortex/intake/* (data routes)
blocks/*.tsx (UI components)
canvas-area.tsx (block rendering)
```
---
## 9. Risico's
| Risico | Impact | Mitigatie |
|--------|--------|-----------|
| Intake context niet beschikbaar | Hoog | ActiveIntake store toevoegen |
| Meerdere intakes per patiënt | Middel | Intent clarification bij ambiguïteit |
| Performance bij grote datasets | Laag | Pagination in queries |
| Pattern overlap met bestaande intents | Middel | Goede escalation logic |
---
## 10. Aanbeveling
**Start met Fase 1 (Query Intents)** omdat:
1. Hergebruikt bestaande server actions
2. Geen destructieve acties (veilig)
3. Direct waarde voor gebruiker
4. Legt foundation voor actie intents
**Eerste implementatie:**
1. `intake_status` - "Wat moet ik nog doen?"
2. `risico_query` - "Wat zijn de risico's?"
3. `intake_navigeer` - "Ga naar diagnose"
Deze 3 intents dekken de belangrijkste use case: snel navigeren en informatie opvragen tijdens een intake sessie.