AI-Powered Clinical Workbench & Prescription Generator for Indian Medical Practitioners
Features Β· Tech Stack Β· Setup Β· Deploy Β· Roadmap
OneStopMed is a full-stack medical application built to modernize the prescription workflow for doctors in India. It combines a lightning-fast drug search engine (powered by SQLite FTS5 across 200,000+ medicines), a medical-grade PDF generator, and a secure doctor authentication system β all wrapped in a clean, modern React interface.
Doctors can search drugs by brand or generic name, build prescriptions with smart auto-complete, save reusable templates, and generate professionally formatted PDF prescriptions β ready to print and sign.
- Full-text search across 200,000+ Indian medicines using SQLite FTS5 with Porter stemming.
- Handles partial matches and typos (e.g.,
"dolo"β"DOLO 650 Tablet"). - Returns brand name, generic composition, drug type, and manufacturer β in milliseconds.
- Generates high-resolution, vector-based PDF prescriptions using WeasyPrint + Jinja2 templates.
- Auto-populates doctor credentials (name, qualification, NMC Reg. No., clinic details).
- Includes patient vitals (age, weight, BP, allergies), diagnosis, Rx table, and follow-up instructions.
- Clean, print-ready layout with proper medical formatting (β symbol, structured fields).
- Save frequently used prescription sets as reusable templates.
- Instantly load, rename, or delete saved templates.
- Templates are doctor-specific and stored securely in Supabase.
- Supabase Auth with JWT-based session management.
- Registration flow with admin approval (pending registrations table).
- Passwords hashed with bcrypt before storage.
- Protected API routes β every endpoint validates the JWT token server-side.
- Editable profile with fields: full name, qualification, clinic name, clinic address, phone, NMC registration number.
- Profile data is automatically embedded into generated prescriptions.
- Real-time drug suggestions as you type β with keyboard navigation (β/β/Enter/Escape).
- Auto-fills generic composition and drug type on selection.
- Prevents prescription errors by validating against the curated database.
- Every generated prescription is logged to Supabase with full patient + medicine data.
- Enables future analytics and audit trail capabilities.
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React 19, TypeScript, Vite | SPA with modern tooling |
| Styling | Tailwind CSS, Shadcn/ui (Radix) | Clean, accessible UI components |
| Routing | React Router v7 | Client-side navigation |
| Auth (Client) | Supabase JS SDK | Session management, JWT tokens |
| HTTP Client | Axios | API communication |
| Backend | FastAPI (Python) | High-performance async API |
| Server | Uvicorn (ASGI) | Production-grade ASGI server |
| Drug Search | SQLite FTS5 | Full-text search with Porter stemming |
| PDF Engine | WeasyPrint + Jinja2 | CSS-styled PDF rendering |
| Auth (Server) | Supabase Admin + bcrypt | JWT validation, password hashing |
| Database | Supabase (PostgreSQL) | Doctors, templates, prescriptions |
| Drug Data | SQLite (42 MB, FTS5) | 200k+ medicines from CSV ingestion |
| Icons | Lucide React | Consistent iconography |
OneStopMed_Prescription/
βββ backend/ # Python / FastAPI
β βββ main.py # All API endpoints
β βββ ingest.py # CSV β SQLite FTS5 data pipeline
β βββ requirements.txt # Python dependencies
β βββ data/
β β βββ medicine_data.csv # Raw drug dataset (~27 MB)
β β βββ drugs.db # SQLite FTS5 database (~42 MB)
β βββ templates/
β βββ prescription.html # Jinja2 template for PDF layout
β
βββ frontend/ # React / Vite / TypeScript
β βββ src/
β β βββ App.tsx # Root component, routing, auth guard
β β βββ Login.tsx # Login page
β β βββ Register.tsx # Registration page
β β βββ supabaseClient.ts # Supabase client initialization
β β βββ pages/
β β β βββ Dashboard.tsx # Main prescription builder UI
β β β βββ Profile.tsx # Doctor profile editor
β β βββ components/ui/ # Shadcn/ui components (12 files)
β β βββ Header.tsx # App header with navigation
β β βββ button.tsx, card.tsx, dialog.tsx, input.tsx,
β β β label.tsx, table.tsx, tabs.tsx, textarea.tsx,
β β β badge.tsx, scroll-area.tsx, separator.tsx
β β βββ ...
β βββ vite.config.ts
β βββ tailwind.config.js
β βββ package.json
β
βββ my-app/ # Next.js (Patient-facing / Landing)
β βββ app/
β β βββ page.tsx # Landing page
β β βββ layout.tsx # Root layout
β βββ package.json
β
βββ .gitignore
βββ README.md
| Tool | Version | Notes |
|---|---|---|
| Python | 3.11+ | Backend runtime |
| Node.js | 18+ | Frontend tooling |
| GTK3 Runtime | Latest | Required by WeasyPrint on Windows (install guide) |
| Supabase Project | β | Create one at supabase.com |
git clone https://github.com/your-username/OneStopMed_Prescription.git
cd OneStopMed_Prescription# Create and activate a virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS/Linux
# Install dependencies
pip install -r backend/requirements.txtCreate backend/.env with your Supabase credentials:
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-service-role-key
CORS_ORIGINS=http://localhost:5173(Optional) Rebuild the drug database from the raw CSV:
cd backend
python ingest.pyStart the API server:
uvicorn backend.main:app --reloadπ’ API is now live at http://127.0.0.1:8000 β interactive docs at /docs
cd frontend
npm installCreate frontend/.env.local:
VITE_API_BASE_URL=http://localhost:8000
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-keyStart the dev server:
npm run devπ’ Frontend is now live at http://localhost:5173
- Push your code to GitHub.
- Create a new Web Service on Render.
- Connect the repository and set the Root Directory to
backend. - Render automatically installs Python dependencies and system packages (
pango,cairo,gdk-pixbuf) for PDF generation. - Add your environment variables (
SUPABASE_URL,SUPABASE_KEY,CORS_ORIGINS) in the Render dashboard.
- Import the repository on Vercel.
- Set the Root Directory to
frontend. - Vercel auto-detects Vite and deploys.
- Add environment variables (
VITE_API_BASE_URL,VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY) in the Vercel dashboard.
Important: Set
VITE_API_BASE_URLto your Render backend URL (e.g.,https://your-app.onrender.com).
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/register |
β | Submit a doctor registration application |
GET |
/me |
β | Get current doctor's profile |
PUT |
/profile |
β | Update doctor profile |
GET |
/search?q= |
β | Search drugs by name (min 2 chars) |
POST |
/generate_pdf |
β | Generate a prescription PDF |
POST |
/templates |
β | Create a new prescription template |
GET |
/templates |
β | List all templates for the current doctor |
PATCH |
/templates/{id} |
β | Rename a template |
DELETE |
/templates/{id} |
β | Delete a template |
The application uses the following tables in Supabase (PostgreSQL):
| Table | Description |
|---|---|
pending_registrations |
Stores doctor registration requests awaiting admin approval |
doctors |
Approved doctor profiles (name, qualification, clinic info, NMC reg.) |
prescription_templates |
Saved prescription templates per doctor |
prescriptions |
Full prescription history with patient data and medicines |
The drug search database (drugs.db) is a local SQLite FTS5 database β not stored in Supabase β for maximum search performance.
- Phase 1 β Fuzzy / Full-Text Drug Search API
- Phase 2 β React Frontend & Prescription Builder UI
- Phase 3 β PDF Generation Engine
- Phase 4 β Cloud Deployment (Render + Vercel)
- Phase 5 β Doctor Authentication & Login (Supabase Auth)
- Phase 6 β Prescription History & Templates
- Phase 7 β Patient-Facing Portal (Next.js)
- Phase 8 β Dashboard Analytics (Appointment trends, patient footfall)
- Phase 9 β WhatsApp Prescription Sharing Integration
License: Private / Proprietary
βοΈ Medical Disclaimer: OneStopMed is an assistive technology designed for registered medical practitioners. It does not replace professional medical judgment. All generated prescriptions must be physically reviewed, signed, and verified by a licensed doctor before being issued to patients.
- All API keys and secrets are loaded from environment variables (
.envfiles) β never hardcoded. .envfiles are excluded from version control via.gitignore.- Supabase service role keys are used server-side only and never exposed to the client.
- CORS origins are configurable via environment variables.
- JWT tokens are validated on every protected endpoint.
Built by Tejas D. Jaiprakash
AIML Student & Full-Stack Developer