# omar11atef/api-hospital-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/omar11atef/api-hospital-management-system
- Repository: https://github.com/omar11atef/api-hospital-management-system

## Overview

This is an ASP.NET Core hospital-management API. Its main workflow is a client request reaching a domain controller, which delegates to a service to manage hospital records and return an API result. The visible domains cover identity and permissions, appointments, patients and medical reports, doctors/departments, and room occupancy. EF Core provides the relational persistence layer. The README also claims billing and invoicing, but the supplied tree shows no corresponding implementation, so that capability is not mapped. Some service and controller links are supported by the SOURCE INDEX; unsampled behavior is not inferred.

Main entry points: [`Hospital Management System/Controllers/PatientController.cs`](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/PatientController.cs) (Patient API), [`Hospital Management System/Services/AuthorService.cs`](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/AuthorService.cs) (Authentication service), [`Hospital Management System/Services/AppointmentService.cs`](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/AppointmentService.cs) (Appointment service), [`Hospital Management System/Controllers/DoctorsController.cs`](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/DoctorsController.cs) (Doctor API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_auth_controller["Authentication API"]
  node_patient_controller["Patient API"]
  node_appointment_controller["Appointment API"]
  node_doctor_controller["Doctor API"]
  node_room_controller["Room API<br/>[RoomsController.cs]"]
  node_department_controller["Department API"]
  node_admin_controller["Admin API<br/>[AdminController.cs]"]
  node_roles_controller["Roles API<br/>[RolesController.cs]"]
  node_users_controller["Users API<br/>[UsersController.cs]"]
end

subgraph group_care["Care operations"]
  node_patient_service["Patient service<br/>[PatientsService.cs]"]
  node_appointment_service["Appointment service"]
  node_doctor_service["Doctor service<br/>[DoctorService.cs]"]
  node_medical_records["Visits and reports<br/>[PatientVisit.cs]"]
end

subgraph group_facility["Hospital facilities"]
  node_department_service["Department service"]
  node_room_service["Room and occupancy service<br/>[RoomService.cs]"]
end

subgraph group_identity["Identity services"]
  node_author_service["Authentication service<br/>[AuthorService.cs]"]
  node_jwt_provider["JWT provider<br/>[JwtProvider.cs]"]
  node_permission_auth["Permission authorization"]
  node_email_service["Email service<br/>[EmailService.cs]"]
end

subgraph group_data["Persistence"]
  node_relational_store[("Relational data context")]
  node_domain_entities["Hospital domain entities<br/>[Appointment.cs]"]
  node_result_model["Operation results<br/>[Result.cs]"]
end

node_client(("API client"))

node_client -->|"sends request"| node_auth_controller
node_client -.->|"sends request"| node_patient_controller
node_client -.->|"sends request"| node_appointment_controller
node_client -.->|"sends request"| node_doctor_controller
node_client -.->|"sends request"| node_room_controller
node_client -.->|"sends request"| node_department_controller
node_client -.->|"sends request"| node_admin_controller
node_client -.->|"sends request"| node_roles_controller
node_client -.->|"sends request"| node_users_controller
node_auth_controller -->|"delegates to"| node_author_service
node_author_service -->|"generates tokens"| node_jwt_provider
node_author_service -.->|"sends email"| node_email_service
node_patient_controller -->|"delegates to"| node_patient_service
node_patient_controller -->|"requests patient appointments"| node_appointment_service
node_appointment_controller -->|"delegates to"| node_appointment_service
node_doctor_controller -->|"delegates to"| node_doctor_service
node_doctor_controller -->|"uses appointments"| node_appointment_service
node_room_controller -->|"delegates to"| node_room_service
node_room_service -->|"queries and saves"| node_relational_store
node_room_service -->|"reads patient stays"| node_medical_records
node_appointment_service -->|"queries and saves"| node_relational_store
node_author_service -->|"returns outcomes"| node_result_model
node_patient_service -->|"returns outcomes"| node_result_model
node_relational_store -->|"maps records"| node_domain_entities
node_permission_auth -->|"checks permissions"| node_domain_entities
node_patient_controller -->|"generates report"| node_medical_records

click node_auth_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/AuthorController.cs"
click node_patient_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/PatientController.cs"
click node_appointment_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/AppointmentsController.cs"
click node_doctor_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/DoctorsController.cs"
click node_room_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/RoomsController.cs"
click node_department_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/DepartmentController.cs"
click node_admin_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/AdminController.cs"
click node_roles_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/RolesController.cs"
click node_users_controller "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/UsersController.cs"
click node_author_service "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/AuthorService.cs"
click node_jwt_provider "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Authentication/JwtProvider.cs"
click node_permission_auth "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Authentication/Filter/PermissionAuthorizationHandler.cs"
click node_email_service "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/EmailService.cs"
click node_patient_service "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/PatientsService.cs"
click node_appointment_service "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/AppointmentService.cs"
click node_doctor_service "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/DoctorService.cs"
click node_medical_records "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Entities/PatientVisit.cs"
click node_department_service "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/DepartmentService.cs"
click node_room_service "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/RoomService.cs"
click node_relational_store "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Persistence/ApplicationDbContext..cs"
click node_domain_entities "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Entities/Appointment.cs"
click node_result_model "https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Abstractions/Result.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_auth_controller,node_patient_controller,node_appointment_controller,node_doctor_controller,node_room_controller,node_department_controller,node_admin_controller,node_roles_controller,node_users_controller,node_client toneBlue
class node_patient_service,node_appointment_service,node_doctor_service,node_medical_records toneAmber
class node_department_service,node_room_service toneMint
class node_author_service,node_jwt_provider,node_permission_auth,node_email_service toneRose
class node_relational_store,node_domain_entities,node_result_model toneIndigo
```

## Components

### API and access

- [Authentication API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/AuthorController.cs): `Hospital Management System/Controllers/AuthorController.cs`
- [Patient API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/PatientController.cs): `Hospital Management System/Controllers/PatientController.cs`
- [Appointment API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/AppointmentsController.cs): `Hospital Management System/Controllers/AppointmentsController.cs`
- [Doctor API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/DoctorsController.cs): `Hospital Management System/Controllers/DoctorsController.cs`
- [Room API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/RoomsController.cs): `Hospital Management System/Controllers/RoomsController.cs`
- [Department API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/DepartmentController.cs): `Hospital Management System/Controllers/DepartmentController.cs`
- [Admin API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/AdminController.cs): `Hospital Management System/Controllers/AdminController.cs`
- [Roles API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/RolesController.cs): `Hospital Management System/Controllers/RolesController.cs`
- [Users API](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Controllers/UsersController.cs): `Hospital Management System/Controllers/UsersController.cs`

### Care operations

- [Patient service](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/PatientsService.cs): `Hospital Management System/Services/PatientsService.cs`
- [Appointment service](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/AppointmentService.cs): `Hospital Management System/Services/AppointmentService.cs`
- [Doctor service](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/DoctorService.cs): `Hospital Management System/Services/DoctorService.cs`
- [Visits and reports](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Entities/PatientVisit.cs): `Hospital Management System/Entities/PatientVisit.cs`

### Hospital facilities

- [Department service](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/DepartmentService.cs): `Hospital Management System/Services/DepartmentService.cs`
- [Room and occupancy service](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/RoomService.cs): `Hospital Management System/Services/RoomService.cs`

### Identity services

- [Authentication service](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/AuthorService.cs): `Hospital Management System/Services/AuthorService.cs`
- [JWT provider](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Authentication/JwtProvider.cs): `Hospital Management System/Authentication/JwtProvider.cs`
- [Permission authorization](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Authentication/Filter/PermissionAuthorizationHandler.cs): `Hospital Management System/Authentication/Filter/PermissionAuthorizationHandler.cs`
- [Email service](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Services/EmailService.cs): `Hospital Management System/Services/EmailService.cs`

### Persistence

- [Relational data context](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Persistence/ApplicationDbContext..cs): `Hospital Management System/Persistence/ApplicationDbContext..cs`
- [Hospital domain entities](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Entities/Appointment.cs): `Hospital Management System/Entities/Appointment.cs`
- [Operation results](https://github.com/omar11atef/api-hospital-management-system/blob/master/Hospital%20Management%20System/Abstractions/Result.cs): `Hospital Management System/Abstractions/Result.cs`

### Other components

- **API client**

## Connections

- API client → Authentication API: sends request (evidence: `README.md`)
- API client → Patient API: sends request
- API client → Appointment API: sends request
- API client → Doctor API: sends request
- API client → Room API: sends request
- API client → Department API: sends request
- API client → Admin API: sends request
- API client → Roles API: sends request
- API client → Users API: sends request
- Authentication API → Authentication service: delegates to (evidence: `Hospital Management System/Controllers/AuthorController.cs`)
- Authentication service → JWT provider: generates tokens (evidence: `Hospital Management System/Services/AuthorService.cs`)
- Authentication service → Email service: sends email
- Patient API → Patient service: delegates to (evidence: `Hospital Management System/Controllers/PatientController.cs`)
- Patient API → Appointment service: requests patient appointments (evidence: `Hospital Management System/Controllers/PatientController.cs`)
- Appointment API → Appointment service: delegates to (evidence: `Hospital Management System/Controllers/AppointmentsController.cs`)
- Doctor API → Doctor service: delegates to (evidence: `Hospital Management System/Controllers/DoctorsController.cs`)
- Doctor API → Appointment service: uses appointments (evidence: `Hospital Management System/Controllers/DoctorsController.cs`)
- Room API → Room and occupancy service: delegates to (evidence: `Hospital Management System/Controllers/RoomsController.cs`)
- Room and occupancy service → Relational data context: queries and saves (evidence: `Hospital Management System/Services/RoomService.cs`)
- Room and occupancy service → Visits and reports: reads patient stays (evidence: `Hospital Management System/Services/RoomService.cs`)
- Appointment service → Relational data context: queries and saves (evidence: `Hospital Management System/Services/AppointmentService.cs`)
- Authentication service → Operation results: returns outcomes (evidence: `Hospital Management System/Services/AuthorService.cs`)
- Patient service → Operation results: returns outcomes (evidence: `Hospital Management System/Services/PatientsService.cs`)
- Relational data context → Hospital domain entities: maps records (evidence: `Hospital Management System/Persistence/ApplicationDbContext..cs`)
- Permission authorization → Hospital domain entities: checks permissions
- Patient API → Visits and reports: generates report (evidence: `Hospital Management System/Controllers/PatientController.cs`)
