UST HealthProof receives alerts from several monitoring surfaces. Design an inheritance hierarchy that calculates each alert's priority through polymorphism, then return the highest-priority alert IDs.
Create a base Alert class with shared fields: alert_id, severity, age_minutes, and created_at. Implement these subclasses:
PatientDataAlert: priority is the base priority plus affected_users // 100.PlatformAlert: priority is the base priority plus affected_users // 50.ComplianceAlert: priority is the base priority plus 15.The base priority is severity * 10 + min(age_minutes, 120) // 30. Each subclass must override a priority() method while reusing inherited fields. The function must construct the correct subclass from each input record, sort alerts by descending priority, then ascending created_at, and finally ascending alert_id. Return at most limit IDs.
rank_alerts(alerts, limit) receives a list of dictionaries and an integer. Each dictionary contains id, type, severity, age_minutes, created_at, and affected_users. The type is one of patient_data, platform, or compliance. Return a list of alert ID strings.
def rank_alerts(alerts, limit):