# saad2134/dosezy architecture

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

- Interactive diagram: https://gitdiagram.com/saad2134/dosezy
- Repository: https://github.com/saad2134/dosezy

## Overview

Dosezy is an offline-first Android medication manager for patients and caregivers. The documented workflow is to enter medicines and schedules, then use reminders to log, snooze, skip, or record doses; the app tracks stock and adherence and offers calendar, analytics, and exports. The tree identifies corresponding UI, domain, notification, and data modules, but their call wiring was not sampled, so those connections are shown as unverified. The optional caregiver cloud and web client are described as forthcoming; their runtime behavior is not established here.

Main entry points: [`patient/android/app/src/main/java/com/example/dosezy/ui/screens/HomeScreen.kt`](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/HomeScreen.kt) (Home and Doses), [`patient/android/app/src/main/java/com/example/dosezy/MainActivity.kt`](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/MainActivity.kt) (App Entry), [`patient/android/app/src/main/java/com/example/dosezy/ui/screens/MedicinesScreen.kt`](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/MedicinesScreen.kt) (Medicine Management), [`patient/android/app/src/main/java/com/example/dosezy/ui/screens/ScheduleScreen.kt`](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/ScheduleScreen.kt) (Schedule Calendar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient_ui["Patient Experience"]
  node_app_entry["App Entry<br/>[MainActivity.kt]"]
  node_home["Home and Doses<br/>[HomeScreen.kt]"]
  node_medicine_ui["Medicine Management<br/>[MedicinesScreen.kt]"]
  node_schedule_ui["Schedule Calendar<br/>[ScheduleScreen.kt]"]
  node_analytics["Adherence Analytics<br/>[AnalyticsScreen.kt]"]
end

subgraph group_medication["Medication Workflow"]
  node_medicine_domain["Medicine Records<br/>[Medicine.kt]"]
  node_schedule_domain["Schedule Generation"]
  node_dose_actions["Dose Actions"]
  node_skip_action["Skip and Snooze"]
  node_research_stats["Evaluation Statistics"]
  node_zenodo_stats["Archived Statistics"]
end

subgraph group_reminders["Reminders and Alarms"]
  node_alarm_scheduler["Alarm Scheduler<br/>[AlarmScheduler.kt]"]
  node_alarm_receiver["Alarm Receiver"]
  node_alarm_screen["Alarm Screen<br/>[AlarmActivity.kt]"]
  node_safeguard["Intake Safeguard"]
end

subgraph group_data["Local Data"]
  node_room_store[("Local Database<br/>[DosezyDatabase.kt]")]
  node_medicine_repo["Medicine Repository"]
  node_schedule_repo["Schedule Repository"]
  node_backup["Backup and Reports"]
end

subgraph group_cloud["Caregiver Cloud"]
  node_cloud_api["Caregiver API<br/>[openapi.yaml]"]
  node_caregiver_web["Caregiver Web"]
end

node_patient(("Patient"))

node_patient -.->|"opens app"| node_app_entry
node_app_entry -.->|"routes to"| node_home
node_patient -->|"enters medicines"| node_medicine_ui
node_patient -->|"views schedule"| node_schedule_ui
node_medicine_ui -.->|"records medicines"| node_medicine_domain
node_schedule_ui -.->|"configures schedules"| node_schedule_domain
node_schedule_domain -.->|"persists schedules"| node_schedule_repo
node_home -.->|"logs doses"| node_dose_actions
node_home -.->|"manages doses"| node_skip_action
node_dose_actions -.->|"updates intake"| node_medicine_repo
node_medicine_repo -.->|"stores records"| node_room_store
node_schedule_repo -.->|"stores schedules"| node_room_store
node_alarm_scheduler -.->|"dispatches alarms"| node_alarm_receiver
node_alarm_receiver -.->|"opens alarm"| node_alarm_screen
node_alarm_screen -.->|"supports intake"| node_safeguard
node_home -.->|"sets reminders"| node_alarm_scheduler
node_patient -->|"reviews adherence"| node_analytics
node_patient -->|"exports data"| node_backup
node_caregiver_web -.->|"uses API"| node_cloud_api
node_patient -.->|"syncs care data"| node_cloud_api

click node_app_entry "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/MainActivity.kt"
click node_home "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/HomeScreen.kt"
click node_medicine_ui "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/MedicinesScreen.kt"
click node_schedule_ui "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/ScheduleScreen.kt"
click node_analytics "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/subscreens/AnalyticsScreen.kt"
click node_medicine_domain "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/model/Medicine.kt"
click node_schedule_domain "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/domain/usecases/GenerateSchedulesUseCase.kt"
click node_dose_actions "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/domain/usecases/TakeCohortUseCase.kt"
click node_skip_action "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/domain/usecases/SkipCohortUseCase.kt"
click node_alarm_scheduler "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/notifications/AlarmScheduler.kt"
click node_alarm_receiver "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/notifications/MedicineAlarmReceiver.kt"
click node_alarm_screen "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/notifications/AlarmActivity.kt"
click node_safeguard "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/notifications/IntakeSafeguardManager.kt"
click node_room_store "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/DosezyDatabase.kt"
click node_medicine_repo "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/repository/MedicineRepository.kt"
click node_schedule_repo "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/repository/ScheduleRepository.kt"
click node_backup "https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/export/BackupRestoreManager.kt"
click node_cloud_api "https://github.com/saad2134/dosezy/blob/main/api/openapi.yaml"
click node_caregiver_web "https://github.com/saad2134/dosezy/tree/main/website/src"
click node_research_stats "https://github.com/saad2134/dosezy/blob/main/research/supplementary/reproduce_paper_stats.py"
click node_zenodo_stats "https://github.com/saad2134/dosezy/blob/main/research/zenodo/reproduce_paper_stats.py"

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_entry,node_home,node_medicine_ui,node_schedule_ui,node_analytics toneBlue
class node_medicine_domain,node_schedule_domain,node_dose_actions,node_skip_action,node_research_stats,node_zenodo_stats toneAmber
class node_alarm_scheduler,node_alarm_receiver,node_alarm_screen,node_safeguard toneMint
class node_room_store,node_medicine_repo,node_schedule_repo,node_backup toneRose
class node_cloud_api,node_caregiver_web,node_patient toneIndigo
```

## Components

### Patient Experience

- [App Entry](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/MainActivity.kt): `patient/android/app/src/main/java/com/example/dosezy/MainActivity.kt`
- [Home and Doses](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/HomeScreen.kt): `patient/android/app/src/main/java/com/example/dosezy/ui/screens/HomeScreen.kt`
- [Medicine Management](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/MedicinesScreen.kt): `patient/android/app/src/main/java/com/example/dosezy/ui/screens/MedicinesScreen.kt`
- [Schedule Calendar](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/screens/ScheduleScreen.kt): `patient/android/app/src/main/java/com/example/dosezy/ui/screens/ScheduleScreen.kt`
- [Adherence Analytics](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/ui/subscreens/AnalyticsScreen.kt): `patient/android/app/src/main/java/com/example/dosezy/ui/subscreens/AnalyticsScreen.kt`

### Medication Workflow

- [Medicine Records](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/model/Medicine.kt): `patient/android/app/src/main/java/com/example/dosezy/data/model/Medicine.kt`
- [Schedule Generation](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/domain/usecases/GenerateSchedulesUseCase.kt): `patient/android/app/src/main/java/com/example/dosezy/domain/usecases/GenerateSchedulesUseCase.kt`
- [Dose Actions](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/domain/usecases/TakeCohortUseCase.kt): `patient/android/app/src/main/java/com/example/dosezy/domain/usecases/TakeCohortUseCase.kt`
- [Skip and Snooze](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/domain/usecases/SkipCohortUseCase.kt): `patient/android/app/src/main/java/com/example/dosezy/domain/usecases/SkipCohortUseCase.kt`
- [Evaluation Statistics](https://github.com/saad2134/dosezy/blob/main/research/supplementary/reproduce_paper_stats.py): `research/supplementary/reproduce_paper_stats.py`
- [Archived Statistics](https://github.com/saad2134/dosezy/blob/main/research/zenodo/reproduce_paper_stats.py): `research/zenodo/reproduce_paper_stats.py`

### Reminders and Alarms

- [Alarm Scheduler](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/notifications/AlarmScheduler.kt): `patient/android/app/src/main/java/com/example/dosezy/notifications/AlarmScheduler.kt`
- [Alarm Receiver](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/notifications/MedicineAlarmReceiver.kt): `patient/android/app/src/main/java/com/example/dosezy/notifications/MedicineAlarmReceiver.kt`
- [Alarm Screen](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/notifications/AlarmActivity.kt): `patient/android/app/src/main/java/com/example/dosezy/notifications/AlarmActivity.kt`
- [Intake Safeguard](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/notifications/IntakeSafeguardManager.kt): `patient/android/app/src/main/java/com/example/dosezy/notifications/IntakeSafeguardManager.kt`

### Local Data

- [Local Database](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/DosezyDatabase.kt): `patient/android/app/src/main/java/com/example/dosezy/data/DosezyDatabase.kt`
- [Medicine Repository](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/repository/MedicineRepository.kt): `patient/android/app/src/main/java/com/example/dosezy/data/repository/MedicineRepository.kt`
- [Schedule Repository](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/repository/ScheduleRepository.kt): `patient/android/app/src/main/java/com/example/dosezy/data/repository/ScheduleRepository.kt`
- [Backup and Reports](https://github.com/saad2134/dosezy/blob/main/patient/android/app/src/main/java/com/example/dosezy/data/export/BackupRestoreManager.kt): `patient/android/app/src/main/java/com/example/dosezy/data/export/BackupRestoreManager.kt`

### Caregiver Cloud

- [Caregiver API](https://github.com/saad2134/dosezy/blob/main/api/openapi.yaml): `api/openapi.yaml`
- [Caregiver Web](https://github.com/saad2134/dosezy/tree/main/website/src): `website/src`

### Other components

- **Patient**

## Connections

- Patient → App Entry: opens app
- App Entry → Home and Doses: routes to
- Patient → Medicine Management: enters medicines (evidence: `README.md`)
- Patient → Schedule Calendar: views schedule (evidence: `README.md`)
- Medicine Management → Medicine Records: records medicines
- Schedule Calendar → Schedule Generation: configures schedules
- Schedule Generation → Schedule Repository: persists schedules
- Home and Doses → Dose Actions: logs doses
- Home and Doses → Skip and Snooze: manages doses
- Dose Actions → Medicine Repository: updates intake
- Medicine Repository → Local Database: stores records
- Schedule Repository → Local Database: stores schedules
- Alarm Scheduler → Alarm Receiver: dispatches alarms
- Alarm Receiver → Alarm Screen: opens alarm
- Alarm Screen → Intake Safeguard: supports intake
- Home and Doses → Alarm Scheduler: sets reminders
- Patient → Adherence Analytics: reviews adherence (evidence: `README.md`)
- Patient → Backup and Reports: exports data (evidence: `README.md`)
- Caregiver Web → Caregiver API: uses API
- Patient → Caregiver API: syncs care data
