# yossefahmed6332/clinicapis-system architecture

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

- Interactive diagram: https://gitdiagram.com/yossefahmed6332/clinicapis-system
- Repository: https://github.com/yossefahmed6332/clinicapis-system

## Overview

Clinic APIs is a layered ASP.NET Core backend for patient, staff, clinical, appointment, and financial workflows. Patients and clinic staff use role-restricted API endpoints; the documented core flow is controllers to business services to repositories and EF Core/SQL Server. The graph also preserves authentication, user and staff administration, clinical records, and billing/reporting. Most feature-specific implementation files were not sampled, so their links reflect README-documented capabilities and layering; the manager service-to-repository call is directly visible in source.

Main entry points: [`ClinicAPIs_NewVersion/Services`](https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Services) (Business services), [`ClinicAPIs_NewVersion/Data/ClinicDbContext.cs`](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Data/ClinicDbContext.cs) (Clinic database), [`ClinicAPIs_NewVersion/Controllers/AppointmentController.cs`](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/AppointmentController.cs) (Appointment API), [`ClinicAPIs_NewVersion/Controllers/MedicalRecordController.cs`](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/MedicalRecordController.cs) (Medical records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_auth["Login and tokens<br/>[AuthController.cs]"]
  node_users["User administration"]
  node_user_model["User hierarchy<br/>[ApplicationUser.cs]"]
end

subgraph group_operations["Clinic operations"]
  node_appointments["Appointment API"]
  node_billing["Payment and reports"]
  node_appointment_model["Appointment model<br/>[Appointment.cs]"]
  node_finance_model["Finance models"]
end

subgraph group_clinical["Clinical care"]
  node_records["Medical records"]
  node_exams["Exams and vitals"]
  node_prescriptions["Prescriptions"]
  node_patient_model["Patient model<br/>[Patient.cs]"]
  node_medical_record_model["Medical record model<br/>[MedicalRecord.cs]"]
end

subgraph group_data["Business and persistence"]
  node_services["Business services"]
  node_manager_service["Manager service<br/>[ManagerService.cs]"]
  node_repositories["Data repositories"]
  node_manager_repository["Manager repository"]
  node_db[("Clinic database<br/>[ClinicDbContext.cs]")]
end

node_patient(("Patient"))
node_staff(("Clinic staff"))

node_patient -->|"logs in"| node_auth
node_patient -->|"books appointments"| node_appointments
node_patient -->|"views history"| node_records
node_staff -->|"manages schedules"| node_appointments
node_staff -->|"updates records"| node_records
node_staff -->|"records results"| node_exams
node_staff -->|"creates prescriptions"| node_prescriptions
node_staff -->|"manages finances"| node_billing
node_staff -->|"administers users"| node_users
node_appointments -->|"delegates to"| node_services
node_users -->|"delegates to"| node_services
node_records -->|"delegates to"| node_services
node_exams -->|"delegates to"| node_services
node_prescriptions -->|"delegates to"| node_services
node_billing -->|"delegates to"| node_services
node_services -->|"uses data access"| node_repositories
node_manager_service -->|"calls"| node_manager_repository
node_repositories -->|"accesses"| node_db
node_db -->|"persists"| node_appointment_model
node_db -->|"persists"| node_user_model
node_db -->|"persists"| node_patient_model
node_db -->|"persists"| node_medical_record_model
node_db -->|"persists"| node_finance_model

click node_auth "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/AuthController/AuthController.cs"
click node_users "https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Controllers/UserControllers"
click node_appointments "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/AppointmentController.cs"
click node_billing "https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Controllers"
click node_records "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/MedicalRecordController.cs"
click node_exams "https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Controllers"
click node_prescriptions "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/PrescriptionController.cs"
click node_services "https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Services"
click node_manager_service "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Services/UserServices/EmployeeServices/NonMedicalStaffServices/ManagerService.cs"
click node_repositories "https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Repositories"
click node_manager_repository "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Repositories/UserRepositories/EmployeeRepository/NonMedicalStaffRepository/ManagerRepository.cs"
click node_db "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Data/ClinicDbContext.cs"
click node_appointment_model "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/Appointment.cs"
click node_user_model "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/User/ApplicationUser.cs"
click node_patient_model "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/User/Patient.cs"
click node_medical_record_model "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/MedicalRecord.cs"
click node_finance_model "https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/PaymentOperation.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,node_users,node_user_model toneBlue
class node_appointments,node_billing,node_appointment_model,node_finance_model toneAmber
class node_records,node_exams,node_prescriptions,node_patient_model,node_medical_record_model toneMint
class node_services,node_manager_service,node_repositories,node_manager_repository,node_db toneRose
class node_patient,node_staff toneIndigo
```

## Components

### API and identity

- [Login and tokens](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/AuthController/AuthController.cs): `ClinicAPIs_NewVersion/Controllers/AuthController/AuthController.cs`
- [User administration](https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Controllers/UserControllers): `ClinicAPIs_NewVersion/Controllers/UserControllers`
- [User hierarchy](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/User/ApplicationUser.cs): `ClinicAPIs_NewVersion/Models/User/ApplicationUser.cs`

### Clinic operations

- [Appointment API](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/AppointmentController.cs): `ClinicAPIs_NewVersion/Controllers/AppointmentController.cs`
- [Payment and reports](https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Controllers): `ClinicAPIs_NewVersion/Controllers`
- [Appointment model](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/Appointment.cs): `ClinicAPIs_NewVersion/Models/Appointment.cs`
- [Finance models](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/PaymentOperation.cs): `ClinicAPIs_NewVersion/Models/PaymentOperation.cs`

### Clinical care

- [Medical records](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/MedicalRecordController.cs): `ClinicAPIs_NewVersion/Controllers/MedicalRecordController.cs`
- [Exams and vitals](https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Controllers): `ClinicAPIs_NewVersion/Controllers`
- [Prescriptions](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Controllers/PrescriptionController.cs): `ClinicAPIs_NewVersion/Controllers/PrescriptionController.cs`
- [Patient model](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/User/Patient.cs): `ClinicAPIs_NewVersion/Models/User/Patient.cs`
- [Medical record model](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Models/MedicalRecord.cs): `ClinicAPIs_NewVersion/Models/MedicalRecord.cs`

### Business and persistence

- [Business services](https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Services): `ClinicAPIs_NewVersion/Services`
- [Manager service](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Services/UserServices/EmployeeServices/NonMedicalStaffServices/ManagerService.cs): `ClinicAPIs_NewVersion/Services/UserServices/EmployeeServices/NonMedicalStaffServices/ManagerService.cs`
- [Data repositories](https://github.com/yossefahmed6332/clinicapis-system/tree/main/ClinicAPIs_NewVersion/Repositories): `ClinicAPIs_NewVersion/Repositories`
- [Manager repository](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Repositories/UserRepositories/EmployeeRepository/NonMedicalStaffRepository/ManagerRepository.cs): `ClinicAPIs_NewVersion/Repositories/UserRepositories/EmployeeRepository/NonMedicalStaffRepository/ManagerRepository.cs`
- [Clinic database](https://github.com/yossefahmed6332/clinicapis-system/blob/main/ClinicAPIs_NewVersion/Data/ClinicDbContext.cs): `ClinicAPIs_NewVersion/Data/ClinicDbContext.cs`

### Other components

- **Patient**
- **Clinic staff**

## Connections

- Patient → Login and tokens: logs in (evidence: `README.md`)
- Patient → Appointment API: books appointments (evidence: `README.md`)
- Patient → Medical records: views history (evidence: `README.md`)
- Clinic staff → Appointment API: manages schedules (evidence: `README.md`)
- Clinic staff → Medical records: updates records (evidence: `README.md`)
- Clinic staff → Exams and vitals: records results (evidence: `README.md`)
- Clinic staff → Prescriptions: creates prescriptions (evidence: `README.md`)
- Clinic staff → Payment and reports: manages finances (evidence: `README.md`)
- Clinic staff → User administration: administers users (evidence: `README.md`)
- Appointment API → Business services: delegates to (evidence: `README.md`)
- User administration → Business services: delegates to (evidence: `README.md`)
- Medical records → Business services: delegates to (evidence: `README.md`)
- Exams and vitals → Business services: delegates to (evidence: `README.md`)
- Prescriptions → Business services: delegates to (evidence: `README.md`)
- Payment and reports → Business services: delegates to (evidence: `README.md`)
- Business services → Data repositories: uses data access (evidence: `README.md`)
- Manager service → Manager repository: calls (evidence: `ClinicAPIs_NewVersion/Services/UserServices/EmployeeServices/NonMedicalStaffServices/ManagerService.cs`)
- Data repositories → Clinic database: accesses (evidence: `README.md`)
- Clinic database → Appointment model: persists (evidence: `ClinicAPIs_NewVersion/Data/ClinicDbContext.cs`)
- Clinic database → User hierarchy: persists (evidence: `ClinicAPIs_NewVersion/Data/ClinicDbContext.cs`)
- Clinic database → Patient model: persists (evidence: `ClinicAPIs_NewVersion/Data/ClinicDbContext.cs`)
- Clinic database → Medical record model: persists (evidence: `ClinicAPIs_NewVersion/Data/ClinicDbContext.cs`)
- Clinic database → Finance models: persists (evidence: `ClinicAPIs_NewVersion/Data/ClinicDbContext.cs`)
