
Project Breakdown (STAR)
Situation
Clinical experts often face significant delays when trying to validate medical hypotheses because they rely heavily on specialized data engineers to query and extract information from complex, highly-regulated healthcare databases.
Task
The objective was to bridge the gap between clinical expertise and data science by building an intelligent copilot that allows medical professionals to query complex datasets directly using natural language, without waiting for human intermediaries.
Action
Engineered a multi-agent AI workflow using LangGraph and DuckDB. The system uses ClinicalBERT and FAISS to ground medical terminology to actual database schemas, dynamically generating accurate SQL queries while enforcing strict Human-In-The-Loop (HITL) checkpoints.
Result
Created an auditable, transparent analytics assistant that empowers clinicians to rapidly explore health data. This drastically reduces the turnaround time for hypothesis testing while preserving data security and exposing the analytical path for clinical review.
System Architecture Gallery
The core design utilizes a multi-agent workflow: interpreting the question, mapping the request to a data schema, proposing SQL/statistical operations, and enforcing Human-In-The-Loop (HITL) review steps.
Agent Pipeline Workflow
Routing, clarification, grounding, and SQL generation.
HITL Checkpoint Design
Compulsory review points before sensitive analytical steps.
Clinical Vocabulary Resolution
Grounding terms via ClinicalBERT, FAISS, and ATHENA metadata.
The Multi-Agent Workflow
Classifies the analytical type (cohort counting, trends, etc.). An Intent Clarifier detects underspecified questions and asks the user for clarification before forcing a query.
Maps natural-language concepts to known tables, fields, and controlled vocabularies using FAISS and ClinicalBERT, preventing the AI from hallucinating invalid medical columns.
A dedicated SQL agent receives dynamic schema pruning (only relevant metadata) to generate explainable DuckDB SQL, drastically reducing prompt clutter and errors.
Positions the assistant as a copilot, not an autonomous doctor. Intermediate artifacts (query plans, generated SQL) are stored in a Data Registry for human review and auditing.
Technologies Stack
Selected References
- Yao et al. (2023), ReAct: Synergizing Reasoning and Acting in Language Models.
- Wang et al. (2023), Plan-and-Solve Prompting.
- Alsentzer et al. (2019), Publicly Available Clinical BERT Embeddings.
- Hollmann et al. (2023), CAAFE: Context-Aware Automated Feature Engineering for Tabular Datasets.
- OHDSI (2024), OMOP Common Data Model v5.4.
- LangChain AI (2024), LangGraph: Stateful Multi-Actor Applications with LLMs.