From 05d0e4c2788c8bc566bd9df50bcea86217a8da57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Trevi=C3=B1o?= Date: Thu, 3 Dec 2026 15:22:15 -0600 Subject: [PATCH] =?UTF-8?q?Autom=C3=A1tico:=20draw-only=20option;=20end-to?= =?UTF-8?q?-end=20test=20covers=20biopsies,=20treatments=20and=20deaths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_automatico.py | 7 +++++-- webapi/ingest.py | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/test_automatico.py b/tests/test_automatico.py index 7647428..b873111 100644 --- a/tests/test_automatico.py +++ b/tests/test_automatico.py @@ -9,6 +9,8 @@ import json from test_conectar import ok, wait_for SOURCE = "resultados" +# Studies whose every record the operator's drawing places, the draft must place too. +DRAWN = ("cervical_cytology", "mammography", "cervical_biopsy", "breast_biopsy") HOURS = 3600 # with a model answering, it reads every document: an hour or more per run @@ -39,7 +41,8 @@ def test_automatico_drafts_a_sites_pipeline_and_runs_it(api, platform, site): kinds = [n["kind"] for n in saved["pipeline"]["nodes"]] assert {"read", "route", "extract", "link", "target"} <= set(kinds) studies = {n["entity"] for n in saved["pipeline"]["nodes"] if n["kind"] == "target"} - assert {"cervical_cytology", "mammography"} <= studies, studies + # One layout may report several studies: pathology by organ, notes by what they record. + assert set(DRAWN) | {"breast_treatment", "death"} <= studies, studies # Documents no route claims wait for a reviewer, as with a drawn pipeline. assert any(n.get("otherwise") for n in saved["pipeline"]["nodes"]) @@ -51,7 +54,7 @@ def test_automatico_drafts_a_sites_pipeline_and_runs_it(api, platform, site): both = set(mine) & set(theirs) differ = {k: (mine[k], theirs[k]) for k in both if str(mine[k]) != str(theirs[k])} assert both and not differ, differ - for study in ("cervical_cytology", "mammography"): + for study in DRAWN: drawn_records = {r for s, r, _ in theirs if s == study} assert drawn_records <= {r for s, r, _ in mine if s == study}, study diff --git a/webapi/ingest.py b/webapi/ingest.py index 481bf96..b2da888 100644 --- a/webapi/ingest.py +++ b/webapi/ingest.py @@ -156,11 +156,11 @@ def language_model() -> LanguageModel: @router.post("/pipelines/{pipeline_id}/draft") def start_draft( - pipeline_id: PipelineId, client: DagsterGraphQLClient = Depends(dagster) + pipeline_id: PipelineId, run: bool = True, client: DagsterGraphQLClient = Depends(dagster) ) -> dict[str, str]: """Automático: starts the `draft` job, which draws the whole pipeline from its saved - sources (the only nodes it may hold), saves it as a new version and runs it; follow it - at /runs/{run_id}.""" + sources (the only nodes it may hold), saves it as a new version and runs it (`run` + false: drawn and saved only); follow it at /runs/{run_id}.""" if not config_log.latest_version(pipeline_id): raise HTTPException(404, detail=f"no pipeline {pipeline_id}") _, saved = config_log.get(pipeline_id) @@ -169,7 +169,7 @@ def start_draft( "fuentes: guárdela solo con ellas.") # fmt: skip if not (found := llm.status())["available"]: raise HTTPException(503, detail=f"El modelo de lenguaje no responde: {found['reason']}") - config = {"ops": {"draft_pipeline": {"config": {"pipeline": pipeline_id}}}} + config = {"ops": {"draft_pipeline": {"config": {"pipeline": pipeline_id, "run": run}}}} try: return {"run_id": client.submit_job_execution("draft", run_config=config)} except DagsterGraphQLClientError as e: