# michelkas/while_health architecture

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

- Interactive diagram: https://gitdiagram.com/michelkas/while_health
- Repository: https://github.com/michelkas/while_health

## Overview

This is a Django healthcare-management application. Its visible patient workflow covers submitting patient and appointment information, checking appointment conflicts, and managing appointments; related domain modules model staff schedules and clinical records. The repository also has public hospital-content models, an API routing module, and asynchronous tasks for appointment emails and reports. The excerpts do not show the complete URL wiring or API behavior, so those connections are left out; the map uses only visible code and SOURCE INDEX references.

Main entry points: [`backend/appointment/models.py`](https://github.com/michelkas/while_health/blob/main/backend/appointment/models.py) (Appointment rules), [`backend/staff/models.py`](https://github.com/michelkas/while_health/blob/main/backend/staff/models.py) (Staff and schedules), [`backend/core/tasks.py`](https://github.com/michelkas/while_health/blob/main/backend/core/tasks.py) (Email and reports), [`backend/core/views.py`](https://github.com/michelkas/while_health/blob/main/backend/core/views.py) (Portal views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_web_urls["Web routing<br/>[urls.py]"]
  node_api_urls["API routing<br/>[api_urls.py]"]
  node_core_views["Portal views<br/>[views.py]"]
  node_user_model["User accounts<br/>[models.py]"]
end

subgraph group_care["Patient care"]
  node_patient_views["Patient workflow<br/>[views.py]"]
  node_patient_forms["Patient forms<br/>[forms.py]"]
  node_patient_records["Patient records<br/>[models.py]"]
  node_appointment_forms["Appointment form<br/>[forms.py]"]
  node_appointments["Appointment rules<br/>[models.py]"]
end

subgraph group_operations["Clinic operations"]
  node_staff_directory["Staff and schedules<br/>[models.py]"]
  node_staff_forms["Staff forms<br/>[forms.py]"]
  node_site_content["Hospital content<br/>[models.py]"]
end

subgraph group_async["Background services"]
  node_appointment_signals["Appointment signals<br/>[signals.py]"]
  node_celery_config["Celery setup<br/>[celery.py]"]
  node_tasks["Email and reports<br/>[tasks.py]"]
end

node_patient(("Patient"))
node_staff_user(("Clinic staff"))
node_database[("Application database")]
node_email_service["Email service"]

node_patient -.->|"uses portal"| node_patient_views
node_staff_user -.->|"uses portal"| node_core_views
node_patient_views -->|"validates with"| node_patient_forms
node_patient_views -->|"reads and saves"| node_patient_records
node_patient_views -->|"checks and saves"| node_appointments
node_patient_views -->|"looks up staff"| node_staff_directory
node_patient_forms -->|"uses"| node_appointment_forms
node_patient_forms -->|"validates edits"| node_appointments
node_appointment_forms -->|"forms model"| node_appointments
node_appointments -->|"references patient"| node_patient_records
node_appointments -->|"references staff schedule"| node_staff_directory
node_staff_forms -->|"forms model"| node_staff_directory
node_site_content -->|"references department"| node_staff_directory
node_core_views -->|"uses"| node_patient_forms
node_core_views -->|"reads records"| node_patient_records
node_core_views -->|"reads staff"| node_staff_directory
node_core_views -->|"uses"| node_user_model
node_appointment_signals -->|"dispatches tasks"| node_tasks
node_celery_config -->|"registers tasks"| node_tasks
node_tasks -->|"reads patient data"| node_patient_records
node_tasks -->|"reads appointments"| node_appointments
node_tasks -->|"reads staff"| node_staff_directory
node_tasks -->|"sends email"| node_email_service
node_patient_records -.->|"persists records"| node_database
node_appointments -.->|"persists appointments"| node_database
node_staff_directory -.->|"persists schedules"| node_database

click node_web_urls "https://github.com/michelkas/while_health/blob/main/backend/config/urls.py"
click node_api_urls "https://github.com/michelkas/while_health/blob/main/backend/config/api_urls.py"
click node_core_views "https://github.com/michelkas/while_health/blob/main/backend/core/views.py"
click node_user_model "https://github.com/michelkas/while_health/blob/main/backend/core/models.py"
click node_patient_views "https://github.com/michelkas/while_health/blob/main/backend/patients/views.py"
click node_patient_forms "https://github.com/michelkas/while_health/blob/main/backend/patients/forms.py"
click node_patient_records "https://github.com/michelkas/while_health/blob/main/backend/patients/models.py"
click node_appointment_forms "https://github.com/michelkas/while_health/blob/main/backend/appointment/forms.py"
click node_appointments "https://github.com/michelkas/while_health/blob/main/backend/appointment/models.py"
click node_staff_directory "https://github.com/michelkas/while_health/blob/main/backend/staff/models.py"
click node_staff_forms "https://github.com/michelkas/while_health/blob/main/backend/staff/forms.py"
click node_site_content "https://github.com/michelkas/while_health/blob/main/backend/data/models.py"
click node_appointment_signals "https://github.com/michelkas/while_health/blob/main/backend/appointment/signals.py"
click node_celery_config "https://github.com/michelkas/while_health/blob/main/backend/core/celery.py"
click node_tasks "https://github.com/michelkas/while_health/blob/main/backend/core/tasks.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_web_urls,node_api_urls,node_core_views,node_user_model toneBlue
class node_patient_views,node_patient_forms,node_patient_records,node_appointment_forms,node_appointments,node_database toneAmber
class node_staff_directory,node_staff_forms,node_site_content toneMint
class node_appointment_signals,node_celery_config,node_tasks toneRose
class node_patient,node_staff_user,node_email_service toneIndigo
```

## Components

### Web application

- [Web routing](https://github.com/michelkas/while_health/blob/main/backend/config/urls.py): `backend/config/urls.py`
- [API routing](https://github.com/michelkas/while_health/blob/main/backend/config/api_urls.py): `backend/config/api_urls.py`
- [Portal views](https://github.com/michelkas/while_health/blob/main/backend/core/views.py): `backend/core/views.py`
- [User accounts](https://github.com/michelkas/while_health/blob/main/backend/core/models.py): `backend/core/models.py`

### Patient care

- [Patient workflow](https://github.com/michelkas/while_health/blob/main/backend/patients/views.py): `backend/patients/views.py`
- [Patient forms](https://github.com/michelkas/while_health/blob/main/backend/patients/forms.py): `backend/patients/forms.py`
- [Patient records](https://github.com/michelkas/while_health/blob/main/backend/patients/models.py): `backend/patients/models.py`
- [Appointment form](https://github.com/michelkas/while_health/blob/main/backend/appointment/forms.py): `backend/appointment/forms.py`
- [Appointment rules](https://github.com/michelkas/while_health/blob/main/backend/appointment/models.py): `backend/appointment/models.py`

### Clinic operations

- [Staff and schedules](https://github.com/michelkas/while_health/blob/main/backend/staff/models.py): `backend/staff/models.py`
- [Staff forms](https://github.com/michelkas/while_health/blob/main/backend/staff/forms.py): `backend/staff/forms.py`
- [Hospital content](https://github.com/michelkas/while_health/blob/main/backend/data/models.py): `backend/data/models.py`

### Background services

- [Appointment signals](https://github.com/michelkas/while_health/blob/main/backend/appointment/signals.py): `backend/appointment/signals.py`
- [Celery setup](https://github.com/michelkas/while_health/blob/main/backend/core/celery.py): `backend/core/celery.py`
- [Email and reports](https://github.com/michelkas/while_health/blob/main/backend/core/tasks.py): `backend/core/tasks.py`

### Other components

- **Patient**
- **Clinic staff**
- **Application database**
- **Email service**

## Connections

- Patient → Patient workflow: uses portal
- Clinic staff → Portal views: uses portal
- Patient workflow → Patient forms: validates with (evidence: `backend/patients/views.py`)
- Patient workflow → Patient records: reads and saves (evidence: `backend/patients/views.py`)
- Patient workflow → Appointment rules: checks and saves (evidence: `backend/patients/views.py`)
- Patient workflow → Staff and schedules: looks up staff (evidence: `backend/patients/views.py`)
- Patient forms → Appointment form: uses (evidence: `backend/patients/forms.py`)
- Patient forms → Appointment rules: validates edits (evidence: `backend/patients/forms.py`)
- Appointment form → Appointment rules: forms model (evidence: `backend/appointment/forms.py`)
- Appointment rules → Patient records: references patient (evidence: `backend/appointment/models.py`)
- Appointment rules → Staff and schedules: references staff schedule (evidence: `backend/appointment/models.py`)
- Staff forms → Staff and schedules: forms model (evidence: `backend/staff/forms.py`)
- Hospital content → Staff and schedules: references department (evidence: `backend/data/models.py`)
- Portal views → Patient forms: uses (evidence: `backend/core/views.py`)
- Portal views → Patient records: reads records (evidence: `backend/core/views.py`)
- Portal views → Staff and schedules: reads staff (evidence: `backend/core/views.py`)
- Portal views → User accounts: uses (evidence: `backend/core/views.py`)
- Appointment signals → Email and reports: dispatches tasks (evidence: `backend/appointment/signals.py`)
- Celery setup → Email and reports: registers tasks (evidence: `backend/core/celery.py`)
- Email and reports → Patient records: reads patient data (evidence: `backend/core/tasks.py`)
- Email and reports → Appointment rules: reads appointments (evidence: `backend/core/tasks.py`)
- Email and reports → Staff and schedules: reads staff (evidence: `backend/core/tasks.py`)
- Email and reports → Email service: sends email (evidence: `backend/core/tasks.py`)
- Patient records → Application database: persists records
- Appointment rules → Application database: persists appointments
- Staff and schedules → Application database: persists schedules
