diff --git a/volumes/db/cc/78-exam-marker-command-preamble.sql b/volumes/db/cc/78-exam-marker-command-preamble.sql new file mode 100644 index 0000000..79b4679 --- /dev/null +++ b/volumes/db/cc/78-exam-marker-command-preamble.sql @@ -0,0 +1,20 @@ +--========================================================================================== +-- 78. exam_questions.command_word + preamble — richer recognition carried by the analyse contract v2 (WS-2) +--========================================================================================== +-- The extraction service (docling-exam-spike analyse.py v2, scripts/ANALYSE-CONTRACT.md) now carries two +-- fields the thin v1 bridge dropped: +-- * command_word — the primary command verb per part (calculate / explain / suggest / describe …), from +-- structure.command_words / part_info.primary. Drives the question-tree command pill + future filtering. +-- * preamble — the stem prose that introduces a question/part (structure.preamble_by_label), as a +-- jsonb sidecar {n, text:[…lines], nontext:[{kind,cls,page}], bands:[{page,y0,y1}]}. Kept as jsonb (not +-- a column per line) so the tree/doc view can show the stem and the canvas can locate its band. The +-- preamble band is ALSO emitted as a drawable context region (context_type='preamble'); this column is +-- the authoritative text for the outline view. +-- Both nullable; containers/parts without a detected command/preamble stay null. Additive + idempotent. +alter table public.exam_questions add column if not exists command_word text; +alter table public.exam_questions add column if not exists preamble jsonb; + +comment on column public.exam_questions.command_word is + 'Primary command verb for a leaf part (calculate/explain/suggest/describe/…), from the analyse contract v2 (structure command_words / part_info). Null for container questions or when none detected.'; +comment on column public.exam_questions.preamble is + 'Stem prose introducing this question/part, from the analyse contract v2 (structure.preamble_by_label): {n, text:[lines], nontext:[{kind,cls,page}], bands:[{page,y0,y1}]}. Authoritative text for the outline view; the band is also drawn as a context_type=preamble region.';