CorticoDB- Clinical Data Agent (Text to SQL AI App)

LLM
ChromaDB
Langgraph
React
Docker
CI/CD
LLMOps
Langsmith
Railway
FASTAPI
Author

Prasad Bhoite

Typing Animation

Tip

CorticoDB is an Agentic Text to SQL AI platform that democratizes access to complex clinical databases—specifically the MIMIC-III ICU database—using natural language queries.

Unlike standard chatbots, CorticoDB avoids hallucinations using an Agentic Orchestrator that:

  • Consults a RAG Knowledge Base
  • Generates syntactically correct PostgreSQL SQL
  • Safely executes SQL
  • Returns real data with full accuracy

🚀 Features

  • 🤖 Agentic Workflow: Decoupled Orchestrator and RAG agents for reasoning vs. retrieval.
  • 🧠 Self-Healing Brain: RAG service automatically detects corruption and rebuilds its vector index on startup.
  • 🏥 Clinical Domain Intelligence: Specialized knowledge of 26+ complex healthcare tables.
  • 🛡️ BYOK Architecture: “Bring Your Own Key” security ensures user API keys are never stored server-side.
  • 🚀 Production DevOps: Fully containerized with Docker and deployed via a multi-environment (Staging/Prod) CI/CD pipeline. admin app.

🧱 MLOps & Professional Practices

  • 🔄 CI/CD: Automated multi-environment deployment pipeline (Dev \(\to\) Staging \(\to\) Production) using GitHub Actions.
  • 🏗️ Architecture: Decoupled Microservices (React Frontend, FastAPI Orchestrator, ChromaDB Agent) ensuring modularity and independent scaling.
  • 👁 Observability: End-to-end request tracing with LangSmith to monitor RAG retrieval quality and SQL generation latency.
  • 📦 Containerization: Optimized, multi-stage Docker images for both Python (FastAPI/UV) and Node.js (Vite) services.
  • 🧠 Resiliency: Self-Healing RAG agent that automatically detects vector store corruption and rebuilds its “Brain” from configuration on startup.
  • 🛡️ Security: Strict 12-Factor App configuration with split secrets for isolated Staging and Production environments.

🧬 Tech Stack


🧬 Demo (Click the play button to view the demo video.)


🏗️ System Architecture

This project utilizes a distributed microservices architecture, decoupling the user interface, orchestration logic, and knowledge retrieval into independent, scalable containers.

The system is composed of three primary services communicating via REST APIs:

Frontend: A modern React (Vite) application that provides the chat interface.

Orchestrator: A FastAPI service that manages logic, sanitizes inputs, and communicates with OpenAI.

RAG Agent: A specialized Microservice (FastAPI + ChromaDB) that acts as the system’s “Brain,” performing semantic search over the database schema.

Runtime Architecture Diagram


CI/CD Workflow


⚡ Getting Started

▶️ Running the Application

  1. Access in Browser Open: https://frontendreact-production-7599.up.railway.app/

🖼️ Screenshots

1. Landing Page:

2. Simple Data Extraction:

3. Group By: