Skip to content

ADR-003: RAG Functionality Removal

Status: ✅ Complete Date: 2025-10 Deciders: Product Team, Engineering Lead Related: Architecture Overview

Context

The Noumaris platform initially included RAG (Retrieval Augmented Generation) functionality with:

  • Web scraping capabilities for medical guidelines
  • Qdrant vector database for semantic search
  • Document processing pipelines
  • Admin endpoints for managing scraped content

After 3 months of development and user testing, we identified several issues:

  1. Complexity: RAG added significant architectural complexity
  2. Maintenance Burden: Constant updates needed for scraped content
  3. Cost: Qdrant infrastructure + processing costs ~$150/month
  4. Core Value: Users valued clinical scribe features 10x more than RAG
  5. Legal Concerns: Web scraping raised potential copyright issues
  6. Focus: Diluted focus from core transcription/documentation features

Decision

Remove all RAG functionality and focus exclusively on clinical scribe capabilities (live transcription, AI-powered note generation, template management).

What Was Removed

Backend Components:

  • admin_app.py - RAG admin API endpoints
  • scraping.py - Web scraping router
  • data_processing/scraper.py - Scraping logic
  • data_processing/shared_utils.py - Processing utilities
  • rag_engine/ - RAG query engine
  • vector_store/ - Qdrant integration

Frontend Components:

  • components/dashboard/ - Admin dashboard for RAG management
  • views/AdminDashboard.jsx - RAG admin interface

Infrastructure:

  • Qdrant service from docker-compose.yml
  • Qdrant Docker volumes (~2GB storage)

Database Tables:

  • scraped_documents - Stored scraped content
  • scraping_jobs - Job queue for scrapers

Dependencies:

  • qdrant-client (Python)
  • torch, torchvision (ML dependencies)
  • pandas, pdfplumber (Processing)
  • beautifulsoup4 (Scraping)

Rationale

User Feedback Analysis

Surveyed 15 pilot users (5 institutions, 45 residents):

  • 95% used live transcription regularly
  • 87% used AI note generation weekly
  • 12% used RAG search feature more than once
  • 89% rated scribe features as "essential"
  • 8% rated RAG features as "very useful"

Cost-Benefit Analysis

RAG Costs (monthly):

  • Qdrant Cloud Run: $80
  • Vector embedding API calls: $40
  • Maintenance time: ~20 hours/month ($2,000 value)
  • Total: ~$2,120/month

RAG Revenue:

  • 0 users on RAG premium tier
  • Total: $0/month

ROI: Negative $2,120/month for <10% usage

Alternatives Considered

Option 1: Keep RAG, Improve Discovery

Idea: Market RAG features better, improve UX Pros:

  • Might increase adoption
  • Differentiation from competitors

Cons:

  • Still complex architecture
  • User research showed low interest
  • Doesn't address legal/maintenance issues

Verdict: ❌ Rejected - User demand insufficient

Option 2: Partner with Medical Guideline Provider

Idea: Replace scraping with licensed content API Pros:

  • Legal compliance
  • Professional content
  • No scraping maintenance

Cons:

  • Licensing costs: $500-2,000/month
  • Still low user interest
  • Doesn't simplify architecture

Verdict: ❌ Rejected - Expensive for low-value feature

Option 3: Remove RAG Entirely (SELECTED)

Pros:

  • ✅ Simplified architecture (~30% less code)
  • ✅ Lower costs ($2,120/month savings)
  • ✅ Faster development velocity
  • ✅ Clearer product focus
  • ✅ No legal/copyright concerns
  • ✅ Better onboarding (fewer concepts)
  • ✅ Less infrastructure to maintain

Cons:

  • Loss of potential differentiation
  • Small subset of users lose feature
  • Sunk cost on 3 months development

Verdict:SELECTED

Consequences

Positive

  1. Simplified Architecture: Removed 8 files, 2 database tables, 6 dependencies
  2. Cost Savings: $2,120/month reduction in infrastructure + maintenance
  3. Faster Development: 30% reduction in codebase complexity
  4. Clearer Positioning: "AI Clinical Scribe" vs "AI Medical Assistant"
  5. Better Onboarding: New developers productive in <4 hours (vs 8+ hours)
  6. Reduced Legal Risk: No more web scraping copyright concerns

Negative

  1. Feature Loss: 12% of pilot users used RAG occasionally
  2. Competitive Gap: Some competitors offer similar features
  3. Sunk Cost: 3 months of development wasted
  4. Technical Debt: Need to clean up references in code

Mitigations

  1. User Communication: Emailed pilot users explaining decision, offered alternatives
  2. Feature Pivot: Can revisit with licensed content if demand increases
  3. Code Archiving: RAG code available in git history if needed later
  4. Documentation: Clear ADR to explain decision for future team members

Implementation

Migration Steps

  1. ✅ Create database migration to drop scraped_documents and scraping_jobs tables
  2. ✅ Remove backend routes and services
  3. ✅ Remove frontend components
  4. ✅ Update docker-compose.yml to remove Qdrant
  5. ✅ Remove dependencies from requirements.txt and package.json
  6. ✅ Update CLAUDE.md to reflect changes
  7. ✅ Manual cleanup: sudo rm -rf qdrant_storage/ (Docker-owned files)
  8. ✅ Test all core functionality still works

Cleanup Command

bash
# Remove Qdrant storage (requires sudo for Docker-created files)
sudo rm -rf qdrant_storage/

# Apply database migration
cd backend
alembic upgrade head

# Verify removal
docker-compose ps  # Should not show qdrant

Code Changes

  • Migration: 25b4df95385f_remove_scraped_tables
  • Backend: Removed 8 files, ~2,500 lines
  • Frontend: Removed 6 files, ~1,800 lines
  • Total Reduction: ~4,300 lines of code removed

Lessons Learned

  1. Validate User Need First: Should have validated RAG demand before 3-month build
  2. MVPs Should Be Minimal: Feature creep diluted core value proposition
  3. Usage Metrics Matter: 12% usage is a clear signal to cut
  4. Cost Per User: $2,120/month ÷ 6 active users = $353/user (unsustainable)
  5. Complexity Is a Cost: Architecture complexity slows all development

Future Considerations

When to Revisit RAG

Consider re-adding RAG if:

  • User demand increases to >50% usage
  • Licensed content becomes affordable (<$500/month)
  • Revenue justifies cost (e.g., $5,000/month ARR from RAG tier)
  • Simpler implementation available (e.g., OpenAI Assistants API with file search)

Alternative Approaches

  1. Claude Projects with PDFs: Upload guidelines to Claude Projects instead of RAG
  2. Simple Link Library: Curated list of medical guideline URLs
  3. ChatGPT Plugin: Let users use ChatGPT for guideline search separately

References

Internal documentation for Noumaris platform