# faris-ragai/hayah architecture

> Architecture diagram of the GitHub repository faris-ragai/hayah, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/faris-ragai/hayah
- Repository: https://github.com/faris-ragai/hayah

## Overview

Hayah is a Flutter UI-only doctor–patient app: users sign in or register, then navigate role-specific screens for patient records and doctor access. Its demo data is in memory, while preferences and pictures are described as device-saved; there is no backend, real QR scanning, or real sync. The README documents the major screen flows and capabilities. Sampled source covers native desktop startup only, so Dart-module interactions below follow documented flows rather than inspected calls.

Main entry points: [`lib/screens/patient_shell_screen.dart`](https://github.com/faris-ragai/hayah/blob/main/lib/screens/patient_shell_screen.dart) (Patient tabs), [`lib/screens/patient_file_screen.dart`](https://github.com/faris-ragai/hayah/blob/main/lib/screens/patient_file_screen.dart) (Patient file view), [`lib/service/mock_database.dart`](https://github.com/faris-ragai/hayah/blob/main/lib/service/mock_database.dart) (In-memory data), [`lib/main.dart`](https://github.com/faris-ragai/hayah/blob/main/lib/main.dart) (App startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and navigation"]
  node_app["App startup<br/>[main.dart]"]
  node_router["App routing<br/>[app_router.dart]"]
  node_login["Welcome and login<br/>[login_screen.dart]"]
end

subgraph group_patient["Patient experience"]
  node_patient_home["Patient tabs"]
  node_patient_record["Medical file"]
  node_patient_rx["Prescriptions"]
  node_patient_profile["Patient profile"]
  node_qr["Patient QR<br/>[my_qr_screen.dart]"]
  node_allowed["Allowed doctors"]
  node_history["History log"]
end

subgraph group_doctor["Doctor experience"]
  node_doctor_home["Doctor tabs"]
  node_search["Patient search<br/>[search_screen.dart]"]
  node_scan["QR scan simulation"]
  node_patient_file["Patient file view"]
  node_access["Access decision"]
  node_medical_entry["Medical info entry"]
  node_new_rx["Prescription authoring"]
end

subgraph group_domain["Domain and services"]
  node_models["Health record models<br/>[medical_entry.dart]"]
  node_roshetta_model["Prescription model<br/>[roshetta.dart]"]
  node_auth["Authentication<br/>[auth_service.dart]"]
  node_patient_service["Patient operations"]
  node_mock_db[("In-memory data<br/>[mock_database.dart]")]
  node_settings["Settings and sync"]
  node_localization["Language support"]
  node_pictures["Picture handling<br/>[image_service.dart]"]
end

subgraph group_platform["Platform hosts"]
  node_windows_host["Windows Flutter host<br/>[flutter_window.cpp]"]
  node_win32_window["Windows native window<br/>[win32_window.cpp]"]
  node_linux_host["Linux application host<br/>[my_application.cc]"]
  node_linux_entry["Linux startup<br/>[main.cc]"]
end

node_user(("Patient or doctor"))

node_user -.->|"opens"| node_app
node_app -.->|"starts at"| node_login
node_login -.->|"authenticates"| node_auth
node_login -.->|"routes roles"| node_router
node_router -.->|"opens patient"| node_patient_home
node_router -.->|"opens doctor"| node_doctor_home
node_patient_home -.->|"opens file"| node_patient_record
node_patient_home -.->|"opens prescriptions"| node_patient_rx
node_patient_home -.->|"opens profile"| node_patient_profile
node_patient_home -.->|"opens QR"| node_qr
node_patient_home -.->|"opens access list"| node_allowed
node_patient_home -.->|"opens history"| node_history
node_doctor_home -.->|"opens search"| node_search
node_doctor_home -.->|"opens scan"| node_scan
node_search -.->|"opens patient"| node_patient_file
node_scan -.->|"opens patient"| node_patient_file
node_patient_file -.->|"may deny access"| node_access
node_patient_file -.->|"opens entry"| node_medical_entry
node_patient_file -.->|"opens authoring"| node_new_rx
node_patient_file -.->|"opens history"| node_history
node_medical_entry -.->|"records data"| node_patient_service
node_new_rx -.->|"records prescription"| node_patient_service
node_patient_service -.->|"uses demo data"| node_mock_db
node_patient_record -.->|"reads demo data"| node_mock_db
node_patient_rx -.->|"reads demo data"| node_mock_db
node_settings -.->|"switches language"| node_localization
node_settings -.->|"shows sync state"| node_mock_db
node_patient_profile -.->|"uses pictures"| node_pictures
node_new_rx -.->|"uses pictures"| node_pictures
node_app -.->|"runs Flutter view"| node_windows_host
node_windows_host -->|"extends window"| node_win32_window
node_linux_entry -->|"creates application"| node_linux_host

click node_app "https://github.com/faris-ragai/hayah/blob/main/lib/main.dart"
click node_router "https://github.com/faris-ragai/hayah/blob/main/lib/screens/app_router.dart"
click node_login "https://github.com/faris-ragai/hayah/blob/main/lib/screens/login_screen.dart"
click node_patient_home "https://github.com/faris-ragai/hayah/blob/main/lib/screens/patient_shell_screen.dart"
click node_patient_record "https://github.com/faris-ragai/hayah/blob/main/lib/screens/my_medical_file_screen.dart"
click node_patient_rx "https://github.com/faris-ragai/hayah/blob/main/lib/screens/my_roshettas_screen.dart"
click node_patient_profile "https://github.com/faris-ragai/hayah/blob/main/lib/screens/patient_profile_screen.dart"
click node_qr "https://github.com/faris-ragai/hayah/blob/main/lib/screens/my_qr_screen.dart"
click node_allowed "https://github.com/faris-ragai/hayah/blob/main/lib/screens/allowed_doctors_screen.dart"
click node_history "https://github.com/faris-ragai/hayah/blob/main/lib/screens/history_log_screen.dart"
click node_doctor_home "https://github.com/faris-ragai/hayah/blob/main/lib/screens/doctor_shell_screen.dart"
click node_search "https://github.com/faris-ragai/hayah/blob/main/lib/screens/search_screen.dart"
click node_scan "https://github.com/faris-ragai/hayah/blob/main/lib/screens/scan_qr_screen.dart"
click node_patient_file "https://github.com/faris-ragai/hayah/blob/main/lib/screens/patient_file_screen.dart"
click node_access "https://github.com/faris-ragai/hayah/blob/main/lib/screens/no_access_screen.dart"
click node_medical_entry "https://github.com/faris-ragai/hayah/blob/main/lib/screens/add_medical_info_screen.dart"
click node_new_rx "https://github.com/faris-ragai/hayah/blob/main/lib/screens/new_roshetta_screen.dart"
click node_models "https://github.com/faris-ragai/hayah/blob/main/lib/model/medical_entry.dart"
click node_roshetta_model "https://github.com/faris-ragai/hayah/blob/main/lib/model/roshetta.dart"
click node_auth "https://github.com/faris-ragai/hayah/blob/main/lib/service/auth_service.dart"
click node_patient_service "https://github.com/faris-ragai/hayah/blob/main/lib/service/patient_service.dart"
click node_mock_db "https://github.com/faris-ragai/hayah/blob/main/lib/service/mock_database.dart"
click node_settings "https://github.com/faris-ragai/hayah/blob/main/lib/screens/settings_screen.dart"
click node_localization "https://github.com/faris-ragai/hayah/blob/main/lib/service/localization_service.dart"
click node_pictures "https://github.com/faris-ragai/hayah/blob/main/lib/service/image_service.dart"
click node_windows_host "https://github.com/faris-ragai/hayah/blob/main/windows/runner/flutter_window.cpp"
click node_win32_window "https://github.com/faris-ragai/hayah/blob/main/windows/runner/win32_window.cpp"
click node_linux_host "https://github.com/faris-ragai/hayah/blob/main/linux/runner/my_application.cc"
click node_linux_entry "https://github.com/faris-ragai/hayah/blob/main/linux/runner/main.cc"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_router,node_login toneBlue
class node_patient_home,node_patient_record,node_patient_rx,node_patient_profile,node_qr,node_allowed,node_history toneAmber
class node_doctor_home,node_search,node_scan,node_patient_file,node_access,node_medical_entry,node_new_rx toneMint
class node_models,node_roshetta_model,node_auth,node_patient_service,node_mock_db,node_settings,node_localization,node_pictures toneRose
class node_windows_host,node_win32_window,node_linux_host,node_linux_entry,node_user toneIndigo
```

## Components

### App entry and navigation

- [App startup](https://github.com/faris-ragai/hayah/blob/main/lib/main.dart): `lib/main.dart`
- [App routing](https://github.com/faris-ragai/hayah/blob/main/lib/screens/app_router.dart): `lib/screens/app_router.dart`
- [Welcome and login](https://github.com/faris-ragai/hayah/blob/main/lib/screens/login_screen.dart): `lib/screens/login_screen.dart`

### Patient experience

- [Patient tabs](https://github.com/faris-ragai/hayah/blob/main/lib/screens/patient_shell_screen.dart): `lib/screens/patient_shell_screen.dart`
- [Medical file](https://github.com/faris-ragai/hayah/blob/main/lib/screens/my_medical_file_screen.dart): `lib/screens/my_medical_file_screen.dart`
- [Prescriptions](https://github.com/faris-ragai/hayah/blob/main/lib/screens/my_roshettas_screen.dart): `lib/screens/my_roshettas_screen.dart`
- [Patient profile](https://github.com/faris-ragai/hayah/blob/main/lib/screens/patient_profile_screen.dart): `lib/screens/patient_profile_screen.dart`
- [Patient QR](https://github.com/faris-ragai/hayah/blob/main/lib/screens/my_qr_screen.dart): `lib/screens/my_qr_screen.dart`
- [Allowed doctors](https://github.com/faris-ragai/hayah/blob/main/lib/screens/allowed_doctors_screen.dart): `lib/screens/allowed_doctors_screen.dart`
- [History log](https://github.com/faris-ragai/hayah/blob/main/lib/screens/history_log_screen.dart): `lib/screens/history_log_screen.dart`

### Doctor experience

- [Doctor tabs](https://github.com/faris-ragai/hayah/blob/main/lib/screens/doctor_shell_screen.dart): `lib/screens/doctor_shell_screen.dart`
- [Patient search](https://github.com/faris-ragai/hayah/blob/main/lib/screens/search_screen.dart): `lib/screens/search_screen.dart`
- [QR scan simulation](https://github.com/faris-ragai/hayah/blob/main/lib/screens/scan_qr_screen.dart): `lib/screens/scan_qr_screen.dart`
- [Patient file view](https://github.com/faris-ragai/hayah/blob/main/lib/screens/patient_file_screen.dart): `lib/screens/patient_file_screen.dart`
- [Access decision](https://github.com/faris-ragai/hayah/blob/main/lib/screens/no_access_screen.dart): `lib/screens/no_access_screen.dart`
- [Medical info entry](https://github.com/faris-ragai/hayah/blob/main/lib/screens/add_medical_info_screen.dart): `lib/screens/add_medical_info_screen.dart`
- [Prescription authoring](https://github.com/faris-ragai/hayah/blob/main/lib/screens/new_roshetta_screen.dart): `lib/screens/new_roshetta_screen.dart`

### Domain and services

- [Health record models](https://github.com/faris-ragai/hayah/blob/main/lib/model/medical_entry.dart): `lib/model/medical_entry.dart`
- [Prescription model](https://github.com/faris-ragai/hayah/blob/main/lib/model/roshetta.dart): `lib/model/roshetta.dart`
- [Authentication](https://github.com/faris-ragai/hayah/blob/main/lib/service/auth_service.dart): `lib/service/auth_service.dart`
- [Patient operations](https://github.com/faris-ragai/hayah/blob/main/lib/service/patient_service.dart): `lib/service/patient_service.dart`
- [In-memory data](https://github.com/faris-ragai/hayah/blob/main/lib/service/mock_database.dart): `lib/service/mock_database.dart`
- [Settings and sync](https://github.com/faris-ragai/hayah/blob/main/lib/screens/settings_screen.dart): `lib/screens/settings_screen.dart`
- [Language support](https://github.com/faris-ragai/hayah/blob/main/lib/service/localization_service.dart): `lib/service/localization_service.dart`
- [Picture handling](https://github.com/faris-ragai/hayah/blob/main/lib/service/image_service.dart): `lib/service/image_service.dart`

### Platform hosts

- [Windows Flutter host](https://github.com/faris-ragai/hayah/blob/main/windows/runner/flutter_window.cpp): `windows/runner/flutter_window.cpp`
- [Windows native window](https://github.com/faris-ragai/hayah/blob/main/windows/runner/win32_window.cpp): `windows/runner/win32_window.cpp`
- [Linux application host](https://github.com/faris-ragai/hayah/blob/main/linux/runner/my_application.cc): `linux/runner/my_application.cc`
- [Linux startup](https://github.com/faris-ragai/hayah/blob/main/linux/runner/main.cc): `linux/runner/main.cc`

### Other components

- **Patient or doctor**

## Connections

- Patient or doctor → App startup: opens
- App startup → Welcome and login: starts at
- Welcome and login → Authentication: authenticates (evidence: `README.md`)
- Welcome and login → App routing: routes roles (evidence: `README.md`)
- App routing → Patient tabs: opens patient (evidence: `README.md`)
- App routing → Doctor tabs: opens doctor (evidence: `README.md`)
- Patient tabs → Medical file: opens file (evidence: `README.md`)
- Patient tabs → Prescriptions: opens prescriptions (evidence: `README.md`)
- Patient tabs → Patient profile: opens profile (evidence: `README.md`)
- Patient tabs → Patient QR: opens QR (evidence: `README.md`)
- Patient tabs → Allowed doctors: opens access list (evidence: `README.md`)
- Patient tabs → History log: opens history (evidence: `README.md`)
- Doctor tabs → Patient search: opens search (evidence: `README.md`)
- Doctor tabs → QR scan simulation: opens scan (evidence: `README.md`)
- Patient search → Patient file view: opens patient (evidence: `README.md`)
- QR scan simulation → Patient file view: opens patient (evidence: `README.md`)
- Patient file view → Access decision: may deny access (evidence: `README.md`)
- Patient file view → Medical info entry: opens entry (evidence: `README.md`)
- Patient file view → Prescription authoring: opens authoring (evidence: `README.md`)
- Patient file view → History log: opens history (evidence: `README.md`)
- Medical info entry → Patient operations: records data
- Prescription authoring → Patient operations: records prescription
- Patient operations → In-memory data: uses demo data (evidence: `README.md`)
- Medical file → In-memory data: reads demo data (evidence: `README.md`)
- Prescriptions → In-memory data: reads demo data (evidence: `README.md`)
- Settings and sync → Language support: switches language (evidence: `README.md`)
- Settings and sync → In-memory data: shows sync state (evidence: `README.md`)
- Patient profile → Picture handling: uses pictures (evidence: `README.md`)
- Prescription authoring → Picture handling: uses pictures (evidence: `README.md`)
- App startup → Windows Flutter host: runs Flutter view
- Windows Flutter host → Windows native window: extends window
- Linux startup → Linux application host: creates application (evidence: `linux/runner/main.cc`)
