abinazebinoy commited on
Commit
b8ea3a2
Β·
1 Parent(s): 8f40968

fix(health): add platt_calibration to degraded_detectors list

Browse files

platt_params.json absence was already detected and reflected in
detector_models.platt_calibration='defaults', but it was not added to
the degraded_detectors array.

Callers (monitoring scripts, CI health checks) that check only the
degraded_detectors field would see an empty list and assume all
calibration is fitted β€” silently missing the uncalibrated state.

Fix: append a descriptive entry to degraded_detectors when
platt_params.json does not exist, including the remediation hint
'Run scripts/fit_platt.py'.

Files changed (1) hide show
  1. backend/main.py +5 -0
backend/main.py CHANGED
@@ -231,6 +231,11 @@ async def health_check(request: Request):
231
  _degraded_detectors.append("own_embedding β€” EfficientNet embedding scores will be 0.5")
232
  if not _xgb_ok:
233
  _degraded_detectors.append("xgboost_ensemble β€” ensemble falls back to unweighted sum")
 
 
 
 
 
234
  return {
235
  "status": "degraded" if _degraded else "healthy",
236
  "debug_mode": settings.DEBUG,
 
231
  _degraded_detectors.append("own_embedding β€” EfficientNet embedding scores will be 0.5")
232
  if not _xgb_ok:
233
  _degraded_detectors.append("xgboost_ensemble β€” ensemble falls back to unweighted sum")
234
+ if not _platt_ok:
235
+ _degraded_detectors.append(
236
+ "platt_calibration β€” using hand-picked defaults (A=5.0, B=-2.5), "
237
+ "not fitted to real data. Run scripts/fit_platt.py to fix."
238
+ )
239
  return {
240
  "status": "degraded" if _degraded else "healthy",
241
  "debug_mode": settings.DEBUG,