Skip to content
Back to projects

In production

VitaliaCare Enterprise — hospital electronic medical records

Hospital system in production: medical records, operating room, beds and pharmacy. I was responsible for the data model and the multi-branch architecture.

Year
2025 — 2026
Role
Data modeling and multi-branch architecture
Stack
Next.js · React · Express · TypeScript · Prisma · PostgreSQL · MongoDB · Socket.IO
Overview of VitaliaCare Enterprise — hospital electronic medical records

Context

The system a hospital actually runs on: admissions, triage, medical records, operating room, nursing, pharmacy, beds, kitchen and indicators. It's 260,000 lines and 1,812 commits over ten months, with a team of five. It's the largest project I've worked on. My responsibility was the layer everything else rests on: the data schema —113 models and 98 backend modules— and taking it from a single medical center to several branches.

The problem

The system was born for one medical center and had to open up to several without either hospital seeing the other's patients. In a clinical system that isn't solved by filtering in the query: if the branch doesn't live in the data, any endpoint someone adds later becomes a leak. And some entities look global but aren't: bed 201 exists at both branches and it isn't the same bed.

The solution

I carried the branch into the schema, model by model, up to the 135 references it has today, and adjusted every controller and service to filter by it. The session token carries the active branch, and the isolation is enforced in the data layer, not in the interface. I also modeled the bed lifecycle and contributed to medical records, encounters, patient history and medications.

Technical decisions

  • The branch belongs in every clinical model, not just in the query. A filter gets forgotten when someone adds a new endpoint; a required column doesn't.
  • Bed codes are unique per branch, not globally: two hospitals each have their own bed 201, and forcing a single unique code would make them rename their wards to accommodate the software.
  • I modeled bed movements as their own table with start and end dates, instead of a status on the bed. The status says where the patient is now; the history answers who was there before and for how long, which is what people ask when there's an infection to trace.
  • A diet order requires the bed, not just the patient: the kitchen delivers by bed number, so an order without a bed is an order that never arrives.
  • The clinical catalogs were split by branch too: each hospital has its own exams, procedures and supplies, and sharing them would have meant a change at one altering the other's prices.

Results

  • Branch isolation across all 135 references in the schema: adding a hospital stopped being a deployment of its own.
  • Full bed traceability: who occupied each one, when, and why they were moved.
  • 446 of the project's 1,812 commits, the second largest contribution on the team.

Project screenshots

Click any image to enlarge it.