feat: migrate clients module to patients + add docs

This commit is contained in:
colinislit
2025-11-23 10:13:00 +01:00
parent 8e3925ea09
commit 6fcb9a0e7b
277 changed files with 9131 additions and 458 deletions

View File

@@ -137,18 +137,18 @@ Het Mini EPD is een modern dossier systeem voor behandelaren in de GGZ. Het onde
**Routing structure:**
```
/epd/dashboard → Behandelaar dashboard (Level 1)
/epd/clients Cliënten lijst (Level 1)
/epd/clients/[id] Client dashboard (Level 2)
/epd/clients/[id]/intake → Intake sectie (Level 2)
/epd/clients/[id]/diagnose → Diagnose sectie (Level 2)
/epd/clients/[id]/plan → Behandelplan (Level 2)
/epd/patients → Patiënten lijst (Level 1)
/epd/patients/[id] → Patient dashboard (Level 2)
/epd/patients/[id]/intakes → Intake sectie (Level 2)
/epd/patients/[id]/diagnose → Diagnose sectie (Level 2)
/epd/patients/[id]/plan → Behandelplan (Level 2)
```
**Context detection logic:**
```typescript
const isClientDossier = pathname.includes('/clients/') &&
pathname.match(/\/clients\/[^\/]+/);
const clientId = isClientDossier ? pathname.split('/')[3] : null;
const isPatientDossier = pathname.includes('/patients/') &&
pathname.match(/\/patients\/[^\/]+/);
const patientId = isPatientDossier ? pathname.split('/')[3] : null;
```
**Components:**
@@ -198,10 +198,10 @@ const debouncedSearch = useMemo(
```
**Components:**
- `app/epd/clients/page.tsx` - Cliënten lijst
- `app/epd/clients/components/client-list.tsx`
- `app/epd/clients/components/client-search.tsx`
- `app/epd/clients/new/page.tsx` - Nieuwe cliënt form
- `app/epd/patients/page.tsx` - Patiënten lijst
- `app/epd/patients/components/patient-list.tsx`
- `app/epd/patients/components/patient-search.tsx`
- `app/epd/patients/new/page.tsx` - Nieuwe patiënt form
---
@@ -250,9 +250,9 @@ intake_notes (
```
**Components:**
- `app/epd/clients/[id]/intake/page.tsx` - Intake lijst
- `app/epd/clients/[id]/intake/components/intake-editor.tsx`
- `app/epd/clients/[id]/intake/components/intake-detail-panel.tsx`
- `app/epd/patients/[id]/intakes/page.tsx` - Intake lijst
- `app/epd/patients/[id]/intakes/components/intake-editor.tsx`
- `app/epd/patients/[id]/intakes/components/intake-detail-panel.tsx`
---
@@ -293,9 +293,9 @@ const SEVERITY_CONFIG = {
```
**Components:**
- `app/epd/clients/[id]/diagnose/page.tsx`
- `app/epd/clients/[id]/diagnose/components/dsm-categories.tsx`
- `app/epd/clients/[id]/diagnose/components/severity-indicator.tsx`
- `app/epd/patients/[id]/diagnose/page.tsx`
- `app/epd/patients/[id]/diagnose/components/dsm-categories.tsx`
- `app/epd/patients/[id]/diagnose/components/severity-indicator.tsx`
---
@@ -357,10 +357,10 @@ await supabase
```
**Components:**
- `app/epd/clients/[id]/plan/page.tsx`
- `app/epd/clients/[id]/plan/components/smart-goals.tsx`
- `app/epd/clients/[id]/plan/components/interventions.tsx`
- `app/epd/clients/[id]/plan/components/plan-version-selector.tsx`
- `app/epd/patients/[id]/plan/page.tsx`
- `app/epd/patients/[id]/plan/components/smart-goals.tsx`
- `app/epd/patients/[id]/plan/components/interventions.tsx`
- `app/epd/patients/[id]/plan/components/plan-version-selector.tsx`
---

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -39,14 +39,14 @@
## 3. Epics & Stories Overzicht
| Epic ID | Titel | Doel | Status | Stories |
|---------|-------|------|--------|---------|
| E1 | Database & Types | Datamodel implementeren in Supabase | ✅ Done | 3 |
| E2 | Cliëntenbeheer | Lijstweergave en aanmaken cliënten | ✅ Done | 3 |
| E3 | Screening Module | Screening tab en functionaliteit | ⏳ To Do | 4 |
| E4 | Intake Core | Intake overzicht en navigatie | ✅ Done | 3 |
| E5 | Intake Details | Specifieke tabbladen (Contact, Risico, etc.) | ⏳ To Do | 5 |
| E6 | Diagnose & Advies | Diagnose stelling en behandeladvies | ⏳ To Do | 3 |
| Epic ID | Titel | Doel | Status | Stories | Progress |
|---------|-------|------|--------|---------|----------|
| E1 | Database & Types | Datamodel implementeren in Supabase | ✅ Done | 3 | 3/3 ✅ |
| E2 | Cliëntenbeheer | Lijstweergave en aanmaken cliënten | ✅ Done | 3 | 3/3 ✅ |
| E3 | Screening Module | Screening tab en functionaliteit | ⏳ To Do | 4 | 0/4 ⏳ |
| E4 | Intake Core | Intake overzicht en navigatie | ✅ Done | 3 | 3/3 ✅ |
| E5 | Intake Details | Specifieke tabbladen (Contact, Risico, etc.) | ✅ Done | 5 | 5/5 ✅ |
| E6 | Diagnose & Advies | Diagnose stelling en behandeladvies | ⏳ To Do | 3 | 0/3 ⏳ |
---
@@ -74,13 +74,19 @@
### Epic 3 — Screening Module (Level 2)
**Doel:** Faciliteren van het screeningsproces.
**Status:** ⏳ To Do - Database schema voltooid (E1), UI functionaliteit nog te implementeren
| Story ID | Beschrijving | Acceptatiecriteria |
|----------|--------------|---------------------|
| E3.S1 | Activiteitenlog | Tijdlijn component met toevoeg-functionaliteit. |
| E3.S2 | Documenten & Hulpvraag | Upload functionaliteit en tekstveld voor hulpvraag. |
| E3.S3 | Screeningsbesluit | Formulier voor besluit (geschikt/niet geschikt) + status update logica. |
| E3.S4 | Basisgegevens Tab | Read-only weergave met edit-modus voor NAW gegevens. |
| Story ID | Status | Beschrijving | Acceptatiecriteria |
|----------|--------|--------------|---------------------|
| E3.S1 | ✅ Done | Activiteitenlog | Tijdlijn component met activiteiten (datum, type, beschrijving):<br>- Chronologische weergave van screeningsactiviteiten<br>- Formulier om nieuwe activiteit toe te voegen<br>- Server Action `addScreeningActivity` voor persistentie<br>- Activity types: Telefoongesprek, Email, Consult, Overig<br>- Integratie met `screening_activities` tabel |
| E3.S2 | ✅ Done | Documenten & Hulpvraag | Upload functionaliteit en hulpvraag registratie:<br>- Document upload component met file preview<br>- Opslag in Supabase Storage (`screening-documents` bucket)<br>- Metadata opslag in `screening_documents` tabel<br>- Hulpvraag tekstveld (rich text) opgeslagen in `screenings.help_request`<br>- Server Actions voor upload en opslaan |
| E3.S3 | ✅ Done | Screeningsbesluit | Formulier voor screeningsbesluit met status update + verwijsbrief-warning:<br>- Besluit opties: Geschikt / Niet geschikt<br>- Motivation textbox + afdeling selectie<br>- Status update logica naar `screenings.decision` + patiënstatus<br>- Warning bij ontbrekende verwijsbrief |
| E3.S4 | ⏳ To Do | Basisgegevens Tab | Read-only weergave met edit-modus voor NAW:<br>- Display mode toont alle patient basisgegevens<br>- Edit knop voor wijzigingsmodus<br>- Inline editing of modal voor NAW gegevens<br>- Hergebruik van `PatientForm` component<br>- Save changes via `updatePatient` action<br>- Cancel/Reset functionaliteit |
**Database Dependencies (✅ Voltooid in E1):**
- `screenings` tabel met decision en help_request velden
- `screening_activities` tabel voor activiteitenlog
- `screening_documents` tabel voor document metadata
### Epic 4 — Intake Core (Level 2) ✅
**Doel:** Beheer van intakes (meerdere per cliënt mogelijk).
@@ -97,11 +103,11 @@
| Story ID | Beschrijving | Acceptatiecriteria |
|----------|--------------|---------------------|
| E5.S1 | Tab Algemeen | Overzicht van intake details, status en notities. |
| E5.S2 | Tab Contactmomenten | CRUD voor contactmomenten (datum, type, verslag). |
| E5.S3 | Tab Kindcheck | Formulier voor kindcheck registratie. |
| E5.S4 | Tab Risicotaxatie | Formulier voor risico-inschatting. |
| E5.S5 | Tabs Anamnese, Onderzoek, ROM | Generieke of specifieke formulieren voor deze onderdelen. |
| E5.S1 | ✅ Done | Tab Algemeen (read-only hulpvraag/besluit + notities). |
| E5.S2 | ✅ Done | Tab Contactmomenten (lijst + CRUD via `encounters`). |
| E5.S3 | ✅ Done | Tab Kindcheck (JSON-editing + alerts). |
| E5.S4 | ✅ Done | Tab Risicotaxatie (`risk_assessments` CRUD). |
| E5.S5 | ✅ Done | Tabs Anamnese, Onderzoek, ROM (gedeelde component met Supabase opslag). |
### Epic 6 — Diagnose & Advies
**Doel:** Afronding van de intake met diagnose en advies.

View File

@@ -0,0 +1,69 @@
# 📆 Gefaseerd Implementatieplan — Screening & Intake
Dit plan bouwt voort op het Functioneel Ontwerp (`fo-screening-intake-v1_0.md`) en het bouwplan (`bouwplan-screening-intake-v1.0.md`). Elk faseblok beschrijft scope, deliverables, afhankelijkheden en validatie zodat duidelijk is wanneer een epic “Done” mag worden verklaard.
---
## Fase 0 — Schema & Migratie Align (Week 0) 🟡 _(plan klaar, uitvoering wacht op Supabase maintenance)_
**Scope:** Repo en Supabase in sync brengen met de documentatie.
- 🟢 Migreer `docs/archive/migrations/20251122-supabase-scheme.sql` naar echte SQL-migraties in `supabase/migrations/`.
- 🟡 Voer migraties uit op alle omgevingen; documenteer eventuele datafixes (oude `clients``patients`).
- 🟢 Update `docs/migratie-clients-naar-patients.md` met runbook + status (RLS tests, API-doc, console-checks).
- 🟡 Valideer met `supabase db diff` en korte CRUD smoke-test op `/api/intakes` zodra maintenance voorbij is.
**DoD:** Schone installaties krijgen identiek schema, APIs werken lokaal, documentatie verwijst naar juiste migratiebestanden.
---
## Fase 1 — Screening Module (E3) (Week 1) 🟢 _(document upload + warning actief)_
**Scope:** UI + opslag voor activiteitenlog, documentbeheer, hulpvraag en screeningsbesluit.
- 🟢 Backend: CRUD server actions + `/api/screenings` endpoints volgens FO §4.3 en data model FO §10.210.4.
- 🟢 Frontend: activiteitenlog, hulpvraag en document upload/delete live.
- 🟢 Statuskoppeling van screeningsbesluit naar `patients.status` geïmplementeerd.
- 🟢 UX-warning bij ontbrekende verwijsbrief vóór besluit.
**DoD:** Alle vier secties functioneel, bestanden worden opgeslagen, statusbadge in header verandert correct, manual test checklist items “Screening doorlopen” en “Besluit nemen” afgevinkt.
---
## Fase 2 — Intake Details (E5) (Week 23) 🟢 _(routing + CRUD opgezet)_
**Scope:** Alle intake-subtabs uit FO §4.4.44.4.10 inclusief nieuwe tabroutes.
- 🟢 Routing child routes (`/contacts`, `/kindcheck`, `/risk`, `/anamnese`, `/onderzoeken`, `/rom`, `/diagnose`, `/behandeladvies`).
- 🟢 Contactmomenten UI/CRUD op `encounters`.
- 🟢 Kindcheck & Risicotaxaties formulieren (JSONB + `risk_assessments`).
- 🟢 Anamnese/Onderzoeken/ROM tabfunctionaliteit (gedeelde component + Supabase mutaties).
- 🟢 Diagnoses (`conditions`) en Behandeladvies (`intakes.treatment_advice`).
- 🟡 Intakekaart metrics (#contactmomenten, diagnoses, status “bezig/afgerond”).
**DoD:** Alle tabs renderen data uit DB, formulieren schrijven terug, status `bezig/afgerond` sluit aan op FO §8.3, manual checklist items “Intake starten”, “Contactmoment toevoegen” en “Intake afronden” geslaagd.
---
## Fase 3 — Diagnose & Behandeladvies (E6) (Week 4) 🟡 _(metadata + tiptap live, diagnose nog te doen)_
**Scope:** DSM-5 diagnose registratie, behandeladvies en statuskoppeling.
- 🔧 Diagnose tab: CRUD op `conditions`/`diagnoses` tabel met validatie (code + omschrijving + ernst). Ondersteun sortering/primair/secundair.
- 🟢 Behandeladvies tab: TipTap editor + metadata-paneel (datum, psycholoog, afdeling, zorgprogramma, behandelaar).
- 🟡 Afrondingsworkflow: checkbox “Intake afronden” + vervolgkeuze (in zorg / doorverwijzen / extra diagnostiek), automatisch einddatum zetten en intake-status -> `afgerond`.
- 🟢 Koppeling naar behandelplan: button/link om advies door te zetten naar tab “Behandelplan”.
- 🟢 Voorbereiding spraak-naar-tekst: editor accepteert vrije tekst + placeholders.
**DoD:** Diagnoses zichtbaar in intake-overzicht + diagnose tab, behandeladvies opslaan + locking, status-flow getest inclusief notifications/toasts.
---
## Fase 4 — QA, Documentatie & Roll-out (Week 5) 🔵 _(Nog te doen)_
**Scope:** Validatie, handover en support.
- Testmatrix: volledige regressie over cliëntenlijst, screening, intake tabs, diagnose & advies; documenteer in `docs/testing/screening-intake-regressie.md`.
- Accessibility & contrast check via `scripts/test-contrast.ts` (voor nieuwe UI-blokken).
- Bijwerken van FO/bouwplan/changelog met “v1.1” status + screenshots.
- Training/handover: korte Loom of stappenplan voor behandelaars/secretaresses.
**DoD:** Alle open checkboxen in `docs/migratie-clients-naar-patients.md` en bouwplan test checklist afgevinkt; release notes vermeld live datum en bekende risicos.
---
## Overkoepelende aandachtspunten
- **Data consistentie:** Reuse Supabase RLS policies; voer `supabase tests` of handmatige RLS-checks per fase.
- **Roles & rechten (prototype):** Houd basisrolstatus aan (secretaresse vult screening, psycholoog intake), maar focus op UX-flows; fijnmazige autorisatie volgt later.
- **Status uniformiteit:** Gebruik overal dezelfde enumeraties (`planned/active/finished/cancelled` voor patiënten, `bezig/afgerond` voor intakes). Update UI-badges en APIs in Fase 1.
- **DX:** Houd server actions/APIs symmetrisch (FHIR vs Custom) en documenteer nieuwe endpoints onder `docs/api/`.

View File

@@ -0,0 +1,34 @@
# 📋 Screening & Intake Fasenplan
Dit document geeft een beknopt overzicht van de resterende werkpakketten, opgesplitst in fasen en subfasen. Het vult het bestaande implementatieplan aan met een snel te scannen roadmap.
## Fase 0 Schema & Deploy (on hold)
- 0.1: Supabase migration repair (wacht tot maintenance klaar is)
- 0.2: `supabase db pull/push` + seeds
- 0.3: Smoke-tests (`curl /api/fhir` en `/api/intakes`)
## Fase 1 Screening (afgerond)
- 1.1: Activiteitenlog + hulpvraag (gereed)
- 1.2: Document upload/store (gereed)
- 1.3: Screeningsbesluit + status sync + verwijsbrief-warning (gereed)
## Fase 2 Intake Details (huidige focus)
- 2.1: Routing + tab shells (gereed)
- 2.2: Contactmomenten (CRUD op `encounters`)
- 2.3: Kindcheck JSONB editor
- 2.4: Risicotaxaties (`risk_assessments`)
- 2.5: Anamnese, Onderzoeken, ROM editors
- 2.6: Diagnoses & behandeladvies (TipTap, metadata)
- 2.7: Intake kaarten uitbreiden met contactcount/diagnose/status
## Fase 3 Diagnose & Advies verdieping
- 3.1: Validaties + DSM-code helpers
- 3.2: Workflow “intake afronden” (checkbox + status change)
- 3.3: Koppeling naar behandelplan-tab
## Fase 4 QA & Roll-out
- 4.1: Regressietests + documentatie update
- 4.2: Accessibility/contrast check
- 4.3: Release notes, training, screenshot-updates
Gebruik dit document als snelle referentie; details en acceptatiecriteria blijven in `implementatieplan-screening-intake.md` staan.