Skip to content

omariut/doctor-appointment-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ AI-Powered Doctor Appointment Assistant

An AI-powered assistant that helps doctors streamline appointment bookings and improve the overall patient experience.

This repo demonstrates practical use of LangChain, FastAPI, Qdrant, Retrieval-Augmented Generation (RAG), conversational memory, and custom tool integrations.


✨ Features

βœ… Patients can ask for a doctor or describe their disease naturally. βœ… RAG-based retrieval of doctor info from Qdrant. βœ… Maintains chat history for contextual conversations. βœ… Uses LangChain tools to save appointments. βœ… Appointments stored in JSON file (easily replaceable with DB).


πŸ–ΌοΈ Demo Flow

  1. User sends a query: "I have a skin disease."
  2. Assistant processes the query through the LLM (Gemini via LangGraph).
  3. Tool calling is triggered:
    • Qdrant Vector Store β†’ retrieves the most relevant doctor based on embeddings.
    • Appointment Tool β†’ handles date, time, and patient information.
  4. Chat history is appended and preserved across turns, so the assistant remembers context during the session.
  5. The assistant orchestrates the tools and combines results into a natural response.
  6. Data persistence:
    • For now, appointments are saved in appointments.json.
    • Future plan: replace with PostgreSQL + checkpointer for persistent history.

πŸ”„ System Flow Diagram

sequenceDiagram
    participant U as User
    participant A as AI Assistant
    participant Q as Qdrant (Vector DB)
    participant T as Tool (save_appointment)

    U->>A: "I have a skin disease"
    A->>Q: Retrieve doctor info
    Q-->>A: Return relevant doctor (e.g. Dermatologist)
    A->>U: Suggest doctor and ask for date/time/name
    U->>A: Provides details
    A->>T: Save appointment to appointments.json
    T-->>A: Confirmation
    A->>U: "Your appointment is booked with Dr. Sara"
Loading

#Langgraph Flow Diagram

          +---------------------+
          |        START        |
          +---------------------+
                    |
                    v
   +-------------------------------+
   |      response_with_tools      |
   +-------------------------------+
                    |
                    v
          +-----------------+
          |    tool_node    |
          +-----------------+
              /         \
             /           \
            v             v
+-------------------+   +-------------------+
| response_without_ |   |        END        |
|      _tools       |   +-------------------+
+-------------------+
        |
        v
+-------------------+
|        END        |
+-------------------+


πŸ› οΈ Tech Stack


βš™οΈ Setup & Run

1️⃣ Clone Repository

git clone https://github.com/your-username/ai-doctor-assistant.git
cd ai-doctor-assistant

2️⃣ Setup Virtual Environment

python -m venv venv
source venv/bin/activate   # Linux/Mac
venv\Scripts\activate      # Windows

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Run FastAPI Server

First, create a .env file in the project root and add the required environment variables (update values as needed):

uvicorn app.main:app --reload

5️⃣ Test the Assistant

You can quickly test the assistant from the homepage.
Simply type a message (e.g., β€œI have a skin disease”) in the chat box.

image

πŸš€ Roadmap

  • Add authentication & role-based access

  • Deploy with Docker + Nginx + Cloud (AWS/DigitalOcean)

  • Add a doctor registration page and injest data to qdrant

  • Replace JSON file storage with PostgreSQL

  • Use LangGraph instead of LangChain

  • Move document search to tools to enable document search only when needed

  • Implement PostgreSQL checkpointer for persistent chat history

  • Add routing to enable document search only when needed

  • Add appointment search to check doctor's availability


πŸ‘¨β€πŸ’» Author

Omar Faruk πŸ“§ omar.iut.09@gmail.com πŸ”— LinkedIn


⭐ If you found this project interesting, don’t forget to star this repo!

About

πŸ₯ Open-source AI assistant for hospitals that helps patients book doctors appointments. πŸ“š LangChain + πŸ€– AI for RAG, πŸ—„οΈ PostgreSQL for appointments, ⚑ FastAPI backend, and πŸ” Qdrant for doctor details.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors