Prescriptions & Voice Workflow
Create structured prescriptions manually or via AI-powered voice transcription.
The prescription system is the most distinctive feature of The Care Nexus. While other systems require doctors to type every prescription field manually, The Care Nexus offers a voice-first workflow: the doctor speaks naturally, the system transcribes and structures the prescription automatically, and the doctor simply reviews, edits if needed, and saves. This reduces prescription creation time from several minutes to under 30 seconds.
Voice Prescription Workflow
1. Record
The doctor clicks the microphone button on the prescription form. The browser's MediaRecorder API captures audio in WebM or WAV format. Recording stops on a second click or after 5 minutes (timeout safety). The audio blob is sent as multipart form data to POST /api/ai/chat/transcribe.
2. Transcribe
The GROQ API's multimodal endpoint processes the audio file and returns raw text. GROQ supports both Urdu and English natively, so doctors can speak in either language. The raw transcript is preserved and stored in the prescription for audit purposes.
3. Parse
The raw transcript is passed to POST /api/ai/gemini/parse-prescription. A carefully crafted system prompt instructs Gemini to extract: diagnosis, list of medicines with dosage/frequency/duration, doctor notes, and follow-up date if mentioned. The response is a validated JSON object.
{
"diagnosis": "Acute pharyngitis with mild fever",
"medicines": [
{ "name": "Amoxicillin", "dosage": "500mg", "frequency": "3x daily", "duration": "7 days" },
{ "name": "Paracetamol", "dosage": "500mg", "frequency": "as needed", "duration": "3 days" }
],
"notes": "Rest advised. Plenty of fluids. Return if fever persists beyond 3 days.",
"followUpDate": "2026-06-22"
}4. Review and Save
The parsed data pre-fills the prescription form. Every field is editable — the doctor can add, remove, or correct any detail. On save, the final prescription is posted to POST /api/doctor/prescriptions, linked to the patient and appointment, and the patient's medical vault is immediately updated.
Manual Prescription
The manual form is also available for doctors who prefer to type. It presents the same field structure: diagnosis text area, a dynamic medicine list where medicines can be added one by one, notes, and follow-up date picker. Both manual and voice prescriptions produce identical data structures in the database.
Prescription Management
| Action | Endpoint | When |
|---|---|---|
| Create | POST /api/doctor/prescriptions | After appointment visit |
| Edit | PUT /api/doctor/prescriptions/:id | Before patient has seen it (same day only) |
| Delete | DELETE /api/doctor/prescriptions/:id | Rare — requires confirmation modal |
| List | GET /api/doctor/prescriptions | Paginated history, searchable by patient name |
Edit window
Prescription edits are allowed only on the same calendar day as creation. After midnight, the prescription becomes read-only to preserve medical record integrity. The doctor can add a new prescription if corrections are needed after this window.