Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🩺 DoctorAI β€” Advanced AI Cardiologist (WHO + AHA Guided)

DoctorAI is a clinical‑grade cardiology support system powered by LLMs (Ollama / Llama 3), WHO 2025 guidelines, medical symptom mapping, OCR analysis, and intelligent emergency classification.

This is NOT a simple chatbot β€” it is a full medical AI framework with:

  • Emergency detection (AHA/WHO compliant)
  • Local medical database fusion
  • WHO cardiology data integration
  • Symptom-to-disease reasoning
  • OCR support for ECG / reports
  • Session memory + anonymized logging
  • Streaming responses (ChatGPT-style)

It is designed for educational + research purposes only.


πŸš€ Features

1. πŸ”₯ Real-time Emergency Detection (AI Triage System)

DoctorAI classifies user symptoms into:

  • LEVEL 1 β€” EMERGENCY β†’ β€œCall 108 / go to hospital NOW”
  • LEVEL 2 β€” URGENT β†’ Consult doctor within 24 hours
  • LEVEL 3 β€” NON-URGENT β†’ General guidance

Uses AHA 2025 + ESC 2024 approved symptom patterns.


2. 🧠 Symptom Matching Engine

Maps symptoms to possible diseases using symptom_disease_map.json.

Example:

'chest pain' β†’ possible: Angina, MI, GERD

3. πŸ—‚ Multi-source Medical Knowledge Fusion

DoctorAI pulls data from:

  • cardio_faq.json (common questions)
  • cardio_tips.json (verified health tips)
  • clinics.json (local cardiology centers)
  • who_cardiology_data.json (WHO medical data)

All relevant information is automatically merged into the LLM prompt.


4. 🧾 OCR Support for Medical Reports

If user uploads files like:

  • ECG
  • Cholesterol report
  • Blood test
  • Medical scan

DoctorAI extracts text using Tesseract OCR and includes it in analysis.


5. πŸ’¬ LLM Streaming (ChatGPT-like)

Responses are streamed chunk-by-chunk for smooth real-time conversation.


6. πŸ” Safety + Ethics Layer

WHO 2025 AI Ethics built-in:

  • No diagnosis
  • No prescriptions
  • Transparency
  • User consent system
  • Anonymized audit logs (HIPAA-like)

Every response ends with a mandatory disclaimer.


7. 🧠 Session Memory + Caching

  • Remembers last 5 user questions (only if consented)
  • Full anonymized logs
  • Smart caching for repeated queries

πŸ“ Project Structure

DoctorAI/
│── app.py                  # Main Flask server
│── uploads/                # User uploaded medical files
│── local_db/
β”‚     β”œβ”€β”€ cardio_faq.json
β”‚     β”œβ”€β”€ cardio_tips.json
β”‚     β”œβ”€β”€ clinics.json
β”‚     β”œβ”€β”€ symptom_disease_map.json
β”‚     β”œβ”€β”€ ai_cache.json
β”‚     └── session_memory.json
β”‚
β”œβ”€β”€ data_sources/
β”‚     └── who_cardiology_data.json
β”‚
└── index.html              # Optional frontend UI

πŸ’» How It Works (Core Flow)

  1. User sends message β†’ /chat endpoint

  2. System checks:

    • Local DB matches
    • WHO data
    • Symptom patterns
    • Emergency triggers
  3. Builds a smart medical prompt

  4. Passes to Ollama β†’ streams response

  5. Adds ethics disclaimer

  6. Logs anonymized query


πŸ”§ Setup Instructions

1. Install Requirements

pip install flask flask-cors requests fuzzywuzzy python-Levenshtein pytesseract pillow

2. Install Tesseract OCR

3. Install & Run Ollama

ollama pull llama3:8b
ollama serve

4. Run DoctorAI

python app.py

Server runs at:

http://localhost:5000

πŸ”Œ API Endpoints

POST /chat

Chat with DoctorAI.

{
  "message": "I have chest pain radiating to my left arm"
}

POST /upload-image

Upload ECG / medical reports.

GET /health

Health check.


πŸ›‘ Ethics Disclaimer (Auto-injected)

DoctorAI is NOT a doctor. It provides educational guidance only. Always consult a certified cardiologist.


🌟 Why This Project Is Special

This is not just an LLM frontend. It is a complete medical intelligence pipeline:

  • Risk classification
  • Symptom inference
  • WHO-level knowledge
  • Real-time triage
  • OCR medical analysis
  • AI context merging

This puts the project in research + startup level domain.


πŸ§‘β€πŸ’» Built By

Sanu Sharma β€” AI Engineer & Innovator

If you use this project, give credit to the original creator.


πŸ“¬ Contact

About

AI Cardiologist using WHO guidelines, Llama-3, emergency detection, symptom mapping, and OCR medical analysis. (Research Only)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages