Skip to content

Advanced Diagnosis Platform with ICD-10/11, DSM-5-TR, AI-Powered Analysis, for clinical, educational, and research use.

License

Notifications You must be signed in to change notification settings

supermarsx/diagnosticox

DiagnosticoX

Advanced AI-Powered Medical Diagnosis Platform

DiagnosticoX is a comprehensive, production-grade medical diagnosis platform featuring intelligent multi-layer caching, pre-emptive data crawling, and extensive symptomatology analysis. Built with cutting-edge web technologies and optimized for performance, DiagnosticoX reduces API calls by up to 70% while delivering sub-second response times.


Repository Structure

  • apps/frontend/ - Vite + React 18 application (primary UI).
  • apps/backend/ - Express + TypeScript prototype API.
  • docs/ - documentation index at docs/README.md.
    • docs/guides/ - setup, deployment, cache/testing guides.
    • docs/architecture/ - system design overview.
    • docs/reports/ - progress, research, and implementation reports.
    • docs/records/ - changelog and release history.
  • research/ - ICD/DSM/symptom research references.
  • user_input_files/ - preserved sample input artefacts for context.

Quickstart (pnpm workspace)

  • Install deps: pnpm install
  • Frontend dev: pnpm run dev:frontend (http://localhost:5173)
  • Backend dev: pnpm run dev:backend (http://localhost:3000)
  • Lint/checks: pnpm run lint and pnpm run format:check
  • Tests: pnpm run test
  • Build (frontend): pnpm run build:prod

Features

Core Clinical Capabilities

1. ICD-10/ICD-11 Integration

  • WHO ICD-API OAuth 2.0 Integration: Secure authentication with the WHO ICD classification system
  • Code Lookup & Search: Fast entity search with caching
  • Post-coordination Support: Advanced code combination capabilities
  • ICD-10 ↔ ICD-11 Mapping: Seamless translation between versions
  • 30-Day Cache TTL: Optimized for clinical workflow

2. DSM-5-TR Psychiatric Assessments

  • PHQ-9 Depression Screening: Patient Health Questionnaire with automatic severity scoring
  • GAD-7 Anxiety Assessment: Generalized Anxiety Disorder screening with clinical interpretation
  • PC-PTSD-5: Primary Care PTSD screening tool
  • Suicide Risk Detection: Mandatory clinical follow-up workflows for item 9 responses
  • FHIR-Compatible Data: Integration with US Behavioral Health Profiles

3. Comprehensive Symptom Database (2000+ Symptoms)

  • 11 Organ Systems: Cardiovascular, Respiratory, Neurological, Gastrointestinal, Musculoskeletal, Dermatological, Endocrine, Genitourinary, Hematological, Psychiatric, Immunological
  • Symptom Overlap Detection: Multi-system symptom analysis
  • Correlation Analysis: Statistical co-occurrence patterns
  • Rare Disease Pattern Recognition: Advanced pattern matching for rare conditions
  • Urgency Assessment: EMERGENT, URGENT, SEMI-URGENT, NON-URGENT classification
  • Red Flag Detection: Automatic identification of critical warning signs
  • SNOMED CT & UMLS Integration: Clinical terminology standards compliance

4. VINDICATE-M Diagnostic Framework

  • Systematic Differential Diagnosis: Vascular, Infectious, Neoplastic, Degenerative, Intoxication, Congenital, Autoimmune, Traumatic, Endocrine, Mechanical
  • Bayesian Probability Calculator: Prior probability, likelihood ratios, sensitivity/specificity analysis
  • Treatment Trial Protocols: Evidence-based diagnostic interventions
  • Evidence Scoring: Clinical guideline-based probability assessment

5. FHIR R4 Interoperability

  • FHIR Resource Creation: Patient, Observation, Condition, MedicationRequest, DiagnosticReport, Bundle
  • Medical Coding Standards: SNOMED CT (clinical terms), LOINC (lab observations), RxNorm (medications), ICD-10 (diagnoses)
  • JSON Export: Download FHIR resources for external systems
  • Validation & Error Reporting: Real-time FHIR compliance checking

Advanced Performance Features

6. Intelligent Multi-Layer Caching System

Three-Tier Architecture for Optimal Performance

  • Memory Cache: Lightning-fast in-memory storage (100 entry limit, LRU eviction)
  • IndexedDB Persistent Cache: Large-capacity browser storage for offline capability
  • Service Worker Cache: Offline-first strategy for network resilience

TTL Configuration by Category:

  • ICD Codes: 30 days
  • Symptoms: 7 days
  • PubMed Articles: 24 hours
  • Drug Interactions: 48 hours
  • Clinical Trials: 12 hours
  • DSM-5 Assessments: 7 days
  • FHIR Resources: 24 hours
  • VINDICATE Analysis: 7 days

Performance Benefits:

  • 70%+ API call reduction
  • Sub-10ms response times for cached data
  • Automatic cache warming with common queries
  • Smart eviction policies to prevent memory overflow

7. Pre-emptive Crawling System

Background Intelligence for Predictive Data Fetching

  • Priority Queue System:

    • HIGH: ICD lookups, DSM assessments, common symptoms
    • MEDIUM: PubMed articles, drug interactions
    • LOW: Historical searches, rare conditions
  • Pattern Analysis:

    • User search history tracking
    • Frequency-based prediction
    • Related query scheduling
    • Medical knowledge graph traversal
  • Concurrency Control:

    • 2 concurrent background tasks
    • Automatic retry with exponential backoff
    • Rate limiting to respect API quotas
  • Common Query Pre-fetching:

    • 18 high-frequency symptoms (chest pain, headache, fever, etc.)
    • 10 common ICD-10 codes
    • 8 prevalent conditions for PubMed searches

8. Medical Research Integration

  • PubMed E-utilities: Search articles, fetch details, evidence grading (GRADE, Oxford CEBM)
  • ClinicalTrials.gov API v2: Study search, enrollment status, phase filtering
  • DrugBank Clinical API: Drug search, interaction checking (minor/moderate/major/contraindicated), formulation lookup

User Management & Security

9. Five Usage Modes

  1. Clinical Setting Mode: Full EHR integration, all clinical tools
  2. Clinical Study Mode: Research data collection, consent management
  3. Student Mode: Educational features, tutorial overlays
  4. Full Hospital Mode: Multi-department workflows, administrative tools
  5. Self Exploration Mode: Patient-facing, simplified interface

10. Advanced Security Features

  • Multi-Factor Authentication: TOTP, SMS, Email, Biometric support
  • Role-Based Access Control (RBAC): 8 predefined roles with granular permissions
  • Security Audit Logs: Comprehensive event tracking with HIPAA/GDPR compliance
  • Encryption Management: AES-256-GCM, RSA-4096 key lifecycle
  • Privacy Controls: Consent management, data sharing agreements, GDPR compliance

Analytics & Monitoring

11. Comprehensive Analytics Suite

  • Patient Outcomes Tracking: Quality of life metrics, treatment progress visualization
  • Treatment Efficacy Analysis: Success rates, cost-effectiveness, adverse events
  • Population Health Monitoring: Epidemiological metrics, demographic analysis
  • Custom Dashboard Builder: Drag-and-drop widget configuration
  • Reporting System: Export clinical summaries, quality measures (JSON, CSV, PDF)

12. Real-Time Monitoring

  • Vital Signs Dashboard: 6 vital sign types with 3-second live updates
  • Alert Management: Threshold-based warnings, critical event simulation
  • Patient Switching: Multi-patient monitoring support

13. Cache Metrics Dashboard

  • Real-Time Performance Monitoring: Hit rates, storage usage, request statistics
  • Memory & Persistent Cache Analytics: Detailed breakdown by cache tier
  • Crawler Status: Queue size, active tasks, search pattern history
  • Storage Estimation: Usage percentage, quota tracking
  • Cache Management: Clear by category, clean expired entries

AI & Advanced Features

14. Multi-Provider AI Integration

  • Supported Providers: OpenAI GPT-4, Anthropic Claude, Google Gemini, Ollama (local)
  • Medical Prompt Templates: Differential diagnosis, treatment planning, drug interactions, clinical summaries, patient education, literature review, risk assessment
  • Cost Tracking: Token usage monitoring per provider
  • Automatic Failover: Local LLM fallback on API failure

15. Progressive Web App (PWA)

  • Offline Support: Full functionality without internet connection
  • Push Notifications: Medication reminders, appointment alerts, critical updates
  • Voice Assistant: Medical note dictation, voice commands, SOAP templates
  • Service Worker: Background sync, cache management, update notifications

Technology Stack

Frontend

  • React 18: Latest React with Concurrent Mode
  • TypeScript: Full type safety across codebase
  • Vite: Lightning-fast build tool with HMR
  • Tailwind CSS: Utility-first styling with glassmorphism design
  • React Router v6: Client-side routing
  • IndexedDB (idb): Persistent storage layer
  • Lucide Icons: Professional SVG icon library

Build & Optimization

  • Code Splitting: 12 optimized chunks for lazy loading
  • Tree Shaking: Dead code elimination
  • Terser Minification: Console.log removal, aggressive optimization
  • Gzip & Brotli Compression: Reduced bundle sizes
  • Bundle Analyzer: Visual size inspection

Testing & Quality

  • Jest: Unit testing framework
  • React Testing Library: Component testing
  • @testing-library/jest-dom: Custom matchers
  • ts-jest: TypeScript support for Jest
  • 70% Coverage Threshold: Branches, functions, lines, statements

Code Quality Tools

  • ESLint: Strict TypeScript linting
  • Prettier: Consistent code formatting
  • Husky: Git hooks for pre-commit validation
  • Lint-staged: Run linters on staged files only

Installation

Prerequisites

  • Node.js 18+ and pnpm 8+
  • Modern browser with IndexedDB support
  • (Optional) WHO ICD-API credentials
  • (Optional) DrugBank Clinical API key
  • (Optional) OpenAI/Anthropic/Google AI API keys

Quick Start

# Clone the repository
git clone <repository-url>
cd diagnosticox

# Install workspace dependencies (frontend + backend)
pnpm install

# Configure frontend environment variables
cd apps/frontend
cp .env.example .env
# Edit .env with your API credentials, then return to repo root
cd ../../

# Start development server
pnpm --filter diagnosticox-frontend dev

# Access at http://localhost:5173

Backend (optional prototype)

cd apps/backend
pnpm install
pnpm dev

Build for Production

# Production build
pnpm --filter diagnosticox-frontend run build:prod

# Analyze bundle size
pnpm --filter diagnosticox-frontend run build:analyze

# Preview production build
pnpm --filter diagnosticox-frontend run preview

Environment Configuration

Create a .env file in apps/frontend/:

# WHO ICD-API (ICD-10/ICD-11)
VITE_ICD_CLIENT_ID=your_client_id_here
VITE_ICD_CLIENT_SECRET=your_client_secret_here

# DrugBank Clinical API
VITE_DRUGBANK_API_KEY=your_drugbank_key_here

# OpenAI API
VITE_OPENAI_API_KEY=your_openai_key_here

# Anthropic Claude API
VITE_ANTHROPIC_API_KEY=your_anthropic_key_here

# Google Gemini API
VITE_GOOGLE_API_KEY=your_google_key_here

# ClinicalTrials.gov (no key required - public API)
# PubMed E-utilities (no key for basic use, email recommended)
VITE_PUBMED_EMAIL=your_email@example.com

Usage

Default Login Credentials

Email: dr.smith@clinic.com
Password: demo123

Key Navigation Routes

Clinical Tools:

  • /clinical/symptom-checker - Comprehensive symptom search and analysis
  • /clinical/icd-lookup - ICD-10/ICD-11 code lookup
  • /clinical/dsm5-assessments - Psychiatric screening tools
  • /clinical/vindicate-m - Diagnostic framework and Bayesian calculator
  • /clinical/fhir - FHIR resource creation

Settings & Management:

  • /settings/features - Usage mode switching and feature toggles
  • /settings/ai-providers - AI provider configuration
  • /settings/adaptive-management - Cost tracking and data controls
  • /settings/cache-metrics - Cache performance monitoring

Analytics:

  • /analytics - Main analytics dashboard
  • /analytics/patient-outcomes - Patient outcome tracking
  • /analytics/treatment-efficacy - Treatment effectiveness analysis
  • /analytics/population-health - Public health metrics

Security:

  • /security - Security center hub
  • /security/mfa - Multi-factor authentication setup
  • /security/permissions - Role and permission management
  • /security/audit-logs - Security event monitoring

Research:

  • /research - PubMed, ClinicalTrials, DrugBank integration

Cache System Usage

Automatic Caching

All API calls are automatically cached. No code changes required for basic usage.

Manual Cache Control

import { cachedICDService, getCacheStatistics, clearCategoryCache } from './services/cacheIntegration';

// Use cached service (automatic)
const results = await cachedICDService.searchEntities('diabetes');

// Force refresh (bypass cache)
const fresh = await cachedICDService.searchEntities('diabetes', true);

// Get cache statistics
const stats = getCacheStatistics();
console.log(`Hit rate: ${stats.cache.hitRate}%`);

// Clear specific category
await clearCategoryCache(CacheCategory.ICD);

Pre-emptive Crawling

import crawlerService, { CrawlPriority } from './services/crawlerService';

// Schedule high-priority crawl
crawlerService.scheduleCrawl('chest pain', CacheCategory.SYMPTOMS, CrawlPriority.HIGH);

// Get crawler status
const status = crawlerService.getStatus();
console.log(`Queue size: ${status.queueSize}`);

Performance Metrics

Production Benchmarks

  • Cache Hit Rate: 70-85% (target: >70%)
  • Memory Cache Hit Rate: 85-95%
  • Cached Response Time: <10ms
  • Uncached Response Time: 200-800ms (API dependent)
  • Total Bundle Size: 4.4 MB (optimized)
  • Initial Load Time: <3s (3G network)
  • Time to Interactive: <5s

Cache Statistics (Example)

Total Requests: 1,247
Cache Hits: 891 (71.4%)
Memory Hits: 743 (83.4% of hits)
Persistent Hits: 148 (16.6% of hits)
API Reduction: 71.4%
Storage Used: 12.3 MB / 250 MB (4.9%)

Architecture

Service Layer

src/services/
├── cacheService.ts           # Multi-layer caching (memory + IndexedDB)
├── crawlerService.ts          # Pre-emptive background crawler
├── cacheIntegration.ts        # Automatic caching wrapper
├── expandedSymptomDatabase.ts # 2000+ symptom definitions
├── icdService.ts              # WHO ICD-API integration
├── dsm5Service.ts             # Psychiatric assessments
├── symptomService.ts          # Symptom analysis
├── vindicatemService.ts       # VINDICATE-M framework
├── fhirService.ts             # FHIR R4 resources
├── pubmedService.ts           # PubMed E-utilities
├── clinicalTrialsService.ts   # ClinicalTrials.gov API
├── drugBankService.ts         # DrugBank Clinical API
└── aiProviderService.ts       # Multi-provider AI

Page Components

src/pages/
├── CacheMetricsDashboard.tsx  # Cache performance monitoring
├── SymptomCheckerPage.tsx     # Symptom search and analysis
├── VindicatemDiagnosisPage.tsx # Diagnostic framework
├── FHIRInteroperabilityPage.tsx # FHIR resource creation
├── AdaptiveManagementPage.tsx  # Cost and data management
└── [29 additional clinical pages]

Development

Available Scripts

# Frontend development
pnpm --filter diagnosticox-frontend run dev           # Start dev server with HMR
pnpm --filter diagnosticox-frontend run build         # Production build
pnpm --filter diagnosticox-frontend run build:prod    # Production build with optimization
pnpm --filter diagnosticox-frontend run build:analyze # Bundle analyzer
pnpm --filter diagnosticox-frontend run preview       # Preview production build

# Backend development
pnpm --filter diagnosticox-backend run dev            # Start API in watch mode
pnpm --filter diagnosticox-backend run build          # Compile TypeScript
pnpm --filter diagnosticox-backend run start          # Run compiled API

# Testing (frontend)
pnpm --filter diagnosticox-frontend run test          # Run Jest tests
pnpm --filter diagnosticox-frontend run test:watch    # Watch mode
pnpm --filter diagnosticox-frontend run test:coverage # Coverage report
pnpm --filter diagnosticox-frontend run test:ci       # CI mode (no watch)

# Code Quality (frontend)
pnpm --filter diagnosticox-frontend run lint          # Run ESLint
pnpm --filter diagnosticox-frontend run format        # Run Prettier
pnpm --filter diagnosticox-frontend run format:check  # Check formatting
pnpm --filter diagnosticox-frontend run validate      # Type check + lint + format

# Documentation
pnpm --filter diagnosticox-frontend run docs:generate # Generate JSDoc documentation
pnpm --filter diagnosticox-frontend run docs:serve    # Serve documentation locally

Code Quality Standards

  • TypeScript Strict Mode: Enabled
  • ESLint: Airbnb TypeScript config
  • Test Coverage: 70% minimum (branches, functions, lines)
  • Bundle Size: <5MB total
  • Performance Budget: <3s initial load, <100ms interactions

Contributing

Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Commit Message Convention

feat: Add new symptom correlation analysis
fix: Resolve cache eviction bug
docs: Update API integration guide
perf: Optimize IndexedDB query performance
test: Add tests for VINDICATE-M service

Troubleshooting

Cache Issues

// Clear all caches
import cacheService from './services/cacheService';
await cacheService.clearAll();

// Clean expired entries
await cacheService.cleanExpiredEntries();

IndexedDB Errors

  • Check browser support: Chrome 24+, Firefox 16+, Safari 10+, Edge 79+
  • Clear browser data if corruption suspected
  • Ensure sufficient storage quota (check in Cache Metrics Dashboard)

API Rate Limiting

  • PubMed: 3 requests/second without API key, 10/second with key
  • ClinicalTrials.gov: No explicit limit, use with reasonable rate
  • WHO ICD-API: Respect OAuth 2.0 token expiration (cache tokens)
  • DrugBank: Check your plan's rate limits

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments

  • WHO: ICD-10 and ICD-11 classification systems
  • NCBI: PubMed E-utilities API
  • NIH: ClinicalTrials.gov database
  • DrugBank: Clinical drug information
  • HL7: FHIR R4 healthcare interoperability standards
  • SNOMED International: Clinical terminology standards
  • APA: DSM-5-TR psychiatric diagnostic criteria

Contact & Support

For questions, issues, or feature requests, please open an issue on the repository.

DiagnosticoX - Advancing medical diagnosis through intelligent technology.


Project Metrics:

  • Lines of Code: 11,599+ (production)
  • Files: 29 core files + 4 new cache/crawler files
  • Test Coverage: 70%+ (branches, functions, lines)
  • Bundle Size: 4.4 MB (optimized, gzipped)
  • Build Time: ~15 seconds
  • Cache Hit Rate Target: 70%+
  • Supported Medical Codes: ICD-10, ICD-11, SNOMED CT, LOINC, RxNorm
  • Symptom Database: 2,000+ symptoms across 11 organ systems

About

Advanced Diagnosis Platform with ICD-10/11, DSM-5-TR, AI-Powered Analysis, for clinical, educational, and research use.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Languages