Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Medical Clinic Virtual Assistant

An AI-powered chatbot built with Streamlit and OpenAI's GPT models to help patients navigate medical specialties and clinic services. This virtual assistant provides empathetic, professional guidance to help patients understand which medical specialty they should consult based on their symptoms and needs.

Streamlit OpenAI Python

Description

This project demonstrates the practical application of AI in healthcare communication. The chatbot serves as a first point of contact for patients, helping them:

  • Understand medical specialties - Get clear explanations of what each specialty treats
  • Navigate symptoms - Receive guidance on which specialist to consult based on symptoms
  • Access clinic information - Learn about office hours, insurance acceptance, and appointment scheduling
  • Get empathetic support - Interact with a professional, welcoming AI assistant

The assistant is designed to be informative without making medical diagnoses, always encouraging patients to schedule proper in-person consultations for accurate medical evaluation.

Features

AI Capabilities

  • Real-time streaming responses using OpenAI's GPT models
  • Context-aware conversations with session memory
  • Empathetic and professional tone tailored for healthcare
  • Symptom-to-specialty guidance without making diagnoses
  • Multilingual potential (currently configured for English)

🔄 Main Conversation Flow

flowchart TD
    A[Patient Opens Chatbot] --> B[Welcome Message Displayed]
    B --> C[Patient Enters Question/Symptom]
    C --> D{Question Type?}
    
    D -->|Symptom-based| E[AI Analyzes Symptoms]
    D -->|General Info| F[AI Provides Clinic Info]
    D -->|Specialty Question| G[AI Explains Specialty]
    
    E --> H[Suggest Appropriate Specialty]
    F --> I[Share Hours/Insurance/Scheduling]
    G --> J[Detail Specialty Coverage]
    
    H --> K[Recommend In-Person Consultation]
    I --> K
    J --> K
    
    K --> L[Display Response with Streaming]
    L --> M[Save to Conversation History]
    M --> N{Continue Conversation?}
    
    N -->|Yes| C
    N -->|No| O[End Session]
    
    style A fill:#e1f5ff
    style L fill:#fff4e1
    style K fill:#ffe1e1
    style O fill:#e1ffe1
Loading

Getting Started

Prerequisites

  • Python 3.8 or higher
  • OpenAI API key (Get one here)
  • pip (Python package manager)

Installation

  1. Clone the repository

  2. Install dependencies

pip install streamlit openai

Or create a requirements.txt:

streamlit>=1.28.0
openai>=1.3.0

Then install:

pip install -r requirements.txt
  1. Configure OpenAI API Key

Create a .streamlit/secrets.toml file in the project root:

OPENAI_API_KEY = "your-openai-api-key-here"
  1. Run the application
streamlit run app.py

The app will open automatically in your browser at http://localhost:8501

Usage Examples

Example Conversations

Symptom-based inquiry:

User: "I have chest pain, which doctor should I see?"
Assistant: "Chest pain can be serious and should be evaluated promptly. 
I recommend seeing our Cardiology specialist who focuses on heart and 
cardiovascular conditions. However, if you're experiencing severe chest 
pain, please seek emergency medical attention immediately..."

General information:

User: "What are your office hours?"
Assistant: "Our clinic is open Monday to Friday from 7am to 7pm, and 
Saturdays from 8am to 12pm. We're closed on Sundays and major holidays..."

Specialty information:

User: "What does a dermatologist treat?"
Assistant: "Our Dermatology department treats various skin conditions 
including acne, eczema, psoriasis, skin cancer screening, mole removal, 
and also offers aesthetic treatments like anti-aging procedures..."

Technical Architecture

Tech Stack

  • Frontend: Streamlit
  • AI Model: OpenAI GPT-3.5-turbo
  • Language: Python 3.8+

Key Components

  1. Session State Management: Maintains conversation history
  2. Streaming Responses: Real-time token-by-token display
  3. System Prompts: Carefully crafted instructions for medical context
  4. Error Handling: Graceful handling of API errors

Security & Privacy

  • No data storage: Conversations are not persisted after session ends
  • API key protection: Keys stored in secure secrets file
  • No medical diagnosis: Assistant explicitly avoids making diagnoses

Local Development

streamlit run app.py

Disclaimer

This chatbot is for informational purposes only and does not provide medical advice, diagnosis, or treatment. Always seek the advice of qualified health providers with any questions regarding medical conditions. In case of emergency, call your local emergency services immediately.

About

An AI-powered chatbot built with Streamlit and OpenAI's GPT models to help patients navigate medical specialties and clinic services.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages