# irani-ewu/hospital-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/irani-ewu/hospital-management-system
- Repository: https://github.com/irani-ewu/hospital-management-system

## Overview

1. This is a small, CLI-based hospital management system written in Python with an OOP design. The application is organized into three domain modules plus a single entry script: `patient.py`, `staffs.py`, `treatment.py`, and `main.py`.

2. `main.py` is the orchestration layer. It likely contains the menu loop, gathers user input, creates the right domain objects, and routes each action to the correct class. There is no separate web server, database, or background service.

3. `patient.py` represents the patient subsystem. The README indicates patients have a name, ID, and symptoms, and that symptoms are encapsulated as a private field. The patient object also has a `show_details()` style method used for displaying patient data in a consistent way.

4. `staffs.py` is the staff-management subsystem. It centers on a shared `StaffProfile` base class, with `Doctor` and `Nurse` as subclasses. This is the main inheritance boundary in the project and is used to reduce duplication across staff types.

5. The staff model is role-specific: doctors carry degree and specialty information, while nurses carry shift information. Both roles likely implement their own `show_details()` behavior, which fits the repo’s polymorphism claim.

6. `treatment.py` appears to handle the consultation or interaction workflow. This is where a doctor object is matched with a patient object, symptoms are compared against specialty, and a prescription can be generated if the pairing is appropriate.

7. The data flow is file-centric. Patient and staff entries are saved as individual text files rather than stored in memory only or in a database. The repository tree shows example output files such as `1'no. patient's data`, `2'no. patient's data`, and `D1'no. staff's data`.

8. Consultation produces additional output files. The sample `D1'no. Dr. prescription for '1'` suggests a doctor-specific prescription file is created as a result of a successful patient-doctor interaction. This makes treatment records a separate artifact from patient registration.

9. The main architectural boundary is between user interaction, domain logic, and persistence. `main.py` handles command flow, the domain classes encapsulate hospital entities and rules, and plain text files serve as the persistence layer.

10. The system is intentionally simple and local. It is designed for practice and demonstration of OOP concepts, not for concurrency, authentication, multi-user access, or scalable storage. All state is managed through objects and text files in the working directory.

11. The most important runtime dependency is the Python interpreter itself. No external frameworks are indicated in the README, so the architecture is self-contained and portable as a folder of `.py` files plus generated `.txt`-style records.

12. For an architecture diagram, the key flows are: user input in the CLI -> object creation in `patient.py` or `staffs.py` -> file write to patient/staff records -> consultation in `treatment.py` -> prescription file generation. That is the core end-to-end lifecycle of the repository.

Main entry points: [`main.py`](https://github.com/irani-ewu/hospital-management-system/blob/main/main.py) (main.py), [`treatment.py`](https://github.com/irani-ewu/hospital-management-system/blob/main/treatment.py) (Treatment), [`patient.py`](https://github.com/irani-ewu/hospital-management-system/blob/main/patient.py) (Patients), [`staffs.py`](https://github.com/irani-ewu/hospital-management-system/blob/main/staffs.py) (Staff)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_orchestration["Orchestration"]
  node_main_py["main.py<br/>CLI orchestrator<br/>[main.py]"]
end

subgraph group_grp_domain["Domain"]
  node_patient_py["Patients<br/>entity module<br/>[patient.py]"]
  node_staffs_py["Staff<br/>inheritance module<br/>[staffs.py]"]
  node_treatment_py["Treatment<br/>workflow module<br/>[treatment.py]"]
end

subgraph group_grp_artifacts["Artifacts"]
  node_patient_data_1["Patient 1<br/>patient record"]
  node_patient_data_2["Patient 2<br/>patient record"]
  node_staff_data_d1["Doctor data<br/>staff record"]
  node_prescription_d1["Prescription"]
end

node_main_py -->|"creates"| node_patient_py
node_main_py -->|"creates"| node_staffs_py
node_main_py -->|"routes"| node_treatment_py
node_patient_py -->|"writes"| node_patient_data_1
node_patient_py -->|"writes"| node_patient_data_2
node_staffs_py -->|"writes"| node_staff_data_d1
node_treatment_py -->|"reads"| node_patient_py
node_treatment_py -->|"reads"| node_staffs_py
node_treatment_py -->|"generates"| node_prescription_d1
node_main_py -.->|"manages"| node_patient_data_1
node_main_py -.->|"manages"| node_staff_data_d1
node_main_py -.->|"manages"| node_prescription_d1

click node_main_py "https://github.com/irani-ewu/hospital-management-system/blob/main/main.py"
click node_patient_py "https://github.com/irani-ewu/hospital-management-system/blob/main/patient.py"
click node_staffs_py "https://github.com/irani-ewu/hospital-management-system/blob/main/staffs.py"
click node_treatment_py "https://github.com/irani-ewu/hospital-management-system/blob/main/treatment.py"
click node_patient_data_1 "https://github.com/irani-ewu/hospital-management-system/blob/main/'1'no. patient's data"
click node_patient_data_2 "https://github.com/irani-ewu/hospital-management-system/blob/main/'2'no. patient's data"
click node_staff_data_d1 "https://github.com/irani-ewu/hospital-management-system/blob/main/'D1'no. staff's data"
click node_prescription_d1 "https://github.com/irani-ewu/hospital-management-system/blob/main/'D1'no. Dr. prescription for '1'"

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_main_py toneBlue
class node_patient_py,node_staffs_py,node_treatment_py toneAmber
class node_patient_data_1,node_patient_data_2,node_staff_data_d1,node_prescription_d1 toneMint
```

## Components

### Orchestration

CLI flow and application entrypoint

- [main.py](https://github.com/irani-ewu/hospital-management-system/blob/main/main.py): CLI orchestrator · Entry script that drives menus, input, object creation, and action routing · `main.py`

### Domain

Hospital entities and treatment rules

- [Patients](https://github.com/irani-ewu/hospital-management-system/blob/main/patient.py): entity module · Patient model with encapsulated symptoms and display behavior · `patient.py`
- [Staff](https://github.com/irani-ewu/hospital-management-system/blob/main/staffs.py): inheritance module · Shared staff profile with doctor and nurse specializations · `staffs.py`
- [Treatment](https://github.com/irani-ewu/hospital-management-system/blob/main/treatment.py): workflow module · Matches patients and doctors and produces consultation output · `treatment.py`

### Artifacts

Generated text records in the working directory

- [Patient 1](https://github.com/irani-ewu/hospital-management-system/blob/HEAD/'1'no.%20patient's%20data): patient record · Generated patient data file · `'1'no. patient's data`
- [Patient 2](https://github.com/irani-ewu/hospital-management-system/blob/HEAD/'2'no.%20patient's%20data): patient record · Generated patient data file · `'2'no. patient's data`
- [Doctor data](https://github.com/irani-ewu/hospital-management-system/blob/HEAD/'D1'no.%20staff's%20data): staff record · Generated staff data file for a doctor profile · `'D1'no. staff's data`
- [Prescription](https://github.com/irani-ewu/hospital-management-system/blob/HEAD/'D1'no.%20Dr.%20prescription%20for%20'1'): prescription file · Generated doctor prescription output for a patient consultation · `'D1'no. Dr. prescription for '1'`

## Connections

- main.py → Patients: creates · Builds patient objects from CLI input
- main.py → Staff: creates · Builds doctor and nurse objects from CLI input
- main.py → Treatment: routes · Dispatches consultation and workflow actions
- Patients → Patient 1: writes · Persists patient details as a text record
- Patients → Patient 2: writes · Persists patient details as a text record
- Staff → Doctor data: writes · Persists staff details as a text record
- Treatment → Patients: reads · Uses patient symptoms during consultation
- Treatment → Staff: reads · Uses doctor specialty and staff role data
- Treatment → Prescription: generates · Creates prescription output when pairing is appropriate
- main.py → Patient 1: manages · Coordinates the end-to-end file-based lifecycle
- main.py → Doctor data: manages · Coordinates the end-to-end file-based lifecycle
- main.py → Prescription: manages · Coordinates the end-to-end file-based lifecycle
