# mi-kelele/-concurrent-patient-management-and-medicine-inventory-system- architecture

> Architecture diagram of the GitHub repository mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-
- Repository: https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-

## Overview

This repository is a Java concurrency demonstration centered on a hospital shift simulation. The main workflow initializes shared hospital resources, dispatches nurses, doctors, laboratory technicians, and pharmacists concurrently, then audits inventory and patient records. Nurses record vitals and submit lab requests; technicians process requests and add results to records; doctors perform consultations and use limited MRI capacity; pharmacists dispense from shared stock. A separate executor-service demo illustrates task submission and shutdown. The excerpts do not show doctors retrieving lab results, so that documented behavior is not drawn as an implemented connection.

Main entry points: [`HospitalSystem.java`](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java) (Hospital System), [`HospitalSimulation.java`](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSimulation.java) (Hospital Simulation), [`Patient.java`](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Patient.java) (Patient Record), [`Nurse.java`](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Nurse.java) (Nurse)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Shift Workflow"]
  node_simulation["Hospital Simulation"]
  node_executor_demo["Executor Demo"]
end

subgraph group_shared["Shared Hospital State"]
  node_hospital["Hospital System"]
  node_patients[("Patient Repository")]
  node_patient[("Patient Record<br/>[Patient.java]")]
  node_lab_queue["Lab Request Queue"]
  node_equipment["MRI Permits"]
  node_inventory[("Medicine Inventory")]
  node_lab_request["Lab Request<br/>[LabRequest.java]"]
end

subgraph group_workers["Care Workers"]
  node_nurse["Nurse<br/>[Nurse.java]"]
  node_doctor["Doctor<br/>[Doctor.java]"]
  node_technician["Laboratory Technician"]
  node_pharmacist["Pharmacist<br/>[Pharmacist.java]"]
end

node_simulation -->|"initializes"| node_hospital
node_simulation -->|"dispatches"| node_nurse
node_simulation -->|"dispatches"| node_doctor
node_simulation -->|"dispatches"| node_technician
node_simulation -->|"dispatches"| node_pharmacist
node_simulation -->|"audits"| node_inventory
node_simulation -->|"inspects"| node_patient
node_hospital -->|"stores"| node_patients
node_hospital -->|"creates"| node_patient
node_hospital -->|"creates"| node_inventory
node_nurse -->|"accesses"| node_hospital
node_nurse -->|"updates vitals"| node_patient
node_nurse -->|"creates"| node_lab_request
node_nurse -->|"enqueues"| node_lab_queue
node_technician -->|"polls"| node_lab_queue
node_technician -->|"completes"| node_lab_request
node_technician -->|"looks up patient"| node_hospital
node_technician -->|"records result"| node_patient
node_doctor -->|"accesses"| node_hospital
node_doctor -->|"adds notes"| node_patient
node_doctor -->|"acquires permit"| node_equipment
node_pharmacist -->|"accesses"| node_hospital
node_pharmacist -->|"dispenses from"| node_inventory
node_pharmacist -->|"records fill"| node_patient

click node_simulation "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSimulation.java"
click node_executor_demo "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/ExecutorServiceMethodsDemo.java"
click node_hospital "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java"
click node_patients "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java"
click node_patient "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Patient.java"
click node_lab_queue "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java"
click node_equipment "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java"
click node_inventory "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/MedicineInventory.java"
click node_lab_request "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/LabRequest.java"
click node_nurse "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Nurse.java"
click node_doctor "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Doctor.java"
click node_technician "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/LaboratoryTechnician.java"
click node_pharmacist "https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Pharmacist.java"

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_simulation,node_executor_demo toneBlue
class node_hospital,node_patients,node_patient,node_lab_queue,node_equipment,node_inventory,node_lab_request toneAmber
class node_nurse,node_doctor,node_technician,node_pharmacist toneMint
```

## Components

### Shift Workflow

- [Hospital Simulation](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSimulation.java): `HospitalSimulation.java`
- [Executor Demo](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/ExecutorServiceMethodsDemo.java): `ExecutorServiceMethodsDemo.java`

### Shared Hospital State

- [Hospital System](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java): `HospitalSystem.java`
- [Patient Repository](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java): `HospitalSystem.java`
- [Patient Record](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Patient.java): `Patient.java`
- [Lab Request Queue](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java): `HospitalSystem.java`
- [MRI Permits](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/HospitalSystem.java): `HospitalSystem.java`
- [Medicine Inventory](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/MedicineInventory.java): `MedicineInventory.java`
- [Lab Request](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/LabRequest.java): `LabRequest.java`

### Care Workers

- [Nurse](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Nurse.java): `Nurse.java`
- [Doctor](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Doctor.java): `Doctor.java`
- [Laboratory Technician](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/LaboratoryTechnician.java): `LaboratoryTechnician.java`
- [Pharmacist](https://github.com/mi-kelele/-concurrent-patient-management-and-medicine-inventory-system-/blob/main/Pharmacist.java): `Pharmacist.java`

## Connections

- Hospital Simulation → Hospital System: initializes (evidence: `HospitalSimulation.java`)
- Hospital Simulation → Nurse: dispatches (evidence: `HospitalSimulation.java`)
- Hospital Simulation → Doctor: dispatches (evidence: `HospitalSimulation.java`)
- Hospital Simulation → Laboratory Technician: dispatches (evidence: `HospitalSimulation.java`)
- Hospital Simulation → Pharmacist: dispatches (evidence: `HospitalSimulation.java`)
- Hospital Simulation → Medicine Inventory: audits (evidence: `HospitalSimulation.java`)
- Hospital Simulation → Patient Record: inspects (evidence: `HospitalSimulation.java`)
- Hospital System → Patient Repository: stores (evidence: `HospitalSystem.java`)
- Hospital System → Patient Record: creates (evidence: `HospitalSystem.java`)
- Hospital System → Medicine Inventory: creates (evidence: `HospitalSystem.java`)
- Nurse → Hospital System: accesses (evidence: `Nurse.java`)
- Nurse → Patient Record: updates vitals (evidence: `Nurse.java`)
- Nurse → Lab Request: creates (evidence: `Nurse.java`)
- Nurse → Lab Request Queue: enqueues (evidence: `Nurse.java`)
- Laboratory Technician → Lab Request Queue: polls (evidence: `LaboratoryTechnician.java`)
- Laboratory Technician → Lab Request: completes (evidence: `LaboratoryTechnician.java`)
- Laboratory Technician → Hospital System: looks up patient (evidence: `LaboratoryTechnician.java`)
- Laboratory Technician → Patient Record: records result (evidence: `LaboratoryTechnician.java`)
- Doctor → Hospital System: accesses (evidence: `Doctor.java`)
- Doctor → Patient Record: adds notes (evidence: `Doctor.java`)
- Doctor → MRI Permits: acquires permit (evidence: `Doctor.java`)
- Pharmacist → Hospital System: accesses (evidence: `Pharmacist.java`)
- Pharmacist → Medicine Inventory: dispenses from (evidence: `Pharmacist.java`)
- Pharmacist → Patient Record: records fill (evidence: `Pharmacist.java`)
