AI-powered adaptive educational platform for antimicrobial stewardship fellowship training with support for multiple AI models including Claude, Gemini, and local Ollama models. The system leverages literature-based recommendations through Retrieval-Augmented Generation (RAG) to provide evidence-backed guidance grounded in current ASP research and guidelines.
The ASP AI Agent is a comprehensive educational system designed to train the next generation of antimicrobial stewardship leaders. It features adaptive learning modules, real-time feedback, and evidence-based clinical scenarios addressing critical gaps in ASP education.
- Hybrid RAG System - Combines literature mining (PubMed) with expert knowledge retrieval
- Adaptive Learning System - Personalized difficulty adjustment based on performance
- Multi-Turn Conversations - Context-aware coaching with up to 50 turns of dialogue
- Rubric-Based Assessment - Standardized evaluation across 4 competency domains
- Continuous Improvement Loop - Expert validation and user feedback systematically enhance AI performance
- Equity Analytics - Real-time monitoring for educational disparities
- Clinical Modules - Real-world scenarios from CICU, NICU, and other settings
-
Clone the repository:
git clone https://github.com/haslamdb/asp_ai_agent.git cd asp_ai_agent -
Install dependencies:
pip install -r requirements.txt
-
Set API keys (choose one or more):
export ANTHROPIC_API_KEY='your-claude-key-here' export GEMINI_API_KEY='your-gemini-key-here' # Optional: Install Ollama for local models
-
Start the server:
./start_local.sh # Or: python unified_server.py -
Open interface: Visit
http://localhost:5001or 'http://192.168.1.163:8080/cicu_module.html'
asp_ai_agent/
βββ docs/ # Documentation
β βββ SETUP.md # Detailed setup instructions
β βββ IMPLEMENTATION_COMPLETE.md # Implementation status
β βββ CICU_Module_Documentation.md # CICU module details
β βββ ASP_Agent_*.md # System documentation
β
βββ modules/ # Educational modules
β βββ cicu_prolonged_antibiotics_module.py
β βββ module_integration.py
β βββ cicu_module_export.json
β
βββ tests/ # Test suites
β βββ test_integration.py # System integration tests
β βββ test_gemma_setup.py # Model testing
β
βββ core_components/ # Core system files
β βββ unified_server.py # Main server with all endpoints
β βββ session_manager.py # User session management
β βββ conversation_manager.py # Multi-turn dialogue handler
β βββ adaptive_engine.py # Adaptive learning engine
β βββ rubric_scorer.py # Assessment system
β βββ equity_analytics.py # Disparity monitoring
β
βββ interfaces/ # User interfaces
β βββ agent_models.html # Training module interface
β βββ asp_ai_agent.html # Chat consultation interface
β βββ index.html # Landing page
β
βββ api/ # API endpoints
β βββ gemini.js # Vercel Edge Function
β βββ claude.js # Vercel Edge Function
β
βββ asp_literature/ # Literature & expert knowledge
β βββ asp_literature_miner.py # PubMed mining tool
β βββ pdfs/ # Downloaded research papers
β βββ expert_embeddings/ # Expert knowledge ChromaDB (planned)
β
βββ data/ # Data storage
β βββ asp_sessions.db # SQLite session database
β βββ next_steps_and_implementation.txt
β
βββ config/ # Configuration
βββ requirements.txt # Python dependencies
βββ vercel.json # Vercel deployment
βββ start_local.sh # Local startup script
The ASP AI Agent maintains an up-to-date literature database through automated daily synchronization with OneDrive and reindexing of the EndNote library.
Script Location: /home/david/scripts/sync/sync_and_reindex_asp_endnote.sh
Execution Time: 4:00 AM daily (via /home/david/scripts/backup/nightly_sync_all.sh)
Process:
- Pull from OneDrive - Downloads latest EndNote library from
onedrive:Documents/Code/asp_ai_agent - Sync Library Files - Updates both
asp_library.enlandasp_library.Data/to localasp_literature/directory - Automatic Reindexing - Runs
reindex_from_endnote.pyto update RAG embeddings with any new PDFs - Logging - Saves detailed logs to
/home/david/logs/sync/asp_endnote_pull_reindex_*.log
Daily Execution Order:
- Sync from interface labs
- Sync from lambda quad
- Sync OneDrive metagenomics
- Sync OneDrive experiments
- Sync main EndNote library
- Pull ASP EndNote library from OneDrive and reindex β New automated step
- Push ASP EndNote library to OneDrive
To manually trigger the sync and reindex process:
/home/david/scripts/sync/sync_and_reindex_asp_endnote.sh- Always Current: RAG system stays synchronized with EndNote library changes
- Zero Manual Intervention: Fully automated nightly updates
- Full Logging: Complete audit trail of sync operations
- Bidirectional Sync: Changes pulled from OneDrive, then pushed back after indexing
Addresses overuse of meropenem and vancomycin in cardiac ICU settings.
- Scenarios: 4 progressive difficulty levels
- Focus: Data analysis β Intervention design β Implementation β Sustainability
- Metrics: Process, outcome, and balancing measures
- Documentation: CICU Module Guide
- NICU Antibiotic Stewardship
- Surgical Prophylaxis Optimization
- Outpatient Oral Antibiotic Selection
- Others!
- SQLite persistence for user progress
- Demographics and learning history tracking
- Module completion status
- Bloom's taxonomy mastery levels
- Performance-based difficulty adjustment
- Personalized learning paths
- Time-to-mastery predictions
- State machine for dialogue flow
- Intent analysis and scaffolding
- Progressive hint system
- Context retention (50 turns)
- Standardized assessment criteria
- 5-level scoring (Not Evident β Exemplary)
- Competency-based evaluation
- Progress tracking over time
- Demographic performance analysis
- Disparity detection and severity scoring
- Actionable recommendations
- Dashboard data generation
The ASP AI Agent implements a comprehensive 4-phase feedback loop that systematically improves system performance through expert validation and user feedback.
The system uses two complementary knowledge sources:
-
Literature RAG - Evidence from ASP research papers
- Indexed PubMed articles on antimicrobial stewardship
- Semantic search using PubMedBERT embeddings
- Citation tracking and evidence grading
-
Expert Knowledge RAG - Pedagogical expertise from educators
- Expert corrections of AI feedback
- Exemplar responses at different mastery levels
- Teaching patterns and common learner misconceptions
- Rubric application examples with expert reasoning
Goal: Ensure clinical accuracy and pedagogical soundness
- Expert Panel Review - 2-3 ASP faculty validate scenarios, rubrics, and AI feedback samples
- Gold Standard Creation - Experts create exemplar responses at each mastery level
- Rubric Calibration - Inter-rater reliability testing (target: ΞΊ > 0.70)
Deliverables:
- Expert validation scores (target: >4.0/5.0)
- Gold standard response library
- Refined assessment rubrics
Goal: Understand learner interactions and identify improvement areas
- Pilot Cohort - 4-6 ID fellows complete modules with comprehensive instrumentation
- Data Collection:
- Engagement metrics (time per scenario, hint usage, drop-off points)
- Learning outcomes (pre/post knowledge gain, score progression)
- User satisfaction (feedback helpfulness ratings, qualitative interviews)
- Expert Review - Content experts evaluate 20-30 AI-generated feedback samples
Success Metrics:
- Completion rate: >75%
- Feedback helpfulness: >80% "helpful" ratings
- Pre/post knowledge gain: >20% improvement
- Expert agreement with AI scoring: <10% discrepancy
Goal: Data-driven refinement of content and AI performance
Analysis Activities:
- Identify drop-off points and revise problematic scenarios
- Correlate hint effectiveness with score improvements
- Analyze AI vs. expert scoring discrepancies
- Extract common learner misconceptions
AI Enhancement Approaches:
-
Prompt Engineering (Primary - 90% of effort)
- Incorporate expert correction patterns into system prompts
- Add concrete examples of desired feedback style
- Specify expert-validated rubric criteria
- Include statistical patterns from expert reviews
-
Expert Knowledge RAG (Secondary)
- Index expert corrections for contextual retrieval
- Build searchable database of teaching patterns
- Link exemplar responses to similar scenarios
- Enable AI to reference relevant expert guidance
-
Output Validation (Quality Assurance)
- Verify required sections in feedback
- Check citation accuracy (PubMed ID validation)
- Ensure specific references to user responses
- Validate actionable next steps
Deliverables:
- Refined system prompts incorporating expert patterns
- Expert knowledge database with 50+ indexed corrections
- Updated module content addressing common misconceptions
- Validation pipeline for AI output quality
Goal: Systematic enhancement as the system scales
In-App Feedback Collection:
// Feedback widget on every AI response
- π/π helpfulness rating
- Optional detailed comments
- Automatic flagging of low-rated responses for expert reviewRegular Review Cycles:
- Monthly: Review flagged unhelpful responses (10-20 samples)
- Quarterly: Expert panel review session (50 random samples)
- Biannually: Update literature database with new publications
A/B Testing Framework:
- Test competing pedagogical approaches (e.g., hint timing, rubric visibility)
- Measure impact on learning outcomes and satisfaction
- Deploy winning variants systematically
Key Success Metrics:
| Metric | Target | Current |
|---|---|---|
| Expert validation score | >4.0/5.0 | Baseline in progress |
| Feedback helpfulness | >80% | Pilot phase |
| Expert-AI scoring agreement | <10% discrepancy | Pilot phase |
| Module completion rate | >75% | Pilot phase |
| Pre/post knowledge gain | >20% | Pilot phase |
| User satisfaction | >4.0/5.0 | Pilot phase |
Database Schema for feedback collection:
-- User feedback on AI responses
CREATE TABLE user_feedback (
feedback_id UUID PRIMARY KEY,
user_id UUID,
response_id UUID,
helpful BOOLEAN,
comments TEXT,
timestamp TIMESTAMP
);
-- Expert corrections
CREATE TABLE expert_corrections (
correction_id UUID PRIMARY KEY,
response_id UUID,
expert_id UUID,
original_ai_feedback TEXT,
corrected_feedback TEXT,
expert_reasoning TEXT,
accuracy_rating INT, -- 1-5
helpfulness_rating INT, -- 1-5
timestamp TIMESTAMP
);
-- Exemplar responses
CREATE TABLE expert_exemplars (
exemplar_id UUID PRIMARY KEY,
module_id TEXT,
scenario_id TEXT,
mastery_level TEXT, -- 'emerging', 'proficient', 'exemplary'
response_text TEXT,
expert_commentary TEXT,
competency_scores JSONB,
timestamp TIMESTAMP
);For detailed implementation guides, see:
- Setting Up the Expert Knowledge RAG System
- Fine Tuning the Model
- Structured Approach for Collecting Feedback
POST /api/asp-feedback- Main ASP feedback with full contextPOST /api/session/create- Create persistent user sessionGET /api/session/current- Get current session with progressPOST /api/conversation/process- Process multi-turn dialogueGET /api/adaptive/assessment- Get difficulty recommendationsPOST /api/rubric/evaluate- Evaluate with standardized rubricsGET /api/equity/dashboard- Equity analytics dashboard
POST /api/modules/cicu/interact- CICU module interactionGET /api/modules/cicu/tracker- Implementation metricsPOST /api/modules/cicu/countermeasure- Get barrier solutions
| Model | Best For | Features | Availability |
|---|---|---|---|
| Claude 3.5 Sonnet | Complex medical reasoning | Best accuracy, nuanced feedback | API key required |
| Gemini 2.5 Flash | Fast responses, search | Web search, quick iterations | Free tier available |
| Gemma2:27b | Local deployment | Privacy, no API costs | Via Ollama |
| Llama3.1:70b | Large local model | High quality, offline | Via Ollama |
Run the comprehensive test suite:
# Run all integration tests
python tests/test_integration.py
# Test model setup
python tests/test_gemma_setup.py
# Test specific module
python modules/cicu_prolonged_antibiotics_module.py- Setup Guide - Complete installation instructions
- Implementation Status - Current feature status
- Executive Summary - Project overview
- Visual Workflows - System architecture
- Module Guide - CICU module details
- Expert Knowledge RAG System - Database schema and implementation for expert knowledge indexing and retrieval
- Fine Tuning Strategy - Comprehensive guide to prompt engineering, RAG enhancement, and LLM fine-tuning approaches
- Feedback Collection Protocol - 4-phase implementation plan with expert review templates and pilot study design
- API keys stored as environment variables
- Server-side proxy for credential protection
- SQLite database with user anonymization
- CORS configured for authorized origins
- No PHI/PII in educational scenarios
./start_local.sh # Starts on port 5001 with auto-reloadvercel --prod # Deploy to productionSee Setup Guide for detailed deployment instructions.
- Session management with SQLite persistence
- Multi-turn conversation engine (50 turns)
- Adaptive difficulty system
- Rubric-based scoring (4 competencies)
- Equity analytics dashboard
- Literature RAG with PubMedBERT embeddings
- CICU module (4 difficulty levels)
- Recruit expert panel (2-3 ASP faculty + 1 medical educator)
- Expert review of CICU module scenarios and rubrics
- Collection of gold standard exemplar responses
- Inter-rater reliability testing (target: ΞΊ > 0.70)
- Initial AI feedback quality baseline
- Recruit 4-6 ID fellows for pilot study
- Comprehensive instrumentation and logging
- Pre/post knowledge assessment
- Semi-structured qualitative interviews
- Expert review of 20-30 AI feedback samples
- Identify drop-off points and usability issues
- Analyze pilot data (engagement, learning outcomes, satisfaction)
- Implement prompt engineering refinements
- Build Expert Knowledge RAG database (50+ corrections)
- Develop output validation pipeline
- Update module content addressing misconceptions
- A/B testing framework implementation
- Deploy in-app feedback collection (π/π ratings)
- Monthly review of flagged responses (10-20 samples)
- Quarterly expert panel reviews (50 random samples)
- Biannual literature database updates
- Systematic A/B testing of pedagogical approaches
- Expand to 2-3 additional fellowship programs
- Develop NICU and surgical prophylaxis modules
- Publish pilot study results
- Optimize performance and infrastructure
- Prepare for national deployment
- Deploy to pediatric ID fellowship programs
- Integration with national ASP certification
- Multi-institutional research collaboration
- Continuous module expansion
- Long-term outcomes tracking
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Add tests for new features
- Update documentation
- Submit a pull request
This project is proprietary and confidential. All rights reserved.
- Technical Issues: dbhaslam@gmail.com
- Module Feedback: aspfeedback@cchmc.org
- Setup Help: See Setup Guide