Full Database Schema
Vista to aplikacja LOCAL-FIRST - wszystkie dane pacjentów i wizyt przechowywane są lokalnie na urządzeniu użytkownika.
Topologia Danych
Dział zatytułowany „Topologia Danych”┌─────────────────────────────────────────────────────────────────────────┐│ TOPOLOGIA DANYCH VISTA │├─────────────────────────────────────────────────────────────────────────┤│ ││ ┌─────────────────┐ ││ │ DESKTOP APP │ ◄── Wszystkie dane żyją LOKALNIE ││ │ (Tauri/Rust) │ ││ └────────┬────────┘ ││ │ ││ ▼ ││ ┌─────────────────┐ ││ │ SQLite DB │ ◄── ~/Library/Application Support/Vista/ ││ │ (WAL mode) │ vista.db (macOS) ││ └────────┬────────┘ ││ │ ││ ▼ ││ ┌─────────────────┐ ││ │ Local Files │ ◄── Audio recordings, attachments ││ │ (recordings/) │ Stored on user's disk ││ └─────────────────┘ ││ ││ ═══════════════════════════════════════════════════════════════════ ││ CLOUD SERVICES (OPCJONALNE) ││ ═══════════════════════════════════════════════════════════════════ ││ ││ ┌─────────────────┐ ┌─────────────────┐ ││ │ LibraxisAI │ │ OpenAI API │ ◄── AI Processing ││ │ (STT/LLM/TTS) │ │ (Fallback) │ (dane NIE są ││ └─────────────────┘ └─────────────────┘ przechowywane) ││ │└─────────────────────────────────────────────────────────────────────────┘ERD - Core Module
Dział zatytułowany „ERD - Core Module”erDiagram USERS ||--o{ VISITS : creates USERS ||--o{ USER_SESSIONS : "has sessions" USERS ||--|| USER_PREFERENCES : "has preferences"
PATIENTS ||--o{ VISITS : has PATIENTS ||--o{ RECORDINGS : "has recordings"
VISITS ||--o{ RECORDINGS : "has recordings" VISITS ||--o{ SPEAKER_SEGMENTS : "has segments"
RECORDINGS ||--|| TRANSCRIPTS : "has transcript"
USERS { string user_id PK string name string email UK string password_hash string license_no UK string roles "JSON array" bool active bool onboarding_completed bool biometric_enabled }
PATIENTS { string patient_id PK string name string species string breed string owner_name string owner_phone string chip_number UK string identity_key }
VISITS { string visit_id PK string patient_id FK string user_id FK datetime date_time string visit_type string visit_status string soap_subjective string soap_objective string soap_assessment string soap_plan int version "optimistic lock" }
USER_SESSIONS { string session_id PK string user_id FK string token datetime expires_at }
RECORDINGS { string id PK string visit_id FK string patient_id FK string path int duration_ms string status string sha256 UK }
TRANSCRIPTS { string id PK string recording_id FK UK string engine string text string segments_json }ERD - Workspace Module
Dział zatytułowany „ERD - Workspace Module”erDiagram USERS ||--o{ TASKS : "assigned to" USERS ||--o{ REMINDERS : "assigned to" PATIENTS ||--o{ TASKS : "related to" VISITS ||--o{ TASKS : "from visit" VISITS ||--o{ AI_TASK_SUGGESTIONS : generates
TASKS { string task_id PK string title string status "active|completed" string priority "low|medium|high" string source "manual|ai" string patient_id FK string visit_id FK string assigned_to FK real confidence }
REMINDERS { string reminder_id PK string title string category string status "pending|completed|snoozed|dismissed" string due_at string assigned_to FK string context_patient_id FK }
AI_TASK_SUGGESTIONS { string suggestion_id PK string visit_id FK string patient_id FK string text string task_type string priority real confidence string status "pending|accepted|dismissed" }ERD - AI Chat Module
Dział zatytułowany „ERD - AI Chat Module”erDiagram USERS ||--o{ CHAT_SESSIONS : "has chats" VISITS ||--o{ CHAT_SESSIONS : "context" CHAT_SESSIONS ||--o{ CHAT_MESSAGES : contains CHAT_SESSIONS ||--o{ CHAT_ATTACHMENTS : "has files"
CHAT_SESSIONS { string id PK string user_id FK string visit_id FK int started_at int ended_at int message_count string title string preview }
CHAT_MESSAGES { string id PK string session_id FK int idx string role "user|assistant|system" string content int timestamp }
CHAT_ATTACHMENTS { string attachment_id PK string session_id FK string uploaded_by FK string file_name string file_path string mime_type int size_bytes }ERD - Calendar Module
Dział zatytułowany „ERD - Calendar Module”erDiagram USERS ||--o{ APPOINTMENTS : schedules USERS ||--o{ USER_WORKING_HOURS : "availability" USERS ||--o{ TIME_BLOCKS : "blocked time" PATIENTS ||--o{ APPOINTMENTS : "scheduled for" APPOINTMENTS ||--o| VISITS : "converts to"
APPOINTMENTS { string appointment_id PK string patient_id FK string veterinarian_id FK string scheduled_date string scheduled_time int duration_minutes string appointment_type string status string visit_id FK bool is_recurring }
USER_WORKING_HOURS { string id PK string user_id FK int day_of_week "0-6" string start_time "HH:MM" string end_time "HH:MM" bool is_working string break_start_time string break_end_time }
TIME_BLOCKS { string id PK string created_by FK string title string start_date string end_date string block_type "busy|available|break|meeting" bool is_recurring }Podsumowanie Tabel (33)
Dział zatytułowany „Podsumowanie Tabel (33)”Core Tables (Główne encje)
Dział zatytułowany „Core Tables (Główne encje)”| # | Tabela | Opis |
|---|---|---|
| 1 | users | Lekarze i personel kliniki |
| 2 | patients | Zwierzęcy pacjenci |
| 3 | visits | Wizyty medyczne + SOAP |
| 4 | appointments | Harmonogram wizyt |
Audio & Transcription
Dział zatytułowany „Audio & Transcription”| # | Tabela | Opis |
|---|---|---|
| 5 | recordings | Metadane nagrań audio |
| 6 | transcripts | Wyniki STT (1:1 z recordings) |
| 7 | speaker_segments | Diaryzacja mówców |
Tasks & Reminders
Dział zatytułowany „Tasks & Reminders”| # | Tabela | Opis |
|---|---|---|
| 8 | tasks | Zadania kliniczne/administracyjne |
| 9 | ai_task_suggestions | Sugestie AI z analizy wizyt |
| 10 | reminders | Przypomnienia użytkownika |
AI & Chat
Dział zatytułowany „AI & Chat”| # | Tabela | Opis |
|---|---|---|
| 11 | chat_sessions | Sesje rozmów AI |
| 12 | chat_messages | Wiadomości w sesjach |
| 13 | chat_attachments | Pliki załączone do chatów |
| 14 | ai_conversation_snapshots | Snapshoty kontekstu AI |
| 15 | ai_context_embeddings | Embeddingi wektorowe |
| 16 | vista_memory | Pamięć agenta Vista |
User Management & Auth
Dział zatytułowany „User Management & Auth”| # | Tabela | Opis |
|---|---|---|
| 17 | user_sessions | Sesje uwierzytelniania |
| 18 | user_preferences | Preferencje onboardingu |
| 19 | password_reset_tokens | Tokeny resetu hasła |
| 20 | user_invitation_tokens | Zaproszenia do zespołu |
| 21 | pin_lockout | Blokada PIN/biometria |
Clinical Data
Dział zatytułowany „Clinical Data”| # | Tabela | Opis |
|---|---|---|
| 22 | clinical_notes | Dodatkowe notatki kliniczne |
| 23 | media_files | Załączniki (zdjęcia, dokumenty) |
| 24 | custom_dictionary | Terminologia medyczna użytkownika |
Calendar & Scheduling
Dział zatytułowany „Calendar & Scheduling”| # | Tabela | Opis |
|---|---|---|
| 25 | user_working_hours | Dostępność weterynarzy |
| 26 | time_blocks | Blokowane przedziały czasowe |
Collaboration & Sharing
Dział zatytułowany „Collaboration & Sharing”| # | Tabela | Opis |
|---|---|---|
| 27 | visit_shares | Współdzielenie wizyt |
| 28 | personal_notes | Prywatne notatki użytkownika |
System & Configuration
Dział zatytułowany „System & Configuration”| # | Tabela | Opis |
|---|---|---|
| 29 | clinic_settings | Ustawienia kliniki (key-value) |
| 30 | license_state | Status licencji aplikacji |
| 31 | dashboard_state | Stan UI dashboardu |
| 32 | audit_trail | Logi aktywności (GDPR) |
| 33 | jobs | Kolejka zadań background |
Statystyki Schematu
Dział zatytułowany „Statystyki Schematu”| Metryka | Wartość |
|---|---|
| Liczba tabel | 33 |
| Liczba indeksów | 106 |
| Liczba triggerów | 6 |
| Tabele z soft-delete | 1 (tylko users) |
| Tabele z version field | 1 (tylko visits) |