23 lines
762 B
Markdown
23 lines
762 B
Markdown
|
|
# Patient Page Refactoring
|
||
|
|
|
||
|
|
## Current Architecture Issues
|
||
|
|
- File: `src/routes/(app)/patients/+page.svelte` (543 lines)
|
||
|
|
- Mixes patient CRUD + visit management + ADT history in one file
|
||
|
|
- Inline visit card rendering (~100 lines)
|
||
|
|
- Helper functions at bottom (formatDate, formatDateTime)
|
||
|
|
- Patient name formatting repeated 3+ times inline
|
||
|
|
|
||
|
|
## Refactoring Plan
|
||
|
|
1. Extract VisitCard.svelte component
|
||
|
|
2. Create patientUtils.js for shared helpers
|
||
|
|
3. Group modal states into objects (patientModals, visitModals)
|
||
|
|
4. Use $derived for computed values (patientFullName, formattedVisits)
|
||
|
|
5. Add JSDoc types for Patient and Visit
|
||
|
|
|
||
|
|
## Related Files
|
||
|
|
- PatientFormModal.svelte
|
||
|
|
- VisitFormModal.svelte
|
||
|
|
- VisitADTHistoryModal.svelte
|
||
|
|
- $lib/api/patients.js
|
||
|
|
- $lib/api/visits.js
|