Global Health
Microscopy
Edge AI
Tropical Diseases

NTD-Assist

An offline multimodal AI prototype for microscopy-based NTD screening, with 12 rule-based biological checks that block or flag outputs that contradict known biology (for example, malaria reported from a tissue sample). It is designed to run on consumer hardware without an internet connection.

The Clinical Problem

"Neglected tropical diseases affect over a billion people, mostly in low-resource settings. Microscopy remains a frontline diagnostic tool there, but expert microscopists are scarce and general lab staff often work without specialist backup."

How It Works

1. Image Quality & Enhancement

  • →Blur detection, underexposure/overexposure checks
  • →Giemsa-stain specific preprocessing (green-channel extraction)
  • →Adaptive sharpening for parasite morphology clarity

2. Multimodal LLM Inference

  • →Primary: MedGemma 4B-IT (4-bit quantized, 6GB VRAM)
  • →Fallback: Qwen2-VL-2B-Instruct (CPU, no GPU needed)
  • →Auto-detects environment: GPU vs CPU at startup

3. Structured JSON Parsing

  • →Pydantic-based schema via VLM-Guard Analysis
  • →Fields: detected_disease, confidence, species, severity
  • →Morphological evidence, recommendations, and rationale

4. Biological Guardrails (12 Rules)

  • →SampleTypeImpossibilityRule: catches impossible sample-type combos
  • →MalariaValidationRule: validates RBC morphology, infers species
  • →SizeAwareRule: catches morphometric impossibilities
  • →NegativeValidationRule: 200 HPFs required for negative diagnosis
  • →ThickSmearRule: adjusts confidence for thick smear preparations

5. Report Generation

  • →Structured JSON output with full validation audit trail
  • →Clinician-friendly PDF with visual evidence and disclaimer
  • →Expandable debug log for diagnostic transparency

Safety & Trust

Every output passes through deterministic, auditable guardrails before reaching the user. No black boxes. No unseen failures.

BlockSample-Type Enforcement

Blocks sample-type combinations the rules define as impossible: malaria requires a blood smear (not tissue), schistosomiasis requires urine/stool, onchocerciasis requires a skin snip.

CorrectSpecies Disambiguation

Disambiguates morphologically similar parasites: microfilaria vs trypanosome in blood smears, sheath presence for Onchocerciasis vs Loiasis.

PromoteUnclear Finding Promotion

When morphological indicators strongly suggest a diagnosis but the LLM is uncertain, promotes the finding with appropriate confidence adjustment.

BlockNegative Result Rigor

'Negative for Parasites' requires >200 high-power fields examined, adequate staining, and specific search targets — otherwise the result is flagged for review.

About This Project

NTD-Assist was built for the MedGemma Impact Challenge on Kaggle to explore how microscopy screening support could work where experts are scarce. The system uses MedGemma 4B-IT (quantized to 4-bit) for edge deployment, with graceful fallback to Qwen2-VL-2B-Instruct on CPU. What makes it safe is the 12-rule biological validation layer built on VLM-Guard: rules check sample-type compatibility (malaria requires blood, schistosomiasis requires urine/stool), validate parasite morphology (sheath presence, spine position, organism size), and enforce diagnostic rigor (200 HPFs required for a negative result). The system outputs structured JSON reports with confidence levels, species identification, and a clinician-friendly PDF.

Key Features

  • 7 supported NTDs: Malaria, Leishmaniasis, Trypanosomiasis, Filariasis, Schistosomiasis, Onchocerciasis, Loiasis
  • 12 biological validation guardrails via VLM-Guard
  • Edge-deployed: runs on consumer hardware (6GB VRAM minimum)
  • Fully offline: zero API calls, no internet required
  • CPU fallback: Qwen2-VL-2B-Instruct when no GPU available
  • PDF report generation with clinician-friendly formatting
  • Hugging Face Spaces deployment with auto GPU/CPU detection
  • Sample images included for testing and education

Impact

  • →Built for the Kaggle MedGemma Impact Challenge as a global-health prototype
  • →Not clinically validated: intended for research and education, not diagnosis
  • →Open source on GitHub + live demo on Hugging Face Spaces
  • →Fully offline operation enables deployment in low-connectivity settings

Technology Stack

Python
MedGemma 4B-IT
Qwen2-VL-2B-Instruct
Transformers
bitsandbytes (4-bit)
Streamlit
VLM-Guard
fpdf
PyTorch

Building a clinical AI system of your own?

The Clinical AI Reliability Audit applies the same kind of evaluation and safety engineering to your system: architecture and risk discovery, evaluation and root cause analysis, and targeted engineering improvements. For a working healthcare app built with AI coding tools, the Clinical Prototype Readiness Review is the smaller starting point.

Related Projects

This project is part of a connected ecosystem. Each piece reinforces the same mission: safe, trustworthy clinical AI.

Mohamed Fakhry

Physician-Engineer working on clinical AI architecture, engineering and reliability, and on healthcare software that has to hold up in real-world use.

Physician-Engineer (M.B.B.Ch.) • Clinical AI Engineering • Former CEO

Connect

Building reliable, production-grade healthcare AI systems.

© 2026 Mohamed Fakhry. All rights reserved.

Built with care using modern web technologies