From b7f1b54f72de1518cd8fc55439723064e63dcdf5 Mon Sep 17 00:00:00 2001 From: edgar Date: Fri, 27 Nov 2026 16:03:20 -0600 Subject: [PATCH] CaCu cytology: additional findings as the cytologist confirmed them No grades or scales: the inflammation severity field and its code system are gone (the raw text keeps the grade). The two endometrial-cell findings are one, for 40 or older. Catalog, ConceptMap, extraction and synthetic site. Tests are deferred until all the new fields are in. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01HmQxVJFdw3mNQ5GUFgzwz1 --- Core/core/catalog/cacu.yaml | 9 +- Core/core/catalog/systems.yaml | 3 - models | 2 +- synthetic/synthetic/site.py | 11 +-- tests/fixtures/concept_maps/erick_site.json | 96 ++++++++++++--------- tests/fixtures/pipelines/erick_site.json | 6 +- 6 files changed, 62 insertions(+), 65 deletions(-) diff --git a/Core/core/catalog/cacu.yaml b/Core/core/catalog/cacu.yaml index 18835a5..df45baf 100644 --- a/Core/core/catalog/cacu.yaml +++ b/Core/core/catalog/cacu.yaml @@ -66,12 +66,6 @@ cervical_cytology: # The cytologist's additional findings, free text on the form (known with the report). # A finding is true when the text states it; otherwise unknown, never false. cyto_findings_text: {type: text, event: report, title: Hallazgos adicionales} - cyto_inflammation_severity: - type: code - event: report - title: Grado de inflamación - system: inflammation-severity - codes: {mild: Leve, moderate: Moderada, severe: Severa} cyto_inflammation: {type: boolean, event: report, title: "Inflamación"} cyto_reactive_changes: {type: boolean, event: report, title: "Cambios reactivos"} cyto_bacterial_vaginosis_flora: {type: boolean, event: report, title: "Flora sugestiva de vaginosis bacteriana"} @@ -91,14 +85,13 @@ cervical_cytology: cyto_radiotherapy_effect: {type: boolean, event: report, title: "Efecto de radioterapia"} cyto_iud_changes: {type: boolean, event: report, title: "Cambios compatibles con dispositivo intrauterino"} cyto_post_hysterectomy_glandular_cells: {type: boolean, event: report, title: "Células glandulares post-histerectomía"} - cyto_endometrial_cells_45_atypia: {type: boolean, event: report, title: "Células endometriales en atipias, 45 años o más"} cyto_bacteria: {type: boolean, event: report, title: "Bacterias"} cyto_herpes_image: {type: boolean, event: report, title: "Imagen del virus del herpes"} cyto_fungi: {type: boolean, event: report, title: "Hongos"} cyto_radiation: {type: boolean, event: report, title: "Cambios reactivos: radiación"} cyto_repair: {type: boolean, event: report, title: "Cambios reactivos: reparación"} cyto_iud_effect: {type: boolean, event: report, title: "Efecto del DIU"} - cyto_endometrial_cells_over_40: {type: boolean, event: report, title: "Células endometriales en mayores de 40 años"} + cyto_endometrial_cells_40_plus: {type: boolean, event: report, title: "Células endometriales, 40 años o más"} cyto_findings_none: {type: boolean, event: report, title: "Hallazgos adicionales: ninguno"} cervical_biopsy: diff --git a/Core/core/catalog/systems.yaml b/Core/core/catalog/systems.yaml index cd98dda..f6ac0b1 100644 --- a/Core/core/catalog/systems.yaml +++ b/Core/core/catalog/systems.yaml @@ -12,9 +12,6 @@ cervical-screening-history: cervix-exam: url: https://isssteleon.org/fhir/CodeSystem/cervix-exam title: Exploración del cuello uterino -inflammation-severity: - url: https://isssteleon.org/fhir/CodeSystem/inflammation-severity - title: Grado de inflamación bi-rads: url: https://isssteleon.org/fhir/CodeSystem/bi-rads title: BI-RADS diff --git a/models b/models index 0fcbe95..a93292f 160000 --- a/models +++ b/models @@ -1 +1 @@ -Subproject commit 0fcbe95c909b7f336eccf72cc88eb5b82b5cef89 +Subproject commit a93292f3dda1afe09ae77f84bbf80937924afa94 diff --git a/synthetic/synthetic/site.py b/synthetic/synthetic/site.py index baabdc5..4fb48b1 100644 --- a/synthetic/synthetic/site.py +++ b/synthetic/synthetic/site.py @@ -206,9 +206,8 @@ def _findings(rng: random.Random) -> tuple[str, dict]: said, values = [], {} for field in picked: statement, values[field] = FINDINGS_CYTO[field], True - if field == "cyto_inflammation": - grade = values["cyto_inflammation_severity"] = rng.choice(list(SEVERITY)) - statement += f" {SEVERITY[grade]}" + if field == "cyto_inflammation": # a grade may follow; no field takes it + statement += rng.choice(("", " leve", " moderada", " severa")) said.append(statement + ".") text = " ".join(said) if len(text) > 100: # one line: the expected text has no line break @@ -271,18 +270,16 @@ FINDINGS_CYTO = { # the cytologist's additional findings: field -> as written "cyto_radiotherapy_effect": "Efecto de radioterapia", "cyto_iud_changes": "Cambios compatibles con presencia de dispositivo intrauterino", "cyto_post_hysterectomy_glandular_cells": "Células glandulares post-histerectomía", - "cyto_endometrial_cells_45_atypia": - "Presencia de células endometriales en atipias en pacientes de 45 años o más", "cyto_bacteria": "Bacterias", "cyto_herpes_image": "Imagen del virus del herpes", "cyto_fungi": "Hongos", "cyto_radiation": "Radiación", "cyto_repair": "Reparación", "cyto_iud_effect": "Efecto del DIU", - "cyto_endometrial_cells_over_40": "Presencia de células endometriales en mayores de 40 años", + "cyto_endometrial_cells_40_plus": + "Presencia de células endometriales en pacientes de 40 años o más", "cyto_findings_none": "Ninguno", } -SEVERITY = {"mild": "leve", "moderate": "moderada", "severe": "severa"} SQUAMOUS = { "NILM": "NINGUNA", "ASC-US": "ASC-US", diff --git a/tests/fixtures/concept_maps/erick_site.json b/tests/fixtures/concept_maps/erick_site.json index c04c990..c8b47a0 100644 --- a/tests/fixtures/concept_maps/erick_site.json +++ b/tests/fixtures/concept_maps/erick_site.json @@ -278,39 +278,6 @@ } ] }, - { - "source": "urn:isssteleon:site:erick_site", - "target": "https://isssteleon.org/fhir/CodeSystem/inflammation-severity", - "element": [ - { - "code": "LEVE", - "target": [ - { - "code": "mild", - "equivalence": "equivalent" - } - ] - }, - { - "code": "MODERADA", - "target": [ - { - "code": "moderate", - "equivalence": "equivalent" - } - ] - }, - { - "code": "SEVERA", - "target": [ - { - "code": "severe", - "equivalence": "equivalent" - } - ] - } - ] - }, { "source": "urn:isssteleon:site:erick_site", "target": "https://isssteleon.org/fhir/CodeSystem/boolean", @@ -630,15 +597,6 @@ } ] }, - { - "code": "METAPLASIA ESCAMOSA TUBULAR", - "target": [ - { - "code": "true", - "equivalence": "equivalent" - } - ] - }, { "code": "CAMBIOS QUERATÓSICOS", "target": [ @@ -827,6 +785,60 @@ "equivalence": "equivalent" } ] + }, + { + "code": "METAPLASIA ESCAMOSA TUBULAR", + "target": [ + { + "code": "true", + "equivalence": "equivalent" + } + ] + }, + { + "code": "PRESENCIA DE CÉLULAS ENDOMETRIALES EN PACIENTES DE 40 AÑOS O MÁS", + "target": [ + { + "code": "true", + "equivalence": "equivalent" + } + ] + }, + { + "code": "PRESENCIA DE CELULAS ENDOMETRIALES EN PACIENTES DE 40 ANOS O MÁS", + "target": [ + { + "code": "true", + "equivalence": "equivalent" + } + ] + }, + { + "code": "PRESENCIA DE CÉLULAS ENDOMETRIALES EN ATIPIAS EN PACIENTES DE 40 AÑOS O MÁS", + "target": [ + { + "code": "true", + "equivalence": "equivalent" + } + ] + }, + { + "code": "PRESENCIA DE CELULAS ENDOMETRIALES EN ATIPIAS EN PACIENTES DE 40 ANOS O MÁS", + "target": [ + { + "code": "true", + "equivalence": "equivalent" + } + ] + }, + { + "code": "PRESENCIA DE CELULAS ENDOMETRIALES EN ATIPIAS EN PACIENTES DE 45 ANOS O MÁS", + "target": [ + { + "code": "true", + "equivalence": "equivalent" + } + ] } ] }, diff --git a/tests/fixtures/pipelines/erick_site.json b/tests/fixtures/pipelines/erick_site.json index 1e932f7..b92b89e 100644 --- a/tests/fixtures/pipelines/erick_site.json +++ b/tests/fixtures/pipelines/erick_site.json @@ -52,7 +52,7 @@ {"id": "cytology", "kind": "extract", "inputs": ["cytology_forms"], "column": "text", "entity": "cervical_cytology", "method": "auto", - "hints": "screening_history is the answer under 'DETECCIÓN DE CÁNCER DE CÉRVIX': 'PRIMERA VEZ EN LA VIDA' is first_time, 'UN AÑO O MENOS' is 1_year_or_less, '2 AÑOS' is 2_years, '3 O MÁS AÑOS' is 3_years_or_more. Leave it out if that box is empty or shows anything else. Under 'CONDICIONES GINECO-OBSTÉTRICAS A LA DETECCIÓN', set to true only the field the answer names: 'PUERPERIO POSTPARTO O POSTABORTO' is gyn_puerperium, 'EMBARAZO ACTUAL' is gyn_pregnancy, 'DIU IN SITU' is gyn_iud, 'TRATAMIENTO HORMONAL' is gyn_hormonal_treatment, 'OTRO TRATAMIENTO GINECOLÓGICO' is gyn_other_treatment, 'POST MENOPAUSIA' is gyn_postmenopause, 'HISTERECTOMÍA' is gyn_hysterectomy, 'NO APLICA' is gyn_not_applicable. Leave all the others out; never set any of these fields to false. Under 'ACTUALMENTE PRESENTA', the same: 'FLUJO' is presents_discharge, 'PRURITO O ARDOR VULVAR' is presents_vulvar_pruritus, 'SANGRADO ANORMAL' is presents_abnormal_bleeding, 'NINGUNO' is presents_none. Set to true only what the answer names; never set any of these fields to false. cervix_exam is the answer under 'A LA EXPLORACIÓN SE OBSERVA': 'CUELLO SANO' is healthy, 'CUELLO ANORMAL CON LESIÓN' is abnormal_with_lesion, 'NO SE OBSERVA CUELLO' is not_visible. Leave it out if that box is empty or shows anything else. 'HALLAZGOS ADICIONALES' is the cytologist's free text: cyto_findings_text is that text as written. Set a cyto_ finding to true only when the text states it as present; never from a negated, doubted or ruled-out mention, and never set one to false. The nurse's answers never set a cyto_ field, nor the reverse. 'Inflamación' is cyto_inflammation, 'Cambios reactivos' is cyto_reactive_changes, 'Cambio en la flora sugestiva de vaginosis bacteriana' is cyto_bacterial_vaginosis_flora, 'Microorganismos micóticos morfológicamente compatibles con Candida sp' is cyto_candida, 'Aumento de la flora bacilar con citólisis de las células intermedias' is cyto_bacillary_flora_cytolysis, 'Citólisis de las células intermedias' is cyto_intermediate_cytolysis, 'Trichomonas vaginalis' is cyto_trichomonas, 'Microorganismos bacterianos morfológicamente compatibles con Leptothrix' is cyto_leptothrix, 'Microorganismos morfológicamente compatibles con Actinomyces sp' is cyto_actinomyces_organisms, 'Cambios celulares compatibles con Actinomyces sp' is cyto_actinomyces_changes, 'Cambios celulares compatibles con virus herpes simple' is cyto_herpes_simplex_changes, 'Metaplasia escamosa tubular' is cyto_squamous_tubular_metaplasia, 'Cambios queratósicos' is cyto_keratotic_changes, 'Cambios asociados al embarazo' is cyto_pregnancy_changes, 'Atrofia' is cyto_atrophy, 'Hipoestrogenismo' is cyto_hypoestrogenism, 'Efecto de radioterapia' is cyto_radiotherapy_effect, 'Cambios compatibles con presencia de dispositivo intrauterino' is cyto_iud_changes, 'Células glandulares post-histerectomía' is cyto_post_hysterectomy_glandular_cells, 'Presencia de células endometriales en atipias en pacientes de 45 años o más' is cyto_endometrial_cells_45_atypia, 'Bacterias' is cyto_bacteria, 'Imagen del virus del herpes' is cyto_herpes_image, 'Hongos' is cyto_fungi, 'Radiación' is cyto_radiation, 'Reparación' is cyto_repair, 'Efecto del DIU' is cyto_iud_effect, 'Presencia de células endometriales en mayores de 40 años' is cyto_endometrial_cells_over_40, 'Ninguno' is cyto_findings_none. cyto_inflammation_severity is mild for 'inflamación leve', moderate for 'inflamación moderada', severe for 'inflamación severa' (cyto_inflammation is then true too); don't translate +, ++ or +++ into it.", + "hints": "screening_history is the answer under 'DETECCIÓN DE CÁNCER DE CÉRVIX': 'PRIMERA VEZ EN LA VIDA' is first_time, 'UN AÑO O MENOS' is 1_year_or_less, '2 AÑOS' is 2_years, '3 O MÁS AÑOS' is 3_years_or_more. Leave it out if that box is empty or shows anything else. Under 'CONDICIONES GINECO-OBSTÉTRICAS A LA DETECCIÓN', set to true only the field the answer names: 'PUERPERIO POSTPARTO O POSTABORTO' is gyn_puerperium, 'EMBARAZO ACTUAL' is gyn_pregnancy, 'DIU IN SITU' is gyn_iud, 'TRATAMIENTO HORMONAL' is gyn_hormonal_treatment, 'OTRO TRATAMIENTO GINECOLÓGICO' is gyn_other_treatment, 'POST MENOPAUSIA' is gyn_postmenopause, 'HISTERECTOMÍA' is gyn_hysterectomy, 'NO APLICA' is gyn_not_applicable. Leave all the others out; never set any of these fields to false. Under 'ACTUALMENTE PRESENTA', the same: 'FLUJO' is presents_discharge, 'PRURITO O ARDOR VULVAR' is presents_vulvar_pruritus, 'SANGRADO ANORMAL' is presents_abnormal_bleeding, 'NINGUNO' is presents_none. Set to true only what the answer names; never set any of these fields to false. cervix_exam is the answer under 'A LA EXPLORACIÓN SE OBSERVA': 'CUELLO SANO' is healthy, 'CUELLO ANORMAL CON LESIÓN' is abnormal_with_lesion, 'NO SE OBSERVA CUELLO' is not_visible. Leave it out if that box is empty or shows anything else. 'HALLAZGOS ADICIONALES' is the cytologist's free text: cyto_findings_text is that text as written. Set a cyto_ finding to true only when the text states it as present; never from a negated, doubted or ruled-out mention, and never set one to false. The nurse's answers never set a cyto_ field, nor the reverse. 'Inflamación' is cyto_inflammation, 'Cambios reactivos' is cyto_reactive_changes, 'Cambio en la flora sugestiva de vaginosis bacteriana' is cyto_bacterial_vaginosis_flora, 'Microorganismos micóticos morfológicamente compatibles con Candida sp' is cyto_candida, 'Aumento de la flora bacilar con citólisis de las células intermedias' is cyto_bacillary_flora_cytolysis, 'Citólisis de las células intermedias' is cyto_intermediate_cytolysis, 'Trichomonas vaginalis' is cyto_trichomonas, 'Microorganismos bacterianos morfológicamente compatibles con Leptothrix' is cyto_leptothrix, 'Microorganismos morfológicamente compatibles con Actinomyces sp' is cyto_actinomyces_organisms, 'Cambios celulares compatibles con Actinomyces sp' is cyto_actinomyces_changes, 'Cambios celulares compatibles con virus herpes simple' is cyto_herpes_simplex_changes, 'Metaplasia escamosa tubular' is cyto_squamous_tubular_metaplasia, 'Cambios queratósicos' is cyto_keratotic_changes, 'Cambios asociados al embarazo' is cyto_pregnancy_changes, 'Atrofia' is cyto_atrophy, 'Hipoestrogenismo' is cyto_hypoestrogenism, 'Efecto de radioterapia' is cyto_radiotherapy_effect, 'Cambios compatibles con presencia de dispositivo intrauterino' is cyto_iud_changes, 'Células glandulares post-histerectomía' is cyto_post_hysterectomy_glandular_cells, 'Bacterias' is cyto_bacteria, 'Imagen del virus del herpes' is cyto_herpes_image, 'Hongos' is cyto_fungi, 'Radiación' is cyto_radiation, 'Reparación' is cyto_repair, 'Efecto del DIU' is cyto_iud_effect, endometrial cells reported for age 40 or older, however worded, is cyto_endometrial_cells_40_plus, 'Ninguno' is cyto_findings_none. Inflammation with any grade or scale is just cyto_inflammation.", "patterns": { "sample_date": "\\bfecha:\\s*(\\d{2}/\\d{2}/\\d{4})", "screening_history": "detecci[oó]n de c[aá]ncer de c[eé]rvix:[^\\n]*\\n[ \\t]*(primera vez en la vida|un a[nñ]o o menos|2 a[nñ]os|3 o m[aá]s a[nñ]os)\\b", @@ -89,16 +89,14 @@ "cyto_radiotherapy_effect": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(efecto\\s+de\\s+radioterapia)(?=\\s*(?:[.;]|observaciones:|$))", "cyto_iud_changes": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(cambios\\s+compatibles\\s+con\\s+presencia\\s+de\\s+dispositivo\\s+intrauterino)(?=\\s*(?:[.;]|observaciones:|$))", "cyto_post_hysterectomy_glandular_cells": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(c[eé]lulas\\s+glandulares\\s+post-histerectom[ií]a)(?=\\s*(?:[.;]|observaciones:|$))", - "cyto_endometrial_cells_45_atypia": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(presencia\\s+de\\s+c[eé]lulas\\s+endometriales\\s+en\\s+atipias\\s+en\\s+pacientes\\s+de\\s+45\\s+a[nñ]os\\s+o\\s+m[aá]s)(?=\\s*(?:[.;]|observaciones:|$))", "cyto_bacteria": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(bacterias)(?=\\s*(?:[.;]|observaciones:|$))", "cyto_herpes_image": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(imagen\\s+del\\s+virus\\s+del\\s+herpes)(?=\\s*(?:[.;]|observaciones:|$))", "cyto_fungi": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(hongos)(?=\\s*(?:[.;]|observaciones:|$))", "cyto_radiation": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(radiaci[oó]n)(?=\\s*(?:[.;]|observaciones:|$))", "cyto_repair": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(reparaci[oó]n)(?=\\s*(?:[.;]|observaciones:|$))", "cyto_iud_effect": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(efecto\\s+del\\s+diu)(?=\\s*(?:[.;]|observaciones:|$))", - "cyto_endometrial_cells_over_40": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(presencia\\s+de\\s+c[eé]lulas\\s+endometriales\\s+en\\s+mayores\\s+de\\s+40\\s+a[nñ]os)(?=\\s*(?:[.;]|observaciones:|$))", + "cyto_endometrial_cells_40_plus": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(presencia\\s+de\\s+c[eé]lulas\\s+endometriales\\s+en\\s+(?:mayores\\s+de\\s+40\\s+a[nñ]os|(?:atipias\\s+en\\s+)?pacientes\\s+de\\s+4[05]\\s+a[nñ]os\\s+o\\s+m[aá]s))(?=\\s*(?:[.;]|observaciones:|$))", "cyto_findings_none": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*(ninguno)(?=\\s*(?:[.;]|observaciones:|$))", - "cyto_inflammation_severity": "hallazgos(?:\\s+adicionales)?\\s*:(?:(?:(?!observaciones:)[\\s\\S])*?[.;])??\\s*inflamaci[oó]n\\s+(leve|moderada|severa)(?=\\s*(?:[.;]|observaciones:|$))", "report_date": "interpretaci[oó]n:[\\s\\S]{0,80}?(\\d{2}/\\d{2}/\\d{4})", "adequacy": "\\b(insatisfactorio|satisfactorio)\\b", "result": "\\b(negativo|asc-us|asc-h|lesi[oó]n de bajo grado|lesi[oó]n de alto grado|carcinoma in situ)\\b"},