omm7 commited on
Commit
8336224
·
verified ·
1 Parent(s): ca1ac84

Upload data_generator.py

Browse files
Files changed (1) hide show
  1. data_generator.py +18 -1
data_generator.py CHANGED
@@ -87,4 +87,21 @@ def compute_ratios(s: FinancialSnapshot) -> Dict:
87
  "roe": roe,
88
  "debt_to_equity": dte,
89
  "profit_margin": pm,
90
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  "roe": roe,
88
  "debt_to_equity": dte,
89
  "profit_margin": pm,
90
+ }
91
+
92
+ # ------------------------------------------------------------
93
+ # Health classification (required by Medium grader)
94
+ # ------------------------------------------------------------
95
+
96
+ def classify_health(roe: float, dte: float, pm: float) -> str:
97
+ """
98
+ Classifies financial health based on ratio thresholds.
99
+ Matches logic expected by grader_medium.
100
+ """
101
+
102
+ if roe > 0.15 and dte < 1.0 and pm > 0.2:
103
+ return "Healthy"
104
+ elif roe > 0.05 and dte < 2.0 and pm > 0.1:
105
+ return "At Risk"
106
+ else:
107
+ return "Critical"