Practice/Oracle/Design a healthcare platform
Design a healthcare platform
System DesignOptional
Problem Statement
Design an online healthcare platform that allows users to access medical records based on their permission levels and view educational video tutorials. The system should support role-based access control for different types of medical information and provide streaming capabilities for instructional content.
This platform combines a medical records access system with a video education library, requiring both fine-grained access control and media delivery infrastructure. Interviewers ask this because it tests your ability to design secure, permission-aware data access alongside scalable content delivery, two distinct but interconnected challenges.
Key Requirements
Functional
- Medical records access -- users authenticate and access medical records based on role, patient consent, and the type of information (labs, imaging, notes)
- Role-based views -- different categories of medical information are restricted by fine-grained, role-based permissions so users only see what they are authorized to see
- Video tutorials -- users stream educational video tutorials with appropriate access controls and adaptive playback quality
- Audit history -- users view an audit trail of who accessed their records and when
Non-Functional
- Scalability -- support millions of patient records and thousands of concurrent video viewers across multiple healthcare institutions
- Reliability -- achieve 99.99% availability for records access; video streaming can degrade quality rather than fail
- Latency -- retrieve medical records within 500ms; start video playback within 2 seconds
- Consistency -- strong consistency for access control decisions and record updates; eventual consistency for video analytics and audit log replication
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Fine-Grained Access Control and Authorization
Healthcare data requires defense-in-depth authorization, not just a single role check at the edge.
Hints to consider:
- Implement a multi-layer authorization model: API gateway for coarse checks, application service for fine-grained policy evaluation
- Model permissions as a combination of role (doctor, nurse, patient, admin), resource type (labs, imaging, notes), and patient consent status
- Use an authorization service that evaluates policies at request time, caching permission decisions in Redis for performance
- Support purpose-of-use tagging so that access decisions can distinguish between treatment, payment, and research purposes
2. Medical Records Data Model and Privacy
Interviewers expect a data model that supports fine-grained access without exposing unauthorized information in any response.
Hints to consider:
- Partition medical records by category (labs, imaging, clinical notes, medications) with separate access policies per category
- Use database-level row security or application-level filtering to ensure queries never return unauthorized records
- Encrypt sensitive fields at rest with per-patient or per-institution keys using envelope encryption
- Support patient-controlled consent: patients can grant or revoke access to specific record categories for specific providers
3. Video Streaming Infrastructure
Educational videos require a separate delivery infrastructure from the medical records system.
Hints to consider:
- Store video content in object storage and deliver via CDN with signed URLs that enforce access control and expiration
- Transcode videos into multiple bitrates and use adaptive bitrate streaming (HLS/DASH) for varying network conditions
- Process uploads asynchronously: transcode, generate thumbnails, and extract captions in a background pipeline
- Implement access control at the URL generation level: only authorized users receive signed URLs to video content
4. Audit Trails and Compliance
Healthcare platforms must maintain detailed, tamper-evident audit logs. Interviewers probe your logging strategy.
Hints to consider:
- Log every data access event with timestamp, user identity, resource accessed, action performed, and IP address
- Store audit logs in an append-only, immutable store (separate from the main database) to prevent tampering
- Support efficient querying of audit logs for compliance reviews (e.g., "show all accesses to patient X's records in the last 30 days")
- Implement break-glass access for emergencies with mandatory justification that is prominently flagged in audit reports