# chye-peng/iot-patient-health-monitoring-system architecture

> Architecture diagram of the GitHub repository chye-peng/iot-patient-health-monitoring-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chye-peng/iot-patient-health-monitoring-system
- Repository: https://github.com/chye-peng/iot-patient-health-monitoring-system

## Overview

This is a Yii2 web application for patient health monitoring, with public signup/login, role-based admin, medical-staff and patient areas, and health-record viewing and entry. The principal workflow is a user signing in, being routed by role, then using their area to manage account details or view/search health records; medical staff can also submit records. The README mentions IoT integration, but sampled code does not establish a device-ingestion path. The graph therefore shows raw-record search separately and marks device input as unverified. Some view and form wiring is supported by controller excerpts; other unsampled details are omitted.

Main entry points: [`controllers/SiteController.php`](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/SiteController.php) (Public access), [`models/User.php`](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/User.php) (User identity), [`controllers/AdminController.php`](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/AdminController.php) (Admin workflows), [`views`](https://github.com/chye-peng/iot-patient-health-monitoring-system/tree/main/views) (Role views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_webentry["Web entry<br/>[index.php]"]
  node_site["Public access<br/>[SiteController.php]"]
  node_admin["Admin workflows"]
  node_staff["Staff workflows"]
  node_patient["Patient workflows"]
  node_views["Role views"]
  node_layout["Navigation layout<br/>[main.php]"]
end

subgraph group_identity["Identity and accounts"]
  node_loginform["Login form<br/>[LoginForm.php]"]
  node_signupform["Signup form<br/>[SignupForm.php]"]
  node_accountforms["Account forms"]
  node_user["User identity<br/>[User.php]"]
  node_assignment["Role assignment<br/>[AuthAssignment.php]"]
  node_usersearch["User search"]
  node_usermanagement["User management"]
end

subgraph group_health["Health records"]
  node_patientsearch["Patient search"]
  node_staffform["Staff record entry"]
  node_healthrecords["Health records<br/>[HealthRecords.php]"]
  node_rawrecords["Raw records"]
end

subgraph group_persistence["Application data"]
  node_database[("Application database<br/>[db.php]")]
  node_config["Yii web configuration<br/>[web.php]"]
end

node_visitor(("Visitor"))
node_device(("IoT device"))

node_visitor -->|"requests pages"| node_webentry
node_webentry -->|"loads app"| node_config
node_config -->|"configures connection"| node_database
node_site -->|"validates login"| node_loginform
node_site -->|"processes signup"| node_signupform
node_loginform -->|"looks up account"| node_user
node_site -->|"routes admin"| node_admin
node_site -->|"routes staff"| node_staff
node_site -->|"routes patient"| node_patient
node_site -->|"renders public pages"| node_views
node_admin -->|"searches users"| node_usersearch
node_admin -->|"updates accounts"| node_usermanagement
node_admin -->|"soft deletes user"| node_user
node_admin -->|"renders admin pages"| node_views
node_usersearch -->|"queries accounts"| node_user
node_usermanagement -->|"manages accounts"| node_user
node_staff -->|"searches records"| node_patientsearch
node_staff -->|"accepts record entry"| node_staffform
node_staff -->|"renders staff pages"| node_views
node_patientsearch -->|"queries patient records"| node_healthrecords
node_patientsearch -->|"queries raw records"| node_rawrecords
node_staffform -->|"writes patient records"| node_healthrecords
node_patient -->|"searches own records"| node_patientsearch
node_patient -->|"updates profile"| node_accountforms
node_patient -->|"renders patient pages"| node_views
node_accountforms -.->|"updates identity"| node_user
node_healthrecords -.->|"persists records"| node_database
node_rawrecords -.->|"stores raw readings"| node_database
node_device -.->|"may supply readings"| node_rawrecords
node_layout -->|"shows signed-in identity"| node_user
node_layout -->|"hosts page content"| node_views

click node_webentry "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/web/index.php"
click node_site "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/SiteController.php"
click node_admin "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/AdminController.php"
click node_staff "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/MedstaffController.php"
click node_patient "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/PatientController.php"
click node_views "https://github.com/chye-peng/iot-patient-health-monitoring-system/tree/main/views"
click node_layout "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/views/layouts/main.php"
click node_loginform "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/LoginForm.php"
click node_signupform "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/SignupForm.php"
click node_accountforms "https://github.com/chye-peng/iot-patient-health-monitoring-system/tree/main/forms"
click node_user "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/User.php"
click node_assignment "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/AuthAssignment.php"
click node_usersearch "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/UserListSearchForm.php"
click node_usermanagement "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/UserManagementForm.php"
click node_patientsearch "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/PatientListSearchForm.php"
click node_staffform "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/MedStaffProfileForm.php"
click node_healthrecords "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/HealthRecords.php"
click node_rawrecords "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/RawHealthRecords.php"
click node_database "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/config/db.php"
click node_config "https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/config/web.php"

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_webentry,node_site,node_admin,node_staff,node_patient,node_views,node_layout toneBlue
class node_loginform,node_signupform,node_accountforms,node_user,node_assignment,node_usersearch,node_usermanagement toneAmber
class node_patientsearch,node_staffform,node_healthrecords,node_rawrecords toneMint
class node_database,node_config toneRose
class node_visitor,node_device toneIndigo
```

## Components

### Web workflows

- [Web entry](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/web/index.php): `web/index.php`
- [Public access](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/SiteController.php): `controllers/SiteController.php`
- [Admin workflows](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/AdminController.php): `controllers/AdminController.php`
- [Staff workflows](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/MedstaffController.php): `controllers/MedstaffController.php`
- [Patient workflows](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/controllers/PatientController.php): `controllers/PatientController.php`
- [Role views](https://github.com/chye-peng/iot-patient-health-monitoring-system/tree/main/views): `views`
- [Navigation layout](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/views/layouts/main.php): `views/layouts/main.php`

### Identity and accounts

- [Login form](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/LoginForm.php): `forms/LoginForm.php`
- [Signup form](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/SignupForm.php): `forms/SignupForm.php`
- [Account forms](https://github.com/chye-peng/iot-patient-health-monitoring-system/tree/main/forms): `forms`
- [User identity](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/User.php): `models/User.php`
- [Role assignment](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/AuthAssignment.php): `models/AuthAssignment.php`
- [User search](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/UserListSearchForm.php): `forms/UserListSearchForm.php`
- [User management](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/UserManagementForm.php): `forms/UserManagementForm.php`

### Health records

- [Patient search](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/PatientListSearchForm.php): `forms/PatientListSearchForm.php`
- [Staff record entry](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/forms/MedStaffProfileForm.php): `forms/MedStaffProfileForm.php`
- [Health records](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/HealthRecords.php): `models/HealthRecords.php`
- [Raw records](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/models/RawHealthRecords.php): `models/RawHealthRecords.php`

### Application data

- [Application database](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/config/db.php): `config/db.php`
- [Yii web configuration](https://github.com/chye-peng/iot-patient-health-monitoring-system/blob/main/config/web.php): `config/web.php`

### Other components

- **Visitor**
- **IoT device**

## Connections

- Visitor → Web entry: requests pages (evidence: `web/index.php`)
- Web entry → Yii web configuration: loads app (evidence: `web/index.php`)
- Yii web configuration → Application database: configures connection (evidence: `config/web.php`)
- Public access → Login form: validates login (evidence: `controllers/SiteController.php`)
- Public access → Signup form: processes signup (evidence: `controllers/SiteController.php`)
- Login form → User identity: looks up account (evidence: `forms/LoginForm.php`)
- Public access → Admin workflows: routes admin (evidence: `controllers/SiteController.php`)
- Public access → Staff workflows: routes staff (evidence: `controllers/SiteController.php`)
- Public access → Patient workflows: routes patient (evidence: `controllers/SiteController.php`)
- Public access → Role views: renders public pages (evidence: `controllers/SiteController.php`)
- Admin workflows → User search: searches users (evidence: `controllers/AdminController.php`)
- Admin workflows → User management: updates accounts (evidence: `controllers/AdminController.php`)
- Admin workflows → User identity: soft deletes user (evidence: `controllers/AdminController.php`)
- Admin workflows → Role views: renders admin pages (evidence: `controllers/AdminController.php`)
- User search → User identity: queries accounts (evidence: `forms/UserListSearchForm.php`)
- User management → User identity: manages accounts (evidence: `forms/UserManagementForm.php`)
- Staff workflows → Patient search: searches records (evidence: `controllers/MedstaffController.php`)
- Staff workflows → Staff record entry: accepts record entry (evidence: `controllers/MedstaffController.php`)
- Staff workflows → Role views: renders staff pages (evidence: `controllers/MedstaffController.php`)
- Patient search → Health records: queries patient records (evidence: `forms/PatientListSearchForm.php`)
- Patient search → Raw records: queries raw records (evidence: `forms/PatientListSearchForm.php`)
- Staff record entry → Health records: writes patient records (evidence: `forms/MedStaffProfileForm.php`)
- Patient workflows → Patient search: searches own records (evidence: `controllers/PatientController.php`)
- Patient workflows → Account forms: updates profile (evidence: `controllers/PatientController.php`)
- Patient workflows → Role views: renders patient pages (evidence: `controllers/PatientController.php`)
- Account forms → User identity: updates identity (evidence: `forms/UserListSearchForm.php`)
- Health records → Application database: persists records
- Raw records → Application database: stores raw readings
- IoT device → Raw records: may supply readings
- Navigation layout → User identity: shows signed-in identity (evidence: `views/layouts/main.php`)
- Navigation layout → Role views: hosts page content (evidence: `views/layouts/main.php`)
