Inspiration

Emergency rooms often operate on a first-come, first-served basis, which doesn't reflect medical urgency. A patient with a minor complaint who arrives first can end up being seen before someone with a life-threatening condition who arrives later. We wanted to build a system that mirrors how real triage should work prioritizing patients based on how critical their condition is, not just when they walked in.

What it does

CareFlow is a patient queue management system for emergency rooms. It lets staff add patients with their age, pain level, and severity, and automatically calculates a priority score for each one. Patients are queued so the most urgent cases are seen first. The system also lets staff search for and update a patient's information, view the full waitlist, pull statistics on how many patients are critical/urgent/non-urgent, and call the next patient in line.

How we built it

We built CareFlow in C, using a singly linked list to represent the ER queue, where the list stays sorted by priority score as patients are added. Each patient node stores their name, age, pain level, severity, computed priority score, and arrival time. Priority scores are calculated using a weighted formula that factors in severity, age, and pain level, and can be recalculated over time to account for how long a patient has been waiting.

Challenges we ran into

Managing dynamic memory correctly was one of our biggest challenges — particularly making sure patient names (stored as dynamically allocated strings) were properly freed and reallocated whenever a patient's information was edited, to avoid memory leaks. We also had to think carefully about maintaining sorted order in the linked list every time a new patient was inserted, rather than sorting after the fact.

Accomplishments that we're proud of

We're proud of building a fully functional priority queue from scratch using core data structures, without relying on any external libraries. We're especially proud of the priority recalculation logic, which factors in wait time so patients don't get stuck waiting indefinitely behind higher-severity cases.

What we learned

We deepened our understanding of linked list manipulation, pointer-to-pointer parameters for modifying list heads, and safe dynamic memory management in C. We also learned how to translate a real-world process (ER triage) into a working prioritization algorithm.

What's next for CareFlow

Next steps include adding a graphical interface, persistent storage (saving patient data between sessions), and more sophisticated priority weighting that could incorporate additional medical factors or be configurable per hospital.

Share this project:

Updates

Submission history