Przegląd architektury
Vista to zaawansowany system zarządzania praktyką weterynaryjną zbudowany na nowoczesnej architekturze desktop-first.
Na tej stronie
High-Level Overview
Dział zatytułowany „High-Level Overview”graph TB subgraph Frontend["Frontend (React)"] App[App.tsx]
subgraph Views["Main Views"] Dashboard[Dashboard] VisitsHub[VisitsHubView] PatientsHub[PatientsWorkspaceView] Calendar[CalendarView] Workspace[WorkspaceView] Settings[SettingsTabsView] end
subgraph Features["Feature Modules"] AIChat[AI Suite] NewVisit[New Visit Flow] Notes[Notes Provider] end end
subgraph Backend["Backend (Tauri/Rust)"] Commands[Tauri Commands] Database[(SQLite + WAL)] Engines[Engines] end
App --> Views App --> Features Views --> Commands Features --> Commands Commands --> Database Commands --> EnginesKluczowe zasady
Dział zatytułowany „Kluczowe zasady”Desktop-First
Dział zatytułowany „Desktop-First”- Natywna wydajność dzięki Tauri (Rust)
- Integracja z systemem operacyjnym
- Wsparcie dla biometrii (Touch ID / Face ID)
Local-First
Dział zatytułowany „Local-First”- Dane pacjentów na lokalnym urządzeniu
- SQLite jako główna baza danych
- Brak wymaganego połączenia z chmurą
- GDPR/RODO compliant by design
AI-Powered
Dział zatytułowany „AI-Powered”- Transkrypcja głosu (WhisperX, MLX)
- Generowanie notatek SOAP (LLM)
- Multi-provider z automatycznym failover
Kluczowe liczby
Dział zatytułowany „Kluczowe liczby”| Kategoria | Liczba | Opis |
|---|---|---|
| React Components | ~330 | Komponenty UI w src/components |
| Tauri Commands | 250 | Komendy backend w src-tauri/src/commands |
| Services | 50 | Logika biznesowa w src/services |
| Hooks | 170 | Custom hooks dla state management |
| Database Tables | 33 | Tabele SQLite |
| Database Indexes | 106 | Indeksy wydajnościowe |
| Database Triggers | 6 | Auto-update updated_at |
| Tests | 150+ | Unit, integration, e2e |
| Languages | 2 | Polski (primary), English (secondary) |
Full Module Map
Dział zatytułowany „Full Module Map”graph TB subgraph App["Vista App"] AppShell[AppShell] end
subgraph Core["Core Layer"] Auth[AuthContext<br/>70 consumers] Types[types/api.ts<br/>60 consumers] Wrapper[tauriWrapper.ts<br/>815 LOC] Logger[secureLogger.ts] end
subgraph Views["Main Views"] DashboardV[Dashboard<br/>4.5k LOC] Visits[VisitsHub<br/>13k LOC] Patients[PatientsHub<br/>15k LOC] CalendarV[Calendar<br/>15k LOC] WorkspaceV[Workspace<br/>9.2k LOC] SettingsV[Settings<br/>11k LOC] end
subgraph Features["Feature Modules"] AISuite[AI Suite<br/>22.6k LOC] Audio[Audio<br/>12k LOC] Tasks[Tasks<br/>2k LOC] end
subgraph Backend["Rust Backend"] CommandsB[~200 Commands] DatabaseB[(SQLite)] EnginesB[Engines] UnifiedAI[UnifiedAI] end
AppShell --> Auth Auth --> Views Views --> Types Views --> Features Types --> Wrapper Features --> Wrapper Wrapper --> CommandsB CommandsB --> DatabaseB CommandsB --> EnginesB CommandsB --> UnifiedAILOC Summary by Module
Dział zatytułowany „LOC Summary by Module”| Module | Files | LOC | Key Hook |
|---|---|---|---|
| Visits | ~50 | ~13,000 | useVisitEditor (1,353) |
| Workspace | ~20 | ~9,200 | useWorkspaceData (857) |
| Patients | ~30 | ~15,000 | usePatientMedicalHistory |
| Audio | ~25 | ~12,000 | useAudioRecording (834) |
| Calendar | ~25 | ~15,000 | useAppointmentForm |
| Tasks | ~10 | ~2,000 | useTasks (123) |
| AI Suite | ~149 | ~22,600 | useStreamingManager (977) |
| Auth | ~15 | ~11,000 | AuthContext (992) |
| Settings | ~25 | ~11,100 | usePreferences |
| Dashboard | ~12 | ~4,500 | useDashboardState |
Struktura katalogów
Dział zatytułowany „Struktura katalogów”vista/├── src/ # React frontend│ ├── app-shell/ # App bootstrap, routing│ ├── components/ # UI components│ │ ├── visits/ # 30+ files, ~7,700 LOC│ │ ├── workspace/ # 12 files, ~6,500 LOC│ │ ├── patients/ # 27 files, ~15,000 LOC│ │ ├── calendar/ # 20 files, ~15,000 LOC│ │ ├── tasks/ # 7 files, ~1,500 LOC│ │ └── ui/ # Shared components│ ├── hooks/ # Custom React hooks│ ├── features/ # Feature modules│ ├── services/ # API clients│ ├── types/ # TypeScript definitions│ └── contexts/ # React Context providers│├── src-tauri/ # Rust backend│ ├── src/│ │ ├── commands/ # Tauri command handlers│ │ ├── database/ # SQLite + migrations│ │ ├── engines/ # Audio, STT, TTS│ │ └── unified_ai/ # AI service layer│ └── .env # Secrets (not in repo)│└── docs/ # DocumentationDomain Model
Dział zatytułowany „Domain Model”Główne encje i relacje między nimi:
erDiagram VISITS ||--o{ RECORDINGS : has VISITS ||--o{ TRANSCRIPTS : has VISITS ||--o{ TASKS : "optional" VISITS ||--o{ AI_TASK_SUGGESTIONS : generates PATIENTS ||--o{ VISITS : has USERS ||--o{ VISITS : creates APPOINTMENTS ||--o| VISITS : "becomes"
VISITS { string visit_id PK string patient_id FK string user_id FK string visit_status string processing_status int version text soap_subjective text soap_objective text soap_assessment text soap_plan text transcript text ai_sugestie }
PATIENTS { string patient_id PK string name string species string breed string owner_name }
RECORDINGS { string recording_id PK string visit_id FK string status blob audio_data }
TASKS { string task_id PK string visit_id FK string patient_id FK string status string priority }Visit Lifecycle
Dział zatytułowany „Visit Lifecycle”Wizyta przechodzi przez różne stany przetwarzania:
stateDiagram-v2 [*] --> draft: create_visit draft --> finalized: finalize finalized --> sent: send
state draft { [*] --> idle idle --> processing_audio: start recording processing_audio --> processing_stt: audio complete processing_stt --> processing_llm: transcript ready processing_llm --> completed: SOAP generated processing_llm --> awaiting_user_merge: needs review processing_llm --> error: failed completed --> idle: edit awaiting_user_merge --> idle: merge/dismiss }Module Dependencies
Dział zatytułowany „Module Dependencies”Zależności między głównymi modułami:
graph LR subgraph Core["Core (Shared)"] API[types/api.ts] DB[types/database.ts] Wrapper[tauriWrapper.ts] Auth[AuthContext] Logger[secureLogger] end
subgraph Visits["Visits Module"] VisitAPI[visitApi] VisitHooks[useVisitEditor<br/>useVisitCreation<br/>useVisitsList] VisitComponents[VisitEditor<br/>SOAPEditor<br/>FileUpload] end
subgraph Workspace["Workspace Module"] WS_Data[useWorkspaceData] WS_View[WorkspaceView] WS_Drafts[WorkspaceDrafts] WS_Audio[WorkspaceAudio] end
subgraph Tasks["Tasks Module"] TaskService[tasksService] TaskDrawer[TaskDrawer] TaskHooks[useTasks] end
subgraph Audio["Audio Module"] AudioRec[useAudioRecording] AudioTrans[useAudioTranscription] Pipeline[AudioPipeline] end
API --> Wrapper DB --> API
VisitAPI --> API VisitHooks --> VisitAPI VisitComponents --> VisitHooks
WS_Data --> API WS_View --> WS_Data WS_Drafts --> VisitAPI WS_Audio --> AudioRec
TaskService --> Wrapper TaskDrawer --> TaskService TaskDrawer --> VisitAPI
AudioRec --> Wrapper AudioTrans --> AudioRecVisit-Centric Data Flow
Dział zatytułowany „Visit-Centric Data Flow”Visit jest centralnym hubem łączącym wszystkie moduły:
graph TB subgraph VisitCore["VISIT (Central Hub)"] Visit[(visits table)] VisitAPI[visitApi.ts<br/>21 methods] end
subgraph Workspace["WORKSPACE"] WS_Data[useWorkspaceData] WS_Drafts[WorkspaceDrafts] WS_Actions[useWorkspaceDraftActions] end
subgraph Patients["PATIENTS"] PatientHistory[usePatientMedicalHistory] PatientProfile[PatientProfileSummary] end
subgraph Dashboard["DASHBOARD"] DashboardView[Dashboard.tsx] MyDay[MyDayPanel] end
subgraph AISuite["AI SUITE"] NotesAgent[useNotesAgent] SOAPGen[useSOAPGeneration] Specialist[AISpecialistHost] end
subgraph AudioM["AUDIO"] AudioRec[useAudioRecording] AudioTrans[useAudioTranscription] Recordings[(recordings)] Transcripts[(transcripts)] end
%% Workspace -> Visit WS_Data -->|getWithDetailsPaginated| VisitAPI WS_Data -->|update, merge/dismiss| VisitAPI WS_Actions -->|create, update, delete| VisitAPI
%% Patients -> Visit PatientHistory -->|getByPatient| VisitAPI
%% Dashboard -> Workspace -> Visit DashboardView -->|uses| WS_Data
%% AI -> Visit SOAPGen -->|visitId| NotesAgent NotesAgent -->|generates SOAP| Visit Specialist -->|visit context| Visit
%% Audio -> Visit AudioRec -->|visitId| Recordings AudioTrans -->|linkToVisit| Recordings Recordings -->|visit_id FK| Visit Transcripts -->|visit_id FK| VisitCommand Count by Module
Dział zatytułowany „Command Count by Module”pie showData title "Tauri Commands by Module (197 active)" "Visits" : 25 "AI Suite" : 40 "Audio" : 16 "Patients" : 15 "Auth" : 18 "Tasks" : 9 "Calendar" : 10 "Settings" : 12 "Analytics" : 12 "Dictionary" : 7 "Clinical Notes" : 5 "Other" : 28Known Issues
Dział zatytułowany „Known Issues”Zidentyfikowane problemy architektoniczne:
| Issue | Severity | Location |
|---|---|---|
update_visit no version check | HIGH | creation.rs |
delete_visit hard delete | HIGH | creation.rs |
| Dead handlers in allowlist | MEDIUM | tauriWrapper.ts |
ai_sugestie Polish field name | LOW | schema |
| Two separate pin systems | MEDIUM | NotesProvider vs DashboardState |
| useNotifications not Provider-based | MEDIUM | 11 instances with own state |
Powiązane dokumenty
Dział zatytułowany „Powiązane dokumenty”- Tech Stack - Technologie i LOC
- Data Flow - Przepływ danych
- Frontend Overview - Frontend
- Backend Overview - Backend
- Database Schema - Baza danych