HealthFirstAI is built around a single idea.
The patient record is the system.
Everything else is derived from it.
Traditional hospital software starts with documents.
HealthFirstAI starts with events.
A consultation happens.
A medication is prescribed.
A procedure is performed.
A nurse records observations.
A lab result arrives.
These events continuously build a patient’s timeline.
Documents are simply different views of that timeline.
System Philosophy
Most hospital software asks users to decide where information belongs.
HealthFirstAI asks only one question.
What happened to this patient?
The system decides where that information should live.
This reduces context switching, duplicate documentation and training requirements.
The software adapts to the workflow instead of forcing the workflow to adapt to the software.
Product Architecture
Voice
│
Typed Notes
│
Handwritten Notes
│
▼
Clinical Input Layer
│
▼
Medical Understanding
(Extraction + Validation)
│
▼
Structured Clinical Data
│
▼
Patient Timeline
│
┌────────────┼─────────────┐
│ │ │
▼ ▼ ▼
Progress Orders Checklists
Notes
│
▼
Discharge Summary
Insurance Documents
Clinical Reports
Every document in the system is generated from the same patient timeline.
No document owns the data.
The patient does.
Information Flow
A doctor speaks naturally.
"Patient has fever since yesterday.
BP 140/90.
Started Azithromycin 500 mg once daily."
The system follows the same pipeline every time.
Voice
↓
Deepgram
↓
Transcript
↓
GPT-4o-mini
↓
Structured medical data
↓
PostgreSQL
↓
Patient timeline
↓
Generated documents
Voice is optional.
Typing follows the same pipeline.
Handwritten notes eventually enter the same pipeline.
Regardless of how information enters the system, the destination is identical.
One source of truth.
The Patient Timeline
This is the core of the architecture.
The product is not a collection of forms.
It is a continuously evolving medical record.
Every interaction contributes to the patient’s history.
Admission
↓
Consultation
↓
Investigations
↓
Medication
↓
Daily Progress
↓
Procedure
↓
Recovery
↓
Discharge
The discharge summary is never written from scratch.
It is assembled from information collected throughout the admission.
This makes discharge a consequence of documentation instead of a separate task.
Why Voice First?
Doctors already communicate verbally.
Asking them to translate spoken observations into structured forms adds unnecessary work.
Voice removes the interface between clinical thinking and documentation.
The objective was never speech recognition.
The objective was reducing documentation friction.
Voice simply happens to be the fastest input available today.
AI’s Role
AI is intentionally limited.
It structures information.
It does not make clinical decisions.
Responsibilities are clearly separated.
Doctor
│
├── Diagnosis
├── Treatment
├── Clinical judgement
└── Final approval
HealthFirstAI
│
├── Understand documentation
├── Extract structured data
├── Generate documents
└── Maintain consistency
Every generated document requires human review before becoming part of the medical record.
Clinical responsibility always remains with the doctor.
Data Model
Almost everything revolves around five entities.
Hospital
│
├── Users
│
├── Patients
│ │
│ ├── Voice Notes
│ ├── Checklists
│ ├── Procedures
│ ├── Documents
│ └── Timeline
│
└── Settings
Relationships matter more than individual tables.
Hospitals own patients.
Patients own clinical events.
Documents are generated from those events.
Why PostgreSQL?
Healthcare data is relational.
Patients belong to hospitals.
Admissions belong to patients.
Voice notes belong to admissions.
Documents reference multiple clinical events.
Trying to model these relationships in a document database quickly introduces duplication and synchronization problems.
PostgreSQL naturally represents the domain.
JSONB is used where clinical information evolves faster than the schema.
Relational tables provide structure.
JSONB provides flexibility.
The two complement each other.
Why JSONB?
Not every hospital documents patients the same way.
Some departments capture information others never record.
Clinical workflows change.
Regulatory requirements change.
Rather than redesigning the database every time documentation evolves, structured medical extraction is stored as JSONB while maintaining relational links to patients and admissions.
Stable relationships remain relational.
Variable clinical content remains flexible.
Documents
HealthFirstAI stores every generated document in two formats.
Structured Data (JSONB)
The structured medical information extracted from the patient’s record.
This allows documents to be searched, queried and regenerated without processing the original voice notes again.
HTML Snapshot
Alongside the structured data, the system stores the rendered HTML exactly as the doctor reviewed it.
The snapshot preserves the document’s appearance even if templates change in the future, ensuring historical records always remain identical to what was originally approved.
We intentionally do not store PDFs by default.
PDFs are significantly larger than HTML and provide little additional value while sitting in storage. Across thousands of discharge summaries and clinical documents, storing PDFs would consume several gigabytes of storage for information already represented as structured data and HTML.
Instead, the browser becomes the PDF engine.
Whenever a doctor needs to print or download a document, the stored HTML is rendered and the browser generates the PDF on demand.
This approach reduces storage costs while still producing print-perfect documents whenever required.
Multi-Tenancy
Every hospital operates inside its own logical workspace.
Isolation exists at three levels.
- Database Row Level Security.
- Application-level filtering.
- API authorization.
Even if one layer fails, another prevents data leakage.
Patient data should never rely on a single protection mechanism.
Storage
Binary assets remain outside the database.
Hospital logos.
Doctor signatures.
Consent signatures.
Attachments.
These are stored in Supabase Storage using signed URLs with time-limited access.
The database stores references rather than files themselves.
Platform
HealthFirstAI is built as a Progressive Web App (PWA).
Rather than maintaining separate Android, iOS and desktop applications, the same application runs across phones, tablets and laptops from a single codebase.
One Codebase
│
┌───────────────┼───────────────┐
▼ ▼ ▼
Mobile Tablet Desktop
Browser Browser Browser
│ │ │
└───────────────┼───────────────┘
▼
Progressive Web App
For hospitals, accessibility is more important than app stores.
Doctors may move between wards, nursing stations, OPDs, ICUs and home. The application should be available wherever they sign in rather than being tied to a specific device or operating system.
Installing the application simply adds it to the home screen, providing an experience similar to a native application while remaining centrally deployed and updated.
Every software update becomes immediately available to every user without Play Store or App Store releases.
Access & Security
Although the application runs in the browser, access is tightly controlled.
Authentication verifies the user’s identity.
Authorization determines what information they can access.
Additional restrictions can be applied at the hospital level, including:
- Registered devices only
- Approved hospital or clinic networks
- IP-based access restrictions
- Device-specific permissions
- User account restrictions
- Hospital-level data isolation through Row Level Security
This allows clinicians to securely access the platform from any supported device while giving hospitals fine-grained control over where and how patient data can be accessed.
The browser is simply the interface.
Security is enforced by the platform, not by the device itself.
Design Principles
Every engineering decision follows the same principles.
- Capture information once.
- Maintain a single source of truth.
- Prefer workflows over forms.
- Separate clinical judgement from AI.
- Keep infrastructure simple until complexity is justified.
- Optimize for hospital adoption before technical elegance.
- Build systems that explain themselves.
Current Stack
Frontend
- Next.js
- TypeScript
- Tailwind CSS
- Progressive Web App
Backend
- Next.js Route Handlers
- Supabase
- PostgreSQL
- Row Level Security
AI
- Deepgram
- OpenAI GPT-4o-mini
- OpenAI GPT-4o
Storage
- Supabase Storage
Deployment
- Vercel
- GitHub Actions
HealthFirstAI is not built around AI.
It is built around a patient.
Everything else exists to preserve, organize and reuse that patient’s story.