File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,19 @@ def get_status(self) -> HealthcheckStatus:
2626 def is_passing (self ) -> bool :
2727 return self .get_status () in (HealthcheckStatus .PASS , HealthcheckStatus .INFO )
2828
29+ def is_user_facing (self ) -> bool :
30+ """Returns True if this card should be displayed to users.
31+
32+ User-facing cards:
33+ - FAIL: Critical issues blocking the experiment and requiring immediate attention
34+ - WARNING: Potential issues that can lead to issues in the future
35+ - INFO: Informational context and feature upsells
36+
37+ Hidden cards:
38+ - PASS: No issues, nothing noteworthy to display
39+ """
40+ return self .get_status () != HealthcheckStatus .PASS
41+
2942 def get_aditional_attrs (self ) -> dict [str , str | int | float | bool ]:
3043 return json .loads (self .blob )
3144
Original file line number Diff line number Diff line change 1+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2+ #
3+ # This source code is licensed under the MIT license found in the
4+ # LICENSE file in the root directory of this source tree.
5+
6+ # pyre-strict
7+
8+ import pandas as pd
9+ from ax .analysis .healthcheck .healthcheck_analysis import (
10+ create_healthcheck_analysis_card ,
11+ HealthcheckStatus ,
12+ )
13+ from ax .utils .common .testutils import TestCase
14+
15+
16+ class TestHealthcheckAnalysisCard (TestCase ):
17+ def test_is_user_facing (self ) -> None :
18+ # Only PASS status should be hidden; all others are user-facing
19+ for status in HealthcheckStatus :
20+ with self .subTest (status = status .name ):
21+ card = create_healthcheck_analysis_card (
22+ name = "TestAnalysis" ,
23+ title = "Test Healthcheck" ,
24+ subtitle = "Test subtitle" ,
25+ df = pd .DataFrame (),
26+ status = status ,
27+ )
28+ expected = status != HealthcheckStatus .PASS
29+ self .assertEqual (card .is_user_facing (), expected )
Original file line number Diff line number Diff line change @@ -265,10 +265,11 @@ def compute(
265265 if analyis is not None
266266 ]
267267
268- non_passing_health_checks = [
268+ user_facing_health_check_cards = [
269269 card
270270 for card in health_check_cards
271- if (isinstance (card , HealthcheckAnalysisCard ) and not card .is_passing ())
271+ if isinstance (card , HealthcheckAnalysisCard )
272+ and card .is_user_facing ()
272273 or isinstance (card , ErrorAnalysisCard )
273274 ]
274275
@@ -277,9 +278,9 @@ def compute(
277278 name = "HealthchecksAnalysis" ,
278279 title = HEALTH_CHECK_CARDGROUP_TITLE ,
279280 subtitle = HEALTH_CHECK_CARDGROUP_SUBTITLE ,
280- children = non_passing_health_checks ,
281+ children = user_facing_health_check_cards ,
281282 )
282- if len (non_passing_health_checks ) > 0
283+ if len (user_facing_health_check_cards ) > 0
283284 else None
284285 )
285286
Original file line number Diff line number Diff line change 55
66# pyre-strict
77
8-
98from datetime import datetime
109
1110import pandas as pd
You can’t perform that action at this time.
0 commit comments