# shivam-agarawal/hospital-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/shivam-agarawal/hospital-management-system
- Repository: https://github.com/shivam-agarawal/hospital-management-system

## Overview

##### Project type and purpose
- This is a simple, console-based, monolithic Java application called “Hospital Management System.”
- Its purpose is to let users add/view Patients, Doctors, and Appointments via a text-menu interface.

##### File structure
- All source files live at the root (no frontend/backend split).
- Top-level files:
- HospitalManagementSystem.java (main/menu & logic)
- Patient.java (domain entity)
- Doctor.java (domain entity)
- Appointment.java (domain entity)
- No external config or persistence layer (data is managed in memory).

##### README for additional insights
- Confirms it’s for beginners to practice OOP and basic data management.
- No mention of a standalone service or external dependencies.

a. Main components
- User Console Interface (UI)
- Application Logic / Controller (in HospitalManagementSystem.java)
- Domain Model (Patient, Doctor, Appointment classes)
- In-Memory Data Store (e.g. Lists or Maps holding instances)
b. Relationships & interactions
- User → UI: enters commands
- UI → Controller: invokes methods (add/view)
- Controller ↔ Domain Model: creates or queries Patient/Doctor/Appointment objects
- Controller ↔ Data Store: inserts or retrieves entities
- Appointment links Patient and Doctor by reference
c. Architectural patterns & principles
- Simplified MVC:
– “View” = console menu
– “Controller” = menu‐driven methods in HospitalManagementSystem.java
– “Model” = domain entities
- OOP: encapsulation of entity data and behaviors
d. Key technologies
- Java (JDK 8+)
- No external frameworks or databases

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Components
    UI["Console UI"]:::ui
    Controller["HospitalManagementSystem\n(Controller/Logic)"]:::controller
    Store["In-Memory Store\n(Lists/Maps)"]:::datastore

    subgraph "Model"
        Patient["Patient"]:::model
        Doctor["Doctor"]:::model
        Appointment["Appointment\n{date, time, patientId, doctorId}"]:::model
    end

    %% Relationships
    UI -->|"user input"| Controller
    Controller -->|"CRUD operations"| Store
    Controller -->|"instantiates/queries"| Patient
    Controller -->|"instantiates/queries"| Doctor
    Controller -->|"instantiates/queries"| Appointment
    Appointment <-->|"association"| Patient
    Appointment <-->|"association"| Doctor

    %% Click Events
    click UI "https://github.com/shivam-agarawal/hospital-management-system/blob/main/HospitalManagementSystem.java"
    click Controller "https://github.com/shivam-agarawal/hospital-management-system/blob/main/HospitalManagementSystem.java"
    click Store "https://github.com/shivam-agarawal/hospital-management-system/blob/main/HospitalManagementSystem.java"
    click Patient "https://github.com/shivam-agarawal/hospital-management-system/blob/main/Patient.java"
    click Doctor "https://github.com/shivam-agarawal/hospital-management-system/blob/main/Doctor.java"
    click Appointment "https://github.com/shivam-agarawal/hospital-management-system/blob/main/Appointment.java"

    %% Styles
    classDef ui fill:#E0F7FA,stroke:#006064,color:#000000
    classDef controller fill:#E8F5E9,stroke:#1B5E20,color:#000000
    classDef model fill:#FFF9C4,stroke:#F57F17,color:#000000
    classDef datastore fill:#ECEFF1,stroke:#37474F,color:#000000
```
