Skip to content

Feat: Medical Domain Embeddings Adapter #38

@iberi22

Description

@iberi22

Problem

The current EmbeddingsAdapter interface produces generic embeddings that don't capture medical terminology in Spanish. OrionHealth needs embeddings that understand:

  • Spanish medical terms (cardiología, nefropatía, etc.)
  • Medical abbreviations (TA, FC, SpO2, etc.)
  • Domain-specific symptom descriptions

Proposed Solution

Create a MedicalEmbeddingsAdapter that wraps the fallback chain (TFLite → ONNX → Gemini) and:

  1. Uses a medical domain fine-tuned embedding model OR
  2. Applies post-processing to enhance medical embeddings
  3. Supports both English and Spanish medical text

Implementation Plan

  1. Create lib/src/embeddings/medical_embeddings_adapter.dart
  2. Extend EmbeddingsAdapter interface with medicalNormalized() method
  3. Add medical-specific tokenizer that handles abbreviations
  4. Add integration with existing FallbackEmbeddingsAdapter chain
  5. Export from isar_agent_memory.dart

Reference

OrionHealth consumer: orionhealth/lib/features/local_agent/infrastructure/services/isar_vector_store_service.dart already uses MemoryGraph for RAG. This adapter will improve retrieval quality for medical queries.

See: spec/technical/on-device-ai.md for existing embedding backend docs in cerebro-flutter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions