# abdallahsaadelbasuoiny/medicare architecture

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

- Interactive diagram: https://gitdiagram.com/abdallahsaadelbasuoiny/medicare
- Repository: https://github.com/abdallahsaadelbasuoiny/medicare

## Overview

MediCare is a multi-tenant clinic-management web application. Patients and doctors use role-specific pages to book and manage appointments, maintain schedules, and create or review medical records and prescriptions; administrators manage clinic operations and tenant settings. The central service layer coordinates domain actions through a unit of work, while EF Core provides tenant-filtered persistence. The README is empty, and several feature implementations are unsampled, so the graph includes documented-by-name capability branches but limits their connections to relationships visible in the source index or excerpts.

Main entry points: [`MediCare.Web/Program.cs`](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Program.cs) (Web startup), [`MediCare.Services/AppointmentService.cs`](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/AppointmentService.cs) (Appointments), [`MediCare.Data/Context/ApplicationDbContext.cs`](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Data/Context/ApplicationDbContext.cs) (Application database), [`MediCare.Web/Controllers/PatientController.cs`](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/PatientController.cs) (Patient portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_patients["Patient portal"]
  node_doctors["Doctor portal"]
  node_admins["Clinic administration<br/>[AdminController.cs]"]
  node_superadmin["Tenant administration"]
  node_accounts["Accounts"]
  node_runtime["Web startup<br/>[Program.cs]"]
end

subgraph group_services["Domain services"]
  node_appointment_service["Appointments"]
  node_schedule_service["Doctor schedules"]
  node_record_service["Medical records"]
  node_prescription_service["Prescriptions"]
  node_tenant_service["Tenant management<br/>[TenantService.cs]"]
  node_analytics["Clinic analytics"]
  node_notifications["Notifications"]
end

subgraph group_core["Domain model"]
  node_identity["Users and roles<br/>[ApplicationUser.cs]"]
  node_clinical["Clinical records<br/>[MedicalRecord.cs]"]
  node_appointment_model["Appointments<br/>[Appointment.cs]"]
  node_schedule_model["Doctor schedules<br/>[DoctorSchedule.cs]"]
  node_tenant_model["Tenants<br/>[Tenant.cs]"]
  node_uow["Unit of work<br/>[IUnitOfWork.cs]"]
end

subgraph group_data["Persistence and tenancy"]
  node_database[("Application database")]
  node_repositories["Data repositories"]
  node_tenant_context["Tenant context<br/>[TenantContext.cs]"]
end

node_end_user(("Clinic user"))

node_end_user -->|"uses portal"| node_patients
node_end_user -->|"uses portal"| node_doctors
node_end_user -->|"uses portal"| node_admins
node_patients -->|"requests appointments"| node_appointment_service
node_patients -->|"checks availability"| node_schedule_service
node_patients -->|"views records"| node_record_service
node_patients -->|"views prescriptions"| node_prescription_service
node_doctors -->|"manages appointments"| node_appointment_service
node_doctors -->|"manages schedules"| node_schedule_service
node_doctors -->|"updates records"| node_record_service
node_doctors -->|"manages prescriptions"| node_prescription_service
node_admins -->|"manages appointments"| node_appointment_service
node_admins -->|"requests analytics"| node_analytics
node_admins -->|"manages tenants"| node_tenant_service
node_superadmin -->|"manages tenants"| node_tenant_service
node_accounts -->|"uses tenant services"| node_tenant_service
node_appointment_service -->|"uses repositories"| node_uow
node_appointment_service -->|"checks schedules"| node_schedule_service
node_appointment_service -->|"sends notifications"| node_notifications
node_record_service -->|"uses repositories"| node_uow
node_tenant_service -->|"uses repositories"| node_uow
node_runtime -->|"configures"| node_database
node_runtime -->|"registers"| node_tenant_context
node_runtime -->|"registers"| node_uow
node_runtime -->|"registers"| node_appointment_service
node_runtime -->|"registers"| node_schedule_service
node_runtime -->|"registers"| node_record_service
node_runtime -->|"registers"| node_prescription_service
node_runtime -->|"registers"| node_tenant_service
node_database -->|"applies tenant filters"| node_tenant_context
node_database -->|"stores tenants"| node_tenant_model
node_database -->|"stores appointments"| node_appointment_model
node_database -->|"stores clinical data"| node_clinical
node_repositories -.->|"queries context"| node_database

click node_patients "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/PatientController.cs"
click node_doctors "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/DoctorController.cs"
click node_admins "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/AdminController.cs"
click node_superadmin "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/SuperAdminController.cs"
click node_accounts "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/AccountController.cs"
click node_runtime "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Program.cs"
click node_appointment_service "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/AppointmentService.cs"
click node_schedule_service "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/DoctorScheduleService.cs"
click node_record_service "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/MedicalRecordService.cs"
click node_prescription_service "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/PrescriptionService.cs"
click node_tenant_service "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/TenantService.cs"
click node_analytics "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/AnalyticsService.cs"
click node_notifications "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/NotificationService.cs"
click node_identity "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/ApplicationUser.cs"
click node_clinical "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/MedicalRecord.cs"
click node_appointment_model "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/Appointment.cs"
click node_schedule_model "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/DoctorSchedule.cs"
click node_tenant_model "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/Tenant.cs"
click node_uow "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Interfaces/IUnitOfWork.cs"
click node_database "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Data/Context/ApplicationDbContext.cs"
click node_repositories "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Data/Repositories/GenericRepository.cs"
click node_tenant_context "https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Services/TenantContext.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_patients,node_doctors,node_admins,node_superadmin,node_accounts,node_runtime,node_end_user toneBlue
class node_appointment_service,node_schedule_service,node_record_service,node_prescription_service,node_tenant_service,node_analytics,node_notifications toneAmber
class node_identity,node_clinical,node_appointment_model,node_schedule_model,node_tenant_model,node_uow toneMint
class node_database,node_repositories,node_tenant_context toneRose
```

## Components

### Web application

- [Patient portal](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/PatientController.cs): `MediCare.Web/Controllers/PatientController.cs`
- [Doctor portal](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/DoctorController.cs): `MediCare.Web/Controllers/DoctorController.cs`
- [Clinic administration](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/AdminController.cs): `MediCare.Web/Controllers/AdminController.cs`
- [Tenant administration](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/SuperAdminController.cs): `MediCare.Web/Controllers/SuperAdminController.cs`
- [Accounts](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Controllers/AccountController.cs): `MediCare.Web/Controllers/AccountController.cs`
- [Web startup](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Program.cs): `MediCare.Web/Program.cs`

### Domain services

- [Appointments](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/AppointmentService.cs): `MediCare.Services/AppointmentService.cs`
- [Doctor schedules](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/DoctorScheduleService.cs): `MediCare.Services/DoctorScheduleService.cs`
- [Medical records](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/MedicalRecordService.cs): `MediCare.Services/MedicalRecordService.cs`
- [Prescriptions](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/PrescriptionService.cs): `MediCare.Services/PrescriptionService.cs`
- [Tenant management](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/TenantService.cs): `MediCare.Services/TenantService.cs`
- [Clinic analytics](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/AnalyticsService.cs): `MediCare.Services/AnalyticsService.cs`
- [Notifications](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Services/NotificationService.cs): `MediCare.Services/NotificationService.cs`

### Domain model

- [Users and roles](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/ApplicationUser.cs): `MediCare.Core/Entities/ApplicationUser.cs`
- [Clinical records](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/MedicalRecord.cs): `MediCare.Core/Entities/MedicalRecord.cs`
- [Appointments](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/Appointment.cs): `MediCare.Core/Entities/Appointment.cs`
- [Doctor schedules](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/DoctorSchedule.cs): `MediCare.Core/Entities/DoctorSchedule.cs`
- [Tenants](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Entities/Tenant.cs): `MediCare.Core/Entities/Tenant.cs`
- [Unit of work](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Core/Interfaces/IUnitOfWork.cs): `MediCare.Core/Interfaces/IUnitOfWork.cs`

### Persistence and tenancy

- [Application database](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Data/Context/ApplicationDbContext.cs): `MediCare.Data/Context/ApplicationDbContext.cs`
- [Data repositories](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Data/Repositories/GenericRepository.cs): `MediCare.Data/Repositories/GenericRepository.cs`
- [Tenant context](https://github.com/abdallahsaadelbasuoiny/medicare/blob/main/MediCare.Web/Services/TenantContext.cs): `MediCare.Web/Services/TenantContext.cs`

### Other components

- **Clinic user**

## Connections

- Clinic user → Patient portal: uses portal (evidence: `MediCare.Web/Controllers/PatientController.cs`)
- Clinic user → Doctor portal: uses portal (evidence: `MediCare.Web/Controllers/DoctorController.cs`)
- Clinic user → Clinic administration: uses portal (evidence: `MediCare.Web/Controllers/AdminController.cs`)
- Patient portal → Appointments: requests appointments (evidence: `MediCare.Web/Controllers/PatientController.cs`)
- Patient portal → Doctor schedules: checks availability (evidence: `MediCare.Web/Controllers/PatientController.cs`)
- Patient portal → Medical records: views records (evidence: `MediCare.Web/Controllers/PatientController.cs`)
- Patient portal → Prescriptions: views prescriptions (evidence: `MediCare.Web/Controllers/PatientController.cs`)
- Doctor portal → Appointments: manages appointments (evidence: `MediCare.Web/Controllers/DoctorController.cs`)
- Doctor portal → Doctor schedules: manages schedules (evidence: `MediCare.Web/Controllers/DoctorController.cs`)
- Doctor portal → Medical records: updates records (evidence: `MediCare.Web/Controllers/DoctorController.cs`)
- Doctor portal → Prescriptions: manages prescriptions (evidence: `MediCare.Web/Controllers/DoctorController.cs`)
- Clinic administration → Appointments: manages appointments (evidence: `MediCare.Web/Controllers/AdminController.cs`)
- Clinic administration → Clinic analytics: requests analytics (evidence: `MediCare.Web/Controllers/AdminController.cs`)
- Clinic administration → Tenant management: manages tenants (evidence: `MediCare.Web/Controllers/AdminController.cs`)
- Tenant administration → Tenant management: manages tenants (evidence: `MediCare.Web/Controllers/SuperAdminController.cs`)
- Accounts → Tenant management: uses tenant services (evidence: `MediCare.Web/Controllers/AccountController.cs`)
- Appointments → Unit of work: uses repositories (evidence: `MediCare.Services/AppointmentService.cs`)
- Appointments → Doctor schedules: checks schedules (evidence: `MediCare.Services/AppointmentService.cs`)
- Appointments → Notifications: sends notifications (evidence: `MediCare.Services/AppointmentService.cs`)
- Medical records → Unit of work: uses repositories (evidence: `MediCare.Services/MedicalRecordService.cs`)
- Tenant management → Unit of work: uses repositories (evidence: `MediCare.Services/TenantService.cs`)
- Web startup → Application database: configures (evidence: `MediCare.Web/Program.cs`)
- Web startup → Tenant context: registers (evidence: `MediCare.Web/Program.cs`)
- Web startup → Unit of work: registers (evidence: `MediCare.Web/Program.cs`)
- Web startup → Appointments: registers (evidence: `MediCare.Web/Program.cs`)
- Web startup → Doctor schedules: registers (evidence: `MediCare.Web/Program.cs`)
- Web startup → Medical records: registers (evidence: `MediCare.Web/Program.cs`)
- Web startup → Prescriptions: registers (evidence: `MediCare.Web/Program.cs`)
- Web startup → Tenant management: registers (evidence: `MediCare.Web/Program.cs`)
- Application database → Tenant context: applies tenant filters (evidence: `MediCare.Data/Context/ApplicationDbContext.cs`)
- Application database → Tenants: stores tenants (evidence: `MediCare.Data/Context/ApplicationDbContext.cs`)
- Application database → Appointments: stores appointments (evidence: `MediCare.Data/Context/ApplicationDbContext.cs`)
- Application database → Clinical records: stores clinical data (evidence: `MediCare.Data/Context/ApplicationDbContext.cs`)
- Data repositories → Application database: queries context (evidence: `MediCare.Data/Repositories/GenericRepository.cs`)
