# mcipll/visitbookingsystem architecture

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

- Interactive diagram: https://gitdiagram.com/mcipll/visitbookingsystem
- Repository: https://github.com/mcipll/visitbookingsystem

## Overview

VisitBookingSystem is an ASP.NET Core REST API for managing patients and medical appointments. Clients submit requests to the patient or appointment endpoints; controllers delegate to services, which enforce business rules, map domain data to DTOs, and persist changes. The documented capabilities also include sorting, CSV exports, appointment constraints, and automatic EF Core migrations. The sampled sources show the appointment request path and both services’ persistence behavior; patient-controller delegation and some startup wiring are documented or indexed but not fully excerpted.

Main entry points: [`Program.cs`](https://github.com/mcipll/visitbookingsystem/blob/master/Program.cs) (Application Startup), [`Data/AppDbContext.cs`](https://github.com/mcipll/visitbookingsystem/blob/master/Data/AppDbContext.cs) (EF Core Context), [`Services/PatientService.cs`](https://github.com/mcipll/visitbookingsystem/blob/master/Services/PatientService.cs) (Patient Service), [`Services/AppointmentService.cs`](https://github.com/mcipll/visitbookingsystem/blob/master/Services/AppointmentService.cs) (Appointment Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_patients_api["Patient Endpoints"]
  node_appointments_api["Appointment Endpoints"]
  node_patient_dtos["Patient DTOs"]
  node_appointment_dtos["Appointment DTOs"]
end

subgraph group_services["Booking Services"]
  node_patient_service["Patient Service<br/>[PatientService.cs]"]
  node_appointment_service["Appointment Service"]
end

subgraph group_persistence["Domain and Storage"]
  node_patient_model["Patient Model<br/>[Patient.cs]"]
  node_appointment_model["Appointment Model<br/>[Appointment.cs]"]
  node_db_context["EF Core Context<br/>[AppDbContext.cs]"]
  node_sqlite[("SQLite Database")]
end

subgraph group_runtime["Application Runtime"]
  node_exception_middleware["Exception Middleware"]
  node_program["Application Startup<br/>[Program.cs]"]
  node_swagger["Swagger / OpenAPI<br/>[Program.cs]"]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_patients_api
node_client -->|"sends requests"| node_appointments_api
node_appointments_api -->|"delegates operations"| node_appointment_service
node_patients_api -.->|"delegates operations"| node_patient_service
node_appointment_service -->|"maps data"| node_appointment_dtos
node_patient_service -->|"maps data"| node_patient_dtos
node_appointment_service -->|"queries and saves"| node_db_context
node_patient_service -->|"queries and saves"| node_db_context
node_db_context -->|"models entities"| node_patient_model
node_db_context -->|"models entities"| node_appointment_model
node_appointment_model -->|"references patient"| node_patient_model
node_db_context -->|"persists data"| node_sqlite
node_program -->|"configures and migrates"| node_db_context
node_program -->|"registers service"| node_patient_service
node_program -->|"registers service"| node_appointment_service
node_program -->|"registers middleware"| node_exception_middleware
node_program -->|"configures docs"| node_swagger
node_program -->|"maps controllers"| node_patients_api
node_program -->|"maps controllers"| node_appointments_api

click node_patients_api "https://github.com/mcipll/visitbookingsystem/blob/master/Controllers/PatientsController.cs"
click node_appointments_api "https://github.com/mcipll/visitbookingsystem/blob/master/Controllers/AppointmentsController.cs"
click node_patient_dtos "https://github.com/mcipll/visitbookingsystem/tree/master/DTOs"
click node_appointment_dtos "https://github.com/mcipll/visitbookingsystem/tree/master/DTOs"
click node_patient_service "https://github.com/mcipll/visitbookingsystem/blob/master/Services/PatientService.cs"
click node_appointment_service "https://github.com/mcipll/visitbookingsystem/blob/master/Services/AppointmentService.cs"
click node_patient_model "https://github.com/mcipll/visitbookingsystem/blob/master/Models/Patient.cs"
click node_appointment_model "https://github.com/mcipll/visitbookingsystem/blob/master/Models/Appointment.cs"
click node_db_context "https://github.com/mcipll/visitbookingsystem/blob/master/Data/AppDbContext.cs"
click node_exception_middleware "https://github.com/mcipll/visitbookingsystem/blob/master/Middleware/ExceptionMiddleware.cs"
click node_program "https://github.com/mcipll/visitbookingsystem/blob/master/Program.cs"
click node_swagger "https://github.com/mcipll/visitbookingsystem/blob/master/Program.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_api,node_appointments_api,node_patient_dtos,node_appointment_dtos,node_client toneBlue
class node_patient_service,node_appointment_service toneAmber
class node_patient_model,node_appointment_model,node_db_context,node_sqlite toneMint
class node_exception_middleware,node_program,node_swagger toneRose
```

## Components

### HTTP API

- [Patient Endpoints](https://github.com/mcipll/visitbookingsystem/blob/master/Controllers/PatientsController.cs): `Controllers/PatientsController.cs`
- [Appointment Endpoints](https://github.com/mcipll/visitbookingsystem/blob/master/Controllers/AppointmentsController.cs): `Controllers/AppointmentsController.cs`
- [Patient DTOs](https://github.com/mcipll/visitbookingsystem/tree/master/DTOs): `DTOs`
- [Appointment DTOs](https://github.com/mcipll/visitbookingsystem/tree/master/DTOs): `DTOs`

### Booking Services

- [Patient Service](https://github.com/mcipll/visitbookingsystem/blob/master/Services/PatientService.cs): `Services/PatientService.cs`
- [Appointment Service](https://github.com/mcipll/visitbookingsystem/blob/master/Services/AppointmentService.cs): `Services/AppointmentService.cs`

### Domain and Storage

- [Patient Model](https://github.com/mcipll/visitbookingsystem/blob/master/Models/Patient.cs): `Models/Patient.cs`
- [Appointment Model](https://github.com/mcipll/visitbookingsystem/blob/master/Models/Appointment.cs): `Models/Appointment.cs`
- [EF Core Context](https://github.com/mcipll/visitbookingsystem/blob/master/Data/AppDbContext.cs): `Data/AppDbContext.cs`
- **SQLite Database**

### Application Runtime

- [Exception Middleware](https://github.com/mcipll/visitbookingsystem/blob/master/Middleware/ExceptionMiddleware.cs): `Middleware/ExceptionMiddleware.cs`
- [Application Startup](https://github.com/mcipll/visitbookingsystem/blob/master/Program.cs): `Program.cs`
- [Swagger / OpenAPI](https://github.com/mcipll/visitbookingsystem/blob/master/Program.cs): `Program.cs`

### Other components

- **API Client**

## Connections

- API Client → Patient Endpoints: sends requests (evidence: `README.md`)
- API Client → Appointment Endpoints: sends requests (evidence: `README.md`)
- Appointment Endpoints → Appointment Service: delegates operations (evidence: `Controllers/AppointmentsController.cs`)
- Patient Endpoints → Patient Service: delegates operations
- Appointment Service → Appointment DTOs: maps data (evidence: `Services/AppointmentService.cs`)
- Patient Service → Patient DTOs: maps data (evidence: `Services/PatientService.cs`)
- Appointment Service → EF Core Context: queries and saves (evidence: `Services/AppointmentService.cs`)
- Patient Service → EF Core Context: queries and saves (evidence: `Services/PatientService.cs`)
- EF Core Context → Patient Model: models entities (evidence: `Data/AppDbContext.cs`)
- EF Core Context → Appointment Model: models entities (evidence: `Data/AppDbContext.cs`)
- Appointment Model → Patient Model: references patient (evidence: `Models/Appointment.cs`)
- EF Core Context → SQLite Database: persists data (evidence: `README.md`)
- Application Startup → EF Core Context: configures and migrates (evidence: `Program.cs`)
- Application Startup → Patient Service: registers service (evidence: `Program.cs`)
- Application Startup → Appointment Service: registers service (evidence: `Program.cs`)
- Application Startup → Exception Middleware: registers middleware (evidence: `Program.cs`)
- Application Startup → Swagger / OpenAPI: configures docs (evidence: `Program.cs`)
- Application Startup → Patient Endpoints: maps controllers (evidence: `Program.cs`)
- Application Startup → Appointment Endpoints: maps controllers (evidence: `Program.cs`)
