Emergency Room Triage Priority Queue Simulator
Hospital emergency room triage intake simulation that dynamically orders and dispatches patients by clinical acuity scores rather than arrival order.
Live ER Triage Priority Queue Simulator
Dynamic max-heap clinical dispatch matching your Java ER_Triage.java
Marcus V.
Severe Chest Trauma
Elena R.
Cardiac Arrhythmia
Sarah L.
Acute Appendicitis
David K.
Moderate Sprain
Tom B.
Mild Laceration
Project Overview & Architecture
Built to demonstrate the real-world application of the Priority Queue Abstract Data Type. Instead of a First-In-First-Out (FIFO) queue, this simulation ingests patient arrival vectors, parses clinical urgency classifications, and utilizes a binary heap priority queue to ensure critical condition patients are prioritized immediately for medical treatment.
Key Implementation Highlights
- ✓Custom patient comparator dynamically ranking cases based on medical urgency score and timestamp.
- ✓Automated intake engine reading patients from structured text inputs and dispatching treatment logs.
- ✓Demonstrates logarithmic O(log n) insertions and extractions under continuous patient arrivals.
Implementation Source Code
1 File1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859import java.io.*;
import java.util.*;
class Patient implements Comparable<Patient> {
String name;
int priority;
public Patient(String name, int priority) {
this.name = name;
this.priority = priority;
}
@Override
public int compareTo(Patient other) {
// Higher numeric priority value indicates higher clinical emergency urgency
return Integer.compare(other.priority, this.priority);
}
@Override
public String toString() {
return name + " [Severity: " + priority + "]";
}
}
public class TriageQueue {
private PriorityQueue<Patient> heap = new PriorityQueue<>();
public void enqueue(Patient patient) {
heap.add(patient);
System.out.println("Enqueued patient: " + patient);
}
public Patient dequeue() {
if (heap.isEmpty()) {
System.out.println("No patients currently in triage queue.");
return null;
}
Patient treated = heap.poll();
System.out.println("Dispatched to Doctor: " + treated);
return treated;
}
public Patient peek() {
return heap.peek();
}
public boolean isEmpty() {
return heap.isEmpty();
}
public void visualize() {
List<Patient> snapshot = new ArrayList<>(heap);
Collections.sort(snapshot);
System.out.println("--- Current Priority Queue Status ---");
for (Patient p : snapshot) {
System.out.println(" • " + p);
}
}
}Technologies & Tools
Academic Classification
More in Data Structures, Algorithms & Small Lab Projects
View all in categoryMulti-Language Graph Algorithms Suite (C++, Java, Python)
Comprehensive tri-lingual implementation of fundamental graph structures, benchmarking traversal, topological sorting, and shortest paths in C++, Java, and Python.
Shunting-Yard Infix to Postfix Converter & Stack Calculator
Mathematical expression parsing engine that converts standard human-readable arithmetic into Reverse Polish Notation (RPN) and computes results via operand stacks.
Ordered Binary Search Tree (BST) Engine
Self-contained binary search tree data structure supporting logarithmic insertions, key lookups, in-order successor deletions, and recursive traversals.