# ghiadamohammedlap2482026-boop/hospital_management-system architecture

> Architecture diagram of the GitHub repository ghiadamohammedlap2482026-boop/hospital_management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ghiadamohammedlap2482026-boop/hospital_management-system
- Repository: https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system

## Overview

CareHub is an ASP.NET Core MVC hospital-management application. Users enter through the routed web UI, then manage departments, doctors, patients, and doctor–patient treatment records through controller actions and Razor pages; those workflows persist through Entity Framework Core to SQL Server. The dashboard, About page, shared presentation layer, and domain models are included. Edges reflect calls and mappings visible in the excerpts or documented capabilities; unsampled view wiring and some entry routing are represented only where the README or Program.cs supports them.

Main entry points: [`Data/Hospital_db_context.cs`](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Data/Hospital_db_context.cs) (EF Core context), [`Controllers/DoctorController.cs`](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/DoctorController.cs) (Doctor management), [`Controllers/TreatmentController.cs`](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/TreatmentController.cs) (Treatment management), [`Controllers/PatientController.cs`](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/PatientController.cs) (Patient management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry and pages"]
  node_startup["MVC startup and routing<br/>[Program.cs]"]
  node_home["Dashboard and About<br/>[HomeController.cs]"]
  node_sharedviews["Shared Razor layout"]
  node_departmentpages["Department pages"]
  node_doctorpages["Doctor pages"]
  node_patientpages["Patient pages"]
  node_treatmentpages["Treatment pages"]
end

subgraph group_workflows["Hospital workflows"]
  node_departmentflow["Department management"]
  node_doctorflow["Doctor management"]
  node_patientflow["Patient management"]
  node_treatmentflow["Treatment management"]
end

subgraph group_domain["Hospital domain"]
  node_departmentmodel["Department entity<br/>[Department.cs]"]
  node_doctormodel["Doctor entity<br/>[Doctor.cs]"]
  node_patientmodel["Patient entity<br/>[Patient.cs]"]
  node_treatmentmodel["Treatment entity<br/>[Treatment.cs]"]
  node_errormodel["Error view model<br/>[ErrorViewModel.cs]"]
end

subgraph group_persistence["Persistence"]
  node_dbcontext["EF Core context"]
  node_sqlserver[("SQL Server database")]
end

node_visitor(("Hospital user"))

node_visitor -->|"requests pages"| node_startup
node_startup -->|"routes MVC"| node_home
node_home -->|"creates error model"| node_errormodel
node_departmentflow -->|"queries and saves"| node_departmentmodel
node_departmentflow -->|"uses context"| node_dbcontext
node_doctorflow -->|"queries and saves"| node_doctormodel
node_doctorflow -->|"loads departments"| node_departmentmodel
node_doctorflow -->|"removes related treatments"| node_treatmentmodel
node_doctorflow -->|"uses context"| node_dbcontext
node_patientflow -->|"queries and saves"| node_patientmodel
node_patientflow -->|"removes related treatments"| node_treatmentmodel
node_patientflow -->|"uses context"| node_dbcontext
node_treatmentflow -->|"queries and saves"| node_treatmentmodel
node_treatmentflow -->|"loads doctors"| node_doctormodel
node_treatmentflow -->|"loads patients"| node_patientmodel
node_treatmentflow -->|"uses context"| node_dbcontext
node_dbcontext -->|"maps entity"| node_departmentmodel
node_dbcontext -->|"maps entity"| node_doctormodel
node_dbcontext -->|"maps entity"| node_patientmodel
node_dbcontext -->|"maps entity relations"| node_treatmentmodel
node_dbcontext -->|"persists via EF"| node_sqlserver
node_home -.->|"renders pages"| node_sharedviews
node_departmentflow -.->|"renders pages"| node_departmentpages
node_doctorflow -.->|"renders pages"| node_doctorpages
node_patientflow -.->|"renders pages"| node_patientpages
node_treatmentflow -.->|"renders pages"| node_treatmentpages

click node_startup "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Program.cs"
click node_home "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/HomeController.cs"
click node_sharedviews "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Shared"
click node_departmentflow "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/DepartmentController.cs"
click node_doctorflow "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/DoctorController.cs"
click node_patientflow "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/PatientController.cs"
click node_treatmentflow "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/TreatmentController.cs"
click node_departmentpages "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Department"
click node_doctorpages "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Doctor"
click node_patientpages "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Patient"
click node_treatmentpages "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Treatment"
click node_departmentmodel "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/Department.cs"
click node_doctormodel "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/Doctor.cs"
click node_patientmodel "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/Patient.cs"
click node_treatmentmodel "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/Treatment.cs"
click node_errormodel "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/ErrorViewModel.cs"
click node_dbcontext "https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Data/Hospital_db_context.cs"

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_startup,node_home,node_sharedviews,node_departmentpages,node_doctorpages,node_patientpages,node_treatmentpages,node_visitor toneBlue
class node_departmentflow,node_doctorflow,node_patientflow,node_treatmentflow toneAmber
class node_departmentmodel,node_doctormodel,node_patientmodel,node_treatmentmodel,node_errormodel toneMint
class node_dbcontext,node_sqlserver toneRose
```

## Components

### Web entry and pages

- [MVC startup and routing](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Program.cs): `Program.cs`
- [Dashboard and About](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/HomeController.cs): `Controllers/HomeController.cs`
- [Shared Razor layout](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Shared): `Views/Shared`
- [Department pages](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Department): `Views/Department`
- [Doctor pages](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Doctor): `Views/Doctor`
- [Patient pages](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Patient): `Views/Patient`
- [Treatment pages](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/tree/main/Views/Treatment): `Views/Treatment`

### Hospital workflows

- [Department management](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/DepartmentController.cs): `Controllers/DepartmentController.cs`
- [Doctor management](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/DoctorController.cs): `Controllers/DoctorController.cs`
- [Patient management](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/PatientController.cs): `Controllers/PatientController.cs`
- [Treatment management](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Controllers/TreatmentController.cs): `Controllers/TreatmentController.cs`

### Hospital domain

- [Department entity](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/Department.cs): `Models/Department.cs`
- [Doctor entity](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/Doctor.cs): `Models/Doctor.cs`
- [Patient entity](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/Patient.cs): `Models/Patient.cs`
- [Treatment entity](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/Treatment.cs): `Models/Treatment.cs`
- [Error view model](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Models/ErrorViewModel.cs): `Models/ErrorViewModel.cs`

### Persistence

- [EF Core context](https://github.com/ghiadamohammedlap2482026-boop/hospital_management-system/blob/main/Data/Hospital_db_context.cs): `Data/Hospital_db_context.cs`
- **SQL Server database**

### Other components

- **Hospital user**

## Connections

- Hospital user → MVC startup and routing: requests pages (evidence: `README.md`)
- MVC startup and routing → Dashboard and About: routes MVC (evidence: `Program.cs`)
- Dashboard and About → Error view model: creates error model (evidence: `Controllers/HomeController.cs`)
- Department management → Department entity: queries and saves (evidence: `Controllers/DepartmentController.cs`)
- Department management → EF Core context: uses context (evidence: `Controllers/DepartmentController.cs`)
- Doctor management → Doctor entity: queries and saves (evidence: `Controllers/DoctorController.cs`)
- Doctor management → Department entity: loads departments (evidence: `Controllers/DoctorController.cs`)
- Doctor management → Treatment entity: removes related treatments (evidence: `Controllers/DoctorController.cs`)
- Doctor management → EF Core context: uses context (evidence: `Controllers/DoctorController.cs`)
- Patient management → Patient entity: queries and saves (evidence: `Controllers/PatientController.cs`)
- Patient management → Treatment entity: removes related treatments (evidence: `Controllers/PatientController.cs`)
- Patient management → EF Core context: uses context (evidence: `Controllers/PatientController.cs`)
- Treatment management → Treatment entity: queries and saves (evidence: `Controllers/TreatmentController.cs`)
- Treatment management → Doctor entity: loads doctors (evidence: `Controllers/TreatmentController.cs`)
- Treatment management → Patient entity: loads patients (evidence: `Controllers/TreatmentController.cs`)
- Treatment management → EF Core context: uses context (evidence: `Controllers/TreatmentController.cs`)
- EF Core context → Department entity: maps entity (evidence: `Data/Hospital_db_context.cs`)
- EF Core context → Doctor entity: maps entity (evidence: `Data/Hospital_db_context.cs`)
- EF Core context → Patient entity: maps entity (evidence: `Data/Hospital_db_context.cs`)
- EF Core context → Treatment entity: maps entity relations (evidence: `Data/Hospital_db_context.cs`)
- EF Core context → SQL Server database: persists via EF (evidence: `Data/Hospital_db_context.cs`)
- Dashboard and About → Shared Razor layout: renders pages (evidence: `README.md`)
- Department management → Department pages: renders pages (evidence: `README.md`)
- Doctor management → Doctor pages: renders pages (evidence: `README.md`)
- Patient management → Patient pages: renders pages (evidence: `README.md`)
- Treatment management → Treatment pages: renders pages (evidence: `README.md`)
