A full-stack application for conducting virtual clinical trials using AI agents to validate medical research hypotheses.
Clinova/
├── frontend/ # React + Vite web application
├── backend/ # FastAPI backend + Python AI agents
├── visualization/ # 3D WebGL visualization (Next.js)
├── docker-compose.yml # Container orchestration
└── README.md # This file
- Framework: React 18 + TypeScript
- Build Tool: Vite 5
- UI Components: shadcn/ui + Radix UI
- Styling: Tailwind CSS
- State Management: TanStack Query
- 3D Graphics: Three.js + React Three Fiber
- Backend Integration: REST API + Supabase
- Routing: React Router v6
- Form Handling: React Hook Form + Zod validation
- API Framework: FastAPI
- Language: Python 3.11+
- AI Models: OpenAI GPT-4, Google Gemini
- Key Features:
- RESTful API for trial management
- Multi-agent pipeline for clinical trial simulation
- Clinical trial replication (PREDICT, Barrett, CARE, VALOR, NEPHRIC)
- Contrast-induced nephropathy (CIN) analysis
- OMOP CDM data lookup
- Automated trial validation
- Framework: Next.js (React)
- 3D Features: React Three Fiber + Yoga flexbox layouts in WebGL
- Purpose: Advanced 3D data visualization
- Clone the repository
git clone <repository-url>
cd Clinova- Set up environment variables
# Copy example env file
cp .env.example .env
# Edit .env and add your API keys
# OPENAI_API_KEY=your_openai_key
# GEMINI_API_KEY=your_gemini_key- Start all services
docker-compose upThis will start:
- Backend API at http://localhost:8000
- Frontend at http://localhost:5173
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure environment variables
cp .env.example .env
# Edit .env and add your API keys
# Start the server
python server.py
# Or: uvicorn server:app --reload --host 0.0.0.0 --port 8000Backend API will be available at http://localhost:8000
cd frontend
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env
# Edit .env if needed
# Start development server
npm run devFrontend will be available at http://localhost:5173
# Backend API Keys
OPENAI_API_KEY=your_openai_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here
# Frontend
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_PROJECT_ID=your_supabase_project_id
VITE_SUPABASE_PUBLISHABLE_KEY=your_supabase_keyOPENAI_API_KEY=your_openai_api_key_here
GEMINI_API_KEY=your_gemini_api_key_hereVITE_API_URL=http://localhost:8000
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_PROJECT_ID=your_project_id
VITE_SUPABASE_PUBLISHABLE_KEY=your_supabase_keyOnce the backend is running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
POST /api/trials # Create new trial
GET /api/trials # List all trials
GET /api/trials/{id}/status # Get trial status
GET /api/trials/{id}/results # Get trial results
DELETE /api/trials/{id} # Delete trial
-
Start the backend and frontend (using docker-compose or manually)
-
Create a trial via API:
curl -X POST http://localhost:8000/api/trials \
-H "Content-Type: application/json" \
-d '{
"question": "How do iodinated contrast agents affect eGFR subgroups and risk of AKI in the next 30 days?"
}'- Check trial status:
curl http://localhost:8000/api/trials/{run_id}/status- Get results (once completed):
curl http://localhost:8000/api/trials/{run_id}/resultsNavigate to http://localhost:5173 and use the web interface to:
- Submit clinical trial questions
- Monitor trial progress
- View results and generated code
- Explore OMOP concept mappings
The backend runs a sophisticated multi-agent pipeline:
- Question Agent (GPT-4): Transforms natural language to causal PICO format
- Design Agent (GPT-4): Generates Target Trial Emulation (TTE) protocol
- Validator Agent (GPT-4): Validates design against clinical rubric (up to 3 iterations)
- OMOP Lookup Agent: Resolves medical terms to standardized concept IDs
- Code Agent (Gemini): Generates Python implementation code
The system can replicate 5 major randomized controlled trials:
- PREDICT (2008): CT with IV contrast in CKD + diabetes patients
- Barrett et al. (2006): CE-MDCT in CKD patients
- CARE (2007): Cardiac angiography/PCI in CKD ± diabetes
- VALOR (2008): Coronary angiography in CKD
- NEPHRIC (2003): High-risk diabetes + CKD angiography
cd frontend
npm run dev # Start dev server
npm run build # Production build
npm run test # Run tests
npm run lint # Lint codecd backend
python -m agent --question "your question here" # Run CLI
python server.py # Run API server# Health check
curl http://localhost:8000/
# Create a trial
curl -X POST http://localhost:8000/api/trials \
-H "Content-Type: application/json" \
-d '{"question": "How does contrast affect kidney function?"}'- Virtual Clinical Trials: Simulate and validate clinical trials using AI
- Multi-Agent System: Specialized agents for different pipeline stages
- Interactive 3D Visualization: Advanced WebGL-based data visualization
- Real-time Trial Monitoring: Track trial progress through web interface
- OMOP CDM Integration: Standardized medical terminology lookup
- Agent-Based Validation: AI agents validate trial hypotheses autonomously
- Responsive UI: Modern, accessible interface built with shadcn/ui
- RESTful API: Complete backend API with OpenAPI documentation
# Build production images
docker-compose -f docker-compose.prod.yml build
# Start production services
docker-compose -f docker-compose.prod.yml up -dFor production, make sure to:
- Use strong, unique API keys
- Set appropriate CORS origins in backend
- Use production Supabase instance
- Configure proper logging
- Set up monitoring and alerting
- Check that OPENAI_API_KEY and GEMINI_API_KEY are set
- Ensure Python 3.11+ is installed
- Verify all dependencies:
pip install -r requirements.txt
- Ensure backend is running on port 8000
- Check VITE_API_URL in frontend/.env
- Verify CORS settings in backend/server.py
- Ensure Docker and Docker Compose are installed
- Check .env file exists and has correct values
- Try:
docker-compose down -v && docker-compose up --build
See LICENSE file.
This is a research project focused on virtual clinical trial validation using AI agents. Contributions are welcome!
Built for advancing medical research through AI-powered virtual clinical trials.