# ellie3125/smart-healthcare architecture

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

- Interactive diagram: https://gitdiagram.com/ellie3125/smart-healthcare
- Repository: https://github.com/ellie3125/smart-healthcare

## Overview

Smart-Healthcare is a healthcare operations product with separate patient and staff web applications, a modular .NET API, and an internal chatbot service. The tree indicates workflows for identity, appointment scheduling, clinical encounters, billing, document uploads, and staff administration. The excerpts show frontend route composition, API module registration, and chatbot turn handling, but do not expose most endpoint-to-service or cross-service calls; those links are therefore omitted rather than inferred.

Main entry points: [`backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs`](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs) (API host), [`frontend/patient-web/src/App.tsx`](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/App.tsx) (Patient app routes), [`frontend/web/src/App.tsx`](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/web/src/App.tsx) (Staff app routes), [`chatbot-service/app/main.py`](https://github.com/ellie3125/smart-healthcare/blob/dev/chatbot-service/app/main.py) (Chat API and turns)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient portal"]
  node_patient_app["Patient app routes<br/>[App.tsx]"]
  node_patient_auth["Patient identity<br/>[AuthContext.tsx]"]
  node_patient_booking["Booking and visits"]
  node_patient_records["Patient records"]
  node_patient_chat["Patient assistant<br/>[ChatbotPage.tsx]"]
end

subgraph group_staff["Staff portal"]
  node_staff_app["Staff app routes<br/>[App.tsx]"]
  node_staff_admin["Service administration"]
  node_staff_payment["Payment lookup"]
end

subgraph group_backend["Healthcare API modules"]
  node_api_host["API host<br/>[Program.cs]"]
  node_identity["Identity and patients<br/>[AuthController.cs]"]
  node_scheduling["Scheduling"]
  node_clinical["Clinical care"]
  node_billing["Billing and refunds"]
  node_documents["Documents and reports"]
end

subgraph group_chatbot["Chatbot service"]
  node_chat_service["Chat API and turns<br/>[main.py]"]
  node_chat_router["Intent shortcuts<br/>[router.py]"]
end

subgraph group_storage["Persistence and files"]
  node_identity_db[("Identity database<br/>[AuthService.cs]")]
  node_clinical_db[("Clinical database")]
  node_billing_db[("Billing database")]
  node_object_storage[("Document object storage<br/>[R2ObjectStorage.cs]")]
end

node_patient_actor(("Patient"))
node_staff_actor(("Healthcare staff"))

node_patient_actor -->|"uses"| node_patient_app
node_patient_app -->|"routes with auth"| node_patient_auth
node_patient_app -->|"routes to"| node_patient_booking
node_patient_app -->|"routes to"| node_patient_records
node_patient_app -->|"routes to"| node_patient_chat
node_staff_actor -->|"uses"| node_staff_app
node_staff_app -->|"routes to"| node_staff_admin
node_staff_app -->|"routes to"| node_staff_payment
node_api_host -->|"registers module"| node_identity
node_api_host -->|"registers module"| node_scheduling
node_api_host -->|"registers module"| node_clinical
node_api_host -->|"registers module"| node_billing
node_api_host -->|"registers module"| node_documents
node_chat_service -.->|"routes intents"| node_chat_router

click node_patient_app "https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/App.tsx"
click node_patient_auth "https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/contexts/AuthContext.tsx"
click node_patient_booking "https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/pages/booking/BookingDoctorsPage.tsx"
click node_patient_records "https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/pages/records/EncounterDetailPage.tsx"
click node_patient_chat "https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/pages/assistant/ChatbotPage.tsx"
click node_staff_app "https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/web/src/App.tsx"
click node_staff_admin "https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/web/src/pages/admin/MedicalServicesPage.tsx"
click node_staff_payment "https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/web/src/pages/reception/ReceptionQueryTxnPage.tsx"
click node_api_host "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs"
click node_identity "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/IdentityPatients/IdentityPatients.Api/Controllers/AuthController.cs"
click node_scheduling "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Scheduling/Scheduling.Application/Appointments/AppointmentChangeService.cs"
click node_clinical "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Clinical/Clinical.Api/ClinicalEndpoints.cs"
click node_billing "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Billing/Billing.Api/PatientPaymentEndpoints.cs"
click node_documents "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/DocumentsReporting/DocumentsReporting.Api/DocumentsEndpoints.cs"
click node_chat_service "https://github.com/ellie3125/smart-healthcare/blob/dev/chatbot-service/app/main.py"
click node_chat_router "https://github.com/ellie3125/smart-healthcare/blob/dev/chatbot-service/app/router.py"
click node_identity_db "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/IdentityPatients/IdentityPatients.Infrastructure/Services/AuthService.cs"
click node_clinical_db "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Clinical/Clinical.Infrastructure/Persistence/ClinicalDbContext.cs"
click node_billing_db "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Billing/Billing.Infrastructure/Persistence/BillingDbContext.cs"
click node_object_storage "https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/DocumentsReporting/DocumentsReporting.Infrastructure/Storage/R2ObjectStorage.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_patient_app,node_patient_auth,node_patient_booking,node_patient_records,node_patient_chat toneBlue
class node_staff_app,node_staff_admin,node_staff_payment toneAmber
class node_api_host,node_identity,node_scheduling,node_clinical,node_billing,node_documents toneMint
class node_chat_service,node_chat_router toneRose
class node_identity_db,node_clinical_db,node_billing_db,node_object_storage,node_patient_actor,node_staff_actor toneIndigo
```

## Components

### Patient portal

- [Patient app routes](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/App.tsx): `frontend/patient-web/src/App.tsx`
- [Patient identity](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/contexts/AuthContext.tsx): `frontend/patient-web/src/contexts/AuthContext.tsx`
- [Booking and visits](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/pages/booking/BookingDoctorsPage.tsx): `frontend/patient-web/src/pages/booking/BookingDoctorsPage.tsx`
- [Patient records](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/pages/records/EncounterDetailPage.tsx): `frontend/patient-web/src/pages/records/EncounterDetailPage.tsx`
- [Patient assistant](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/patient-web/src/pages/assistant/ChatbotPage.tsx): `frontend/patient-web/src/pages/assistant/ChatbotPage.tsx`

### Staff portal

- [Staff app routes](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/web/src/App.tsx): `frontend/web/src/App.tsx`
- [Service administration](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/web/src/pages/admin/MedicalServicesPage.tsx): `frontend/web/src/pages/admin/MedicalServicesPage.tsx`
- [Payment lookup](https://github.com/ellie3125/smart-healthcare/blob/dev/frontend/web/src/pages/reception/ReceptionQueryTxnPage.tsx): `frontend/web/src/pages/reception/ReceptionQueryTxnPage.tsx`

### Healthcare API modules

- [API host](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs): `backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs`
- [Identity and patients](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/IdentityPatients/IdentityPatients.Api/Controllers/AuthController.cs): `backend/src/Modules/IdentityPatients/IdentityPatients.Api/Controllers/AuthController.cs`
- [Scheduling](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Scheduling/Scheduling.Application/Appointments/AppointmentChangeService.cs): `backend/src/Modules/Scheduling/Scheduling.Application/Appointments/AppointmentChangeService.cs`
- [Clinical care](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Clinical/Clinical.Api/ClinicalEndpoints.cs): `backend/src/Modules/Clinical/Clinical.Api/ClinicalEndpoints.cs`
- [Billing and refunds](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Billing/Billing.Api/PatientPaymentEndpoints.cs): `backend/src/Modules/Billing/Billing.Api/PatientPaymentEndpoints.cs`
- [Documents and reports](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/DocumentsReporting/DocumentsReporting.Api/DocumentsEndpoints.cs): `backend/src/Modules/DocumentsReporting/DocumentsReporting.Api/DocumentsEndpoints.cs`

### Chatbot service

- [Chat API and turns](https://github.com/ellie3125/smart-healthcare/blob/dev/chatbot-service/app/main.py): `chatbot-service/app/main.py`
- [Intent shortcuts](https://github.com/ellie3125/smart-healthcare/blob/dev/chatbot-service/app/router.py): `chatbot-service/app/router.py`

### Persistence and files

- [Identity database](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/IdentityPatients/IdentityPatients.Infrastructure/Services/AuthService.cs): `backend/src/Modules/IdentityPatients/IdentityPatients.Infrastructure/Services/AuthService.cs`
- [Clinical database](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Clinical/Clinical.Infrastructure/Persistence/ClinicalDbContext.cs): `backend/src/Modules/Clinical/Clinical.Infrastructure/Persistence/ClinicalDbContext.cs`
- [Billing database](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/Billing/Billing.Infrastructure/Persistence/BillingDbContext.cs): `backend/src/Modules/Billing/Billing.Infrastructure/Persistence/BillingDbContext.cs`
- [Document object storage](https://github.com/ellie3125/smart-healthcare/blob/dev/backend/src/Modules/DocumentsReporting/DocumentsReporting.Infrastructure/Storage/R2ObjectStorage.cs): `backend/src/Modules/DocumentsReporting/DocumentsReporting.Infrastructure/Storage/R2ObjectStorage.cs`

### Other components

- **Patient**
- **Healthcare staff**

## Connections

- Patient → Patient app routes: uses (evidence: `frontend/patient-web/src/App.tsx`)
- Patient app routes → Patient identity: routes with auth (evidence: `frontend/patient-web/src/App.tsx`)
- Patient app routes → Booking and visits: routes to (evidence: `frontend/patient-web/src/App.tsx`)
- Patient app routes → Patient records: routes to (evidence: `frontend/patient-web/src/App.tsx`)
- Patient app routes → Patient assistant: routes to (evidence: `frontend/patient-web/src/App.tsx`)
- Healthcare staff → Staff app routes: uses (evidence: `frontend/web/src/App.tsx`)
- Staff app routes → Service administration: routes to (evidence: `frontend/web/src/App.tsx`)
- Staff app routes → Payment lookup: routes to (evidence: `frontend/web/src/App.tsx`)
- API host → Identity and patients: registers module (evidence: `backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs`)
- API host → Scheduling: registers module (evidence: `backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs`)
- API host → Clinical care: registers module (evidence: `backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs`)
- API host → Billing and refunds: registers module (evidence: `backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs`)
- API host → Documents and reports: registers module (evidence: `backend/src/Bootstrapper/SmartHealthcare.Api/Program.cs`)
- Chat API and turns → Intent shortcuts: routes intents
