# thecodeycorner/medicare architecture

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

- Interactive diagram: https://gitdiagram.com/thecodeycorner/medicare
- Repository: https://github.com/thecodeycorner/medicare

## Overview

MediCare is a role-based healthcare portal with patient, doctor, and admin experiences. A principal workflow is a user submitting credentials, Django delegating authentication to Supabase and loading QueueCare role data, then serving role-appropriate pages. Patient-facing capabilities include appointments, medical records, profile and health metrics; the landing page supports finding doctors by department and search. The tree documents these screens, but README is empty and most view/model source was not sampled, so links from views to particular data or feature pages are intentionally limited.

Main entry points: [`core/views.py`](https://github.com/thecodeycorner/medicare/blob/main/core/views.py) (Request views), [`core/auth_backends.py`](https://github.com/thecodeycorner/medicare/blob/main/core/auth_backends.py) (Supabase backend), [`core/urls.py`](https://github.com/thecodeycorner/medicare/blob/main/core/urls.py) (Core routes), [`medicare/urls.py`](https://github.com/thecodeycorner/medicare/blob/main/medicare/urls.py) (Django routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry"]
  node_urls["Django routes<br/>[urls.py]"]
  node_core_urls["Core routes<br/>[urls.py]"]
  node_views["Request views<br/>[views.py]"]
end

subgraph group_identity["Identity and access"]
  node_login_ui["Login form<br/>[login.html]"]
  node_login_js["Login behavior<br/>[login.js]"]
  node_auth_backend["Supabase backend<br/>[auth_backends.py]"]
  node_supabase_auth["Supabase Auth"]
  node_queuecare_db[("QueueCare user data")]
  node_middleware["User middleware<br/>[middleware.py]"]
end

subgraph group_care["Patient care"]
  node_patient_pages["Patient pages"]
  node_patient_js["Patient interactions<br/>[patient.js]"]
end

subgraph group_roles["Role dashboards"]
  node_navigation["Role navigation"]
  node_doctor_pages["Doctor dashboard"]
  node_admin_pages["Admin dashboard"]
  node_dashboard_shared["Dashboard layout"]
end

subgraph group_discovery["Care discovery"]
  node_landing_page["Care landing<br/>[landing.html]"]
  node_landing_js["Doctor discovery<br/>[landing.js]"]
end

node_visitor(("Portal user"))

node_visitor -->|"requests pages"| node_urls
node_urls -->|"includes routes"| node_core_urls
node_core_urls -->|"dispatches"| node_views
node_visitor -->|"opens login"| node_login_ui
node_login_ui -->|"loads behavior"| node_login_js
node_login_js -->|"posts credentials"| node_core_urls
node_auth_backend -->|"checks credentials"| node_supabase_auth
node_auth_backend -->|"loads role data"| node_queuecare_db
node_middleware -->|"reconstructs user"| node_auth_backend
node_views -->|"authenticates"| node_auth_backend
node_views -->|"renders"| node_patient_pages
node_views -->|"renders"| node_doctor_pages
node_views -->|"renders"| node_admin_pages
node_views -->|"renders"| node_landing_page
node_patient_pages -->|"loads interactions"| node_patient_js
node_patient_js -->|"posts dismissal"| node_core_urls
node_navigation -->|"supplies navigation"| node_dashboard_shared
node_landing_page -->|"loads discovery"| node_landing_js

click node_urls "https://github.com/thecodeycorner/medicare/blob/main/medicare/urls.py"
click node_core_urls "https://github.com/thecodeycorner/medicare/blob/main/core/urls.py"
click node_views "https://github.com/thecodeycorner/medicare/blob/main/core/views.py"
click node_login_ui "https://github.com/thecodeycorner/medicare/blob/main/templates/login.html"
click node_login_js "https://github.com/thecodeycorner/medicare/blob/main/static/js/login.js"
click node_auth_backend "https://github.com/thecodeycorner/medicare/blob/main/core/auth_backends.py"
click node_middleware "https://github.com/thecodeycorner/medicare/blob/main/core/middleware.py"
click node_navigation "https://github.com/thecodeycorner/medicare/blob/main/core/context_processors.py"
click node_patient_pages "https://github.com/thecodeycorner/medicare/tree/main/templates/patient"
click node_patient_js "https://github.com/thecodeycorner/medicare/blob/main/static/js/patient.js"
click node_doctor_pages "https://github.com/thecodeycorner/medicare/tree/main/templates/doctor"
click node_admin_pages "https://github.com/thecodeycorner/medicare/tree/main/templates/admin"
click node_dashboard_shared "https://github.com/thecodeycorner/medicare/tree/main/templates/dashboard"
click node_landing_page "https://github.com/thecodeycorner/medicare/blob/main/templates/landing.html"
click node_landing_js "https://github.com/thecodeycorner/medicare/blob/main/static/js/landing.js"

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_urls,node_core_urls,node_views,node_visitor toneBlue
class node_login_ui,node_login_js,node_auth_backend,node_supabase_auth,node_queuecare_db,node_middleware toneAmber
class node_patient_pages,node_patient_js toneMint
class node_navigation,node_doctor_pages,node_admin_pages,node_dashboard_shared toneRose
class node_landing_page,node_landing_js toneIndigo
```

## Components

### Web entry

- [Django routes](https://github.com/thecodeycorner/medicare/blob/main/medicare/urls.py): `medicare/urls.py`
- [Core routes](https://github.com/thecodeycorner/medicare/blob/main/core/urls.py): `core/urls.py`
- [Request views](https://github.com/thecodeycorner/medicare/blob/main/core/views.py): `core/views.py`

### Identity and access

- [Login form](https://github.com/thecodeycorner/medicare/blob/main/templates/login.html): `templates/login.html`
- [Login behavior](https://github.com/thecodeycorner/medicare/blob/main/static/js/login.js): `static/js/login.js`
- [Supabase backend](https://github.com/thecodeycorner/medicare/blob/main/core/auth_backends.py): `core/auth_backends.py`
- **Supabase Auth**
- **QueueCare user data**
- [User middleware](https://github.com/thecodeycorner/medicare/blob/main/core/middleware.py): `core/middleware.py`

### Patient care

- [Patient pages](https://github.com/thecodeycorner/medicare/tree/main/templates/patient): `templates/patient`
- [Patient interactions](https://github.com/thecodeycorner/medicare/blob/main/static/js/patient.js): `static/js/patient.js`

### Role dashboards

- [Role navigation](https://github.com/thecodeycorner/medicare/blob/main/core/context_processors.py): `core/context_processors.py`
- [Doctor dashboard](https://github.com/thecodeycorner/medicare/tree/main/templates/doctor): `templates/doctor`
- [Admin dashboard](https://github.com/thecodeycorner/medicare/tree/main/templates/admin): `templates/admin`
- [Dashboard layout](https://github.com/thecodeycorner/medicare/tree/main/templates/dashboard): `templates/dashboard`

### Care discovery

- [Care landing](https://github.com/thecodeycorner/medicare/blob/main/templates/landing.html): `templates/landing.html`
- [Doctor discovery](https://github.com/thecodeycorner/medicare/blob/main/static/js/landing.js): `static/js/landing.js`

### Other components

- **Portal user**

## Connections

- Portal user → Django routes: requests pages
- Django routes → Core routes: includes routes
- Core routes → Request views: dispatches
- Portal user → Login form: opens login
- Login form → Login behavior: loads behavior
- Login behavior → Core routes: posts credentials
- Supabase backend → Supabase Auth: checks credentials
- Supabase backend → QueueCare user data: loads role data
- User middleware → Supabase backend: reconstructs user
- Request views → Supabase backend: authenticates
- Request views → Patient pages: renders
- Request views → Doctor dashboard: renders
- Request views → Admin dashboard: renders
- Request views → Care landing: renders
- Patient pages → Patient interactions: loads interactions
- Patient interactions → Core routes: posts dismissal
- Role navigation → Dashboard layout: supplies navigation
- Care landing → Doctor discovery: loads discovery
