# diasks2/scheduler architecture

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

- Interactive diagram: https://gitdiagram.com/diasks2/scheduler
- Repository: https://github.com/diasks2/scheduler

## Overview

Hospital Shift Scheduler is a small Rails application whose visible workflow is a user signing in and managing hospital shifts; the README also describes shift trading, workload tracking, email updates, and fairness points. The supplied routes expose the home page and Devise user authentication, but no shift-management controllers or implementation excerpts are present. Model relationships are documented, while the README’s scheduling features cannot be traced to runtime components in the sampled code.

Main entry points: [`app/models/user.rb`](https://github.com/diasks2/scheduler/blob/master/app/models/user.rb) (User), [`app/models/shift.rb`](https://github.com/diasks2/scheduler/blob/master/app/models/shift.rb) (Shift), [`config/routes.rb`](https://github.com/diasks2/scheduler/blob/master/config/routes.rb) (Application routes), [`app/models/hospital.rb`](https://github.com/diasks2/scheduler/blob/master/app/models/hospital.rb) (Hospital)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry"]
  node_routes["Application routes<br/>[routes.rb]"]
  node_staticpages["Home page action"]
  node_basecontroller["Request protection"]
end

subgraph group_identity["User identity"]
  node_user["User<br/>[user.rb]"]
  node_authconfig["Auth configuration<br/>[devise.rb]"]
end

subgraph group_scheduling["Scheduling domain"]
  node_hospital["Hospital<br/>[hospital.rb]"]
  node_shift["Shift<br/>[shift.rb]"]
  node_blackout["Blackout<br/>[blackout.rb]"]
  node_postal["Postal<br/>[postal.rb]"]
end

subgraph group_persistence["Persistence"]
  node_database[("Relational database")]
end

node_webrequest(("Web user"))

node_webrequest -->|"sends request"| node_routes
node_routes -->|"routes home"| node_staticpages
node_routes -->|"enables Devise routes"| node_user
node_staticpages -->|"inherits from"| node_basecontroller
node_user -.->|"uses Devise"| node_authconfig
node_user -->|"has many"| node_shift
node_user -->|"has many"| node_blackout
node_hospital -.->|"has many"| node_shift
node_shift -.->|"belongs to"| node_user
node_shift -.->|"belongs to"| node_hospital
node_blackout -.->|"belongs to"| node_user
node_user -.->|"stores account"| node_database
node_hospital -.->|"stores records"| node_database
node_shift -.->|"stores records"| node_database
node_blackout -.->|"stores records"| node_database
node_postal -.->|"stores records"| node_database

click node_user "https://github.com/diasks2/scheduler/blob/master/app/models/user.rb"
click node_authconfig "https://github.com/diasks2/scheduler/blob/master/config/initializers/devise.rb"
click node_routes "https://github.com/diasks2/scheduler/blob/master/config/routes.rb"
click node_staticpages "https://github.com/diasks2/scheduler/blob/master/app/controllers/static_pages_controller.rb"
click node_basecontroller "https://github.com/diasks2/scheduler/blob/master/app/controllers/application_controller.rb"
click node_hospital "https://github.com/diasks2/scheduler/blob/master/app/models/hospital.rb"
click node_shift "https://github.com/diasks2/scheduler/blob/master/app/models/shift.rb"
click node_blackout "https://github.com/diasks2/scheduler/blob/master/app/models/blackout.rb"
click node_postal "https://github.com/diasks2/scheduler/blob/master/app/models/postal.rb"

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_routes,node_staticpages,node_basecontroller,node_webrequest toneBlue
class node_user,node_authconfig toneAmber
class node_hospital,node_shift,node_blackout,node_postal toneMint
class node_database toneRose
```

## Components

### Web entry

- [Application routes](https://github.com/diasks2/scheduler/blob/master/config/routes.rb): `config/routes.rb`
- [Home page action](https://github.com/diasks2/scheduler/blob/master/app/controllers/static_pages_controller.rb): `app/controllers/static_pages_controller.rb`
- [Request protection](https://github.com/diasks2/scheduler/blob/master/app/controllers/application_controller.rb): `app/controllers/application_controller.rb`

### User identity

- [User](https://github.com/diasks2/scheduler/blob/master/app/models/user.rb): `app/models/user.rb`
- [Auth configuration](https://github.com/diasks2/scheduler/blob/master/config/initializers/devise.rb): `config/initializers/devise.rb`

### Scheduling domain

- [Hospital](https://github.com/diasks2/scheduler/blob/master/app/models/hospital.rb): `app/models/hospital.rb`
- [Shift](https://github.com/diasks2/scheduler/blob/master/app/models/shift.rb): `app/models/shift.rb`
- [Blackout](https://github.com/diasks2/scheduler/blob/master/app/models/blackout.rb): `app/models/blackout.rb`
- [Postal](https://github.com/diasks2/scheduler/blob/master/app/models/postal.rb): `app/models/postal.rb`

### Persistence

- **Relational database**

### Other components

- **Web user**

## Connections

- Web user → Application routes: sends request (evidence: `config/routes.rb`)
- Application routes → Home page action: routes home (evidence: `config/routes.rb`)
- Application routes → User: enables Devise routes (evidence: `config/routes.rb`)
- Home page action → Request protection: inherits from (evidence: `app/controllers/static_pages_controller.rb`)
- User → Auth configuration: uses Devise
- User → Shift: has many (evidence: `app/models/user.rb`)
- User → Blackout: has many (evidence: `app/models/user.rb`)
- Hospital → Shift: has many
- Shift → User: belongs to
- Shift → Hospital: belongs to
- Blackout → User: belongs to
- User → Relational database: stores account
- Hospital → Relational database: stores records
- Shift → Relational database: stores records
- Blackout → Relational database: stores records
- Postal → Relational database: stores records
