Authentication: All endpoints require
Authorization: Bearer <access_token>.External Dependencies: Nama Agent (internal LLM) · Aathma (Narayana Health doctor platform)Status: Planned — endpoint contracts pending confirmation from the Nama Agent team.Why AI Before Doctor?
Connecting every user directly to a doctor would require a massive pool of physicians on call at all times — economically unsustainable for a ₹0 entry-point product serving gig workers. More importantly, the first 5 minutes of every doctor consultation are usually the same: the doctor collects basic information. What is the chief complaint? How long has it been happening? How severe? Any existing conditions? Current medications? Allergies? Nama Agent handles that intake conversationally — in the user’s language, at their pace, via text. By the time a real doctor receives the case, they have a structured clinical summary with all intake fields completed. The consultation becomes immediately productive. This approach also benefits patients: the conversational format is less intimidating than a clinical questionnaire. Users are more forthcoming about symptoms when talking to a bot than when filling out a form.The Role of Each Component
Nama Agent (Internal LLM)
Nama is an internal LLM (large language model) built by the Aarokya engineering team. Its role in the Call Doctor flow:- Initialises a session when the patient starts the consultation
- Conducts a structured intake conversation in natural language
- Dynamically chooses follow-up questions based on the user’s responses (e.g. if the user says “chest pain”, Nama asks about radiation, duration, and associated symptoms)
- When it has sufficient information, generates a structured clinical summary JSON object
- Sets the session status to
SUMMARY_READY
Aathma (Narayana Health Doctor Platform)
Aathma is Narayana Health’s doctor assignment and teleconsultation platform. Once the clinical summary is submitted:- Aathma receives the structured summary
- Routes to an available doctor based on specialty, geography, and availability
- Returns an
aathma_referenceID (e.g.ATH-2025-00456) - The doctor contacts the patient via the Narayana Health app/call
How It Works — End to End
Session State Machine
| State | What it means | Patient can send messages? |
|---|---|---|
OPEN | Session created, Nama not yet engaged | No |
COLLECTING | Nama is asking intake questions | Yes — to Nama directly |
SUMMARY_READY | Nama has generated the clinical summary | No — summary is ready to review |
SUBMITTED | Summary submitted to Aathma, awaiting doctor assignment | No |
LOCKED | Doctor assigned, session permanently frozen | No |
The Clinical Summary Structure
The clinical summary produced by Nama Agent is a structured JSON object that maps to standard clinical intake fields:Why Sessions Are Immutable After LOCK
This is one of the most deliberate design decisions in the module:- Clinical integrity: A doctor receives a summary, forms a clinical impression, and prepares questions. If the patient could edit the summary after submission, the doctor’s preparation would be based on outdated information.
- Liability boundary: The locked summary is the authoritative record of what was communicated. Both patient and doctor have a clear, immutable reference point.
- Prevents gaming: In a system where insurance covers certain conditions, mutability could be exploited. The immutable session is the source of truth.
- Audit trail: For HIPAA-adjacent compliance, the session record must be unchangeable after the point of professional handoff.
locked_at timestamp records exactly when the session was frozen — this is the legal handoff moment.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /doctor/session | Start a new consultation session |
GET | /doctor/summary/{userId}/{sessionId} | Fetch Nama-generated clinical summary |
POST | /doctor/submit/{sessionId} | Submit summary to Aathma, lock session |
Request / Response Examples
What This Module Does NOT Own
Doctor Scheduling
Handled entirely by Aathma (Narayana Health). Aarokya only submits the clinical summary and stores the reference ID.
Video / Audio Calls
Out of scope for v1. Consultation happens via Narayana Health’s platform after Aathma assigns a care professional.
Summary Generation
Nama Agent generates the clinical summary from the conversation — the Aarokya backend only stores and forwards it.
Database Schema
chat_messages stores the full conversation transcript for audit purposes. The role field distinguishes patient messages (user) from Nama Agent messages (assistant). Messages are stored even after the session is locked.