Inspiration

Maternity and gynaecology clinics often struggle with fragmented administrative workflows. Paper records are easily misplaced, patient queues can be chaotic, doctors lose valuable consultation time typing out prescriptions, and expecting mothers lack direct access to their clinical history.

We built MaterniCare HMS to resolve these bottlenecks. Our goal was to create a secure, self-hosted, and lightweight Hospital Management System that bridges the communication gap between administrators, doctors, nurses, and patients. By implementing voice-to-text dictation and real-time queues, clinic staff can focus on what matters most: providing care to mothers.


How We Built It

MaterniCare HMS is structured as a role-based web application with a local AI transcription helper. Here is the architecture behind the system:

  1. Frontend: Built with React 19, TypeScript, and Tailwind CSS v4 for a clean, modern user experience. We used TanStack Start for server-side rendering and APIs, paired with TanStack Router to manage type-safe routing.
  2. Database & Security: Supported by Supabase (PostgreSQL). We implemented Row Level Security (RLS) policies to strictly isolate patient data.
  3. Voice Dictation Engine: A standalone FastAPI server running OpenAI's Whisper model locally, transcribing raw audio files recorded via the browser directly into clinical notes.
  4. Data Analytics: Integrated Recharts to visualize patient registration statistics and queue efficiency.

What We Learned

We deepened our understanding of building role-based access control (RBAC) in modern full-stack frameworks. Managing real-time states—such as updating a doctor's active duty status ('on_duty', 'off_duty', 'on_break') and immediately reflecting those changes in the Nurse dropdown lists—taught us the importance of clean, reactive state management.

Additionally, we learned how to design complex PostgreSQL RLS policies that secure private data while allowing clinical personnel unified access.


Mathematical Models & Clinical Tracking

To assist nurses in tracking maternal health metrics, we incorporated clinical formulas.

  • Estimated Date of Delivery (EDD): Calculated using Naegele's Rule based on the Last Menstrual Period (LMP): $$\text{EDD} = \text{LMP} + 7\text{ days} - 3\text{ months} + 1\text{ year}$$

  • Mean Arterial Pressure (MAP): Calculated during vitals entry (Systolic Blood Pressure $SBP$ and Diastolic Blood Pressure $DBP$): $$\text{MAP} = \frac{\text{SBP} + 2 \times \text{DBP}}{3}$$


Challenges We Faced

  • Local Audio Latency: Running Whisper speech-to-text models on standard CPU hardware can be slow. We resolved this by optimizing our Python backend to run the Whisper base/tiny models, enabling near-instantaneous transcription without sending private health details to external cloud APIs.
  • RLS Policies for Patients: Devising a secure database architecture where patients can read only their own vitals, queue logs, and prescriptions, while ensuring staff accounts maintain full write access, required writing robust policy constraints.

Built With

Share this project:

Updates