From e48dd73fdf85ce6b47519dbc34049d4cea04243e Mon Sep 17 00:00:00 2001 From: "Kevin Carter (via Claude)" Date: Sat, 4 Jul 2026 13:13:45 +0000 Subject: [PATCH] exam: capture sections + choice_groups + marks_confidence in extraction_meta (WS-2 R3) Persist the paper's question-layout signals (A-level Section A/B, EITHER/OR choice groups, marks confidence) onto exam_templates.extraction_meta so the setup UI can show them. Data was carried by the contract but dropped at persistence. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01GruxHXxfdp4kZCgAMVFgvV --- routers/exam/templates.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/exam/templates.py b/routers/exam/templates.py index c4b6d66..bf79388 100644 --- a/routers/exam/templates.py +++ b/routers/exam/templates.py @@ -802,6 +802,10 @@ def _run_service_extract_merge(ctx: ExamContext, template_id: str, pdf_bytes: by updates: Dict[str, Any] = {"extraction_meta": { "engine": "extract-service", "slug": slug, "audit": meta.get("audit") or {}, "counts": {k: len(v) for k, v in rows.items()}, + # question-layout signals for the setup UI: paper sections (e.g. A-level Section A/B) + EITHER/OR choices + "sections": meta.get("sections") or [], + "choice_groups": meta.get("choice_groups") or [], + "marks_confidence": meta.get("marks_confidence"), }} n_pages = meta.get("n_pages") or meta.get("pages") if n_pages: