Architecture Overview
This document provides a comprehensive overview of Medispeak's architecture, explaining how different components work together to provide seamless voice-to-EMR functionality.
Component Overview
1. Frontend Components
Chrome Extension
- Technology: React + TypeScript
- Key Features:
- Voice capture and processing
- EMR field detection
- Real-time feedback
- Integration Points:
- Chrome Extension API
- Backend API communication
Web Widget
- Technology: React + TypeScript
- Features:
- Embeddable interface
- Customizable UI
- Event-driven architecture
- Integration:
- Custom events system
- PostMessage API
2. Backend Services
Rails API Server
- Technology: Ruby on Rails
- Responsibilities:
- Request handling
- Authentication
- Business logic
- Data persistence
- Key Features:
- RESTful API
- WebSocket support
- Background job processing
- Caching layer
AI Processing Service
- Components:
- Speech-to-text engine
- Medical terminology processor
- Context analyzer
- Field mapper
- Technologies:
- TensorFlow/PyTorch models
- NLP processing pipeline
- Custom medical models
3. Data Storage
PostgreSQL Database
- Schema Overview:
-- Core tables
users
organizations
transcriptions
emr_mappings
-- Reference tables
medical_terms
field_templates
specialties - Key Features:
- Audit logging
- Data encryption
- Performance optimization
Redis Cache
- Usage:
- Session management
- Rate limiting
- Real-time data
- Job queues
- Key Features:
- High availability
- Data persistence
- Pub/sub capabilities
Data Flow
1. Voice Input Processing
sequenceDiagram
participant U as User
participant F as Frontend
participant B as Backend
participant AI as AI Service
U->>F: Speak into mic
F->>F: Buffer audio
F->>B: Stream audio
B->>AI: Process speech
AI->>B: Return text
B->>F: Send structured data
F->>U: Show results
2. EMR Integration
sequenceDiagram
participant F as Frontend
participant B as Backend
participant EMR as EMR System
F->>B: Send structured data
B->>B: Validate data
B->>EMR: Map to EMR fields
EMR->>B: Confirm update
B->>F: Success response
Security Architecture
1. Authentication
- JWT-based authentication
- OAuth2 integration
- Multi-factor authentication
- Session management
2. Data Protection
- End-to-end encryption
- At-rest encryption
- Audit logging
3. Network Security
- TLS/SSL encryption
- API rate limiting
- CORS policies
- WAF integration
Scalability
1. Horizontal Scaling
- Load balancing
- Service replication
- Database sharding
- Cache distribution
2. Performance Optimization
- CDN integration
- Query optimization
- Caching strategies
- Background processing
Monitoring and Logging
1. System Monitoring
- Performance metrics
- Error tracking
- Usage statistics
- Health checks
2. Logging
- Structured logging
- Log aggregation
- Audit trails
- Analytics
Development Workflow
1. Code Organization
frontend/
├── src/
│ ├── components/
│ ├── services/
│ ├── hooks/
│ └── utils/
backend/
├── app/
│ ├── controllers/
│ ├── models/
│ └── services/
└── lib/
└── ai/
2. Deployment Pipeline
- Continuous Integration
- Automated testing
- Staging environments
- Production deployment
Future Architecture Considerations
1. Scalability Improvements
- Microservices architecture
- Serverless components
- Edge computing
- Global distribution
2. AI Enhancements
- Custom model training
- Real-time learning
- Specialty-specific models
- Multi-language support
Contributing
For information on contributing to Medispeak's architecture:
- Review our Contributing Guidelines
- Check Future Projects
- Join architecture discussions on GitHub