Sivas039/Medical-Symptom-Checker

0

stars

2

commits

Python

primary language

Nov 8, 2025

updated

README

πŸ₯ SympCheck Plus - AI-Powered Healthcare Assistant

⚑ Latest Update: All optimizations implemented! Single entry point, <10 second response time, universal symptom support, and visible AI reasoning.

SympCheck Plus is an intelligent medical assistant that provides comprehensive symptom assessment, contextual conversations, and hospital recommendations. Built with advanced AI and designed for healthcare support.

✨ Key Features (Optimized)

  • ⚑ Ultra-Fast Diagnosis: Response within 10 seconds
  • πŸ€– Universal Symptom Analysis: Handles ANY symptom type dynamically
  • 🧠 Agentic AI (ReAct): Shows reasoning process step-by-step
  • πŸ₯ Interactive Hospital Locator: Real-time map with nearby hospitals
  • πŸŽ™οΈ Voice Input Support: Audio transcription with Whisper
  • πŸ”Š Text-to-Speech: Audio responses for accessibility
  • πŸ“Š Medical Knowledge Base: RAG-powered information retrieval
  • ⚑ Lazy Loading: Fast startup, deferred AI model loading
  • πŸ›‘οΈ Timeout Protection: No hanging requests, graceful degradation

πŸš€ Quick Start (NEW)

# Single command to run the app:
python gradio_app.py

# Opens at: http://localhost:7860

That's it! No need for run_app.py, run.py, or quick_start.py anymore.

πŸ“Š Project Structure (Reorganized)

SympCheck/
β”œβ”€β”€ gradio_app.py              ← ONLY entry point
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env                       ← Set API keys here
β”‚
β”œβ”€β”€ modules/                   ← AI Components
β”‚   β”œβ”€β”€ llm_agent.py          βœ“ Streaming + timeouts
β”‚   β”œβ”€β”€ medical_agent.py      βœ“ ReAct reasoning engine
β”‚   β”œβ”€β”€ rag_retriever.py      βœ“ Medical knowledge base
β”‚   β”œβ”€β”€ symptom_parser.py     βœ“ Symptom extraction
β”‚   β”œβ”€β”€ hospital_locator.py   βœ“ Map generation
β”‚   └── tts_output.py         βœ“ Audio synthesis
β”‚
β”œβ”€β”€ prompts/                   ← AI Templates
β”‚   β”œβ”€β”€ diagnosis_prompt.txt   (enhanced for any symptom)
β”‚   └── followup_prompt.txt
β”‚
β”œβ”€β”€ data/                      ← Medical Data
β”œβ”€β”€ metrics/                   ← Analytics
β”œβ”€β”€ docs/                      ← Documentation
β”œβ”€β”€ tests/                     ← Unit tests
β”œβ”€β”€ legacy/                    ← Archived launchers
β”‚   β”œβ”€β”€ run_app.py
β”‚   β”œβ”€β”€ run.py
β”‚   β”œβ”€β”€ quick_start.py
β”‚   └── start_app.py
β”‚
└── README.md                  (You are here)

🎯 Performance Improvements

MetricBeforeAfterStatus
Response Time15-20s7-9sβœ…
Symptom Types~30 hardcodedUnlimitedβœ…
AI ReasoningHiddenVisibleβœ…
Hospital DisplayTextInteractive Mapβœ…
Startup TimeSlowFastβœ…
  • Optional: Google Maps API key for hospital locator

Installation Steps

  1. Clone the repository:
git clone <your-repo-url>
cd SympCheck-AI-Healthcare
  1. Create virtual environment:
python -m venv venv

# On Windows:
venv\Scripts\activate

# On Linux/Mac:
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your API keys
  1. Download spaCy model (recommended):
python -m spacy download en_core_web_sm
  1. Run the application:
python gradio_app.py
  1. Access the interface:
    • Open your browser to http://localhost:7860
    • Start describing your symptoms!

πŸ“‹ Environment Configuration

Create a .env file with the following variables:

# LLM Configuration (Optional - for advanced features)
NVIDIA_API_KEY=your_nvidia_api_key_here
NVIDIA_API_BASE=https://integrate.api.nvidia.com/v1
NVIDIA_MODEL=openai/gpt-4o-mini

# Google Maps API (Optional - for hospital locator)
GOOGLE_MAPS_API_KEY=your_google_maps_api_key

# Logging Level
LLM_AGENT_LOGLEVEL=INFO

πŸ”§ Advanced Setup

Medical Database Setup

To use the RAG (Retrieval-Augmented Generation) features:

  1. Download medical dataset:

  2. Build the database:

python build_database.py

This creates FAISS indices for fast medical information retrieval.

Audio Features Setup

For voice input/output features:

  1. Install audio dependencies:
# On Ubuntu/Debian:
sudo apt-get install ffmpeg

# On macOS:
brew install ffmpeg

# On Windows:
# Download ffmpeg and add to PATH
  1. Test audio functionality:
python -c "from modules.audio_input import AudioTranscriber; AudioTranscriber()"

🎯 Usage Examples

Basic Symptom Input

"I have a headache and fever for 2 days"

Detailed Consultation

"I've been experiencing chest pain that gets worse when I breathe deeply. 
It started yesterday evening and I also feel short of breath."

Follow-up Conversation

User: "I have stomach pain"
Assistant: [Provides assessment and questions]
User: "The pain is getting worse and I feel nauseous"
Assistant: [Updates assessment based on new information]

πŸ₯ Hospital Locator

The system can automatically recommend nearby hospitals based on:

  • Symptom severity
  • Your location (IP-based or GPS)
  • Emergency services availability
  • Distance and travel time

Emergency numbers are provided for immediate situations.

🧠 AI Components

Symptom Parser

  • Uses spaCy NLP for advanced symptom extraction
  • Regex fallback for reliability
  • Handles negations and synonyms

LLM Agent

  • Supports NVIDIA API, OpenAI-compatible endpoints
  • Conversation memory and context awareness
  • Local fallback models available

RAG Retriever

  • FAISS vector database for medical knowledge
  • Sentence transformer embeddings
  • Fast similarity search

Audio Processing

  • Whisper for speech-to-text
  • Multiple TTS options (Coqui, gTTS)
  • Audio format conversion

πŸ“Š System Monitoring

The application includes built-in metrics tracking:

  • Session statistics
  • LLM call success rates
  • Symptom detection accuracy
  • User interaction patterns

View metrics through the admin interface (if enabled).

πŸ”§ Development

Running Tests

python -m pytest tests/

Code Style

pip install black flake8
black .
flake8 .

Adding New Features

  1. Create module in modules/
  2. Add tests in tests/
  3. Update documentation
  4. Submit pull request

⚠️ Important Disclaimers

MEDICAL DISCLAIMER: This application is for informational purposes only and is not intended to be a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.

EMERGENCY SITUATIONS: In case of medical emergencies, always call your local emergency services immediately (108 in India, 911 in US, etc.).

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.

πŸ“ž Support

For support and questions:

  • Create an issue on GitHub
  • Check the documentation in docs/
  • Review the troubleshooting section

πŸ™ Acknowledgments

  • MedQuAD dataset for medical knowledge
  • OpenAI Whisper for audio processing
  • Hugging Face for transformer models
  • Google Maps for hospital location services
  • Gradio for the web interface

Built with ❀️ for healthcare accessibility

Contributors

Sivas039

2 commits

Sivas039/Medical-Symptom-Checker

0

stars

2

commits

Python

primary language

Nov 8, 2025

updated

README

πŸ₯ SympCheck Plus - AI-Powered Healthcare Assistant

⚑ Latest Update: All optimizations implemented! Single entry point, <10 second response time, universal symptom support, and visible AI reasoning.

SympCheck Plus is an intelligent medical assistant that provides comprehensive symptom assessment, contextual conversations, and hospital recommendations. Built with advanced AI and designed for healthcare support.

✨ Key Features (Optimized)

  • ⚑ Ultra-Fast Diagnosis: Response within 10 seconds
  • πŸ€– Universal Symptom Analysis: Handles ANY symptom type dynamically
  • 🧠 Agentic AI (ReAct): Shows reasoning process step-by-step
  • πŸ₯ Interactive Hospital Locator: Real-time map with nearby hospitals
  • πŸŽ™οΈ Voice Input Support: Audio transcription with Whisper
  • πŸ”Š Text-to-Speech: Audio responses for accessibility
  • πŸ“Š Medical Knowledge Base: RAG-powered information retrieval
  • ⚑ Lazy Loading: Fast startup, deferred AI model loading
  • πŸ›‘οΈ Timeout Protection: No hanging requests, graceful degradation

πŸš€ Quick Start (NEW)

# Single command to run the app:
python gradio_app.py

# Opens at: http://localhost:7860

That's it! No need for run_app.py, run.py, or quick_start.py anymore.

πŸ“Š Project Structure (Reorganized)

SympCheck/
β”œβ”€β”€ gradio_app.py              ← ONLY entry point
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env                       ← Set API keys here
β”‚
β”œβ”€β”€ modules/                   ← AI Components
β”‚   β”œβ”€β”€ llm_agent.py          βœ“ Streaming + timeouts
β”‚   β”œβ”€β”€ medical_agent.py      βœ“ ReAct reasoning engine
β”‚   β”œβ”€β”€ rag_retriever.py      βœ“ Medical knowledge base
β”‚   β”œβ”€β”€ symptom_parser.py     βœ“ Symptom extraction
β”‚   β”œβ”€β”€ hospital_locator.py   βœ“ Map generation
β”‚   └── tts_output.py         βœ“ Audio synthesis
β”‚
β”œβ”€β”€ prompts/                   ← AI Templates
β”‚   β”œβ”€β”€ diagnosis_prompt.txt   (enhanced for any symptom)
β”‚   └── followup_prompt.txt
β”‚
β”œβ”€β”€ data/                      ← Medical Data
β”œβ”€β”€ metrics/                   ← Analytics
β”œβ”€β”€ docs/                      ← Documentation
β”œβ”€β”€ tests/                     ← Unit tests
β”œβ”€β”€ legacy/                    ← Archived launchers
β”‚   β”œβ”€β”€ run_app.py
β”‚   β”œβ”€β”€ run.py
β”‚   β”œβ”€β”€ quick_start.py
β”‚   └── start_app.py
β”‚
└── README.md                  (You are here)

🎯 Performance Improvements

MetricBeforeAfterStatus
Response Time15-20s7-9sβœ…
Symptom Types~30 hardcodedUnlimitedβœ…
AI ReasoningHiddenVisibleβœ…
Hospital DisplayTextInteractive Mapβœ…
Startup TimeSlowFastβœ…
  • Optional: Google Maps API key for hospital locator

Installation Steps

  1. Clone the repository:
git clone <your-repo-url>
cd SympCheck-AI-Healthcare
  1. Create virtual environment:
python -m venv venv

# On Windows:
venv\Scripts\activate

# On Linux/Mac:
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your API keys
  1. Download spaCy model (recommended):
python -m spacy download en_core_web_sm
  1. Run the application:
python gradio_app.py
  1. Access the interface:
    • Open your browser to http://localhost:7860
    • Start describing your symptoms!

πŸ“‹ Environment Configuration

Create a .env file with the following variables:

# LLM Configuration (Optional - for advanced features)
NVIDIA_API_KEY=your_nvidia_api_key_here
NVIDIA_API_BASE=https://integrate.api.nvidia.com/v1
NVIDIA_MODEL=openai/gpt-4o-mini

# Google Maps API (Optional - for hospital locator)
GOOGLE_MAPS_API_KEY=your_google_maps_api_key

# Logging Level
LLM_AGENT_LOGLEVEL=INFO

πŸ”§ Advanced Setup

Medical Database Setup

To use the RAG (Retrieval-Augmented Generation) features:

  1. Download medical dataset:

  2. Build the database:

python build_database.py

This creates FAISS indices for fast medical information retrieval.

Audio Features Setup

For voice input/output features:

  1. Install audio dependencies:
# On Ubuntu/Debian:
sudo apt-get install ffmpeg

# On macOS:
brew install ffmpeg

# On Windows:
# Download ffmpeg and add to PATH
  1. Test audio functionality:
python -c "from modules.audio_input import AudioTranscriber; AudioTranscriber()"

🎯 Usage Examples

Basic Symptom Input

"I have a headache and fever for 2 days"

Detailed Consultation

"I've been experiencing chest pain that gets worse when I breathe deeply. 
It started yesterday evening and I also feel short of breath."

Follow-up Conversation

User: "I have stomach pain"
Assistant: [Provides assessment and questions]
User: "The pain is getting worse and I feel nauseous"
Assistant: [Updates assessment based on new information]

πŸ₯ Hospital Locator

The system can automatically recommend nearby hospitals based on:

  • Symptom severity
  • Your location (IP-based or GPS)
  • Emergency services availability
  • Distance and travel time

Emergency numbers are provided for immediate situations.

🧠 AI Components

Symptom Parser

  • Uses spaCy NLP for advanced symptom extraction
  • Regex fallback for reliability
  • Handles negations and synonyms

LLM Agent

  • Supports NVIDIA API, OpenAI-compatible endpoints
  • Conversation memory and context awareness
  • Local fallback models available

RAG Retriever

  • FAISS vector database for medical knowledge
  • Sentence transformer embeddings
  • Fast similarity search

Audio Processing

  • Whisper for speech-to-text
  • Multiple TTS options (Coqui, gTTS)
  • Audio format conversion

πŸ“Š System Monitoring

The application includes built-in metrics tracking:

  • Session statistics
  • LLM call success rates
  • Symptom detection accuracy
  • User interaction patterns

View metrics through the admin interface (if enabled).

πŸ”§ Development

Running Tests

python -m pytest tests/

Code Style

pip install black flake8
black .
flake8 .

Adding New Features

  1. Create module in modules/
  2. Add tests in tests/
  3. Update documentation
  4. Submit pull request

⚠️ Important Disclaimers

MEDICAL DISCLAIMER: This application is for informational purposes only and is not intended to be a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.

EMERGENCY SITUATIONS: In case of medical emergencies, always call your local emergency services immediately (108 in India, 911 in US, etc.).

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.

πŸ“ž Support

For support and questions:

  • Create an issue on GitHub
  • Check the documentation in docs/
  • Review the troubleshooting section

πŸ™ Acknowledgments

  • MedQuAD dataset for medical knowledge
  • OpenAI Whisper for audio processing
  • Hugging Face for transformer models
  • Google Maps for hospital location services
  • Gradio for the web interface

Built with ❀️ for healthcare accessibility

Contributors

Sivas039

2 commits

Languages

Python

98.5%