The Core Problem
A patient's information lives in pieces. Their appointments are in one system, their test results in another, their prescriptions in a third, their bills in a fourth. None of them talk to each other properly.
The consequences are ordinary and constant. A doctor prescribes a medication without seeing that it conflicts with something another doctor prescribed last month. A critical test result sits unread for hours. A patient calls the front desk to ask a question that's already answered in a document nobody can find. Staff retype the same information into four different screens.
None of this is a technology problem in the exciting sense. It's a coordination problem. The information exists — it just never arrives where it's needed, when it's needed.
The Solution
HealthPack is designed as fifteen small independent services instead of one large one. Each one owns a single job and does it well: one handles patient records, one handles appointments, one handles lab results, one handles prescriptions, one handles documents, one handles the AI assistant.
They stay in sync by broadcasting to each other. When a lab result is finalized, the lab service announces it once, on lab.result.finalized. Everything that cares — the patient's medical timeline, the doctor's alert system, the billing pipeline, the AI assistant's search index — hears the same announcement over Kafka and reacts independently. Nobody has to remember to notify anybody.
That's the whole idea: the system tells itself what happened, and the right things happen automatically. Kafka carries the facts — things that happened, replayable, kept — and RabbitMQ carries the work — render this PDF, send this notification, one worker, one attempt, retried on failure.
The Hard Parts
Things fail, and the system has to survive it. In a system of fifteen independent services, one being temporarily down is normal, not exceptional. HealthPack's design keeps a failure contained: if the notification service goes down, appointments still get booked — the reminders queue up in RabbitMQ and go out when it recovers. Nothing is lost.
Nothing should happen twice. A prescription must never be issued twice because a network request was retried. Every document render carries an idempotency key, checked before any work starts, so replaying the same command produces the same result as running it once.
Speed where it matters. A doctor's dashboard pulls information from five different services. Done naively that's dozens of separate requests and a slow page. The GraphQL layer batches them into one gRPC call per service instead of one per patient row, so the page loads in a single round trip.
Privacy is a design constraint, not a feature. Consent is checked before the AI assistant reads anything. Personal details are stripped before any data leaves the hospital's own servers. These aren't add-ons — the architecture assumes them from the first diagram — the design below is complete; none of it is built yet.
Patient records
A single verified identity for each patient, so every other service is talking about the same person. Sensitive fields are encrypted individually, not just "the database is encrypted."
Appointments
Patients book online and see real availability. A database exclusion constraint makes double-booking the same doctor for the same slot structurally impossible to save, not just carefully checked for.
Clinical records
Doctors record visits, diagnoses and measurements. Everything is timestamped, attached to the patient's timeline, and coded against ICD-10, SNOMED CT and LOINC — the standards hospitals actually use.
Lab results
Results arrive in the standard hospital messaging format (HL7 v2) straight from lab machines. A streaming job watches every result for dangerous values and alerts a doctor within seconds, bypassing do-not-disturb settings.
Prescriptions
Before a prescription can be issued it's checked against everything else the patient is currently taking. A dangerous interaction blocks the order and shows exactly why; an override is recorded permanently with the doctor's stated reason.
Documents
Discharge summaries, lab reports, prescriptions and invoices generate as archival-quality PDFs, cryptographically signed so tampering is detectable. Generation happens in the background — nobody waits on a loading screen.
AI assistant
Patients and staff ask questions in plain language. The assistant answers only from that patient's actual documents, cites its source for every claim, and says so plainly when the documents don't contain an answer.
Messaging
Real-time chat between patients and clinicians, and with the AI assistant. Answers stream in token by token instead of arriving after a long pause.
Notifications
Appointment reminders, results-ready alerts and critical values, delivered by push, email or SMS depending on what each person has chosen. Critical alerts take a separate, faster path that bypasses quiet hours.
Billing
Invoices generate automatically when a visit is completed, with card payments handled through Stripe and a transactional outbox keeping the two in sync.
Audit trail
Every action anyone takes is recorded in a tamper-evident, hash-chained log. Altering a past record breaks the chain and is detectable — regulations require this, and most systems implement it badly.