Wire the guarded conversational RAG answer layer end-to-end

This commit is contained in:
2026-08-05 14:33:13 +07:00
parent 834d9e51b0
commit ef08b4929e
127 changed files with 37921 additions and 169 deletions
+11
View File
@@ -2,6 +2,7 @@ import json
from pathlib import Path
from ingestion.extract.formulas import (
BARLESS_FORMULA_BOTTOM_PT,
FORMULA_BAND_HEIGHT_PT,
FORMULA_SIDE_MARGIN_PT,
load_formula_regions,
@@ -50,6 +51,16 @@ def test_the_barless_adenosin_formula_is_recorded_as_a_recall_limit():
assert "UNMEASURED" in payload["recall_limit"]
def test_barless_adenosin_band_reaches_its_printed_denominator():
payload = json.loads(VERIFIED.read_text(encoding="utf-8"))
entry = next(r for r in payload["regions"] if r.get("source_prints_no_bar"))
region = next(r for r in load_formula_regions() if r.physical_page == 147)
assert region.bbox[3] == entry["bar_bbox"][3] + BARLESS_FORMULA_BOTTOM_PT
# "Ví dụ:" begins immediately afterwards with its span centre at ~704.3;
# the formula band must stop before that prose and the following table.
assert region.bbox[3] < 704
def test_outlined_text_transcriptions_cover_every_detected_run():
payload = json.loads(TRANSCRIPTIONS.read_text(encoding="utf-8"))
runs = payload["runs"]