feat: deterministic sheet-list reconciliation (cover index vs identified sheets)
This commit is contained in:
@@ -27,6 +27,7 @@ from typing import Dict, Optional, Callable
|
||||
|
||||
from backend.pipeline.pdf_processor import convert_pdf_to_images
|
||||
from backend.pipeline.extractor import extract_assertions
|
||||
from backend.sheet_reconcile import declared_sheet_list, reconcile_sheets
|
||||
from backend.text_layer import attach_text_layers, coverage_gaps
|
||||
from backend.pipeline.sheet_index import classify_sheets, derive_project_meta_from_cover
|
||||
from backend.pipeline.jurisdiction import run_jurisdiction
|
||||
@@ -111,6 +112,19 @@ def _run_stages(
|
||||
sheets = extract_assertions(pages)
|
||||
coverage_gaps(pages, sheets) # classic: log-only recall signal
|
||||
|
||||
# Deterministic reconciliation: cover-sheet index vs identified sheets.
|
||||
page_to_text = {p["page_number"]: p.get("text_layer") for p in pages}
|
||||
sheet_recon = reconcile_sheets(sheets, declared_sheet_list(page_to_text))
|
||||
if sheet_recon["declared_total"]:
|
||||
print(f"[SheetIndex] cover declares {sheet_recon['declared_total']} "
|
||||
f"sheets; {sheet_recon['found_total']} identified in set")
|
||||
if sheet_recon["declared_not_in_set"]:
|
||||
print(f"[SheetIndex] declared but not in set: "
|
||||
f"{', '.join(sheet_recon['declared_not_in_set'][:20])}")
|
||||
if sheet_recon["in_set_not_declared"]:
|
||||
print(f"[SheetIndex] in set but not declared: "
|
||||
f"{', '.join(sheet_recon['in_set_not_declared'][:20])}")
|
||||
|
||||
stage("Classify sheet index")
|
||||
sheet_index = classify_sheets(sheets)
|
||||
|
||||
@@ -167,6 +181,7 @@ def _run_stages(
|
||||
report["project_input"] = merged_input
|
||||
report["jurisdiction"] = jurisdiction
|
||||
report["sheet_index"] = sheet_index
|
||||
report["sheet_reconciliation"] = sheet_recon
|
||||
report["project_intelligence"] = project_intel
|
||||
report["validated_issues"] = prioritized
|
||||
report["rfis"] = rfis
|
||||
|
||||
Reference in New Issue
Block a user