# hospital-management-system-emr/hospital-management-system-emr-opensource architecture

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

- Interactive diagram: https://gitdiagram.com/hospital-management-system-emr/hospital-management-system-emr-opensource
- Repository: https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource

## Overview

Danphe EMR is a web-based hospital information and electronic medical-record system. Its broad user workflow spans patient and visit management, clinical care, diagnostics, admission and discharge, medication and inventory operations, billing, and accounting. The sampled ASP.NET controllers are the clearest runtime entry layer, coordinating domain operations with database contexts; the README documents additional product areas. The excerpts are partial, so the graph shows only supported controller-to-context links and avoids implying an end-to-end sequence between separate modules.

Main entry points: [`Code/Websites/DanpheEMR/Controllers/Radiology/RadiologyController.cs`](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Radiology/RadiologyController.cs) (Radiology imaging), [`Code/Websites/DanpheEMR/Controllers/Admission/AdmissionController.cs`](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Admission/AdmissionController.cs) (Admission and discharge), [`Code/Websites/DanpheEMR/Controllers/Emergency/EmergencyController.cs`](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Emergency/EmergencyController.cs) (Emergency care), [`Code/Websites/DanpheEMR/Controllers/Lab/LabController.cs`](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Lab/LabController.cs) (Laboratory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_care["Patient care"]
  node_admission["Admission and discharge"]
  node_emergency["Emergency care"]
  node_clinical["Clinical records"]
  node_appointments["Appointments"]
end

subgraph group_diagnostics["Diagnostics"]
  node_lab["Laboratory<br/>[LabController.cs]"]
  node_radiology["Radiology imaging"]
end

subgraph group_operations["Hospital operations"]
  node_pharmacy["Pharmacy"]
  node_inventory["Inventory procurement"]
  node_ward_supply["Ward supply"]
  node_access["Access control<br/>[DanpheRBAC.cs]"]
end

subgraph group_finance["Finance"]
  node_billing["Patient billing"]
  node_bill_settings["Billing configuration"]
  node_accounting["Accounting"]
  node_insurance["Insurance claims"]
end

subgraph group_data["Data layer"]
  node_adt_db[("Admission data")]
  node_emergency_db[("Emergency data")]
  node_lab_db[("Lab data<br/>[LabDbContext.cs]")]
  node_radiology_db[("Radiology data")]
  node_dicom_db[("Imaging studies<br/>[DicomDbContext.cs]")]
  node_pharmacy_db[("Pharmacy data")]
  node_inventory_db[("Inventory data")]
  node_ward_db[("Ward supply data")]
  node_billing_db[("Billing data")]
  node_accounting_db[("Accounting data")]
  node_insurance_db[("Insurance data")]
end

node_patient(("Patient or staff"))

node_patient -->|"requests care"| node_admission
node_patient -->|"seeks urgent care"| node_emergency
node_patient -->|"uses services"| node_lab
node_patient -->|"uses services"| node_radiology
node_patient -->|"receives billing"| node_billing
node_admission -->|"reads and writes"| node_adt_db
node_emergency -->|"reads and writes"| node_emergency_db
node_lab -->|"reads and writes"| node_lab_db
node_radiology -->|"reads and writes"| node_radiology_db
node_radiology -->|"queries studies"| node_dicom_db
node_pharmacy -->|"reads and writes"| node_pharmacy_db
node_inventory -->|"reads and writes"| node_inventory_db
node_ward_supply -->|"reads and writes"| node_ward_db
node_billing -->|"reads and writes"| node_billing_db
node_bill_settings -->|"reads and writes"| node_billing_db
node_accounting -->|"uses data context"| node_accounting_db
node_insurance -->|"uses data context"| node_insurance_db

click node_admission "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Admission/AdmissionController.cs"
click node_adt_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/AdmissionDbContext.cs"
click node_emergency "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Emergency/EmergencyController.cs"
click node_emergency_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/EmergencyDbContext.cs"
click node_clinical "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.ServerModel/ClinicalModel_New/ClinicalNoteModel.cs"
click node_appointments "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.ServerModel/AppointmentModels/AppointmentModel.cs"
click node_lab "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Lab/LabController.cs"
click node_lab_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/LabDbContext.cs"
click node_radiology "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Radiology/RadiologyController.cs"
click node_radiology_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/RadiologyDbContext.cs"
click node_dicom_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/DicomDbContext.cs"
click node_pharmacy "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Pharmacy/PharmacyController.cs"
click node_pharmacy_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/PharmacyDbContext.cs"
click node_inventory "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Inventory/InventoryController.cs"
click node_inventory_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/InventoryDbContext.cs"
click node_ward_supply "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/WardSupply/WardSupplyController.cs"
click node_ward_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/WardSupplyDbContext.cs"
click node_billing "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Billing/BillingController.cs"
click node_billing_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/BillingDbContext.cs"
click node_bill_settings "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Settings/BillSettingsController.cs"
click node_accounting "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Accounting/AccountingController.cs"
click node_accounting_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/AccountingDbContext.cs"
click node_insurance "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Insurance/GovInsuranceController.cs"
click node_insurance_db "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/InsuranceDbContext.cs"
click node_access "https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.Security/RBAC/DanpheRBAC.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_admission,node_emergency,node_clinical,node_appointments toneBlue
class node_lab,node_radiology toneAmber
class node_pharmacy,node_inventory,node_ward_supply,node_access toneMint
class node_billing,node_bill_settings,node_accounting,node_insurance toneRose
class node_adt_db,node_emergency_db,node_lab_db,node_radiology_db,node_dicom_db,node_pharmacy_db,node_inventory_db,node_ward_db,node_billing_db,node_accounting_db,node_insurance_db,node_patient toneIndigo
```

## Components

### Patient care

- [Admission and discharge](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Admission/AdmissionController.cs): `Code/Websites/DanpheEMR/Controllers/Admission/AdmissionController.cs`
- [Emergency care](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Emergency/EmergencyController.cs): `Code/Websites/DanpheEMR/Controllers/Emergency/EmergencyController.cs`
- [Clinical records](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.ServerModel/ClinicalModel_New/ClinicalNoteModel.cs): `Code/Components/DanpheEMR.ServerModel/ClinicalModel_New/ClinicalNoteModel.cs`
- [Appointments](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.ServerModel/AppointmentModels/AppointmentModel.cs): `Code/Components/DanpheEMR.ServerModel/AppointmentModels/AppointmentModel.cs`

### Diagnostics

- [Laboratory](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Lab/LabController.cs): `Code/Websites/DanpheEMR/Controllers/Lab/LabController.cs`
- [Radiology imaging](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Radiology/RadiologyController.cs): `Code/Websites/DanpheEMR/Controllers/Radiology/RadiologyController.cs`

### Hospital operations

- [Pharmacy](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Pharmacy/PharmacyController.cs): `Code/Websites/DanpheEMR/Controllers/Pharmacy/PharmacyController.cs`
- [Inventory procurement](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Inventory/InventoryController.cs): `Code/Websites/DanpheEMR/Controllers/Inventory/InventoryController.cs`
- [Ward supply](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/WardSupply/WardSupplyController.cs): `Code/Websites/DanpheEMR/Controllers/WardSupply/WardSupplyController.cs`
- [Access control](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.Security/RBAC/DanpheRBAC.cs): `Code/Components/DanpheEMR.Security/RBAC/DanpheRBAC.cs`

### Finance

- [Patient billing](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Billing/BillingController.cs): `Code/Websites/DanpheEMR/Controllers/Billing/BillingController.cs`
- [Billing configuration](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Settings/BillSettingsController.cs): `Code/Websites/DanpheEMR/Controllers/Settings/BillSettingsController.cs`
- [Accounting](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Accounting/AccountingController.cs): `Code/Websites/DanpheEMR/Controllers/Accounting/AccountingController.cs`
- [Insurance claims](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Websites/DanpheEMR/Controllers/Insurance/GovInsuranceController.cs): `Code/Websites/DanpheEMR/Controllers/Insurance/GovInsuranceController.cs`

### Data layer

- [Admission data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/AdmissionDbContext.cs): `Code/Components/DanpheEMR.DalLayer/AdmissionDbContext.cs`
- [Emergency data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/EmergencyDbContext.cs): `Code/Components/DanpheEMR.DalLayer/EmergencyDbContext.cs`
- [Lab data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/LabDbContext.cs): `Code/Components/DanpheEMR.DalLayer/LabDbContext.cs`
- [Radiology data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/RadiologyDbContext.cs): `Code/Components/DanpheEMR.DalLayer/RadiologyDbContext.cs`
- [Imaging studies](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/DicomDbContext.cs): `Code/Components/DanpheEMR.DalLayer/DicomDbContext.cs`
- [Pharmacy data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/PharmacyDbContext.cs): `Code/Components/DanpheEMR.DalLayer/PharmacyDbContext.cs`
- [Inventory data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/InventoryDbContext.cs): `Code/Components/DanpheEMR.DalLayer/InventoryDbContext.cs`
- [Ward supply data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/WardSupplyDbContext.cs): `Code/Components/DanpheEMR.DalLayer/WardSupplyDbContext.cs`
- [Billing data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/BillingDbContext.cs): `Code/Components/DanpheEMR.DalLayer/BillingDbContext.cs`
- [Accounting data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/AccountingDbContext.cs): `Code/Components/DanpheEMR.DalLayer/AccountingDbContext.cs`
- [Insurance data](https://github.com/hospital-management-system-emr/hospital-management-system-emr-opensource/blob/master/Code/Components/DanpheEMR.DalLayer/InsuranceDbContext.cs): `Code/Components/DanpheEMR.DalLayer/InsuranceDbContext.cs`

### Other components

- **Patient or staff**

## Connections

- Patient or staff → Admission and discharge: requests care
- Patient or staff → Emergency care: seeks urgent care
- Patient or staff → Laboratory: uses services
- Patient or staff → Radiology imaging: uses services
- Patient or staff → Patient billing: receives billing
- Admission and discharge → Admission data: reads and writes
- Emergency care → Emergency data: reads and writes
- Laboratory → Lab data: reads and writes
- Radiology imaging → Radiology data: reads and writes
- Radiology imaging → Imaging studies: queries studies
- Pharmacy → Pharmacy data: reads and writes
- Inventory procurement → Inventory data: reads and writes
- Ward supply → Ward supply data: reads and writes
- Patient billing → Billing data: reads and writes
- Billing configuration → Billing data: reads and writes
- Accounting → Accounting data: uses data context
- Insurance claims → Insurance data: uses data context
