Healthcare · AI Product Engineering

Building an AI-first EMR where the doctor decides what the AI sees

A microservices electronic medical record platform with a clinical AI assistant — designed so that patient data reaches a language model only when a clinician explicitly attaches it.

SECTOR
Healthcare / Clinical
ENGAGEMENT
Product engineering
TEAM
4 engineers
DURATION
6 Months
STATUS
Private Beta
The patient record consolidates demographics, medical history, encounters, questionnaires and documents behind a single identifier.

What the client needed

Most electronic medical record systems are archives. A clinician opens a patient, then works through tabs, forms and prior encounters to reconstruct a history that may span years. The information is present. Retrieving it during a ten-minute consultation is the problem.

The brief was to build an EMR where clinical history could be interrogated conversationally — ask a question, get an answer grounded in that patient's actual record — without weakening access control, and without the AI layer becoming an uncontrolled route to patient data.

An EMR that can answer questions is only useful if you can also prove which records it was allowed to read.

The constraints that shaped the build

Every clinic records differently

Fixed schemas fail immediately across specialities. Intake for a dermatology visit shares almost nothing with a pre-dialysis assessment.

AI cannot bypass permissions

If a clinician cannot open a record in the interface, no assistant built on top of that interface may summarise it either.

Patients speak several languages

Notes and patient-facing interactions in India routinely mix English with regional languages within a single record.

Clinical modules change at different speeds

Record storage is stable. AI behaviour is not. Deploying a prompt change should not require redeploying patient records.

What we built

A microservices platform on NestJS and MongoDB with a Next.js clinical interface. Records, forms, questionnaires, scheduling and the AI services are separate deployables communicating over internal APIs.

Rather than shipping fixed intake forms, we built a form builder and a questionnaire builder. Clinics assemble their own instruments; the platform stores responses as structured data the AI layer can later read as context instead of as free text.

Patient EMRDemographics, history, encounters, documents and notes under one MRN.
Form builderClinic-defined intake and clinical forms without engineering involvement.
Questionnaire builderStructured instruments that produce machine-readable clinical responses.
Medical Assistant AIAnswers grounded in the specific records a clinician attaches.
Clinical chatConversational retrieval across an attached patient context.
Role-based accessPermissions enforced at the service layer, inherited by AI requests.
Before asking a question, the clinician selects which parts of the record to attach: allergies, past medical history, family history, lifestyle, surgical history. Nothing unselected is sent.

The design decision that mattered most

The obvious way to build a clinical AI assistant is to give it broad read access to the record and let it retrieve whatever it judges relevant. It demonstrates well. It is difficult to defend.

We inverted it. The assistant holds no standing access to patient data. A clinician opens the record, ticks the sections relevant to their question, attaches them, and only then asks. The model receives exactly that payload and nothing more.

This costs a few seconds per query. In exchange, three things become true: the clinician always knows what the model saw, the AI cannot exceed the permissions of the person operating it, and every request carries an explicit record of the data that left the system. For anyone evaluating this platform against a data protection standard, that last property is worth more than the seconds it costs.

Technology choices and why

Every item below was chosen against a constraint above, not by preference.

DATA

MongoDB

Clinical documents vary in shape by speciality and by clinic. A document store fits that better than migrating relational schemas for every new instrument.

SERVICES

NestJS microservices

Separates the parts that change weekly — prompts, agents, AI behaviour — from the parts that must not change casually, such as patient record storage.

INTERFACE

Next.js

Server rendering for record-heavy screens, and one codebase for clinical desktop use and tablet use at the bedside.

REASONING

Claude

Long-context handling of an attached record without lossy pre-summarisation, and instruction adherence strong enough to hold clinical guardrails.

LANGUAGE

Sarvam AI

Indic language handling for records and patient interactions that mix English with regional languages.

DELIVERY

Nginx

Reverse proxy and routing across services, with TLS termination at the edge.

Clinics define their own intake instruments. Responses are stored as structured fields, which is what makes them usable as AI context later.

How the team built it

GegoSoft engineers use Claude Code as standard daily tooling across all projects. On this build it carried the repetitive engineering load: service scaffolding, DTO and validation layers, test coverage, and the API client work between microservices.

What it did not do is decide anything. Architecture, the data-attachment consent model, clinical workflow design and every schema decision were made by the team. All generated code passed normal review before merge. We are specific about this because in healthcare the distinction matters: AI assistance changed how quickly the team wrote code, not who was accountable for it.

Where it stands

The platform runs in production and continues under active development. The same service architecture now underpins the hospital management, pharmacy and AI agent products in the LifeBridge range.

Common questions

Can GegoSoft build a custom EMR for our hospital or clinic group?

Yes. We build EMR and clinical platforms from scratch, and we can also adapt the existing LifeBridge architecture where the requirements overlap. Which route is cheaper depends on how much of your clinical workflow is unusual — that is the first thing we assess.

How long does an EMR platform take to build?

It depends on scope: number of specialities, integrations with existing lab or imaging systems, and whether mobile applications are needed. We scope this in a technical discovery before quoting, rather than giving a figure that changes once requirements are understood.

Is patient data sent to an AI provider?

Only the records a clinician explicitly attaches to a specific question. The assistant has no standing access to the record database, and cannot read anything the operating clinician is not permitted to see.

Can it work in languages other than English?

Yes. The platform uses Sarvam AI for Indic language handling, so records and patient interactions that mix English with regional languages are supported.

What does "AI-assisted development" actually mean here?

Our engineers use Claude Code daily for scaffolding, tests, refactors and integration code. Design decisions and code review remain with the engineering team. It shortens delivery; it does not replace engineering judgement or accountability.

Planning a healthcare platform?

Tell us what your clinical workflow looks like today. We will tell you honestly whether to build from scratch, adapt an existing platform, or buy something off the shelf — including when the answer is the last one.

Start a conversation See all case studies