# foxelhadad812-design/medicare architecture

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

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

## Overview

MediCare is a clinic-management application whose primary workflow is doctor discovery, slot selection, appointment booking, reminders and notifications, followed by clinical encounter documentation and prescription issuance. Its MVC/API presentation layer calls application services, which use repositories and EF Core persistence. The graph also preserves documented administration, identity, payments, reporting, and realtime capabilities. Several service implementations and controllers are represented from the README and source index; their internal call details were not sampled, so those links are limited to documented or indexed relationships.

Main entry points: [`src/MediCare.Data/UnitOfWork/UnitOfWork.cs`](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/UnitOfWork/UnitOfWork.cs) (Repository unit of work), [`src/MediCare.Services/Implementations/AppointmentService.cs`](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/AppointmentService.cs) (Appointment lifecycle), [`src/MediCare.Data/Context/ApplicationDbContext.cs`](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Context/ApplicationDbContext.cs) (EF domain context), [`src/MediCare.Web/Controllers/Api/CalendarApiController.cs`](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/Api/CalendarApiController.cs) (Calendar API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Web experience"]
  node_web["MVC and API<br/>[Program.cs]"]
  node_booking_ui["Appointment flow"]
  node_calendar_api["Calendar API"]
  node_account["Account portal"]
  node_admin_ui["Admin portal<br/>[AdminController.cs]"]
end

subgraph group_booking["Scheduling and care"]
  node_appointment_service["Appointment lifecycle"]
  node_slot_engine["Slot calculation"]
  node_schedule_service["Schedule management<br/>[ScheduleService.cs]"]
  node_doctor_directory["Doctor directory<br/>[DoctorService.cs]"]
  node_reminders["Appointment reminders"]
  node_records["Clinical encounters"]
  node_prescriptions["Prescriptions"]
end

subgraph group_operations["Clinic operations"]
  node_admin_service["Admin analytics<br/>[AdminService.cs]"]
  node_auth["Identity and roles<br/>[AuthService.cs]"]
  node_payments["Payments<br/>[PaymentService.cs]"]
  node_notifications["Notifications"]
  node_realtime["Realtime delivery"]
  node_reporting["Report exports"]
end

subgraph group_persistence["Persistence"]
  node_uow["Repository unit of work<br/>[UnitOfWork.cs]"]
  node_appointment_repo["Appointment repository"]
  node_doctor_repo["Doctor repository"]
  node_repository["Generic repository<br/>[Repository.cs]"]
  node_dbcontext[("EF domain context")]
end

node_patient(("Patient"))

node_patient -->|"uses portals"| node_web
node_web -->|"routes booking"| node_booking_ui
node_booking_ui -->|"requests bookings"| node_appointment_service
node_calendar_api -->|"requests slots"| node_slot_engine
node_calendar_api -->|"checks booking"| node_appointment_service
node_calendar_api -->|"loads doctors"| node_doctor_directory
node_appointment_service -.->|"uses persistence"| node_uow
node_slot_engine -->|"reads schedules"| node_uow
node_schedule_service -.->|"uses persistence"| node_uow
node_doctor_directory -.->|"uses persistence"| node_uow
node_reminders -->|"requests reminders"| node_appointment_service
node_booking_ui -->|"requests encounters"| node_records
node_records -.->|"uses persistence"| node_uow
node_prescriptions -.->|"uses persistence"| node_uow
node_account -.->|"authenticates"| node_auth
node_admin_ui -->|"requests administration"| node_admin_service
node_admin_service -.->|"uses persistence"| node_uow
node_payments -.->|"uses persistence"| node_uow
node_notifications -.->|"persists notifications"| node_uow
node_realtime -.->|"delivers updates"| node_notifications
node_admin_service -.->|"exports reports"| node_reporting
node_uow -->|"provides repository"| node_appointment_repo
node_uow -->|"provides repository"| node_doctor_repo
node_uow -->|"provides repository"| node_repository
node_appointment_repo -->|"queries appointments"| node_dbcontext
node_doctor_repo -->|"queries doctors"| node_dbcontext
node_repository -->|"accesses sets"| node_dbcontext
node_web -->|"calls services"| node_appointment_service
node_appointment_service -->|"through data layer"| node_dbcontext

click node_web "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Program.cs"
click node_booking_ui "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/AppointmentsController.cs"
click node_calendar_api "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/Api/CalendarApiController.cs"
click node_account "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/AccountController.cs"
click node_admin_ui "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/AdminController.cs"
click node_appointment_service "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/AppointmentService.cs"
click node_slot_engine "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/SlotEngineService.cs"
click node_schedule_service "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/ScheduleService.cs"
click node_doctor_directory "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/DoctorService.cs"
click node_reminders "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/BackgroundServices/AppointmentReminderBackgroundService.cs"
click node_records "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/MedicalRecordService.cs"
click node_prescriptions "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/PrescriptionService.cs"
click node_admin_service "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/AdminService.cs"
click node_auth "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/AuthService.cs"
click node_payments "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/PaymentService.cs"
click node_notifications "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/NotificationService.cs"
click node_realtime "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Services/SignalRRealtimeNotifier.cs"
click node_reporting "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Common/ReportExportGenerators.cs"
click node_uow "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/UnitOfWork/UnitOfWork.cs"
click node_appointment_repo "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Repositories/AppointmentRepository.cs"
click node_doctor_repo "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Repositories/DoctorRepository.cs"
click node_repository "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Repositories/Repository.cs"
click node_dbcontext "https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Context/ApplicationDbContext.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_web,node_booking_ui,node_calendar_api,node_account,node_admin_ui toneBlue
class node_appointment_service,node_slot_engine,node_schedule_service,node_doctor_directory,node_reminders,node_records,node_prescriptions toneAmber
class node_admin_service,node_auth,node_payments,node_notifications,node_realtime,node_reporting toneMint
class node_uow,node_appointment_repo,node_doctor_repo,node_repository,node_dbcontext toneRose
class node_patient toneIndigo
```

## Components

### Web experience

- [MVC and API](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Program.cs): `src/MediCare.Web/Program.cs`
- [Appointment flow](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/AppointmentsController.cs): `src/MediCare.Web/Controllers/AppointmentsController.cs`
- [Calendar API](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/Api/CalendarApiController.cs): `src/MediCare.Web/Controllers/Api/CalendarApiController.cs`
- [Account portal](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/AccountController.cs): `src/MediCare.Web/Controllers/AccountController.cs`
- [Admin portal](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Controllers/AdminController.cs): `src/MediCare.Web/Controllers/AdminController.cs`

### Scheduling and care

- [Appointment lifecycle](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/AppointmentService.cs): `src/MediCare.Services/Implementations/AppointmentService.cs`
- [Slot calculation](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/SlotEngineService.cs): `src/MediCare.Services/Implementations/SlotEngineService.cs`
- [Schedule management](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/ScheduleService.cs): `src/MediCare.Services/Implementations/ScheduleService.cs`
- [Doctor directory](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/DoctorService.cs): `src/MediCare.Services/Implementations/DoctorService.cs`
- [Appointment reminders](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/BackgroundServices/AppointmentReminderBackgroundService.cs): `src/MediCare.Services/BackgroundServices/AppointmentReminderBackgroundService.cs`
- [Clinical encounters](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/MedicalRecordService.cs): `src/MediCare.Services/Implementations/MedicalRecordService.cs`
- [Prescriptions](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/PrescriptionService.cs): `src/MediCare.Services/Implementations/PrescriptionService.cs`

### Clinic operations

- [Admin analytics](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/AdminService.cs): `src/MediCare.Services/Implementations/AdminService.cs`
- [Identity and roles](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/AuthService.cs): `src/MediCare.Services/Implementations/AuthService.cs`
- [Payments](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/PaymentService.cs): `src/MediCare.Services/Implementations/PaymentService.cs`
- [Notifications](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Implementations/NotificationService.cs): `src/MediCare.Services/Implementations/NotificationService.cs`
- [Realtime delivery](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Web/Services/SignalRRealtimeNotifier.cs): `src/MediCare.Web/Services/SignalRRealtimeNotifier.cs`
- [Report exports](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Services/Common/ReportExportGenerators.cs): `src/MediCare.Services/Common/ReportExportGenerators.cs`

### Persistence

- [Repository unit of work](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/UnitOfWork/UnitOfWork.cs): `src/MediCare.Data/UnitOfWork/UnitOfWork.cs`
- [Appointment repository](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Repositories/AppointmentRepository.cs): `src/MediCare.Data/Repositories/AppointmentRepository.cs`
- [Doctor repository](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Repositories/DoctorRepository.cs): `src/MediCare.Data/Repositories/DoctorRepository.cs`
- [Generic repository](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Repositories/Repository.cs): `src/MediCare.Data/Repositories/Repository.cs`
- [EF domain context](https://github.com/foxelhadad812-design/medicare/blob/main/src/MediCare.Data/Context/ApplicationDbContext.cs): `src/MediCare.Data/Context/ApplicationDbContext.cs`

### Other components

- **Patient**

## Connections

- Patient → MVC and API: uses portals
- MVC and API → Appointment flow: routes booking (evidence: `src/MediCare.Web/Controllers/AppointmentsController.cs`)
- Appointment flow → Appointment lifecycle: requests bookings (evidence: `src/MediCare.Web/Controllers/AppointmentsController.cs`)
- Calendar API → Slot calculation: requests slots (evidence: `src/MediCare.Web/Controllers/Api/CalendarApiController.cs`)
- Calendar API → Appointment lifecycle: checks booking (evidence: `src/MediCare.Web/Controllers/Api/CalendarApiController.cs`)
- Calendar API → Doctor directory: loads doctors (evidence: `src/MediCare.Web/Controllers/Api/CalendarApiController.cs`)
- Appointment lifecycle → Repository unit of work: uses persistence
- Slot calculation → Repository unit of work: reads schedules (evidence: `src/MediCare.Services/Implementations/SlotEngineService.cs`)
- Schedule management → Repository unit of work: uses persistence
- Doctor directory → Repository unit of work: uses persistence (evidence: `src/MediCare.Services/Implementations/DoctorService.cs`)
- Appointment reminders → Appointment lifecycle: requests reminders (evidence: `src/MediCare.Services/BackgroundServices/AppointmentReminderBackgroundService.cs`)
- Appointment flow → Clinical encounters: requests encounters (evidence: `src/MediCare.Web/Controllers/AppointmentsController.cs`)
- Clinical encounters → Repository unit of work: uses persistence
- Prescriptions → Repository unit of work: uses persistence
- Account portal → Identity and roles: authenticates
- Admin portal → Admin analytics: requests administration (evidence: `src/MediCare.Web/Controllers/AdminController.cs`)
- Admin analytics → Repository unit of work: uses persistence
- Payments → Repository unit of work: uses persistence
- Notifications → Repository unit of work: persists notifications
- Realtime delivery → Notifications: delivers updates
- Admin analytics → Report exports: exports reports
- Repository unit of work → Appointment repository: provides repository (evidence: `src/MediCare.Data/UnitOfWork/UnitOfWork.cs`)
- Repository unit of work → Doctor repository: provides repository (evidence: `src/MediCare.Data/UnitOfWork/UnitOfWork.cs`)
- Repository unit of work → Generic repository: provides repository (evidence: `src/MediCare.Data/UnitOfWork/UnitOfWork.cs`)
- Appointment repository → EF domain context: queries appointments (evidence: `src/MediCare.Data/Repositories/AppointmentRepository.cs`)
- Doctor repository → EF domain context: queries doctors (evidence: `src/MediCare.Data/Repositories/DoctorRepository.cs`)
- Generic repository → EF domain context: accesses sets (evidence: `src/MediCare.Data/Repositories/Repository.cs`)
- MVC and API → Appointment lifecycle: calls services
- Appointment lifecycle → EF domain context: through data layer
