Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TabeebAI

Live Demo TabeebAI Overview

AI Powered Clinical Triage System for Urdu and English Speaking Patients


Python Streamlit Groq Whisper RAG Sentence Transformers License Status



Overview


TabeebAI is a clinical decision support system designed to assist healthcare providers in performing rapid, structured patient triage in both Urdu and English.



Key Features


  • Bilingual Input Handling — accepts patient statements in Urdu or English, through text or audio, with automatic language detection.
  • Speech Transcription — converts recorded or uploaded patient audio into text using Whisper Large V3 Turbo.
  • Automatic Translation — Urdu input is translated into clinical English before downstream processing, while preserving medical meaning.
  • Query Classification — every statement is classified as medical, non medical, or a mental health crisis before triage continues, with crisis cases routed directly to support resources.
  • Structured Symptom Extraction — extracts chief complaint, individual symptoms, severity, duration, and urgency level in a strict JSON schema.
  • Risk Scoring Engine — a deterministic scoring model combines urgency level, symptom severity, emergency keyword detection, and symptom count into a 0 to 100 risk score, mapped to Green, Yellow, or Red triage levels.
  • Disease Symptom Matching — extracted symptoms are matched against a structured disease symptom dataset to surface statistically likely conditions.
  • Retrieval Augmented Knowledge — a sentence embedding model retrieves the most relevant medical reference passages to ground the generated report in factual context.
  • SOAP Report Generation — produces a complete Subjective, Objective, Assessment, and Plan report formatted for clinical use.
  • Human in the Loop Review — physicians can edit, confirm, and sign off on generated reports before they are finalized or downloaded.
  • Multi Dashboard Interface — separate views for patients, doctors, and developers, each tailored to its audience.
  • Pipeline Observability — full visibility into stage by stage execution time, retrieved knowledge chunks, disease matches, and model usage for debugging and audit purposes.



How It Works


  1. Patient input is received as typed text or recorded or uploaded audio.
  2. If audio is provided, it is transcribed using Whisper and the resulting language is detected.
  3. If the input is Urdu, it is translated into English using a Groq hosted LLaMA model.
  4. The translated statement is classified as medical, non medical, or crisis.
  5. Medical statements proceed to structured symptom extraction in JSON format.
  6. A deterministic risk score and triage level are computed from the extracted data.
  7. Extracted symptoms are matched against a disease symptom dataset to identify probable conditions.
  8. Relevant medical knowledge passages are retrieved using sentence embedding similarity search.
  9. A SOAP formatted clinical report is generated using the extracted data and retrieved context.
  10. The report is presented to the physician for review, editing, and confirmation before being finalized.



Dashboards


Patient Dashboard
Presents a simplified summary of the triage outcome, including risk level, identified symptoms, chief complaint, and clear next step instructions written for a non clinical audience.



Doctor Dashboard
Provides the full clinical picture, including the SOAP report with editing and sign off controls, detailed symptom breakdown, disease matching results, and retrieved reference knowledge.



Developer Dashboard
Exposes pipeline execution status, stage by stage timing breakdowns, raw JSON output, retrieval debug information, and the specific models used at each stage of the pipeline.



Risk Scoring Logic


Risk is calculated using a weighted, rule based model rather than a black box prediction, which keeps the scoring transparent and auditable.

  • Base score is assigned according to extracted urgency level.
  • Additional points are added based on the severity of each reported symptom.
  • A fixed bonus is applied if known emergency keywords are detected in either English or Urdu.
  • A small additional weight is applied based on total symptom count.
  • The final score is capped at 100 and mapped to a Green, Yellow, or Red triage category.



Tech Stack


Layer Technology
Frontend and Application Framework Streamlit
Language Model Inference Groq API, LLaMA 3.3 70B Versatile, LLaMA 3.1 8B Instant
Speech Transcription Whisper Large V3 Turbo
Embeddings and Retrieval Sentence Transformers, all MiniLM L6 v2
Data Processing Pandas, NumPy
Core Language Python
Deployment Streamlit Community Cloud



Project Structure


tabeeb/
├── app.py                     Main Streamlit application and pipeline logic
├── data/
│   ├── diseases_symptoms.csv  Disease and symptom reference dataset
│   └── medical_knowledge.json Knowledge base used for retrieval augmented generation
├── assets/
│   ├── logo.png                Application logo
│   └── agahi_logo.png          Organization logo
└── README.md                   Project documentation



Installation


Clone the repository.

git clone https://github.com/hamaylzahid/tabeeb.git
cd tabeeb

Create and activate a virtual environment.

python -m venv venv
venv\Scripts\activate        for Windows
source venv/bin/activate     for macOS or Linux

Install the required dependencies.

pip install -r requirements.txt

Set the Groq API key as an environment variable.

export GROQ_API_KEY=your_api_key_here      for macOS or Linux
set GROQ_API_KEY=your_api_key_here         for Windows

Run the application.

streamlit run app.py



Usage


  1. Open the application in a browser using the local or deployed URL.
  2. Select Text Input or Audio Input from the sidebar.
  3. Enter patient symptoms in Urdu or English, or record or upload a voice statement.
  4. Click Analyze to run the full triage pipeline.
  5. Review the risk level, generated SOAP report, and recommended next steps in the relevant dashboard.
  6. Doctors may edit and confirm the SOAP report before downloading it in text or markdown format.



Live Demo




Disclaimer


TabeebAI is a clinical decision support tool. It is not a diagnostic system and must not be used as a substitute for professional medical judgment. All AI generated outputs, including risk scores and SOAP reports, must be reviewed and approved by a licensed healthcare professional before being used for any clinical decision. In cases of suspected medical emergency, contact local emergency services immediately.



License


This project is released under the MIT License. See the LICENSE file in the repository for full terms.

About

AI-powered bilingual clinical triage system for Urdu & English using Whisper, Llama 3.3, RAG, ChromaDB, and Streamlit.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages