Your question is Filter Collection by Criteria. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Dataminr First Alert processes event records with fields such as category, confidence, severity, and acknowledgment status. Given a collection of alerts and a set of optional criteria, return every alert that satisfies all specified criteria, preserving the original order.
Implement filter_alerts(alerts, criteria).
alerts is a list of dictionaries. Each dictionary contains id as a string, category as a string, confidence as a number from 0 to 1, severity as an integer from 1 to 5, and acknowledged as a boolean.criteria is a dictionary. Supported optional keys are min_confidence, min_severity, categories, and acknowledged.criteria.categories is a list of accepted category strings. An empty list matches no categories.alerts or its dictionaries.def filter_alerts(alerts, criteria):