drop cohort builder plumbing; use kit cohorte_armado builds for MLflow lineage
This commit is contained in:
+22
-4
@@ -1,10 +1,12 @@
|
||||
from datetime import date
|
||||
|
||||
import pytest
|
||||
|
||||
from core.ocr import OcrEstatus
|
||||
from models.ocr import CIT_VPH_COLUMNS, OcrExtractionResult, OcrExtractor, run_pending_extractions
|
||||
|
||||
from models.ocr import (
|
||||
CIT_VPH_COLUMNS,
|
||||
OcrExtractionResult,
|
||||
OcrExtractor,
|
||||
run_pending_extractions,
|
||||
)
|
||||
|
||||
|
||||
class StubVphExtractor(OcrExtractor):
|
||||
@@ -95,3 +97,19 @@ def test_run_pending_extractions_logs_to_governance(cacu_db, governance_db):
|
||||
assert len(runs) == 1
|
||||
assert runs[0].domain == "cacu"
|
||||
assert runs[0].source_description == "HIS export 2026-09-01"
|
||||
|
||||
|
||||
def test_done_rows_do_not_use_up_the_batch(cacu_db):
|
||||
repo, CitologiaCervical = _make_cacu_citologia_repo()
|
||||
for n in range(3):
|
||||
repo.create(CitologiaCervical(pac_id_hospital=f"H-{n}", cit_vph_pdf_blob=b"%PDF-fake",
|
||||
cit_vph_ocr_estatus=OcrEstatus.REALIZADO.value))
|
||||
repo.create(CitologiaCervical(pac_id_hospital="H-nuevo", cit_vph_pdf_blob=b"%PDF-fake"))
|
||||
repo.create(CitologiaCervical(pac_id_hospital="H-sin-pdf"))
|
||||
|
||||
summary = run_pending_extractions(repo, CIT_VPH_COLUMNS, StubVphExtractor(), domain="cacu",
|
||||
entity="citologiacervical", limit=1)
|
||||
|
||||
assert (summary.processed, summary.skipped_already_done) == (1, 3)
|
||||
assert repo.list(pac_id_hospital="H-nuevo")[0].cit_vph_resultado == "POSITIVO"
|
||||
assert repo.list(pac_id_hospital="H-sin-pdf")[0].cit_vph_ocr_estatus is None
|
||||
|
||||
Reference in New Issue
Block a user