fix: harden extraction batch handling
Deploy contracts-flask / validate (push) Canceled after 0s

This commit is contained in:
2026-10-31 19:06:34 +03:00
parent 9c73a730d1
commit 79de42da96
6 changed files with 79 additions and 21 deletions
+4 -2
View File
@@ -184,8 +184,10 @@ def _build_dossiers_for_batch(batch_id):
records = []
for document in documents:
passport = passport_by_id.get(document["id"])
if not passport:
passport = {"document_id": document["id"], "doc_class": "unknown"}
# A missing or failed passport says extraction produced no usable evidence;
# do not misreport that technical failure as a missing contract number.
if not passport or passport.get("status") == "FAILED":
continue
if passport.get("doc_class") == "ignored_accounting":
continue
counterparty = {