From ca0f02aa0ce691e70df554cee7784d2a0150cd5f Mon Sep 17 00:00:00 2001 From: rockdrigo Date: Wed, 18 Nov 2026 19:56:07 -0600 Subject: [PATCH] A coded catalog result may name the code system of its values; the histological type comes out as its ICD-O-3 code --- tests/test_extracted_results.py | 2 +- webapi/orchestration/reference/catalogs.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_extracted_results.py b/tests/test_extracted_results.py index 8dd938e..440f42e 100644 --- a/tests/test_extracted_results.py +++ b/tests/test_extracted_results.py @@ -125,7 +125,7 @@ def test_a_pathology_pdf_s_text_layer_gives_its_results(): going through the PDF reader, or a receptor's percentage stops sharing its captions with the receptor.""" leido = cama.DEL_REPORTE_DE_PATOLOGIA.leer(SimpleNamespace(bx_pdf_blob=pdf_de(INFORME_DE_PATOLOGIA[1]))) assert {r: v for r, (v, _) in leido.items()} == { - "biopsia.tipo_histologico": "DUCTAL_INFILTRANTE", "biopsia.grado_nottingham": "G2", + "biopsia.tipo_histologico": "8500/3", "biopsia.grado_nottingham": "G2", "biopsia.receptor_estrogeno": "POSITIVO", "biopsia.receptor_estrogeno_pct": 90.0, "biopsia.receptor_progesterona": "NEGATIVO", "biopsia.receptor_progesterona_pct": 0.0, "biopsia.her2": "H3", "biopsia.ki67_pct": 25.0, diff --git a/webapi/orchestration/reference/catalogs.py b/webapi/orchestration/reference/catalogs.py index 2691940..a4a8bd8 100644 --- a/webapi/orchestration/reference/catalogs.py +++ b/webapi/orchestration/reference/catalogs.py @@ -204,8 +204,8 @@ def _tipo_de_valor(resultado: dict, resultado_id: str) -> str: raise CatalogoInvalido(f"{resultado_id}: un resultado de tipo codigo necesita valores.") if tipo_valor != "codigo" and "valores" in resultado: raise CatalogoInvalido(f"{resultado_id}: solo un resultado de tipo codigo lleva valores, no uno de tipo {tipo_valor}.") - if tipo_valor != "externo" and "sistema" in resultado: - raise CatalogoInvalido(f"{resultado_id}: solo un resultado de tipo externo lleva sistema, no uno de tipo {tipo_valor}.") + if tipo_valor not in ("codigo", "externo") and "sistema" in resultado: + raise CatalogoInvalido(f"{resultado_id}: solo un resultado de tipo codigo o externo lleva sistema, no uno de tipo {tipo_valor}.") if tipo_valor != "numero" and "unidad" in resultado: raise CatalogoInvalido(f"{resultado_id}: solo un resultado de tipo numero lleva unidad, no uno de tipo {tipo_valor}.") return tipo_valor