rohitsar567 Claude Opus 4.7 (1M context) commited on
Commit
2323b26
Β·
1 Parent(s): 59cf54e

fix(upload-extract): read sc.grade not sc.overall_grade

Browse files

Scorecard dataclass exposes `.grade` (backend/scorecard.py:112). Only
the ScorecardResponse wire model renames it to `.overall_grade` in
the /api/policies/{id}/scorecard endpoint. The extraction-status
resolver was reading `.overall_grade` off the dataclass, getting None,
and silently storing grade=None on every upload β€” the multi-insurer
parity audit caught it.

Audit re-run will now show status.completeness_pct AND status.overall_grade
both equal to the scorecard endpoint's response.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. backend/uploaded_docs.py +6 -1
backend/uploaded_docs.py CHANGED
@@ -1182,7 +1182,12 @@ async def extract_one_for_upload(
1182
  _sc = _bs(_doc_for_sc, insurer_reviews=_ir, profile=None)
1183
  if _sc is not None:
1184
  _final_completeness = float(_sc.data_completeness_pct)
1185
- _final_grade = _sc.overall_grade
 
 
 
 
 
1186
  except Exception as _sc_err: # noqa: BLE001
1187
  _log.warning(
1188
  "[upload-extract] status-card resolve failed for %s: %s: %s",
 
1182
  _sc = _bs(_doc_for_sc, insurer_reviews=_ir, profile=None)
1183
  if _sc is not None:
1184
  _final_completeness = float(_sc.data_completeness_pct)
1185
+ # 2026-05-27 β€” Scorecard dataclass attr is `.grade`, NOT
1186
+ # `.overall_grade` (only the ScorecardResponse wire field
1187
+ # is renamed). Earlier draft of this resolver used the
1188
+ # wire name and silently logged grade=None on every
1189
+ # upload β€” the parity audit caught it.
1190
+ _final_grade = _sc.grade
1191
  except Exception as _sc_err: # noqa: BLE001
1192
  _log.warning(
1193
  "[upload-extract] status-card resolve failed for %s: %s: %s",