Skip to content

AI-powered clinical decision support that chains vector search, medical imaging, and expert reasoning to provide instant diagnostic assistance for healthcare professionals.

License

Notifications You must be signed in to change notification settings

N-45div/ElitOrc-AI

Repository files navigation

ElitorcAI - TiDB AgentX Hackathon

Multi-Step Agentic Clinical AI System

ElitorcAI is an advanced multimodal clinical AI assistant that demonstrates real-world agentic workflows using TiDB Serverless for vector search and clinical case analysis. Built for the TiDB AgentX Hackathon, this system showcases multi-step AI agents that go beyond simple RAG to deliver comprehensive clinical decision support.

Multi-Step Agentic Workflow:

flowchart TD
    A[πŸ“‹ Patient Input<br/>Medical Images + Symptoms] --> B[πŸ” Step 1: Medical Image Analysis<br/>Roboflow AI Detection]
    B --> C[🧠 Step 2: Embedding Generation<br/>Cohere Text Embeddings]
    C --> D[πŸ”Ž Step 3: Vector Search<br/>TiDB Similarity Search]
    D --> E[βš•οΈ Step 4: Clinical Reasoning<br/>Groq LLM Synthesis]
    
    F[(πŸ—„οΈ TiDB Serverless<br/>Vector Database)] -.-> D
    G[πŸ“Š MultiCaRe Dataset<br/>200+ Clinical Cases] -.-> F
    
    E --> H[πŸ“„ Structured Clinical Report<br/>β€’ Primary Diagnosis<br/>β€’ Similar Cases<br/>β€’ Treatment Plan]
    
    style A fill:#f9f9f9,stroke:#333,stroke-width:2px,color:#000
    style B fill:#f9f9f9,stroke:#333,stroke-width:2px,color:#000
    style C fill:#f9f9f9,stroke:#333,stroke-width:2px,color:#000
    style D fill:#f9f9f9,stroke:#333,stroke-width:2px,color:#000
    style E fill:#f9f9f9,stroke:#333,stroke-width:2px,color:#000
    style F fill:#e6e6e6,stroke:#333,stroke-width:2px,color:#000
    style G fill:#e6e6e6,stroke:#333,stroke-width:2px,color:#000
    style H fill:#f9f9f9,stroke:#333,stroke-width:2px,color:#000
Loading

🧠 Dr. AMIE - Clinical AI Agent

Dr. AMIE (Advanced Multimodal Intelligence for Emergency care) is a sophisticated clinical AI that:

  • Analyzes medical images (X-rays, CT scans, MRI) using Roboflow integration
  • Searches clinical databases for similar cases using TiDB vector search
  • Provides differential diagnoses with confidence levels
  • Recommends diagnostic workups and treatment plans
  • Ingests new cases into the knowledge base for continuous learning

πŸ”§ Technical Architecture

  • Frontend: Next.js with Mastra framework
  • Backend: Unified Mastra server with agent orchestration
  • Database: TiDB Serverless with vector search capabilities
  • LLM: Groq (Llama 3.3 70B)
  • Embeddings: Cohere embed-english-v3.0
  • Image Analysis: Roboflow API
  • Memory: LibSQL with persistent storage

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • TiDB Serverless account
  • API keys for Groq, Cohere, and Roboflow

Installation

git clone https://github.com/N-45div/ElitOrc-AI
npm install
cp env.example .env
# Configure your API keys in .env

Database Scripts

npm run seed              # Seed with sample clinical cases
npm run seed:multicare    # Seed with MultiCaRe dataset (with embeddings)
npm run test:tidb         # Test TiDB connection and functionality
npm run reset:tidb        # Reset TiDB tables

Run the Application

# Start Mastra server (port 3001)
npx mastra dev

# In another terminal, start Next.js frontend (port 3000)
npm run dev

Test the System

Visit http://localhost:3001 for the Mastra playground or http://localhost:3000 for the full chat interface.

Example Queries:

  • "A 45-year-old male presents with chest pain, shortness of breath, and fatigue for the past 3 days. He has a history of hypertension and smoking. What should I consider?"
  • "Analyze this MRI scan for a patient with lower back pain"
  • "Find similar cases for a 67-year-old female with COPD and pneumonia"

πŸ—οΈ Multi-Step Workflow

  1. Patient Query Input β†’ Clinical symptoms, medical history, images
  2. TiDB Vector Search β†’ Find similar historical cases using embeddings
  3. Image Analysis β†’ Roboflow API processes medical images
  4. LLM Clinical Reasoning β†’ Groq analyzes all data for diagnosis
  5. Case Documentation β†’ Novel cases ingested back into TiDB
  6. Clinical Report β†’ Structured output with recommendations

πŸ“Š Data Flow

Patient Input β†’ Embedding Generation β†’ TiDB Vector Search β†’ Similar Cases
     ↓                                                           ↓
Medical Images β†’ Roboflow Analysis β†’ Clinical Context β†’ LLM Analysis
     ↓                                                           ↓
Structured Report ← Clinical Reasoning ← Combined Evidence ← Case History

🎯 Innovative Features

  • Real-World Impact: Actual clinical decision support system
  • Multi-Step Agents: Complex workflows beyond simple Q&A
  • TiDB Vector Search: Leverages TiDB Serverless vector capabilities
  • Continuous Learning: New cases automatically indexed
  • Multimodal Integration: Text, images, and structured data

πŸ”§ Technical Implementation

Vector Database (TiDB Serverless)

  • Clinical case storage with vector embeddings
  • Cosine similarity search for case matching
  • Scalable cloud-native architecture

Agent Architecture

  • Mastra framework for agent orchestration
  • Tool-based architecture with composable functions
  • Memory persistence with LibSQL

API Integrations

  • Groq: LLM inference with Llama 3.3 70B
  • Cohere: High-quality medical text embeddings
  • Roboflow: Medical image analysis and detection

Data Processing Pipeline

  • Parquet File Support: Process large medical datasets efficiently
  • Batch Processing: Handle thousands of clinical cases with optimized memory usage
  • Embedding Generation: Create semantic vectors for similarity search
  • Database Migration Scripts: Seamless data import and management

🌟 Key Features

Clinical Decision Support

  • Multi-modal analysis (text + medical images)
  • Evidence-based recommendations with confidence scores
  • Similar case retrieval for complex presentations
  • Risk stratification based on historical outcomes

Radiology Support

  • MRI/CT scan analysis with Roboflow integration
  • Comparison with similar imaging findings
  • Automated reporting with confidence scores

Medical Education

  • Case-based learning with similar patient scenarios
  • Clinical reasoning development
  • Evidence-based medicine integration

Advanced Data Processing

  • MultiCaRe Dataset Integration: Process large-scale medical case datasets from Zenodo
  • Batch Embedding Generation: Efficient processing with Cohere embeddings
  • Vector Database Seeding: Populate TiDB with real clinical cases for similarity search

πŸ”’ Privacy & Compliance

  • No PHI stored in vector embeddings
  • Anonymized clinical cases only
  • HIPAA-compliant architecture ready
  • Audit trails for all clinical decisions

πŸ“Š Dataset Attribution

This project utilizes the MultiCaRe Dataset for training and evaluation:

  • Dataset: MultiCaRe - A Multi-Domain Dataset for Case Report Classification
  • Source: Zenodo Repository
  • GitHub: MultiCaRe Dataset Repository
  • License: Open source dataset for research purposes
  • Citation: Nievoff, M., et al. (2024). MultiCaRe: A Multi-Domain Dataset for Case Report Classification

The dataset contains anonymized clinical case reports across multiple medical domains, enabling robust similarity search and clinical decision support capabilities.

πŸ“ˆ Future Roadmap

  • Real-time clinical alerts and notifications
  • Integration with EHR systems
  • Mobile app for point-of-care use
  • Federated learning across healthcare networks

Built for TiDB AgentX Hackathon 2025 | Team: ElitorcAI | License: MIT

About

AI-powered clinical decision support that chains vector search, medical imaging, and expert reasoning to provide instant diagnostic assistance for healthcare professionals.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published