Priority
P1
Story Points
34 (8 + 8 + 13 + 5 for orchestrator)
Dependencies
Depends on #6 (Shared Libraries), #22 (Service Communication)
Summary
Implement the 4 remaining service stubs to complete the core platform architecture: RAG service for AI-enhanced document retrieval, Audio Capture service for medical dictation, FHIR Adapter for healthcare data interoperability, and Agent Orchestrator for multi-service workflows.
Background
Currently these services are empty stubs:
- RAG Service (
services/rag) - Retrieval-augmented generation for clinical documentation
- Audio Capture Service (
services/audio-capture) - Audio recording and streaming
- FHIR Adapter Service (
services/fhir-adapter) - FHIR resource transformation
- Agent Orchestrator Service (
services/agent-orchestrator) - Workflow orchestration
Service Breakdown
1. RAG Service (8 story points)
Purpose: Provide context-aware AI assistance for clinical documentation using retrieval-augmented generation.
Key Features:
- Vector embedding generation for clinical documents
- Semantic search over patient history
- Context retrieval for AI prompts
- Integration with vector database (pgvector)
- Integration with LLM providers (OpenAI, Anthropic)
Endpoints:
POST /embeddings - Generate embeddings for documents
POST /search - Semantic search over documents
POST /retrieve-context - Get relevant context for prompt
GET /health - Health check
Tech Stack:
- Node.js/TypeScript
- pgvector for vector storage
- OpenAI embeddings API
- LangChain for RAG pipeline
2. Audio Capture Service (8 story points)
Purpose: Handle audio recording, storage, and streaming for medical dictation workflows.
Key Features:
- Real-time audio streaming via WebSocket
- Audio file upload and storage (S3)
- Audio format conversion
- Audio quality validation
- Integration with transcription service
Endpoints:
WebSocket /stream - Real-time audio streaming
POST /upload - Upload audio file
GET /audio/:id - Retrieve audio file
GET /audio/:id/metadata - Get audio metadata
DELETE /audio/:id - Delete audio file
Tech Stack:
- Node.js/TypeScript
- WebSocket for streaming
- AWS S3 for storage
- FFmpeg for format conversion
3. FHIR Adapter Service (13 story points)
Purpose: Transform ScribeMed data to/from FHIR R4 format for healthcare interoperability.
Key Features:
- FHIR R4 resource transformation (Patient, Encounter, Observation, etc.)
- FHIR validation
- Integration with EHR systems
- FHIR search API
- Bulk FHIR export
Endpoints:
GET /Patient/:id - Get FHIR Patient resource
GET /Encounter/:id - Get FHIR Encounter resource
GET /Observation/:id - Get FHIR Observation resource
POST /Patient - Create FHIR Patient
GET /Patient?identifier=:mrn - Search patients
POST /$export - Bulk FHIR export
Tech Stack:
- Node.js/TypeScript
- HAPI FHIR validator
- FHIR R4 specification
- Integration with ScribeMed database
FHIR Resource Mappings:
ScribeMed → FHIR R4
---------------------
patients → Patient
encounters → Encounter
notes → DocumentReference / DiagnosticReport
vitals → Observation
prescriptions → MedicationRequest
providers → Practitioner
organizations → Organization
4. Agent Orchestrator Service (5 story points)
Purpose: Coordinate multi-service workflows for complex clinical documentation tasks.
Key Features:
- Workflow definition and execution
- Service coordination (transcription → RAG → documentation → coding)
- State management for long-running workflows
- Error handling and retry logic
- Workflow monitoring and logging
Example Workflow:
1. Audio uploaded to Audio Capture Service
2. Orchestrator triggers Transcription Service
3. Transcription complete → Orchestrator retrieves result
4. Orchestrator calls RAG Service for context
5. Orchestrator calls Documentation Service to generate note
6. Orchestrator calls Coding Service for ICD-10/CPT codes
7. Final result aggregated and returned
Endpoints:
POST /workflows - Start new workflow
GET /workflows/:id - Get workflow status
GET /workflows/:id/steps - Get workflow execution steps
DELETE /workflows/:id - Cancel workflow
Tech Stack:
Acceptance Criteria
RAG Service:
Audio Capture Service:
FHIR Adapter:
Agent Orchestrator:
Implementation Timeline
Month 1:
- Week 1-2: RAG Service
- Week 3-4: Audio Capture Service
Month 2:
- Week 1-3: FHIR Adapter Service
- Week 4: Agent Orchestrator Service
Testing Requirements
- Unit tests for each service (70%+ coverage)
- Integration tests for service communication
- E2E tests for complete workflows
- FHIR compliance testing
- Performance testing for RAG search
Documentation
- Service README for each service
- API documentation
- FHIR mapping documentation
- Workflow examples
- Integration guides
Status
Open
Related Issues
Priority
P1
Story Points
34 (8 + 8 + 13 + 5 for orchestrator)
Dependencies
Depends on #6 (Shared Libraries), #22 (Service Communication)
Summary
Implement the 4 remaining service stubs to complete the core platform architecture: RAG service for AI-enhanced document retrieval, Audio Capture service for medical dictation, FHIR Adapter for healthcare data interoperability, and Agent Orchestrator for multi-service workflows.
Background
Currently these services are empty stubs:
services/rag) - Retrieval-augmented generation for clinical documentationservices/audio-capture) - Audio recording and streamingservices/fhir-adapter) - FHIR resource transformationservices/agent-orchestrator) - Workflow orchestrationService Breakdown
1. RAG Service (8 story points)
Purpose: Provide context-aware AI assistance for clinical documentation using retrieval-augmented generation.
Key Features:
Endpoints:
POST /embeddings- Generate embeddings for documentsPOST /search- Semantic search over documentsPOST /retrieve-context- Get relevant context for promptGET /health- Health checkTech Stack:
2. Audio Capture Service (8 story points)
Purpose: Handle audio recording, storage, and streaming for medical dictation workflows.
Key Features:
Endpoints:
WebSocket /stream- Real-time audio streamingPOST /upload- Upload audio fileGET /audio/:id- Retrieve audio fileGET /audio/:id/metadata- Get audio metadataDELETE /audio/:id- Delete audio fileTech Stack:
3. FHIR Adapter Service (13 story points)
Purpose: Transform ScribeMed data to/from FHIR R4 format for healthcare interoperability.
Key Features:
Endpoints:
GET /Patient/:id- Get FHIR Patient resourceGET /Encounter/:id- Get FHIR Encounter resourceGET /Observation/:id- Get FHIR Observation resourcePOST /Patient- Create FHIR PatientGET /Patient?identifier=:mrn- Search patientsPOST /$export- Bulk FHIR exportTech Stack:
FHIR Resource Mappings:
4. Agent Orchestrator Service (5 story points)
Purpose: Coordinate multi-service workflows for complex clinical documentation tasks.
Key Features:
Example Workflow:
Endpoints:
POST /workflows- Start new workflowGET /workflows/:id- Get workflow statusGET /workflows/:id/steps- Get workflow execution stepsDELETE /workflows/:id- Cancel workflowTech Stack:
Acceptance Criteria
RAG Service:
Audio Capture Service:
FHIR Adapter:
Agent Orchestrator:
Implementation Timeline
Month 1:
Month 2:
Testing Requirements
Documentation
Status
Open
Related Issues