# andareomondi/hcms architecture

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

- Interactive diagram: https://gitdiagram.com/andareomondi/hcms
- Repository: https://github.com/andareomondi/hcms

## Overview

HCMS is a modular Django hospital-management system: staff use browser-authorized workflows to register patients, manage encounters and clinical services, and settle charges. Its domain spans outpatient triage, consultation, diagnostics, pharmacy, maternity, surgery and inpatient care, with billing gates and shared patient records. The README documents shared permissions, audit requirements and a PostgreSQL-backed modular monolith. Edges cite the README or indexed source references; several feature areas are represented from documentation and the tree rather than inspected implementation, so their internal calls are not inferred.

Main entry points: [`billing/services.py`](https://github.com/andareomondi/hcms/blob/main/billing/services.py) (Charges and payments), [`triage_queue/services.py`](https://github.com/andareomondi/hcms/blob/main/triage_queue/services.py) (Triage and encounters), [`doctors_portal/views.py`](https://github.com/andareomondi/hcms/blob/main/doctors_portal/views.py) (Doctor consultation), [`access/services.py`](https://github.com/andareomondi/hcms/blob/main/access/services.py) (Browser authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_security["Access and governance"]
  node_browser_auth["Browser authorization<br/>[services.py]"]
  node_permissions["Permissions and navigation<br/>[permissions.py]"]
  node_audit["Audit actions<br/>[audit_actions.py]"]
end

subgraph group_patient["Patient and encounter"]
  node_patients[("Patient records<br/>[models.py]")]
  node_patient_workflows["Patient workflows<br/>[views.py]"]
  node_encounters["Triage and encounters<br/>[services.py]"]
end

subgraph group_clinical["Clinical services"]
  node_doctors["Doctor consultation<br/>[views.py]"]
  node_laboratory["Laboratory<br/>[services.py]"]
  node_radiology["Radiology<br/>[services.py]"]
  node_pharmacy["Pharmacy and stock<br/>[services.py]"]
  node_maternity["Maternity care<br/>[services.py]"]
  node_surgery["Surgical care<br/>[services.py]"]
end

subgraph group_operations["Hospital operations"]
  node_wards["Ward admissions<br/>[services.py]"]
  node_duty["Staff duty<br/>[services.py]"]
  node_notifications["Staff notifications<br/>[services.py]"]
end

subgraph group_finance["Billing and reporting"]
  node_billing["Charges and payments<br/>[services.py]"]
  node_refunds["Refunds<br/>[refunds.py]"]
  node_dashboard["Dashboard and exports<br/>[views.py]"]
end

node_staff(("Hospital staff"))
node_database[("PostgreSQL")]

node_staff -->|"requests access"| node_browser_auth
node_browser_auth -->|"blocks unapproved"| node_staff
node_staff -->|"uses capabilities"| node_permissions
node_staff -.->|"uses"| node_patient_workflows
node_patient_workflows -.->|"manages records"| node_patients
node_patients -->|"anchors visits"| node_encounters
node_encounters -->|"adds visit fees"| node_billing
node_encounters -->|"notifies staff"| node_notifications
node_staff -.->|"consults"| node_doctors
node_doctors -.->|"orders tests"| node_laboratory
node_laboratory -->|"adds test charges"| node_billing
node_doctors -.->|"requests scans"| node_radiology
node_doctors -.->|"orders medicines"| node_pharmacy
node_pharmacy -->|"uses billing services"| node_billing
node_staff -.->|"records maternity care"| node_maternity
node_maternity -->|"uses billing services"| node_billing
node_maternity -->|"uses pharmacy services"| node_pharmacy
node_staff -.->|"manages surgical cases"| node_surgery
node_surgery -->|"uses billing services"| node_billing
node_staff -.->|"manages admissions"| node_wards
node_wards -->|"notifies doctors"| node_notifications
node_wards -->|"uses queue services"| node_encounters
node_staff -.->|"records duty"| node_duty
node_notifications -->|"finds on-duty staff"| node_duty
node_staff -.->|"records payments"| node_billing
node_refunds -->|"uses billing services"| node_billing
node_staff -.->|"views reports"| node_dashboard
node_browser_auth -->|"records security events"| node_audit
node_patients -->|"persists"| node_database
node_encounters -->|"persists"| node_database
node_billing -->|"persists"| node_database

click node_browser_auth "https://github.com/andareomondi/hcms/blob/main/access/services.py"
click node_permissions "https://github.com/andareomondi/hcms/blob/main/hospital_system/permissions.py"
click node_audit "https://github.com/andareomondi/hcms/blob/main/dashboard/audit_actions.py"
click node_patients "https://github.com/andareomondi/hcms/blob/main/core_patients/models.py"
click node_patient_workflows "https://github.com/andareomondi/hcms/blob/main/core_patients/views.py"
click node_encounters "https://github.com/andareomondi/hcms/blob/main/triage_queue/services.py"
click node_doctors "https://github.com/andareomondi/hcms/blob/main/doctors_portal/views.py"
click node_laboratory "https://github.com/andareomondi/hcms/blob/main/lab/services.py"
click node_radiology "https://github.com/andareomondi/hcms/blob/main/radiology/services.py"
click node_pharmacy "https://github.com/andareomondi/hcms/blob/main/pharmacy/services.py"
click node_maternity "https://github.com/andareomondi/hcms/blob/main/maternity/services.py"
click node_surgery "https://github.com/andareomondi/hcms/blob/main/surgery/services.py"
click node_wards "https://github.com/andareomondi/hcms/blob/main/wards/services.py"
click node_duty "https://github.com/andareomondi/hcms/blob/main/duty/services.py"
click node_notifications "https://github.com/andareomondi/hcms/blob/main/notifications/services.py"
click node_billing "https://github.com/andareomondi/hcms/blob/main/billing/services.py"
click node_refunds "https://github.com/andareomondi/hcms/blob/main/billing/refunds.py"
click node_dashboard "https://github.com/andareomondi/hcms/blob/main/dashboard/views.py"

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_browser_auth,node_permissions,node_audit toneBlue
class node_patients,node_patient_workflows,node_encounters,node_database toneAmber
class node_doctors,node_laboratory,node_radiology,node_pharmacy,node_maternity,node_surgery toneMint
class node_wards,node_duty,node_notifications toneRose
class node_billing,node_refunds,node_dashboard,node_staff toneIndigo
```

## Components

### Access and governance

- [Browser authorization](https://github.com/andareomondi/hcms/blob/main/access/services.py): `access/services.py`
- [Permissions and navigation](https://github.com/andareomondi/hcms/blob/main/hospital_system/permissions.py): `hospital_system/permissions.py`
- [Audit actions](https://github.com/andareomondi/hcms/blob/main/dashboard/audit_actions.py): `dashboard/audit_actions.py`

### Patient and encounter

- [Patient records](https://github.com/andareomondi/hcms/blob/main/core_patients/models.py): `core_patients/models.py`
- [Patient workflows](https://github.com/andareomondi/hcms/blob/main/core_patients/views.py): `core_patients/views.py`
- [Triage and encounters](https://github.com/andareomondi/hcms/blob/main/triage_queue/services.py): `triage_queue/services.py`

### Clinical services

- [Doctor consultation](https://github.com/andareomondi/hcms/blob/main/doctors_portal/views.py): `doctors_portal/views.py`
- [Laboratory](https://github.com/andareomondi/hcms/blob/main/lab/services.py): `lab/services.py`
- [Radiology](https://github.com/andareomondi/hcms/blob/main/radiology/services.py): `radiology/services.py`
- [Pharmacy and stock](https://github.com/andareomondi/hcms/blob/main/pharmacy/services.py): `pharmacy/services.py`
- [Maternity care](https://github.com/andareomondi/hcms/blob/main/maternity/services.py): `maternity/services.py`
- [Surgical care](https://github.com/andareomondi/hcms/blob/main/surgery/services.py): `surgery/services.py`

### Hospital operations

- [Ward admissions](https://github.com/andareomondi/hcms/blob/main/wards/services.py): `wards/services.py`
- [Staff duty](https://github.com/andareomondi/hcms/blob/main/duty/services.py): `duty/services.py`
- [Staff notifications](https://github.com/andareomondi/hcms/blob/main/notifications/services.py): `notifications/services.py`

### Billing and reporting

- [Charges and payments](https://github.com/andareomondi/hcms/blob/main/billing/services.py): `billing/services.py`
- [Refunds](https://github.com/andareomondi/hcms/blob/main/billing/refunds.py): `billing/refunds.py`
- [Dashboard and exports](https://github.com/andareomondi/hcms/blob/main/dashboard/views.py): `dashboard/views.py`

### Other components

- **Hospital staff**
- **PostgreSQL**

## Connections

- Hospital staff → Browser authorization: requests access (evidence: `README.md`)
- Browser authorization → Hospital staff: blocks unapproved (evidence: `README.md`)
- Hospital staff → Permissions and navigation: uses capabilities (evidence: `README.md`)
- Hospital staff → Patient workflows: uses
- Patient workflows → Patient records: manages records
- Patient records → Triage and encounters: anchors visits
- Triage and encounters → Charges and payments: adds visit fees (evidence: `triage_queue/services.py`)
- Triage and encounters → Staff notifications: notifies staff (evidence: `triage_queue/services.py`)
- Hospital staff → Doctor consultation: consults
- Doctor consultation → Laboratory: orders tests
- Laboratory → Charges and payments: adds test charges (evidence: `lab/services.py`)
- Doctor consultation → Radiology: requests scans
- Doctor consultation → Pharmacy and stock: orders medicines
- Pharmacy and stock → Charges and payments: uses billing services (evidence: `pharmacy/services.py`)
- Hospital staff → Maternity care: records maternity care
- Maternity care → Charges and payments: uses billing services (evidence: `maternity/services.py`)
- Maternity care → Pharmacy and stock: uses pharmacy services (evidence: `maternity/services.py`)
- Hospital staff → Surgical care: manages surgical cases
- Surgical care → Charges and payments: uses billing services (evidence: `surgery/services.py`)
- Hospital staff → Ward admissions: manages admissions
- Ward admissions → Staff notifications: notifies doctors (evidence: `wards/services.py`)
- Ward admissions → Triage and encounters: uses queue services (evidence: `wards/services.py`)
- Hospital staff → Staff duty: records duty
- Staff notifications → Staff duty: finds on-duty staff (evidence: `notifications/services.py`)
- Hospital staff → Charges and payments: records payments
- Refunds → Charges and payments: uses billing services (evidence: `billing/refunds.py`)
- Hospital staff → Dashboard and exports: views reports
- Browser authorization → Audit actions: records security events (evidence: `access/services.py`)
- Patient records → PostgreSQL: persists (evidence: `README.md`)
- Triage and encounters → PostgreSQL: persists (evidence: `README.md`)
- Charges and payments → PostgreSQL: persists (evidence: `README.md`)
