# 0x00c0ff33/medicare-portal-owasp architecture

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

- Interactive diagram: https://gitdiagram.com/0x00c0ff33/medicare-portal-owasp
- Repository: https://github.com/0x00c0ff33/medicare-portal-owasp

## Overview

MediCare Portal is a role-based healthcare portal and an OWASP Top 10 vulnerability demonstration: users can switch between vulnerable and hardened behavior with SECURE_MODE. The main workflow is registration or login, then role-specific dashboards and patient-care features such as appointments, records, messaging, search, uploads, and insurance verification. Admin tools provide user, audit, and portal oversight. The sampled files show authentication, shared helpers, configuration, appointments, chat, search, and uploads; README capabilities and the tree support several additional branches, but their internal calls are not inferred.

Main entry points: [`config.php`](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/config.php) (Mode and access config), [`helpers.php`](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/helpers.php) (Shared UI and helpers), [`db/schema.sql`](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/db/schema.sql) (Portal database), [`auth/login.php`](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/auth/login.php) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity and Access"]
  node_entry["Portal entry<br/>[index.php]"]
  node_login["Login<br/>[login.php]"]
  node_register["Registration<br/>[register.php]"]
  node_logout["Logout<br/>[logout.php]"]
  node_config["Mode and access config<br/>[config.php]"]
end

subgraph group_care["Patient Care"]
  node_patientdash["Patient dashboard<br/>[dashboard.php]"]
  node_records["Patient records<br/>[records.php]"]
  node_appointments["Appointments<br/>[appointments.php]"]
  node_patientchat["Patient messaging<br/>[chat.php]"]
  node_doctordash["Doctor dashboard<br/>[dashboard.php]"]
  node_doctorpatients["Doctor patients<br/>[patients.php]"]
  node_doctorchat["Doctor messaging<br/>[chat.php]"]
end

subgraph group_shared["Shared Services"]
  node_helpers["Shared UI and helpers<br/>[helpers.php]"]
  node_search["Doctor search<br/>[search.php]"]
  node_upload["Document uploads<br/>[upload.php]"]
  node_insurance["Insurance verification"]
  node_database[("Portal database<br/>[schema.sql]")]
end

subgraph group_admin["Administration and Security"]
  node_adminboard["Admin dashboard<br/>[dashboard.php]"]
  node_users["User administration<br/>[users.php]"]
  node_audit["Audit log<br/>[audit_log.php]"]
  node_toggle["Mode and hint toggles<br/>[toggle_mode.php]"]
end

node_visitor(("Portal user"))

node_visitor -.->|"opens"| node_entry
node_entry -.->|"routes to"| node_login
node_visitor -->|"submits credentials"| node_login
node_visitor -->|"submits details"| node_register
node_login -->|"checks mode"| node_config
node_register -->|"checks mode"| node_config
node_login -->|"queries users"| node_database
node_register -->|"creates user"| node_database
node_login -->|"uses auth helpers"| node_helpers
node_register -->|"uses helpers"| node_helpers
node_visitor -.->|"requests logout"| node_logout
node_patientdash -.->|"checks role"| node_config
node_records -.->|"checks role"| node_config
node_appointments -->|"checks role and mode"| node_config
node_appointments -->|"reads and books"| node_database
node_appointments -->|"renders and audits"| node_helpers
node_patientchat -->|"checks role and mode"| node_config
node_patientchat -->|"reads and sends"| node_database
node_patientchat -->|"renders and audits"| node_helpers
node_doctordash -.->|"checks role"| node_config
node_doctorpatients -.->|"checks role"| node_config
node_doctorchat -->|"checks role and mode"| node_config
node_doctorchat -->|"reads and sends"| node_database
node_doctorchat -->|"renders and audits"| node_helpers
node_search -->|"checks login and mode"| node_config
node_search -->|"searches doctors"| node_database
node_search -->|"renders and audits"| node_helpers
node_upload -->|"checks login and mode"| node_config
node_upload -->|"stores upload metadata"| node_database
node_upload -->|"renders and audits"| node_helpers
node_upload -.->|"serves upload result"| node_visitor
node_insurance -.->|"uses configuration"| node_config
node_adminboard -->|"checks role"| node_config
node_adminboard -->|"reads portal counts"| node_database
node_adminboard -->|"renders dashboard"| node_helpers
node_users -.->|"checks role"| node_config
node_audit -.->|"checks role"| node_config
node_toggle -->|"rewrites settings"| node_config
node_visitor -.->|"toggles demo mode"| node_toggle

click node_entry "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/index.php"
click node_login "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/auth/login.php"
click node_register "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/auth/register.php"
click node_logout "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/auth/logout.php"
click node_config "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/config.php"
click node_patientdash "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/patient/dashboard.php"
click node_records "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/patient/records.php"
click node_appointments "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/patient/appointments.php"
click node_patientchat "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/patient/chat.php"
click node_doctordash "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/doctor/dashboard.php"
click node_doctorpatients "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/doctor/patients.php"
click node_doctorchat "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/doctor/chat.php"
click node_helpers "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/helpers.php"
click node_search "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/shared/search.php"
click node_upload "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/shared/upload.php"
click node_insurance "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/shared/insurance_fetch.php"
click node_database "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/db/schema.sql"
click node_adminboard "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/admin/dashboard.php"
click node_users "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/admin/users.php"
click node_audit "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/admin/audit_log.php"
click node_toggle "https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/toggle_mode.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_entry,node_login,node_register,node_logout,node_config,node_visitor toneBlue
class node_patientdash,node_records,node_appointments,node_patientchat,node_doctordash,node_doctorpatients,node_doctorchat toneAmber
class node_helpers,node_search,node_upload,node_insurance,node_database toneMint
class node_adminboard,node_users,node_audit,node_toggle toneRose
```

## Components

### Identity and Access

- [Portal entry](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/index.php): `index.php`
- [Login](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/auth/login.php): `auth/login.php`
- [Registration](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/auth/register.php): `auth/register.php`
- [Logout](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/auth/logout.php): `auth/logout.php`
- [Mode and access config](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/config.php): `config.php`

### Patient Care

- [Patient dashboard](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/patient/dashboard.php): `patient/dashboard.php`
- [Patient records](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/patient/records.php): `patient/records.php`
- [Appointments](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/patient/appointments.php): `patient/appointments.php`
- [Patient messaging](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/patient/chat.php): `patient/chat.php`
- [Doctor dashboard](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/doctor/dashboard.php): `doctor/dashboard.php`
- [Doctor patients](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/doctor/patients.php): `doctor/patients.php`
- [Doctor messaging](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/doctor/chat.php): `doctor/chat.php`

### Shared Services

- [Shared UI and helpers](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/helpers.php): `helpers.php`
- [Doctor search](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/shared/search.php): `shared/search.php`
- [Document uploads](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/shared/upload.php): `shared/upload.php`
- [Insurance verification](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/shared/insurance_fetch.php): `shared/insurance_fetch.php`
- [Portal database](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/db/schema.sql): `db/schema.sql`

### Administration and Security

- [Admin dashboard](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/admin/dashboard.php): `admin/dashboard.php`
- [User administration](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/admin/users.php): `admin/users.php`
- [Audit log](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/admin/audit_log.php): `admin/audit_log.php`
- [Mode and hint toggles](https://github.com/0x00c0ff33/medicare-portal-owasp/blob/main/toggle_mode.php): `toggle_mode.php`

### Other components

- **Portal user**

## Connections

- Portal user → Portal entry: opens
- Portal entry → Login: routes to
- Portal user → Login: submits credentials (evidence: `auth/login.php`)
- Portal user → Registration: submits details (evidence: `auth/register.php`)
- Login → Mode and access config: checks mode (evidence: `auth/login.php`)
- Registration → Mode and access config: checks mode (evidence: `auth/register.php`)
- Login → Portal database: queries users (evidence: `auth/login.php`)
- Registration → Portal database: creates user (evidence: `auth/register.php`)
- Login → Shared UI and helpers: uses auth helpers (evidence: `auth/login.php`)
- Registration → Shared UI and helpers: uses helpers (evidence: `auth/register.php`)
- Portal user → Logout: requests logout
- Patient dashboard → Mode and access config: checks role (evidence: `patient/dashboard.php`)
- Patient records → Mode and access config: checks role (evidence: `patient/records.php`)
- Appointments → Mode and access config: checks role and mode (evidence: `patient/appointments.php`)
- Appointments → Portal database: reads and books (evidence: `patient/appointments.php`)
- Appointments → Shared UI and helpers: renders and audits (evidence: `patient/appointments.php`)
- Patient messaging → Mode and access config: checks role and mode (evidence: `patient/chat.php`)
- Patient messaging → Portal database: reads and sends (evidence: `patient/chat.php`)
- Patient messaging → Shared UI and helpers: renders and audits (evidence: `patient/chat.php`)
- Doctor dashboard → Mode and access config: checks role (evidence: `doctor/dashboard.php`)
- Doctor patients → Mode and access config: checks role (evidence: `doctor/patients.php`)
- Doctor messaging → Mode and access config: checks role and mode (evidence: `doctor/chat.php`)
- Doctor messaging → Portal database: reads and sends (evidence: `doctor/chat.php`)
- Doctor messaging → Shared UI and helpers: renders and audits (evidence: `doctor/chat.php`)
- Doctor search → Mode and access config: checks login and mode (evidence: `shared/search.php`)
- Doctor search → Portal database: searches doctors (evidence: `shared/search.php`)
- Doctor search → Shared UI and helpers: renders and audits (evidence: `shared/search.php`)
- Document uploads → Mode and access config: checks login and mode (evidence: `shared/upload.php`)
- Document uploads → Portal database: stores upload metadata (evidence: `shared/upload.php`)
- Document uploads → Shared UI and helpers: renders and audits (evidence: `shared/upload.php`)
- Document uploads → Portal user: serves upload result
- Insurance verification → Mode and access config: uses configuration (evidence: `shared/insurance_fetch.php`)
- Admin dashboard → Mode and access config: checks role (evidence: `admin/dashboard.php`)
- Admin dashboard → Portal database: reads portal counts (evidence: `admin/dashboard.php`)
- Admin dashboard → Shared UI and helpers: renders dashboard (evidence: `admin/dashboard.php`)
- User administration → Mode and access config: checks role (evidence: `admin/users.php`)
- Audit log → Mode and access config: checks role (evidence: `admin/audit_log.php`)
- Mode and hint toggles → Mode and access config: rewrites settings (evidence: `toggle_mode.php`)
- Portal user → Mode and hint toggles: toggles demo mode
