From 4d086ba7b3729e0450a35beb80e2e579bc12e092 Mon Sep 17 00:00:00 2001 From: edgar Date: Sun, 22 Nov 2026 02:10:08 -0600 Subject: [PATCH 1/5] CaCu: cancer cases and death dates for the survival scenario (S-D19) poblar and documentos add the cancer cases (4 % of n, from CACU-9001, each with its carcinoma biopsy from 6 months to 6.5 years back) to the n usual women, and a third of the cases and 1.5 % of the others get a death date. The usual histories do not change. --- README.md | 9 ++ _docs/supuestos.md | 19 ++++ src/dev_data/cacu/cancer.py | 137 ++++++++++++++++++++++++++++ src/dev_data/cacu/expediente.py | 7 +- src/dev_data/cacu/filas.py | 3 +- src/dev_data/cacu/historias.py | 1 + src/dev_data/cacu/proyecto.py | 4 +- tests/test_cancer.py | 152 ++++++++++++++++++++++++++++++++ tests/test_expediente_cacu.py | 6 +- tests/test_poblar.py | 2 +- 10 files changed, 331 insertions(+), 9 deletions(-) create mode 100644 src/dev_data/cacu/cancer.py create mode 100644 tests/test_cancer.py diff --git a/README.md b/README.md index c96c499..204fad1 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,15 @@ montura/poblar.sh # el hospital en Docker (puerto 9505 del servidor), g montura/cargar.sh http://10.0.10.41:18080 # el hospital a una plataforma vacía, los tres proyectos ``` +## Casos de cáncer y defunciones de CaCu + +Las historias de CaCu cubren los dos años anteriores a la referencia. Para la supervivencia del kit, `poblar cacu` +agrega a las `n` mujeres el 4 % de casos de cáncer (con `n` = 200, 8 casos, de `CACU-9001` en adelante): cada uno +con su biopsia reportada como carcinoma de hace entre 6 meses y 6.5 años, su citología de origen, a veces una previa y +la nota de cirugía oncológica. Una tercera parte de los casos y el 1.5 % de las demás mujeres tienen fecha de +defunción (`pac_fecha_defuncion`), siempre después de su último evento y antes de la referencia. `n` debe ser menor +que 9000. Lo de siempre no cambia: ver `_docs/supuestos.md`, S-D19. + ## Documentos `documentos` escribe en disco los expedientes en PDF de las mismas historias diff --git a/_docs/supuestos.md b/_docs/supuestos.md index c5ec89b..149133d 100644 --- a/_docs/supuestos.md +++ b/_docs/supuestos.md @@ -218,3 +218,22 @@ repoblarlo (`repoblar = si`), y cargarlo a una plataforma vacía. poder ligarlo con su fila. - **Un reactivo sin dato dice `S/D` y no suma**; quién acompañó al niño sale de `documentos:`. + +**S-D19. CaCu agrega casos de cáncer y fechas de defunción, aparte de las historias de dos años.** (fix/cacu-indicadores) +La supervivencia del kit indexa en la primera biopsia reportada como carcinoma y sigue a la mujer hasta su defunción o +el corte, a uno, tres y cinco años. Las historias de siempre cubren dos años, casi no traen cáncer y nunca llenaban +`pac_fecha_defuncion`. Supuestos, todos de proporciones arbitrarias: +- **Los casos de cáncer son el 4 % de `n`** (al menos uno), agregados a las `n` mujeres de siempre con las claves + `CACU-9001` en adelante, para que su historia no dependa de `n`. `n` debe ser menor que 9000. +- **Cada caso** tiene una biopsia reportada como carcinoma de hace entre 6 meses y 6.5 años, la citología (ASC-H, LIEAG + o CIS, con VPH como en las demás) que la originó, a veces una previa de resultado menor, la edad al diagnóstico de + 30 a 70 años y la nota que resuelve la toma con las reglas de S-D15 (con `C53.9`, de cirugía oncológica). +- **Defunción:** una tercera parte de los casos y el 1.5 % de las demás mujeres, con fecha de al menos 30 días después + de su último evento y no después de la referencia. La de los casos es la menor de dos tiradas, para que se cargue + hacia el diagnóstico. +- **Lo de siempre no cambia:** `historias` es la misma y cada dato nuevo sale de un azar derivado con nombre propio. + Cambia que `poblar` y `documentos` de CaCu agregan los casos, así que el hospital tiene `n` más el 4 % de mujeres. + +Falta, y es otra tarea: las notas de colposcopia y de tratamiento, y el seguimiento a lo largo de años para la progresión. + +Se deshace pasando `proporcion_cancer=0` a `con_cancer` y quitando `pac_fecha_defuncion` de `cacu/filas.py`. diff --git a/src/dev_data/cacu/cancer.py b/src/dev_data/cacu/cancer.py new file mode 100644 index 0000000..f2f2ad2 --- /dev/null +++ b/src/dev_data/cacu/cancer.py @@ -0,0 +1,137 @@ +"""Casos de cáncer y defunciones de CaCu: lo que la supervivencia necesita y las historias de dos años no traen. + +Las historias de `historias.py` cubren los dos años anteriores a la referencia, con muy pocos cánceres y ninguna +defunción. La supervivencia del kit indexa en la primera biopsia reportada como carcinoma y sigue a la mujer hasta su +defunción o hasta el corte, a uno, tres y cinco años: hacen falta diagnósticos más antiguos y fechas de defunción. + +Todo lo de aquí se agrega aparte. `historias` no cambia y cada dato sale de un azar derivado con nombre propio, así +que lo que ya se generaba sigue igual (S-D19). Las proporciones son arbitrarias: sirven para que la supervivencia +tenga qué contar, no para interpretar nada. +""" + +from dataclasses import replace +from datetime import date, timedelta + +from dev_data.azar import Azar +from dev_data.catalogos import SATISFACTORIO +from dev_data.cacu.historias import ( + BIOPSIA_DESDE, + BIOPSIA_HASTA, + DIAS_HACIA_ATRAS, + PROPORCION_CON_VPH, + PROPORCION_GENOTIPO_16, + PROPORCION_GENOTIPO_18, + REPORTE_DESDE, + REPORTE_HASTA, + SOLICITUD_DESDE, + SOLICITUD_HASTA, + VPH_POSITIVO, + Biopsia, + Citologia, + Historia, + _hace_anios, + _notas, + historias, +) + +CLAVE_DE_LOS_CASOS = 9000 # los casos son `CACU-9001` en adelante: su clave no depende de `n`, que debe ser menor +PROPORCION_CANCER = 0.04 # de `n`: casos de cáncer que se agregan a las mujeres de siempre +PROPORCION_CANCER_FALLECE = 0.34 # de los casos de cáncer, las que mueren antes de la referencia +PROPORCION_DEFUNCION = 0.015 # de las demás mujeres, las que mueren antes de la referencia +DIAGNOSTICO_DESDE, DIAGNOSTICO_HASTA = 180, 2372 # días de la referencia al reporte del carcinoma: de 6 meses a 6.5 años +EDAD_AL_DIAGNOSTICO = (30, 70) +RESULTADOS_DEL_CASO = ("ASC-H", "LIEAG", "CIS") # lo que dice la citología que origina la biopsia del carcinoma +PESOS_DEL_CASO = (0.20, 0.50, 0.30) +PROPORCION_CON_CITOLOGIA_PREVIA = 0.50 +RESULTADOS_PREVIOS = ("NORMAL", "ASC-US", "LIEBG") +PESOS_PREVIOS = (0.50, 0.30, 0.20) +PREVIA_DESDE, PREVIA_HASTA = 180, 700 # días de la citología previa a la del caso +DIAS_A_LA_DEFUNCION = 30 # lo menos que pasa del último evento de la historia a la defunción + + +def _vph(azar: Azar, resultado: str) -> tuple[str | None, int | None, int | None]: + """(VPH, genotipo 16, genotipo 18) de una citología con resultado, con las proporciones de las historias.""" + if not azar.derivar("con_vph").ocurre(PROPORCION_CON_VPH): + return None, None, None + if not azar.derivar("vph").ocurre(VPH_POSITIVO[resultado]): + return "NEGATIVO", None, None + return ( + "POSITIVO", + int(azar.derivar("genotipo_16").ocurre(PROPORCION_GENOTIPO_16)), + int(azar.derivar("genotipo_18").ocurre(PROPORCION_GENOTIPO_18)), + ) + + +def _citologia(azar: Azar, toma: date, resultado: str, reporte: date | None = None) -> Citologia: + """Una citología satisfactoria; sin `reporte`, el resultado llega de `REPORTE_DESDE` a `REPORTE_HASTA` días después.""" + reporte = reporte or toma + timedelta(days=azar.derivar("reporte").entero(REPORTE_DESDE, REPORTE_HASTA)) + return Citologia(toma, SATISFACTORIO, reporte, resultado, *_vph(azar.derivar("vph"), resultado)) + + +def _caso(azar: Azar, clave: str) -> Historia: + """Una mujer con carcinoma: sus fechas se cuentan hacia atrás desde el reporte de la biopsia. + + La biopsia la origina su última citología (ASC-H, LIEAG o CIS); con la mitad de los casos hay una citología + previa, de resultado menor y sin biopsia. La nota que resuelve la toma sale de las mismas reglas que las demás. + """ + diagnostico = azar.referencia - timedelta(days=azar.derivar("diagnostico").entero(DIAGNOSTICO_DESDE, DIAGNOSTICO_HASTA)) + solicitud = diagnostico - timedelta(days=azar.derivar("biopsia").entero(BIOPSIA_DESDE, BIOPSIA_HASTA)) + reporte = solicitud - timedelta(days=azar.derivar("solicitud").entero(SOLICITUD_DESDE, SOLICITUD_HASTA)) + toma = reporte - timedelta(days=azar.derivar("toma").entero(REPORTE_DESDE, REPORTE_HASTA)) + resultado = azar.derivar("resultado").elegir(list(RESULTADOS_DEL_CASO), list(PESOS_DEL_CASO)) + citologias = [_citologia(azar.derivar("citologia"), toma, resultado, reporte)] + if azar.derivar("previa").ocurre(PROPORCION_CON_CITOLOGIA_PREVIA): + a = azar.derivar("previa:citologia") + previa = a.derivar("resultado").elegir(list(RESULTADOS_PREVIOS), list(PESOS_PREVIOS)) + citologias.insert(0, _citologia(a, toma - timedelta(days=a.derivar("antes").entero(PREVIA_DESDE, PREVIA_HASTA)), previa)) + biopsias = (Biopsia(len(citologias) - 1, solicitud, diagnostico, "CARCINOMA"),) + edad = azar.derivar("edad").entero(*EDAD_AL_DIAGNOSTICO) + nacimiento = _hace_anios(diagnostico, edad) - timedelta(days=azar.derivar("dia_de_nacimiento").entero(0, 364)) + return Historia( + clave=clave, + nacimiento=nacimiento, + citologias=tuple(citologias), + biopsias=biopsias, + notas=_notas(azar.derivar("notas"), tuple(citologias), biopsias), + ) + + +def ultimo_evento(h: Historia) -> date | None: + """La fecha más reciente de la historia: tomas, reportes, solicitudes de biopsia y notas.""" + fechas = [ + *(c.fecha_toma for c in h.citologias), *(c.fecha_reporte for c in h.citologias), + *(b.fecha_solicitud for b in h.biopsias), *(b.fecha_reporte for b in h.biopsias if b.fecha_reporte), + *(n.fecha for n in h.notas), + ] # fmt: skip + return max(fechas) if fechas else None + + +def con_defuncion(h: Historia, azar: Azar, proporcion: float, *, temprana: bool = False) -> Historia: + """`h` con su fecha de defunción si se sortea: después de su último evento y antes de la referencia. + + Con `temprana`, la fecha es la menor de dos tiradas, así que las defunciones se cargan hacia el diagnóstico. + """ + desde = (ultimo_evento(h) or azar.referencia - timedelta(days=DIAS_HACIA_ATRAS)) + timedelta(days=DIAS_A_LA_DEFUNCION) + if desde > azar.referencia or not azar.derivar("muere").ocurre(proporcion): + return h + fecha = azar.derivar("fecha").fecha_entre(desde, azar.referencia) + if temprana: + fecha = min(fecha, azar.derivar("otra_fecha").fecha_entre(desde, azar.referencia)) + return replace(h, defuncion=fecha) + + +def con_cancer(n: int, azar: Azar, *, proporcion_cancer: float = PROPORCION_CANCER) -> list[Historia]: + """Las `n` mujeres de `historias`, con su defunción si la tienen, y los casos de cáncer que se les agregan. + + Los casos van a continuación, con las claves `CACU-9001` en adelante: no dependen de `n`, así que la historia de + cada mujer, la de siempre o un caso, es la misma pidan las que se pidan. + """ + if n >= CLAVE_DE_LOS_CASOS: + raise ValueError(f"`n` ({n}) debe ser menor que {CLAVE_DE_LOS_CASOS}, donde empieza la numeración de los casos") + mujeres = [con_defuncion(h, azar.derivar(f"defuncion:{h.clave}"), PROPORCION_DEFUNCION) for h in historias(n, azar)] + casos = max(1, round(n * proporcion_cancer)) if n > 0 and proporcion_cancer > 0 else 0 + for i in range(1, casos + 1): + clave = f"CACU-{CLAVE_DE_LOS_CASOS + i:04d}" + caso = _caso(azar.derivar(f"cancer:{clave}"), clave) + mujeres.append(con_defuncion(caso, azar.derivar(f"defuncion:{clave}"), PROPORCION_CANCER_FALLECE, temprana=True)) + return mujeres diff --git a/src/dev_data/cacu/expediente.py b/src/dev_data/cacu/expediente.py index 3470040..eef3a08 100644 --- a/src/dev_data/cacu/expediente.py +++ b/src/dev_data/cacu/expediente.py @@ -17,7 +17,8 @@ from importlib.resources import files from dev_data import notas from dev_data.azar import Azar -from dev_data.cacu.historias import CIE_DE_LA_CITOLOGIA, Biopsia, Citologia, Historia, historias +from dev_data.cacu.cancer import con_cancer +from dev_data.cacu.historias import CIE_DE_LA_CITOLOGIA, Biopsia, Citologia, Historia from dev_data.documentos import personas from dev_data.documentos.expediente import Documentos, Expediente from dev_data.documentos.plantilla import Plantilla, cargar @@ -74,8 +75,8 @@ def plantillas() -> dict[str, Plantilla]: def generar(n: int, azar: Azar) -> list[Expediente]: - """Los expedientes de las mismas `n` mujeres que `historias` genera con ese azar.""" - return expedientes(historias(n, azar), azar) + """Los expedientes de las mismas mujeres que `con_cancer` genera con ese azar.""" + return expedientes(con_cancer(n, azar), azar) def expedientes(mujeres: list[Historia], azar: Azar) -> list[Expediente]: diff --git a/src/dev_data/cacu/filas.py b/src/dev_data/cacu/filas.py index 8090a56..df85725 100644 --- a/src/dev_data/cacu/filas.py +++ b/src/dev_data/cacu/filas.py @@ -17,7 +17,8 @@ def a_filas(historias: list[Historia]) -> dict[str, list]: cit_id = bx_id = nm_id = 0 for pac_id, h in enumerate(historias, start=1): filas["pacientes"].append( - Paciente(pac_id=pac_id, pac_id_hospital=h.clave, pac_sexo=SEXO, pac_fecha_nacimiento=h.nacimiento) + Paciente(pac_id=pac_id, pac_id_hospital=h.clave, pac_sexo=SEXO, pac_fecha_nacimiento=h.nacimiento, + pac_fecha_defuncion=h.defuncion) ) de_la_mujer = [] for c in h.citologias: diff --git a/src/dev_data/cacu/historias.py b/src/dev_data/cacu/historias.py index bfe6812..c034652 100644 --- a/src/dev_data/cacu/historias.py +++ b/src/dev_data/cacu/historias.py @@ -95,6 +95,7 @@ class Historia: citologias: tuple[Citologia, ...] = () biopsias: tuple[Biopsia, ...] = () notas: tuple[Nota, ...] = () + defuncion: date | None = None # nula mientras vive; la pone `cancer.con_defuncion` def _hace_anios(fecha: date, anios: int) -> date: diff --git a/src/dev_data/cacu/proyecto.py b/src/dev_data/cacu/proyecto.py index f16dc36..6666faa 100644 --- a/src/dev_data/cacu/proyecto.py +++ b/src/dev_data/cacu/proyecto.py @@ -5,12 +5,12 @@ from core.cacu.models import BiopsiaCervical, CitologiaCervical, NotaMedica, Pac from dev_data.azar import Azar from dev_data.cacu.expediente import DOCUMENTOS from dev_data.cacu.filas import a_filas -from dev_data.cacu.historias import historias +from dev_data.cacu.cancer import con_cancer from dev_data.proyecto import Proyecto def _generar(n: int, azar: Azar) -> dict[str, list]: - return a_filas(historias(n, azar)) + return a_filas(con_cancer(n, azar)) CACU = Proyecto( diff --git a/tests/test_cancer.py b/tests/test_cancer.py new file mode 100644 index 0000000..250d7bc --- /dev/null +++ b/tests/test_cancer.py @@ -0,0 +1,152 @@ +"""CaCu: los casos de cáncer y las defunciones que se agregan a las historias (S-D19). + +Lo que se prueba es la propiedad (fechas en orden, rangos, que lo de siempre no cambia), no un valor al azar. +""" + +from dataclasses import replace +from datetime import date, timedelta + +import pytest + +from dev_data.azar import Azar +from dev_data.cacu import expediente +from dev_data.cacu.cancer import ( + DIAGNOSTICO_DESDE, + DIAGNOSTICO_HASTA, + DIAS_A_LA_DEFUNCION, + EDAD_AL_DIAGNOSTICO, + CLAVE_DE_LOS_CASOS, + PROPORCION_CANCER, + _caso, + con_cancer, + con_defuncion, + ultimo_evento, +) +from dev_data.cacu.filas import a_filas +from dev_data.cacu.historias import historias + +REFERENCIA = date(2026, 1, 1) +N = 500 +SEMILLA = 7 + + +@pytest.fixture(scope="module") +def mujeres(): + return con_cancer(N, Azar(SEMILLA, REFERENCIA)) + + +@pytest.fixture(scope="module") +def casos(mujeres): + return mujeres[N:] + + +def test_las_n_mujeres_de_siempre_no_cambian_salvo_su_defuncion(mujeres): + base = historias(N, Azar(SEMILLA, REFERENCIA)) + assert [replace(h, defuncion=None) for h in mujeres[:N]] == base + + +def test_los_casos_de_cancer_tienen_una_numeracion_que_no_depende_de_n(casos): + assert [c.clave for c in casos] == [f"CACU-{CLAVE_DE_LOS_CASOS + i:04d}" for i in range(1, len(casos) + 1)] + + +def test_un_n_que_invade_la_numeracion_de_los_casos_se_rechaza(): + with pytest.raises(ValueError): + con_cancer(CLAVE_DE_LOS_CASOS, Azar(SEMILLA, REFERENCIA)) + + +def test_la_historia_de_un_caso_es_la_misma_pidan_las_mujeres_que_se_pidan(): + pocas = {h.clave: h for h in con_cancer(100, Azar(SEMILLA, REFERENCIA))} + muchas = {h.clave: h for h in con_cancer(300, Azar(SEMILLA, REFERENCIA))} + compartidas = [c for c in pocas if int(c[-4:]) > CLAVE_DE_LOS_CASOS] + assert compartidas and all(pocas[c] == muchas[c] for c in compartidas) + + +def test_la_cantidad_de_casos_es_la_proporcion_de_n(casos): + assert len(casos) == round(N * PROPORCION_CANCER) + + +def test_con_pocas_mujeres_hay_al_menos_un_caso_y_con_proporcion_cero_ninguno(): + assert len(con_cancer(10, Azar(SEMILLA, REFERENCIA))) == 11 + assert len(con_cancer(10, Azar(SEMILLA, REFERENCIA), proporcion_cancer=0)) == 10 + + +def test_cada_caso_tiene_una_biopsia_de_carcinoma_reportada(casos): + assert all(len(c.biopsias) == 1 and c.biopsias[0].grado == "CARCINOMA" and c.biopsias[0].fecha_reporte for c in casos) + + +def test_las_fechas_de_un_caso_van_en_orden_de_la_toma_al_reporte_de_la_biopsia(casos): + for c in casos: + b = c.biopsias[0] + origen = c.citologias[b.citologia] + assert origen.fecha_toma < origen.fecha_reporte < b.fecha_solicitud < b.fecha_reporte + + +def test_la_citologia_previa_es_anterior_a_la_que_origina_la_biopsia(casos): + con_previa = [c for c in casos if len(c.citologias) == 2] + assert con_previa and all(c.citologias[0].fecha_reporte < c.citologias[1].fecha_toma for c in con_previa) + + +def test_los_diagnosticos_caen_entre_seis_meses_y_seis_anios_y_medio_antes_de_la_referencia(casos): + dias = [(REFERENCIA - c.biopsias[0].fecha_reporte).days for c in casos] + assert all(DIAGNOSTICO_DESDE <= d <= DIAGNOSTICO_HASTA for d in dias) + + +def test_hay_casos_con_mas_de_tres_anios_de_seguimiento(casos): + assert any((REFERENCIA - c.biopsias[0].fecha_reporte).days > 3 * 365 for c in casos) + + +def test_la_edad_al_diagnostico_esta_en_rango(casos): + desde, hasta = EDAD_AL_DIAGNOSTICO + edades = [(c.biopsias[0].fecha_reporte - c.nacimiento).days / 365.25 for c in casos] + assert all(desde <= e < hasta + 1 for e in edades) + + +def test_la_defuncion_es_posterior_al_ultimo_evento_y_no_pasa_de_la_referencia(mujeres): + fallecidas = [h for h in mujeres if h.defuncion] + assert fallecidas + for h in fallecidas: + ultimo = ultimo_evento(h) + assert (ultimo is None or h.defuncion >= ultimo + timedelta(days=DIAS_A_LA_DEFUNCION)) and h.defuncion <= REFERENCIA + + +def test_hay_defunciones_entre_los_casos_y_entre_las_demas(mujeres, casos): + assert 0 < sum(bool(c.defuncion) for c in casos) < len(casos) + assert 0 < sum(bool(h.defuncion) for h in mujeres[:N]) < N * 0.1 + + +def test_las_defunciones_de_los_casos_se_cargan_hacia_el_diagnostico(casos): + sin_sesgo = temprana = 0 + for c in casos: + azar = Azar(SEMILLA, REFERENCIA).derivar(c.clave) + sin_sesgo += (con_defuncion(c, azar, 1.0).defuncion - c.biopsias[0].fecha_reporte).days + temprana += (con_defuncion(c, azar, 1.0, temprana=True).defuncion - c.biopsias[0].fecha_reporte).days + assert temprana < sin_sesgo + + +def test_un_caso_sin_defuncion_sorteada_no_la_tiene(): + caso = _caso(Azar(SEMILLA, REFERENCIA), "CACU-9999") + assert con_defuncion(caso, Azar(SEMILLA, REFERENCIA), 0.0).defuncion is None + + +def test_las_filas_llevan_la_fecha_de_defuncion(mujeres): + filas = a_filas(mujeres) + assert [p.pac_fecha_defuncion for p in filas["pacientes"]] == [h.defuncion for h in mujeres] + assert any(p.pac_fecha_defuncion for p in filas["pacientes"]) + + +def test_las_filas_de_los_casos_llevan_su_biopsia_de_carcinoma(mujeres): + filas = a_filas(mujeres) + claves = {p.pac_id: p.pac_id_hospital for p in filas["pacientes"]} + carcinomas = [b for b in filas["biopsias"] if b.bx_cin_grado == "CARCINOMA" and int(claves[b.pac_id][-4:]) > CLAVE_DE_LOS_CASOS] + assert len(carcinomas) == round(N * PROPORCION_CANCER) + + +def test_la_misma_semilla_da_las_mismas_mujeres_y_otra_semilla_otras(mujeres): + assert con_cancer(N, Azar(SEMILLA, REFERENCIA)) == mujeres + assert con_cancer(N, Azar(SEMILLA + 1, REFERENCIA)) != mujeres + + +def test_los_expedientes_incluyen_a_los_casos_de_cancer(): + n = 60 + claves = {e.clave.rsplit("-C", 1)[0] for e in expediente.generar(n, Azar(SEMILLA, REFERENCIA))} + assert any(int(c[-4:]) > CLAVE_DE_LOS_CASOS for c in claves) diff --git a/tests/test_expediente_cacu.py b/tests/test_expediente_cacu.py index 2e3266f..c89da15 100644 --- a/tests/test_expediente_cacu.py +++ b/tests/test_expediente_cacu.py @@ -206,12 +206,14 @@ def test_la_misma_semilla_da_los_mismos_expedientes_y_no_dependen_de_cuantas_muj """Fija que los expedientes son reproducibles y que los de una mujer no cambian con `n`. Falla si un valor sale de azar sin derivar por clave: pedir 300 historias daría a CACU-0001 otro nombre - que pedir 5, y los documentos dejarían de corresponder a un hospital poblado con otro `--n`. + que pedir 5, y los documentos dejarían de corresponder a un hospital poblado con otro `--n`. Se compara por + clave, porque los casos de cáncer van al final y con otro `n` hay más de ellos. """ cinco = generar(5, Azar(SEMILLA, REFERENCIA)) + cuarenta = {e.clave: e for e in generar(40, Azar(SEMILLA, REFERENCIA))} assert generar(5, Azar(SEMILLA, REFERENCIA)) == cinco - assert generar(40, Azar(SEMILLA, REFERENCIA))[: len(cinco)] == cinco + assert all(cuarenta[e.clave] == e for e in cinco) assert generar(5, Azar(SEMILLA + 1, REFERENCIA)) != cinco diff --git a/tests/test_poblar.py b/tests/test_poblar.py index 04fa3bb..61a45d3 100644 --- a/tests/test_poblar.py +++ b/tests/test_poblar.py @@ -22,7 +22,7 @@ def test_poblar_escribe_en_el_hospital_y_no_toca_la_base(urls, tmp_path): _, url_hospital = urls conteo = poblar_proyecto(CACU, url_hospital, n=40, semilla=7, referencia=REFERENCIA) - assert conteo["pacientes"] == 40 + assert conteo["pacientes"] == 40 + 2 # más los casos de cáncer: el 4 % de `n` assert {clave: len(filas) for clave, filas in hospital.leer(url_hospital, CACU.modelos).items()} == conteo assert not (tmp_path / "cacu.db").exists() -- 2.53.0 From ae440e074d5306dd05e33592ee001de80da531ff Mon Sep 17 00:00:00 2001 From: edgar Date: Sun, 22 Nov 2026 02:31:40 -0600 Subject: [PATCH 2/5] CaCu: the valuation visit, the colposcopy and the treatment as medical notes (S-D20) After an anomalous cytology, poblar and documentos add, in clinical order, the valuation visit, the colposcopy (the day its biopsy is requested, with the kit's reason as its note) and, for some biopsies, the treatment. The notes follow the kit's lists and do not resolve any sample, so what was already generated stays the same. --- README.md | 8 +++ _docs/supuestos.md | 24 +++++++ src/dev_data/cacu/cancer.py | 8 ++- src/dev_data/cacu/filas.py | 1 + src/dev_data/cacu/ruta.py | 79 ++++++++++++++++++++++ src/dev_data/notas.py | 1 + tests/test_cancer.py | 5 +- tests/test_ruta.py | 128 ++++++++++++++++++++++++++++++++++++ 8 files changed, 250 insertions(+), 4 deletions(-) create mode 100644 src/dev_data/cacu/ruta.py create mode 100644 tests/test_ruta.py diff --git a/README.md b/README.md index 204fad1..203036f 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,14 @@ la nota de cirugía oncológica. Una tercera parte de los casos y el 1.5 % de la defunción (`pac_fecha_defuncion`), siempre después de su último evento y antes de la referencia. `n` debe ser menor que 9000. Lo de siempre no cambia: ver `_docs/supuestos.md`, S-D19. +## La ruta de CaCu: valoración, colposcopia y tratamiento + +Después de una citología anómala, `poblar cacu` agrega las notas médicas de la ruta, en orden: la cita de valoración, +la colposcopia (anterior a la biopsia, que se pide ese mismo día; su resultado es una nota de esa cita, con el motivo +«ACUDE A COLPOSCOPIA» del kit) y, para algunas biopsias, el tratamiento. Con ellas el dbt reconoce colposcopias y +tratamientos, y las medidas de la ruta y los estratos de seguimiento dejan de salir vacíos. Ver `_docs/supuestos.md`, +S-D20. + ## Documentos `documentos` escribe en disco los expedientes en PDF de las mismas historias diff --git a/_docs/supuestos.md b/_docs/supuestos.md index 149133d..d8da9c7 100644 --- a/_docs/supuestos.md +++ b/_docs/supuestos.md @@ -237,3 +237,27 @@ el corte, a uno, tres y cinco años. Las historias de siempre cubren dos años, Falta, y es otra tarea: las notas de colposcopia y de tratamiento, y el seguimiento a lo largo de años para la progresión. Se deshace pasando `proporcion_cancer=0` a `con_cancer` y quitando `pac_fecha_defuncion` de `cacu/filas.py`. + +**S-D20. CaCu agrega la cita de valoración, la colposcopia y el tratamiento, como notas médicas.** (fix/cacu-indicadores) +El dbt infiere la colposcopia y el tratamiento de las notas (`cacu.seguimiento.*` del kit) y las historias solo traían +la nota que resuelve cada toma, después de la biopsia: sin colposcopias ni tratamientos. Lo que se supone, con +proporciones arbitrarias: +- **El orden clínico:** la cita de valoración es anterior a la colposcopia, y el resultado de la colposcopia sale en una + nota de la misma cita, con su motivo. El kit exige esa valoración previa (`colposcopia.requisito = valoracion_previa`), + así que la regla no cambia. La nota que resuelve la toma sigue después de la biopsia, como la interpretación. +- **Valoración:** el 85 % de las mujeres con una citología anómala (ASC-US o peor). Con biopsia cae entre el reporte + de la citología y el día anterior a la solicitud; sin biopsia, de 7 a 45 días después del reporte. Lleva el CIE-10 de + la citología y la especialidad de colposcopia. +- **Colposcopia:** con biopsia, el día de la solicitud (así la orden de biopsia cuenta como colposcopia, como pide el + kit); sin biopsia, el 60 % de las valoradas, de 7 a 30 días después. Su CIE-10 sale del resultado (R87.6, N87.0, + N87.2) y su motivo es el primero que lista el kit. +- **Tratamiento:** una nota de cirugía oncológica con D06.9, D06.0 o D06.1, de 14 a 90 días después del reporte de la + biopsia (o de su nota), para el 15 % de las biopsias LIEBG, el 60 % de las LIEAG y el 85 % de las CIS. El carcinoma + no se trata aquí: el kit solo reconoce D06 como tratamiento. No distingue el tipo de tratamiento. +- **Las notas nuevas no resuelven una toma** (`toma=None`): los expedientes y lo de siempre no cambian. Sí cambia que + la valoración pasa a ser la primera nota de diagnóstico de una mujer, así que el tiempo de la toma al diagnóstico de + estos datos baja. + +Falta, y es otra tarea: el seguimiento a lo largo de años para la progresión, y el tipo de tratamiento cuando haya catálogo. + +Se deshace quitando `con_ruta` de `cancer.con_cancer`. diff --git a/src/dev_data/cacu/cancer.py b/src/dev_data/cacu/cancer.py index f2f2ad2..0bf23d2 100644 --- a/src/dev_data/cacu/cancer.py +++ b/src/dev_data/cacu/cancer.py @@ -33,6 +33,7 @@ from dev_data.cacu.historias import ( _notas, historias, ) +from dev_data.cacu.ruta import con_ruta CLAVE_DE_LOS_CASOS = 9000 # los casos son `CACU-9001` en adelante: su clave no depende de `n`, que debe ser menor PROPORCION_CANCER = 0.04 # de `n`: casos de cáncer que se agregan a las mujeres de siempre @@ -128,10 +129,13 @@ def con_cancer(n: int, azar: Azar, *, proporcion_cancer: float = PROPORCION_CANC """ if n >= CLAVE_DE_LOS_CASOS: raise ValueError(f"`n` ({n}) debe ser menor que {CLAVE_DE_LOS_CASOS}, donde empieza la numeración de los casos") - mujeres = [con_defuncion(h, azar.derivar(f"defuncion:{h.clave}"), PROPORCION_DEFUNCION) for h in historias(n, azar)] + mujeres = [ + con_defuncion(con_ruta(h, azar.derivar(f"ruta:{h.clave}")), azar.derivar(f"defuncion:{h.clave}"), PROPORCION_DEFUNCION) + for h in historias(n, azar) + ] casos = max(1, round(n * proporcion_cancer)) if n > 0 and proporcion_cancer > 0 else 0 for i in range(1, casos + 1): clave = f"CACU-{CLAVE_DE_LOS_CASOS + i:04d}" - caso = _caso(azar.derivar(f"cancer:{clave}"), clave) + caso = con_ruta(_caso(azar.derivar(f"cancer:{clave}"), clave), azar.derivar(f"ruta:{clave}")) mujeres.append(con_defuncion(caso, azar.derivar(f"defuncion:{clave}"), PROPORCION_CANCER_FALLECE, temprana=True)) return mujeres diff --git a/src/dev_data/cacu/filas.py b/src/dev_data/cacu/filas.py index df85725..5100725 100644 --- a/src/dev_data/cacu/filas.py +++ b/src/dev_data/cacu/filas.py @@ -46,6 +46,7 @@ def a_filas(historias: list[Historia]) -> dict[str, list]: NotaMedica( nm_id=nm_id, pac_id=pac_id, pac_id_hospital=h.clave, nm_id_hospital=f"NM-{nm_id:05d}", nm_fecha=n.fecha, nm_cie_codigo=n.cie, nm_especialidad=n.especialidad, + nm_motivo_consulta=n.motivo, ) ) return filas diff --git a/src/dev_data/cacu/ruta.py b/src/dev_data/cacu/ruta.py new file mode 100644 index 0000000..61f8cb8 --- /dev/null +++ b/src/dev_data/cacu/ruta.py @@ -0,0 +1,79 @@ +"""La ruta después de una citología anómala: la cita de valoración, la colposcopia y el tratamiento (S-D20). + +`historias` genera solo la nota que resuelve cada toma, que sigue al reporte de la biopsia: sin notas de colposcopia +ni de tratamiento, las medidas de la ruta y los estratos de seguimiento del dbt salen vacíos. Aquí se agregan, en el +orden clínico: la cita de valoración, que escribe una nota de diagnóstico; la colposcopia, que es posterior y cuyo +resultado es una nota médica de la misma cita, con su motivo; y, para algunas biopsias, el tratamiento, una nota +posterior a la colposcopia con un CIE-10 de carcinoma in situ. + +Las notas nuevas no resuelven ninguna toma (`toma=None`), así que los expedientes no cambian, y cada dato sale de un +azar derivado con nombre propio: lo que ya se generaba sigue igual. Las proporciones son arbitrarias. Los CIE-10, la +especialidad y el motivo son los del kit (`cacu.seguimiento.*`), que lee `valores_del_archivo`, no una copia. +""" + +from dataclasses import replace +from datetime import timedelta + +from dev_data.azar import Azar +from dev_data.cacu.historias import CIE_DE_LA_CITOLOGIA, COLPOSCOPIA, ONCOLOGIA, Historia +from dev_data.notas import Nota +from dev_data.parametros import valores_del_archivo + +PROPORCION_VALORADA = 0.85 # de las mujeres con una citología anómala, las que van a la cita de valoración +VALORACION_DESDE, VALORACION_HASTA = 7, 45 # días del reporte a la valoración, si no hay biopsia que fije el día +PROPORCION_COLPOSCOPIA_SIN_BIOPSIA = 0.60 # de las valoradas sin biopsia, las que tienen colposcopia +COLPOSCOPIA_DESDE, COLPOSCOPIA_HASTA = 7, 30 # días de la valoración a la colposcopia, si no hay biopsia +# Lo que dice la colposcopia, por el resultado de la citología (CIE-10 como los escribe el hospital). +CIE_DE_LA_COLPOSCOPIA = {"ASC-US": "R87.6", "LIEBG": "N87.0", "ASC-H": "R87.6", "LIEAG": "N87.2", "CIS": "N87.2"} +# De las biopsias reportadas, las que llevan a tratamiento según su grado: algunos LIEBG y LIEAG, casi todos los CIS. +PROPORCION_TRATADA = {"LIEBG": 0.15, "LIEAG": 0.60, "CIS": 0.85} +TRATAMIENTO_DESDE, TRATAMIENTO_HASTA = 14, 90 # días de la biopsia (o de su nota) al tratamiento +CIE_DEL_TRATAMIENTO = ("D06.9", "D06.0", "D06.1") +PESOS_DEL_TRATAMIENTO = (0.70, 0.20, 0.10) + + +def _motivo() -> str: + """El motivo con que se reconoce una colposcopia en la nota, el primero que lista el kit.""" + return valores_del_archivo()["cacu.seguimiento.colposcopia.motivos"][0] + + +def con_ruta(h: Historia, azar: Azar) -> Historia: + """`h` con las notas de valoración, colposcopia y tratamiento de cada una de sus citologías anómalas. + + Con biopsia, la valoración cae entre el reporte de la citología y el día anterior a la solicitud, y la colposcopia + es ese día de la solicitud: así la orden de biopsia cuenta como colposcopia, como pide el kit. Sin biopsia, la + valoración sigue al reporte y la colposcopia, si la hay, a la valoración. Una nota que caería después de la + referencia todavía no existe. + """ + biopsias = {b.citologia: b for b in h.biopsias} + nuevas = [] + for lugar, c in enumerate(h.citologias): + if c.resultado not in CIE_DE_LA_COLPOSCOPIA: + continue + a = azar.derivar(f"citologia:{lugar}") + if not a.derivar("valorada").ocurre(PROPORCION_VALORADA): + continue + b = biopsias.get(lugar) + if b is not None: + valoracion = a.derivar("valoracion").fecha_entre(c.fecha_reporte, b.fecha_solicitud - timedelta(days=1)) + colposcopia = b.fecha_solicitud + else: + valoracion = c.fecha_reporte + timedelta(days=a.derivar("valoracion").entero(VALORACION_DESDE, VALORACION_HASTA)) + colposcopia = None + if a.derivar("colposcopia").ocurre(PROPORCION_COLPOSCOPIA_SIN_BIOPSIA): + colposcopia = valoracion + timedelta(days=a.derivar("dias_a_la_colposcopia").entero(COLPOSCOPIA_DESDE, COLPOSCOPIA_HASTA)) + if valoracion > azar.referencia: + continue + nuevas.append(Nota(valoracion, CIE_DE_LA_CITOLOGIA[c.resultado], COLPOSCOPIA)) + if colposcopia is None or colposcopia > azar.referencia: + continue + nuevas.append(Nota(colposcopia, CIE_DE_LA_COLPOSCOPIA[c.resultado], COLPOSCOPIA, motivo=_motivo())) + if b is None or b.fecha_reporte is None or not a.derivar("tratada").ocurre(PROPORCION_TRATADA.get(b.grado, 0.0)): + continue + resolutoras = [n.fecha for n in h.notas if n.toma == lugar] + desde = max([b.fecha_reporte, *resolutoras]) + tratamiento = desde + timedelta(days=a.derivar("dias_al_tratamiento").entero(TRATAMIENTO_DESDE, TRATAMIENTO_HASTA)) + if tratamiento <= azar.referencia: + cie = a.derivar("cie_del_tratamiento").elegir(list(CIE_DEL_TRATAMIENTO), list(PESOS_DEL_TRATAMIENTO)) + nuevas.append(Nota(tratamiento, cie, ONCOLOGIA)) + return replace(h, notas=tuple(sorted([*h.notas, *nuevas], key=lambda n: n.fecha))) diff --git a/src/dev_data/notas.py b/src/dev_data/notas.py index d34424c..3352dd8 100644 --- a/src/dev_data/notas.py +++ b/src/dev_data/notas.py @@ -70,6 +70,7 @@ class Nota: cie: str especialidad: str toma: int | None = None + motivo: str | None = None # el motivo de consulta, si la nota lo dice: lo lleva la de una colposcopia def de_resolucion(azar: Azar, desde: date, cie: str, especialidad: str, *, dias_hasta: int) -> Nota | None: diff --git a/tests/test_cancer.py b/tests/test_cancer.py index 250d7bc..d859894 100644 --- a/tests/test_cancer.py +++ b/tests/test_cancer.py @@ -40,9 +40,10 @@ def casos(mujeres): return mujeres[N:] -def test_las_n_mujeres_de_siempre_no_cambian_salvo_su_defuncion(mujeres): +def test_las_n_mujeres_de_siempre_no_cambian_salvo_su_defuncion_y_las_notas_de_la_ruta(mujeres): base = historias(N, Azar(SEMILLA, REFERENCIA)) - assert [replace(h, defuncion=None) for h in mujeres[:N]] == base + assert [replace(h, defuncion=None, notas=b.notas) for h, b in zip(mujeres[:N], base)] == base + assert all(set(b.notas) <= set(h.notas) for h, b in zip(mujeres[:N], base)) def test_los_casos_de_cancer_tienen_una_numeracion_que_no_depende_de_n(casos): diff --git a/tests/test_ruta.py b/tests/test_ruta.py new file mode 100644 index 0000000..696425d --- /dev/null +++ b/tests/test_ruta.py @@ -0,0 +1,128 @@ +"""CaCu: la cita de valoración, la colposcopia y el tratamiento que se agregan a las historias (S-D20). + +Los CIE-10, la especialidad y el motivo se comparan con los del kit (`cacu.seguimiento.*`), no con una copia. +""" + +from datetime import date + +import pytest + +from dev_data.azar import Azar +from dev_data.cacu.cancer import con_cancer +from dev_data.cacu.filas import a_filas +from dev_data.cacu.historias import CIE_DE_LA_CITOLOGIA, COLPOSCOPIA, ONCOLOGIA +from dev_data.cacu.ruta import CIE_DE_LA_COLPOSCOPIA, PROPORCION_TRATADA, TRATAMIENTO_DESDE +from dev_data.parametros import valores_del_archivo + +REFERENCIA = date(2026, 1, 1) +N = 500 +SEMILLA = 7 + + +def _cie(codigo: str) -> str: + """El CIE-10 como lo lista el kit: sin punto.""" + return codigo.replace(".", "") + + +@pytest.fixture(scope="module") +def mujeres(): + return con_cancer(N, Azar(SEMILLA, REFERENCIA)) + + +def _colposcopias(h): + return [n for n in h.notas if n.motivo] + + +def _tratamientos(h): + return [n for n in h.notas if n.toma is None and n.especialidad == ONCOLOGIA and _cie(n.cie).startswith("D06")] + + +def _valoraciones(h): + return [n for n in h.notas if n.toma is None and n.especialidad == COLPOSCOPIA and not n.motivo] + + +def test_hay_valoraciones_colposcopias_y_tratamientos(mujeres): + assert any(_valoraciones(h) for h in mujeres) + assert any(_colposcopias(h) for h in mujeres) + assert any(_tratamientos(h) for h in mujeres) + + +def test_la_cita_de_valoracion_es_anterior_a_la_colposcopia(mujeres): + for h in mujeres: + for colposcopia in _colposcopias(h): + assert any(v.fecha < colposcopia.fecha for v in _valoraciones(h)) + + +def test_la_valoracion_es_una_nota_de_diagnostico_de_colposcopia_segun_el_kit(mujeres): + kit = valores_del_archivo() + diagnostican = set(kit["cacu.diagnostico.cie"]) + notas = [v for h in mujeres for v in _valoraciones(h)] + assert notas and {_cie(v.cie) for v in notas} <= diagnostican + assert {v.especialidad for v in notas} == {COLPOSCOPIA} + + +def test_la_nota_de_colposcopia_lleva_el_motivo_y_los_cie_del_kit(mujeres): + kit = valores_del_archivo() + notas = [c for h in mujeres for c in _colposcopias(h)] + assert notas + assert {c.motivo for c in notas} <= set(kit["cacu.seguimiento.colposcopia.motivos"]) + assert {_cie(c.cie) for c in notas} <= set(kit["cacu.seguimiento.colposcopia.cie"]) + assert {c.especialidad for c in notas} == {COLPOSCOPIA} + + +def test_los_cie_de_la_ruta_son_los_que_se_declaran_aqui(): + assert set(CIE_DE_LA_COLPOSCOPIA) <= set(CIE_DE_LA_CITOLOGIA) + + +def test_la_solicitud_de_una_biopsia_cae_el_dia_de_una_colposcopia(mujeres): + biopsias = [(h, b) for h in mujeres for b in h.biopsias] + coinciden = [1 for h, b in biopsias if any(c.fecha == b.fecha_solicitud for c in _colposcopias(h))] + assert biopsias and len(coinciden) / len(biopsias) > 0.7 + + +def test_la_valoracion_de_una_biopsia_es_anterior_a_su_solicitud(mujeres): + for h in mujeres: + for b in h.biopsias: + if any(c.fecha == b.fecha_solicitud for c in _colposcopias(h)): + assert any(v.fecha < b.fecha_solicitud for v in _valoraciones(h)) + + +def test_el_tratamiento_es_posterior_a_la_colposcopia_y_al_reporte_de_la_biopsia(mujeres): + kit = valores_del_archivo() + tratadas = [h for h in mujeres if _tratamientos(h)] + assert tratadas + for h in tratadas: + for t in _tratamientos(h): + assert _cie(t.cie) in set(kit["cacu.seguimiento.tratamiento.cie"]) + assert any(c.fecha < t.fecha for c in _colposcopias(h)) + assert any(b.fecha_reporte and b.fecha_reporte.toordinal() + TRATAMIENTO_DESDE <= t.fecha.toordinal() for b in h.biopsias) + + +def test_solo_se_trata_a_quien_tiene_una_biopsia_de_un_grado_con_tratamiento(mujeres): + for h in mujeres: + if _tratamientos(h): + assert any(b.grado in PROPORCION_TRATADA for b in h.biopsias if b.fecha_reporte) + + +def test_hay_menos_tratamientos_que_colposcopias(mujeres): + assert 0 < sum(len(_tratamientos(h)) for h in mujeres) < sum(len(_colposcopias(h)) for h in mujeres) + + +def test_las_notas_de_la_ruta_no_resuelven_ninguna_toma(mujeres): + assert all(n.toma is None for h in mujeres for n in [*_valoraciones(h), *_colposcopias(h), *_tratamientos(h)]) + + +def test_ninguna_nota_pasa_de_la_referencia_ni_de_la_defuncion(mujeres): + assert all(n.fecha <= REFERENCIA for h in mujeres for n in h.notas) + assert all(n.fecha <= h.defuncion for h in mujeres if h.defuncion for n in h.notas) + + +def test_las_notas_de_cada_mujer_van_en_orden_de_fecha(mujeres): + assert all([n.fecha for n in h.notas] == sorted(n.fecha for n in h.notas) for h in mujeres) + + +def test_las_filas_llevan_el_motivo_de_la_colposcopia(mujeres): + filas = a_filas(mujeres) + con_motivo = [n for n in filas["notas"] if n.nm_motivo_consulta] + assert len(con_motivo) == sum(len(_colposcopias(h)) for h in mujeres) + assert {n.nm_especialidad for n in con_motivo} == {COLPOSCOPIA} -- 2.53.0 From 9b968849ea4bb672aa6744120e00f2b34130621e Mon Sep 17 00:00:00 2001 From: edgar Date: Sun, 22 Nov 2026 07:53:38 -0600 Subject: [PATCH 3/5] CaCu: a cytology can carry its glandular result `Citologia.glandulares` goes to `cit_celulas_glandulares` (an AGC result), empty unless a generator gives it; the simple generator doesn't. --- src/dev_data/cacu/filas.py | 1 + src/dev_data/cacu/historias.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/dev_data/cacu/filas.py b/src/dev_data/cacu/filas.py index 5100725..d93c312 100644 --- a/src/dev_data/cacu/filas.py +++ b/src/dev_data/cacu/filas.py @@ -30,6 +30,7 @@ def a_filas(historias: list[Historia]) -> dict[str, list]: cit_fecha_reporte=c.fecha_reporte, cit_calidad_especimen=c.calidad, cit_celulas_escamosas=c.resultado, cit_vph_resultado=c.vph, cit_vph_genotipo_16=c.genotipo_16, cit_vph_genotipo_18=c.genotipo_18, + cit_celulas_glandulares=c.glandulares, ) ) for b in h.biopsias: diff --git a/src/dev_data/cacu/historias.py b/src/dev_data/cacu/historias.py index c034652..e4c8767 100644 --- a/src/dev_data/cacu/historias.py +++ b/src/dev_data/cacu/historias.py @@ -74,6 +74,7 @@ class Citologia: vph: str | None = None genotipo_16: int | None = None genotipo_18: int | None = None + glandulares: str | None = None # resultado de células glandulares (AGC); solo lo da el hospital de KPNC @dataclass(frozen=True) -- 2.53.0 From 243aa2cc078ae284829c1981ffe06293812d33c5 Mon Sep 17 00:00:00 2001 From: edgar Date: Sun, 22 Nov 2026 07:58:18 -0600 Subject: [PATCH 4/5] CaCu: the KPNC-like hospital as `poblar cacu --generador kpnc` The option (or `DEV_DATA_GENERADOR=kpnc`) replaces the fixed proportions with bayes-pim's KPNC-like hospital (`bayes_pim.hospital`): women cotested over the 14 years before the reference under KPNC's protocol, several visits each, colposcopies and CIN2+ biopsies from KPNC's published tables, turned into the hospital's cytologies, biopsies and notes. bayes-pim is the `kpnc` extra, pinned to a commit of its Gitea repository; the Docker image doesn't install it yet. --- README.md | 9 + pyproject.toml | 6 + src/dev_data/cacu/kpnc.py | 86 ++++++ src/dev_data/cacu/proyecto.py | 17 +- tests/test_cacu_kpnc.py | 64 ++++ uv.lock | 548 ++++++++++++++++++++++++++++++++-- 6 files changed, 694 insertions(+), 36 deletions(-) create mode 100644 src/dev_data/cacu/kpnc.py create mode 100644 tests/test_cacu_kpnc.py diff --git a/README.md b/README.md index 203036f..40c84dc 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ uv run --python 3.12 pytest uv run python -m dev_data poblar tea --referencia 2026-01-01 --hospital mysql+pymysql://... uv run python -m dev_data cargar tea --api http://localhost:5050 --hospital mysql+pymysql://hospital:hospital@:9505/hospital uv run python -m dev_data documentos cacu --referencia 2026-01-01 --salida datos/expedientes +uv run --extra kpnc python -m dev_data poblar cacu --generador kpnc --n 5000 --referencia 2026-01-01 --hospital montura/poblar.sh # el hospital en Docker (puerto 9505 del servidor), generado y poblado montura/cargar.sh http://10.0.10.41:18080 # el hospital a una plataforma vacía, los tres proyectos ``` @@ -41,6 +42,14 @@ la colposcopia (anterior a la biopsia, que se pide ese mismo día; su resultado tratamientos, y las medidas de la ruta y los estratos de seguimiento dejan de salir vacíos. Ver `_docs/supuestos.md`, S-D20. +## El hospital tipo KPNC de CaCu + +`poblar cacu --generador kpnc` (o `DEV_DATA_GENERADOR=kpnc`) cambia las proporciones fijas por el hospital tipo +KPNC de bayes-pim (`bayes_pim.hospital`): mujeres con cotest en los 14 años anteriores a la referencia bajo el +protocolo de KPNC, varias visitas cada una, colposcopías y biopsias CIN2+ desde las tablas publicadas de KPNC, para +ajustar y comparar los modelos de CaCu con seguimiento de varios años. Necesita el extra `kpnc` (bayes-pim); la +imagen de Docker todavía no lo trae. + ## Documentos `documentos` escribe en disco los expedientes en PDF de las mismas historias diff --git a/pyproject.toml b/pyproject.toml index 2878d31..1662556 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,10 @@ dependencies = [ "reportlab>=4.2", ] +[project.optional-dependencies] +# `poblar cacu --generador kpnc`: el hospital tipo KPNC de bayes-pim (trae pandas, scipy y pymc). +kpnc = ["bayes-pim"] + [dependency-groups] dev = [ "pytest==9.1.1", @@ -28,6 +32,8 @@ dev = [ [tool.uv.sources] core = { path = "../ISSSTELEON/Core", editable = true } webapi = { path = "../ISSSTELEON/WebApi", editable = true } +# bayes-pim desde su repositorio en Gitea (lectura por HTTP sin credenciales), en un commit fijo. +bayes-pim = { git = "http://10.0.10.41:3000/edgar/bayes-pim.git", rev = "1cef69be90a7a9ea30378118cd2a2c9fa312943e" } [build-system] requires = ["hatchling"] diff --git a/src/dev_data/cacu/kpnc.py b/src/dev_data/cacu/kpnc.py new file mode 100644 index 0000000..e3e667b --- /dev/null +++ b/src/dev_data/cacu/kpnc.py @@ -0,0 +1,86 @@ +"""Historias de CaCu desde el hospital tipo KPNC de bayes-pim (`bayes_pim.hospital`), en lugar de proporciones fijas. + +bayes-pim simula mujeres inscritas de 2003 a 2017 con el protocolo de KPNC (cotest, colposcopía por resultado +anormal, seguimiento anual o trienal) y una biología CIN2+ tomada de las tablas publicadas de KPNC, con cada biopsia +positiva graduada CIN2, CIN3 o cáncer. Aquí cada visita se vuelve un registro del hospital: + +- el calendario de bayes-pim (meses de 30 días desde enero de 2003) se recorre para que termine en la referencia; +- un tamizaje es una citología satisfactoria con VPH: NILM es NORMAL, LSIL es LIEBG, HSIL+ es LIEAG, y AGC va en + células glandulares con las escamosas NORMAL; +- una colposcopía con biopsia es una biopsia pedida tras la última citología: date: + return origen + timedelta(days=int(round(mes * DIAS_POR_MES))) + + +def _historia(clave: str, visitas: pd.DataFrame, ingreso: float, origen: date, azar: Azar) -> Historia: + referencia = azar.referencia + fecha_ingreso = _fecha(origen, ingreso) + edad = azar.derivar("edad").entero(*EDAD_INGRESO) + nacimiento = azar.derivar("nacimiento").fecha_entre(_hace_anios(fecha_ingreso, edad + 1) + timedelta(days=1), + _hace_anios(fecha_ingreso, edad)) + citologias, biopsias = [], [] + for i, v in enumerate(visitas.itertuples(index=False)): + fecha = _fecha(origen, v.mes_calendario) + if fecha > referencia: + break + a = azar.derivar(f"visita:{i}") + if v.evento == "tamizaje": + reporte = min(fecha + timedelta(days=a.derivar("reporte").entero(REPORTE_DESDE, REPORTE_HASTA)), referencia) + citologias.append(Citologia(fecha, SATISFACTORIO, reporte, ESCAMOSAS[v.citologia], VPH[v.vph], + glandulares="AGC" if v.citologia == "AGC" else None)) + elif isinstance(v.histologia, str) and citologias: + solicitud = max(fecha, citologias[-1].fecha_reporte) + reporte = solicitud + timedelta(days=a.derivar("reporte").entero(BIOPSIA_DESDE, BIOPSIA_HASTA)) + if reporte > referencia: + biopsias.append(Biopsia(len(citologias) - 1, solicitud, None, None)) + continue + grados, pesos = GRADO_DE[v.histologia] + biopsias.append(Biopsia(len(citologias) - 1, solicitud, reporte, a.derivar("grado").elegir(list(grados), + list(pesos)))) + citologias, biopsias = tuple(citologias), tuple(biopsias) + return Historia(clave=clave, nacimiento=nacimiento, citologias=citologias, biopsias=biopsias, + notas=_notas(azar.derivar("notas"), citologias, biopsias)) + + +def historias_kpnc(n: int, azar: Azar) -> list[Historia]: + """Unas `n` mujeres del hospital tipo KPNC (las celdas de la tabla 1 se redondean), con las visitas que caen hasta + la referencia; la semilla de bayes-pim sale del azar.""" + from bayes_pim.hospital import simulate_hospital # pesado (pandas, scipy): solo cuando se usa este generador + + visitas, verdad = simulate_hospital(n, seed=azar.derivar("bayes-pim").entero(0, 2**31 - 1)) + origen = azar.referencia - timedelta(days=MESES_INSCRIPCION * DIAS_POR_MES) + ingreso = verdad.set_index("id")["ingreso"] + lista = [] + for i, (ident, suyas) in enumerate(visitas.groupby("id", sort=True), start=1): + clave = f"CACU-{i:05d}" + lista.append(_historia(clave, suyas, float(ingreso[ident]), origen, azar.derivar(f"historias:{clave}"))) + return lista diff --git a/src/dev_data/cacu/proyecto.py b/src/dev_data/cacu/proyecto.py index 6666faa..8aacb99 100644 --- a/src/dev_data/cacu/proyecto.py +++ b/src/dev_data/cacu/proyecto.py @@ -6,11 +6,21 @@ from dev_data.azar import Azar from dev_data.cacu.expediente import DOCUMENTOS from dev_data.cacu.filas import a_filas from dev_data.cacu.cancer import con_cancer -from dev_data.proyecto import Proyecto +from dev_data.proyecto import OpcionInvalida, Proyecto + +# Quién genera las historias (`poblar cacu --generador`): las proporciones fijas, o el hospital tipo KPNC de +# bayes-pim (`dev_data.cacu.kpnc`, con el extra `kpnc`). +GENERADORES = ("simple", "kpnc") -def _generar(n: int, azar: Azar) -> dict[str, list]: - return a_filas(con_cancer(n, azar)) +def _generar(n: int, azar: Azar, generador: str | None = None) -> dict[str, list]: + if generador in (None, "simple"): + return a_filas(con_cancer(n, azar)) + if generador == "kpnc": + from dev_data.cacu.kpnc import historias_kpnc # trae bayes-pim: solo cuando se pide + + return a_filas(historias_kpnc(n, azar)) + raise OpcionInvalida(f"cacu no tiene el generador {generador!r}; tiene: {', '.join(GENERADORES)}") CACU = Proyecto( @@ -20,4 +30,5 @@ CACU = Proyecto( }, generar=_generar, documentos=DOCUMENTOS, + opciones={"generador": "quién genera las historias: simple (por omisión) o kpnc (el hospital tipo KPNC de bayes-pim)"}, ) diff --git a/tests/test_cacu_kpnc.py b/tests/test_cacu_kpnc.py new file mode 100644 index 0000000..7d72513 --- /dev/null +++ b/tests/test_cacu_kpnc.py @@ -0,0 +1,64 @@ +"""CaCu con el hospital tipo KPNC de bayes-pim (`poblar cacu --generador kpnc`): historias, filas y la opción. + +Sin fixtures: genera en memoria. Se salta si bayes-pim no está instalado (el extra `kpnc`). +""" + +from datetime import date + +import pytest + +pytest.importorskip("bayes_pim.hospital") + +from dev_data.azar import Azar # noqa: E402 +from dev_data.cacu.filas import a_filas # noqa: E402 +from dev_data.cacu.kpnc import historias_kpnc # noqa: E402 +from dev_data.cacu.proyecto import CACU # noqa: E402 +from dev_data.proyecto import OpcionInvalida # noqa: E402 + +REFERENCIA = date(2026, 1, 1) + + +@pytest.fixture(scope="module") +def historias(): + """Unas 800 mujeres del hospital tipo KPNC con semilla 7 y referencia 2026-01-01.""" + return historias_kpnc(800, Azar(7, REFERENCIA)) + + +def test_every_record_falls_before_the_reference_and_in_core_vocabulary(historias): + """Fija: ninguna toma, reporte ni biopsia pasa de la referencia, los resultados son los de `Core` y cada biopsia + sigue a la citología que la originó. Falla si se rompe el recorrido del calendario de bayes-pim o la traducción + de sus resultados.""" + citologias = [c for h in historias for c in h.citologias] + biopsias = [(h, b) for h in historias for b in h.biopsias] + assert all(c.fecha_reporte <= REFERENCIA for c in citologias) + assert {c.resultado for c in citologias} <= {"NORMAL", "ASC-US", "LIEBG", "ASC-H", "LIEAG"} + assert {c.vph for c in citologias} == {"POSITIVO", "NEGATIVO"} + assert {c.glandulares for c in citologias} <= {None, "AGC"} + assert all(b.fecha_solicitud >= h.citologias[b.citologia].fecha_reporte for h, b in biopsias) + assert all(b.fecha_reporte is None or b.fecha_reporte <= REFERENCIA for _, b in biopsias) + + +def test_follow_up_spans_years_and_reaches_cin2_plus(historias): + """Fija: hay mujeres con varias visitas a lo largo de años y biopsias CIN2+ (LIEAG o más), que es lo que el modelo + de mezcla prevalencia–incidencia necesita. Falla si el generador vuelve a una sola visita o pierde los casos.""" + varias = [h for h in historias if len(h.citologias) >= 3] + assert len(varias) > 50 + assert max((h.citologias[-1].fecha_toma - h.citologias[0].fecha_toma).days for h in varias) > 5 * 365 + grados = {b.grado for h in historias for b in h.biopsias} + assert {"LIEAG", "NORMAL"} <= grados + + +def test_the_same_seed_gives_the_same_hospital(): + """Fija: la semilla del azar fija también la de bayes-pim. Falla si el generador usa azar sin semilla.""" + a, b = (a_filas(historias_kpnc(200, Azar(3, REFERENCIA))) for _ in range(2)) + assert a == b + + +def test_the_project_offers_it_as_its_generator_option(): + """Fija: `poblar cacu --generador kpnc` (o `DEV_DATA_GENERADOR=kpnc`) usa este generador, y uno desconocido se + rechaza. Falla si se quita la opción del proyecto.""" + assert "generador" in CACU.opciones + filas = CACU.generar(100, Azar(7, REFERENCIA), generador="kpnc") + assert set(filas) == set(CACU.modelos) and filas["pacientes"] + with pytest.raises(OpcionInvalida): + CACU.generar(100, Azar(7, REFERENCIA), generador="otro") diff --git a/uv.lock b/uv.lock index 8bb6dc8..845b25b 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 5 +revision = 3 requires-python = ">=3.12" resolution-markers = [ "python_full_version >= '3.14' and sys_platform == 'win32'", @@ -281,6 +281,68 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/1b/52/859ec72a8a22d616307a933de7edbb9a14b004873a7ac3d830f29dc96880/array_api_extra-0.11.5-py3-none-any.whl", hash = "sha256:872814852b992595ee84ed1356bebb74c6c1b12b6c1546f0169cc4b5ceb59b60", size = 120294, upload-time = "2026-10-25T12:34:37.884Z" }, ] +[[package]] +name = "arviz" +version = "1.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "arviz-base" }, + { name = "arviz-plots" }, + { name = "arviz-stats", extra = ["xarray"] }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e6/f2/d295913894dfc5021dc8d1c5a865c4ff3da73ddc3227d1ed1b8ce48a375d/arviz-1.3.0.tar.gz", hash = "sha256:9e332c0a0da370cb1c00823678065e9b0462fbdf1efa0f38c37485cc78c8a576", size = 8723, upload-time = "2026-08-11T08:17:43.668Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/67/b7/f37610512b621cda1153dd82ff61678b787545a2914eaa2b8daacaeee924/arviz-1.3.0-py3-none-any.whl", hash = "sha256:16ab348e94c80295d205ea65e695d835b66daef8b31eddf71b88fd9b48490a85", size = 9219, upload-time = "2026-08-11T08:17:42.379Z" }, +] + +[[package]] +name = "arviz-base" +version = "1.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "lazy-loader" }, + { name = "numpy" }, + { name = "typing-extensions" }, + { name = "xarray" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d1/e6/4cbf049a330a6b36cb4c2ed6913564965d397e30304b1e1ac13067630d26/arviz_base-1.3.1.tar.gz", hash = "sha256:f83c49d1842ca93821d38bc03f1d75df18d56d507694804a07ce6c1b3bbf2d6c", size = 1410984, upload-time = "2026-09-25T09:43:21.898Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/34/8f/1cdf6dbab034fdf9fea31c05599497b1d14e2f62d51a6045c1a647d93af4/arviz_base-1.3.1-py3-none-any.whl", hash = "sha256:4b4d60807f0e136af295a3c64aa13d87d3b7ba78b54acb015f6cb515ffd4b8fd", size = 1428088, upload-time = "2026-09-25T09:43:20.071Z" }, +] + +[[package]] +name = "arviz-plots" +version = "1.3.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "arviz-base" }, + { name = "arviz-stats", extra = ["xarray"] }, +] +sdist = { url = "https://files.pythonhosted.org/packages/4e/08/ff7e5f5edb4e019017a5754a9a211a4589c9d3d51127b64a7b61bf2da941/arviz_plots-1.3.2.tar.gz", hash = "sha256:040b5672f186e39ea21554f8fa60c01786798bd10eb0853cab1fc09e54eacead", size = 167771, upload-time = "2026-09-25T18:17:09.383Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/38/b8/d4c4938e3d3dfbb331c61c9e32b824ab692229eb750c87f705d896b7a2cd/arviz_plots-1.3.2-py3-none-any.whl", hash = "sha256:17d66e373eef7340ca25d8a318a4eebe29532ea76dc4723924d4608e21ed3c64", size = 253332, upload-time = "2026-09-25T18:17:07.804Z" }, +] + +[[package]] +name = "arviz-stats" +version = "1.3.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "numpy" }, + { name = "scipy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/80/e0/3d6815e0026a12b8719ff4dfdbaa7cc45d0c0e0cc7ae371d768fc08d2c6e/arviz_stats-1.3.3.tar.gz", hash = "sha256:3fed50cc2a9bb8e2719fd675691b1c332c15394e13d4b7a2bef64f6a6c2a6ccf", size = 180679, upload-time = "2026-09-25T10:20:45.105Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/eb/c5/b68639b3a766469838d7053b6929e092679d014e8d336034b67441cd0da7/arviz_stats-1.3.3-py3-none-any.whl", hash = "sha256:2fdd79ac91a95235c3820343a31ada37437a195a6d544b7561122429ba54771d", size = 209422, upload-time = "2026-09-25T10:20:42.934Z" }, +] + +[package.optional-dependencies] +xarray = [ + { name = "arviz-base" }, + { name = "xarray" }, + { name = "xarray-einstats" }, +] + [[package]] name = "asttokens" version = "3.0.2" @@ -299,6 +361,44 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" }, ] +[[package]] +name = "autograd" +version = "1.9.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "numpy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9d/ac/4a8b58364ba865ab545251edbe475e5a35326814a5d274a2211d33ed8a5d/autograd-1.9.1.tar.gz", hash = "sha256:7818c5c69ddf9efb7da74097bd741a4c7920133f41966f68537223a15ef798bc", size = 2566975, upload-time = "2026-07-02T07:43:58.255Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6e/ce/8c98e6604bb1ec9d03c8493c328185b69bb7533fe08f3640f0f3641bd9d1/autograd-1.9.1-py3-none-any.whl", hash = "sha256:b788bae3fa010cbffb4cfb7b8ba2a3f0daa6072a8506da6164c779fe9cf3e05a", size = 54387, upload-time = "2026-07-02T07:43:56.502Z" }, +] + +[[package]] +name = "autograd-gamma" +version = "0.5.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "autograd" }, + { name = "scipy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/85/ae/7f2031ea76140444b2453fa139041e5afd4a09fc5300cfefeb1103291f80/autograd-gamma-0.5.0.tar.gz", hash = "sha256:f27abb7b8bb9cffc8badcbf59f3fe44a9db39e124ecacf1992b6d952934ac9c4", size = 3952, upload-time = "2020-10-15T16:51:06.785Z" } + +[[package]] +name = "bayes-pim" +version = "0.1.0" +source = { git = "http://10.0.10.41:3000/edgar/bayes-pim.git?rev=1cef69be90a7a9ea30378118cd2a2c9fa312943e#1cef69be90a7a9ea30378118cd2a2c9fa312943e" } +dependencies = [ + { name = "apache-hamilton" }, + { name = "dask", extra = ["distributed"] }, + { name = "numpy" }, + { name = "openpyxl" }, + { name = "pandas" }, + { name = "pyarrow" }, + { name = "pymc" }, + { name = "scikit-learn" }, + { name = "scipy" }, +] + [[package]] name = "beautifulsoup4" version = "4.15.0" @@ -312,6 +412,23 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/88/c6/92fcd42f1ba33e1184263f25bfabf3d27c383410470f169e4b8163bf9c17/beautifulsoup4-4.15.0-py3-none-any.whl", hash = "sha256:d6f88de62e1d4e38ecb1077eb9724cd0eff29d2a08ca16a401e9b9e93f117cf9", size = 109924, upload-time = "2026-06-07T16:44:21.566Z" }, ] +[[package]] +name = "better-optimize" +version = "0.5.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "joblib" }, + { name = "numpy" }, + { name = "pandas" }, + { name = "rich" }, + { name = "scipy" }, + { name = "threadpoolctl" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/34/08/4adb96c5e3600cf6db010312397712659d392e7d13e6e3b8e5e4c4116f86/better_optimize-0.5.1.tar.gz", hash = "sha256:e6adf6473e4e416d7abf642c903701b1482ef3b2fb4607faf253e90bba10e9d0", size = 94462, upload-time = "2026-10-18T07:08:46.598Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ff/47/f0fa0c744017561c27ed06ad8d30f548a4c1ff199b18c9a2d121eb5c5169/better_optimize-0.5.1-py3-none-any.whl", hash = "sha256:3cfc2408db1d161bc9d8cfef8192081e5bd6d3989dda70fae302e76e2c1e07ee", size = 77214, upload-time = "2026-10-18T07:08:45.039Z" }, +] + [[package]] name = "bleach" version = "6.4.0" @@ -340,11 +457,11 @@ wheels = [ [[package]] name = "cachetools" -version = "7.3.0" +version = "6.2.6" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/5f/6b/6c1553e1e8f672f9423344a1915aad1537439ad3d14a3fbc1a02159cfd94/cachetools-7.3.0.tar.gz", hash = "sha256:3f63fc208410f0c3a3b37883c4903ecdacd6f0b259134e6d2e82debd5b2e01de", size = 48563, upload-time = "2026-11-05T20:38:46.434Z" } +sdist = { url = "https://files.pythonhosted.org/packages/39/91/d9ae9a66b01102a18cd16db0cf4cd54187ffe10f0865cc80071a4104fbb3/cachetools-6.2.6.tar.gz", hash = "sha256:16c33e1f276b9a9c0b49ab5782d901e3ad3de0dd6da9bf9bcd29ac5672f2f9e6", size = 32363, upload-time = "2026-01-27T20:32:59.956Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/29/aa/e54a49d0927b2fa7b86bc94dbde57125e38e8cfca7a31b6764e8dbf35e9f/cachetools-7.3.0-py3-none-any.whl", hash = "sha256:2105787c94619bde7072624fec0fe7b8a08bb7bf6c757c318f8925573c6f07c9", size = 19575, upload-time = "2026-11-05T20:38:44.928Z" }, + { url = "https://files.pythonhosted.org/packages/90/45/f458fa2c388e79dd9d8b9b0c99f1d31b568f27388f2fdba7bb66bbc0c6ed/cachetools-6.2.6-py3-none-any.whl", hash = "sha256:8c9717235b3c651603fff0076db52d6acbfd1b338b8ed50256092f7ce9c85bda", size = 11668, upload-time = "2026-01-27T20:32:58.527Z" }, ] [[package]] @@ -797,6 +914,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f8/3a/4fc99e788bcfa1b3b3f21abf57da45898d807d007e7f6fd1c7300904eb70/dask-2026.8.0-py3-none-any.whl", hash = "sha256:ccc0c83a189b0398602435189771d28dad7b5773b6089bb8dce14ae732dd782c", size = 1492182, upload-time = "2026-08-24T19:21:23.997Z" }, ] +[package.optional-dependencies] +distributed = [ + { name = "distributed" }, +] + [[package]] name = "databricks-sdk" version = "0.163.0" @@ -871,6 +993,11 @@ dependencies = [ { name = "reportlab" }, ] +[package.optional-dependencies] +kpnc = [ + { name = "bayes-pim" }, +] + [package.dev-dependencies] dev = [ { name = "pytest" }, @@ -879,6 +1006,7 @@ dev = [ [package.metadata] requires-dist = [ + { name = "bayes-pim", marker = "extra == 'kpnc'", git = "http://10.0.10.41:3000/edgar/bayes-pim.git?rev=1cef69be90a7a9ea30378118cd2a2c9fa312943e" }, { name = "core", editable = "../ISSSTELEON/Core" }, { name = "edfio", specifier = ">=0.4.18" }, { name = "numpy", specifier = ">=1.26" }, @@ -888,6 +1016,7 @@ requires-dist = [ { name = "pypdfium2", specifier = ">=4.0" }, { name = "reportlab", specifier = ">=4.2" }, ] +provides-extras = ["kpnc"] [package.metadata.requires-dev] dev = [ @@ -1045,6 +1174,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d1/86/32914542064b8aee77ac48142f8a1955df78da4eb905dd41697d26941d21/fhir_resources-8.3.0-py2.py3-none-any.whl", hash = "sha256:151e6c9b4336e36383cc2aaf2067a6f112a420fce1c7bd289182e55dd950871b", size = 2288069, upload-time = "2026-07-03T15:23:51.97Z" }, ] +[[package]] +name = "filelock" +version = "4.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6c/bf/a895b0b8e83d0a64d134f658e393e83998abfc22bbb8b58181ce55268706/filelock-4.3.0.tar.gz", hash = "sha256:143407310acf479e82d88068e3b9a6486f45fb410c0ed8729fe7359eaabeb6f1", size = 742199, upload-time = "2026-11-22T02:15:03.187Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/68/66/870b527908a06c7ec0e91239bd2c4d0bb22921efd4f915428b4e47d461a6/filelock-4.3.0-py3-none-any.whl", hash = "sha256:f933f39f7e01249a4a49b9abab30edc6d4b874624c3de5dd0b0d137aa8adb979", size = 244553, upload-time = "2026-11-22T02:15:01.667Z" }, +] + [[package]] name = "flask" version = "3.1.3" @@ -1413,6 +1551,69 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, ] +[[package]] +name = "hf-xet" +version = "1.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/2f/18/d91c20f815df6cc496a5d0ad8db6d274dad5c0cfcd59babfa2440a9aba44/hf_xet-1.8.0.tar.gz", hash = "sha256:10ed23b51dacf7917d64f335c25048deb470efa755e9989b218fc0531386138e", size = 1013014, upload-time = "2026-10-30T10:04:33.741Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2c/18/db7ebc58820d82fd5506aa405a75611e7a4398f573dc436f7387603bf63d/hf_xet-1.8.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:c74e3751cbcdae9222c5170e8d788e83201a03dc5e5f4308a20f17a5b6023b56", size = 3883873, upload-time = "2026-10-30T10:04:03.24Z" }, + { url = "https://files.pythonhosted.org/packages/37/bd/6c9ed89aafbeb4a7ee0d76d6b7b9365221e3e7ee47958aeecdc2c60a0511/hf_xet-1.8.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:56735c2d4f416d7473fc986586b26a8756e067832ca4b7fdaad32a0d6f2ce740", size = 3594510, upload-time = "2026-10-30T10:04:05.364Z" }, + { url = "https://files.pythonhosted.org/packages/0e/1f/c26154b3a053b637c0984db0db9fdacbbfc257bdc2e95e9bc0782b745b0c/hf_xet-1.8.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3ecfe2934448cca55a4c42732b60f985266aecb241905945219b3d388aceb7ba", size = 4281780, upload-time = "2026-10-30T10:04:07.35Z" }, + { url = "https://files.pythonhosted.org/packages/e3/9e/d84c31f8e3acc286c9c6a4fd85f7f332e3db40636595f0de5ad776b69beb/hf_xet-1.8.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:7edeb21c5d381903ee5f4857fc746fa7b52a4b374035e8811ecfb67ee27add0c", size = 4060223, upload-time = "2026-10-30T10:04:09.029Z" }, + { url = "https://files.pythonhosted.org/packages/a4/70/c142e4ad8a679ff6ffe40964a9d017fa0211aabca9ca4d3d547c3a2fc165/hf_xet-1.8.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:07a06d7481702616726c2d8578cfb00052a5b3f21beed6a674592bc837a10330", size = 4263619, upload-time = "2026-10-30T10:04:11.085Z" }, + { url = "https://files.pythonhosted.org/packages/9d/08/92e03e3ac4eaeab046359093c447c03c8c30b577c2b1e1687dc747654f1c/hf_xet-1.8.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f42940869572dc2b05dfe06f4cc398c6291503e086ddc4eddfb7a6ab9409ad01", size = 4493381, upload-time = "2026-10-30T10:04:13.022Z" }, + { url = "https://files.pythonhosted.org/packages/61/63/a512b2906d0f92b5d325f58169d1fd8c3202a9ee61bd8405ec78c67e5315/hf_xet-1.8.0-cp314-cp314t-win_amd64.whl", hash = "sha256:23c262e9f5e137b18dadbce60becfeea84156b0d43119c320bffe260d32cd2fa", size = 3901344, upload-time = "2026-10-30T10:04:15.051Z" }, + { url = "https://files.pythonhosted.org/packages/2d/5e/b453f82690cb36f176c4b01e64d6d32757fabbf34dbb9bcbdf747e429a79/hf_xet-1.8.0-cp314-cp314t-win_arm64.whl", hash = "sha256:62b056aedb89ac809f78940baf465fe553b70c8b25ee56890fbab3039fffec1b", size = 3731681, upload-time = "2026-10-30T10:04:16.855Z" }, + { url = "https://files.pythonhosted.org/packages/97/74/d89d5235524bc14d8519e12ca8bc5204f45009ae83d63a410f52c29eb4a8/hf_xet-1.8.0-cp38-abi3-macosx_10_12_x86_64.whl", hash = "sha256:e00d8f60170cd3dd55d98306e41dbaf28b27ff1bcfefbfa84279d197221be83e", size = 3875002, upload-time = "2026-10-30T10:04:18.958Z" }, + { url = "https://files.pythonhosted.org/packages/d4/f2/ef25e2085e92dcaeaa675331e443923aed2006f6fe2d984e15d8b8d40766/hf_xet-1.8.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:3e8934784425781f0f779b91044df441f3a7af4dab47375d7e3aeaecbb8eecb4", size = 3600947, upload-time = "2026-10-30T10:04:20.906Z" }, + { url = "https://files.pythonhosted.org/packages/f8/1e/1e8ecc05ef034e9a95c18ed32d2ec07905a7cd2ca611a9d88e25ee1f4850/hf_xet-1.8.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:29dab7c904cd1914a0439c6e1306c12c7497c8bd32290fbe563ebf51ca4b6d6d", size = 4292483, upload-time = "2026-10-30T10:04:22.875Z" }, + { url = "https://files.pythonhosted.org/packages/35/c4/127a1548df019ea4c80f06e685f263e146075143335a02e78a3c41dbc4eb/hf_xet-1.8.0-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:8800e3444770f2c630b361bc6d5c6ebb770b7830646cf632fbb79d0e5bbc9e7f", size = 4069340, upload-time = "2026-10-30T10:04:24.664Z" }, + { url = "https://files.pythonhosted.org/packages/a5/d5/281cd82736c3e181e597588589d2204d3a5c388a464d4a2a8c546995bae9/hf_xet-1.8.0-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:a584a7b3268da62f23c3187cc7201ca01f7b610985a36b1b6119c66bccb0383c", size = 4272344, upload-time = "2026-10-30T10:04:26.519Z" }, + { url = "https://files.pythonhosted.org/packages/48/77/886f09e91a5eadb054ce03b8855323cd2a72f20db76ab4119e0ecda65eef/hf_xet-1.8.0-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:1ebaf248c9bef8bb0c9d1d8d71db1fdf0cac14f922cc7a936a81adbf12eb5f01", size = 4500689, upload-time = "2026-10-30T10:04:28.394Z" }, + { url = "https://files.pythonhosted.org/packages/97/4d/2c76a992b370ff77d0b5219275779f8c9a7dabb8ee649deb265dfed84d0f/hf_xet-1.8.0-cp38-abi3-win_amd64.whl", hash = "sha256:92188598dedc1e1f5609bd718d4db8687a6c89915553912571e2f587892eecec", size = 3911559, upload-time = "2026-10-30T10:04:30.165Z" }, + { url = "https://files.pythonhosted.org/packages/87/91/fdb1454a43eff8011047d176ada2f0fb4926cf3d74b87357ff35793f6d98/hf_xet-1.8.0-cp38-abi3-win_arm64.whl", hash = "sha256:42b66fdc688eaa4ff3eb77dc9275e5a0f1258ecc9fdd083ddaf43bb49bec925b", size = 3738458, upload-time = "2026-10-30T10:04:31.882Z" }, +] + +[[package]] +name = "httpcore2" +version = "2.16.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "h11", marker = "sys_platform != 'emscripten'" }, + { name = "truststore", marker = "sys_platform != 'emscripten'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/92/9d/df40b41f7db0370f82019820709244e7b660c52aa3da3c9e5c4e8141f6e6/httpcore2-2.16.2.tar.gz", hash = "sha256:6c519d0f7b44f7269fa9bbb4d2763db395a4a2370f046d8e8e0a4b38227815d2", size = 70064, upload-time = "2026-11-16T10:12:19.491Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/e8/009c347feac27f8960605aa98d55ed263b5870dd4fd80b82fd1d00d5716c/httpcore2-2.16.2-py3-none-any.whl", hash = "sha256:16051ae2a42f776007543f32de9349a317b23d2cbb4e1456b4bac0e88b87419a", size = 85551, upload-time = "2026-11-16T10:12:16.674Z" }, +] + +[[package]] +name = "httpx2" +version = "2.16.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio", marker = "sys_platform != 'emscripten'" }, + { name = "httpcore2", marker = "sys_platform != 'emscripten'" }, + { name = "httpx2-jsfetch", marker = "sys_platform == 'emscripten'" }, + { name = "idna" }, + { name = "truststore", marker = "sys_platform != 'emscripten'" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/1c/77/6515121dc5ac3c743ad1bff5afe635bcd1a3f23cc40db3c5c89f7d02917d/httpx2-2.16.2.tar.gz", hash = "sha256:748b615678f07d8e3b183efe81ad13b655ca88bfc56ce4589219b2d442860574", size = 103370, upload-time = "2026-11-16T10:12:20.49Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/77/de/8c4306a3d6aa2495111986addf33a9e561eff4c47552e4c4b9251160d0ad/httpx2-2.16.2-py3-none-any.whl", hash = "sha256:f05c13aade4c45dbf1c9060647a1058f0acad62398fad96e741269edb33d46f5", size = 97893, upload-time = "2026-11-16T10:12:18.192Z" }, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/cd/c4/0e5636363151a2a1795e0a77617168b9ca438e1748ec05fc9b5687f93d64/httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60", size = 6872, upload-time = "2026-08-07T00:13:07.492Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9b/43/832f631d32e4f1211caa2ba368317739fe71f0b8530e4c9d15dc454bac2a/httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32", size = 6382, upload-time = "2026-08-07T00:13:06.567Z" }, +] + [[package]] name = "huey" version = "3.5.4" @@ -1422,6 +1623,26 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/62/2d/7f87a56f62b39d4bac5456b3e8e46edfc1f730c23ebecb4e753dad0b662a/huey-3.5.4-py3-none-any.whl", hash = "sha256:a3b68953fc62fbbbfe15cd6c48bef9d8072a267234c647121c31ec466e35e8e8", size = 135393, upload-time = "2026-11-01T17:59:19.956Z" }, ] +[[package]] +name = "huggingface-hub" +version = "2.4.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "filelock" }, + { name = "fsspec" }, + { name = "hf-xet", marker = "platform_machine == 'AMD64' or platform_machine == 'ARM64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'" }, + { name = "httpx2" }, + { name = "packaging" }, + { name = "pyyaml" }, + { name = "tqdm" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b5/3b/2fcef1eabe52aec90fc8cd253cc154da1d02a446d7bbcdec59b4a51d4be7/huggingface_hub-2.4.0.tar.gz", hash = "sha256:13a6158b9e3393d9d3f248ce99074d50c2a0a1449fb9d8e2f710751e2084c188", size = 1066194, upload-time = "2026-10-29T15:30:12.321Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d4/55/ff47f1b082ecf5f43f4bc1e3b932d68eead171dabbbd1a92666c686301d7/huggingface_hub-2.4.0-py3-none-any.whl", hash = "sha256:42ecfd93ede47bdd333daebbf66a32d7bfe2e18752754fe4d2d4f98a0179d801", size = 857021, upload-time = "2026-10-29T15:30:10.421Z" }, +] + [[package]] name = "idna" version = "3.20" @@ -1750,6 +1971,24 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/23/93/4e45e37f26c820216704b36b8e67cc55c490a7abd287a78a26a2c0e21386/lazy_loader-0.6-py3-none-any.whl", hash = "sha256:77253be3391b06124a0e16105bd663b6c54470af1a9ca8e1cf026f38d58ed056", size = 8791, upload-time = "2026-09-21T21:31:31.632Z" }, ] +[[package]] +name = "lifelines" +version = "0.30.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "autograd" }, + { name = "autograd-gamma" }, + { name = "formulaic" }, + { name = "matplotlib" }, + { name = "numpy" }, + { name = "pandas" }, + { name = "scipy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ea/4f/f0b363278d40baf7d7a03217bee839cb880946c62109f243391c8754bb09/lifelines-0.30.0.tar.gz", hash = "sha256:f7f6f6275fcb167fe0f5b1ef98f868993f9c074cb74b1dd6e92736efa854be18", size = 383221, upload-time = "2024-10-29T12:00:43.513Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/14/f7/379e185a75ac8166ac70756d0ba68d9a2b02b555c7fde4983246752396bd/lifelines-0.30.0-py3-none-any.whl", hash = "sha256:ac7c602c8aceced9770d3977817c9d99c250ed8cd86f2567fa0d23e4e8014bf9", size = 349319, upload-time = "2024-10-29T12:00:41.749Z" }, +] + [[package]] name = "lightgbm" version = "4.7.0" @@ -1837,6 +2076,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6d/a0/053d6af3e8f871e0073b4a36732d9e65be77a72e5434c31b94f6af78a6bb/mako-1.4.3-py3-none-any.whl", hash = "sha256:723296007c870bfd6b3f0c3230dba7198096e5269297ebf5e4eff9e7ffa39d4f", size = 80164, upload-time = "2026-09-22T20:54:33.128Z" }, ] +[[package]] +name = "markdown-it-py" +version = "4.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mdurl" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/16/fc/cee2c45553c9a9bf77d8b0c391560c556d7ed756b1f0bb35eb5d48db09ea/markdown_it_py-4.3.0.tar.gz", hash = "sha256:91a58fa5b72c71a40cf7177250fd767480d7a2bb3ac426ccfb76fb90305fdaaa", size = 242701, upload-time = "2026-11-10T16:18:30.467Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c9/31/5f0ac2f1a1c67423c995c731a11cd4ad05d081a2be969d74f868bdb9cc70/markdown_it_py-4.3.0-py3-none-any.whl", hash = "sha256:7aa1511a46c39138de78d9eba92ce47e63124d8003fc98b3a351909e04239efa", size = 96951, upload-time = "2026-11-10T16:18:28.975Z" }, +] + [[package]] name = "markupsafe" version = "3.0.4" @@ -2023,6 +2274,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/41/09/5b161152e2d90f7b87f781c2e1267494aef9c32498df793f73ad0a0a494a/matplotlib_inline-0.2.2-py3-none-any.whl", hash = "sha256:3c821cf1c209f59fb2d2d64abbf5b23b67bcb2210d663f9918dd851c6da1fcf6", size = 9534, upload-time = "2026-05-08T17:33:32.055Z" }, ] +[[package]] +name = "mdurl" +version = "0.1.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729, upload-time = "2022-08-14T12:40:10.846Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" }, +] + [[package]] name = "meegkit" version = "0.2.0" @@ -2177,32 +2437,78 @@ notebooks = [ { name = "nbclient" }, { name = "nbconvert" }, ] +seer-survival = [ + { name = "lifelines" }, + { name = "matplotlib" }, + { name = "mpmath" }, + { name = "networkx" }, + { name = "pgmpy" }, + { name = "scipy" }, + { name = "statsmodels" }, +] +survival-curves = [ + { name = "mpmath" }, + { name = "plotly" }, + { name = "scipy" }, +] [package.metadata] requires-dist = [ { name = "apache-hamilton", specifier = ">=1.90" }, + { name = "dcurves", marker = "extra == 'seer-survival-dca'", specifier = ">=1.1" }, { name = "extraction", editable = "../ISSSTELEON/Extraction" }, { name = "ipykernel", marker = "extra == 'notebooks'", specifier = ">=6.29" }, + { name = "lifelines", marker = "extra == 'seer-survival'", specifier = ">=0.28" }, + { name = "matplotlib", marker = "extra == 'seer-survival'", specifier = ">=3.8" }, { name = "mlflow", specifier = ">=2.9" }, + { name = "mpmath", marker = "extra == 'seer-survival'", specifier = ">=1.3" }, + { name = "mpmath", marker = "extra == 'survival-curves'", specifier = ">=1.3" }, { name = "nbclient", marker = "extra == 'notebooks'", specifier = ">=0.10" }, { name = "nbconvert", marker = "extra == 'notebooks'", specifier = ">=7.16" }, + { name = "networkx", marker = "extra == 'seer-survival'", specifier = ">=3.0" }, { name = "pandas", specifier = ">=2.0" }, { name = "pandera", specifier = ">=0.20" }, { name = "persistance", editable = "../ISSSTELEON/Persistance" }, + { name = "pgmpy", marker = "extra == 'seer-survival'", specifier = ">=1.0" }, + { name = "plotly", marker = "extra == 'survival-curves'", specifier = ">=5.18" }, { name = "pyarrow", specifier = ">=15" }, { name = "scikit-learn", specifier = ">=1.4" }, + { name = "scipy", marker = "extra == 'seer-survival'", specifier = ">=1.11" }, + { name = "scipy", marker = "extra == 'survival-curves'", specifier = ">=1.11" }, + { name = "statsmodels", marker = "extra == 'seer-survival'", specifier = ">=0.14" }, { name = "tea", editable = "../ISSSTELEON/models/libs/tea" }, { name = "tea", extras = ["s3"], marker = "extra == 'eeg-reference'", editable = "../ISSSTELEON/models/libs/tea" }, ] -provides-extras = ["eeg-reference", "notebooks"] +provides-extras = ["eeg-reference", "notebooks", "seer-survival", "survival-curves", "seer-survival-dca"] [package.metadata.requires-dev] dev = [ { name = "ipykernel", specifier = ">=6.29" }, + { name = "lifelines", specifier = ">=0.28" }, + { name = "matplotlib", specifier = ">=3.8" }, + { name = "mpmath", specifier = ">=1.3" }, { name = "nbclient", specifier = ">=0.10" }, { name = "nbconvert", specifier = ">=7.16" }, + { name = "networkx", specifier = ">=3.0" }, + { name = "pgmpy", specifier = ">=1.0" }, + { name = "plotly", specifier = ">=5.18" }, { name = "pytest", specifier = ">=8.0.0" }, { name = "reportlab", specifier = ">=4.0" }, + { name = "scipy", specifier = ">=1.11" }, + { name = "statsmodels", specifier = ">=0.14" }, +] +notebooks = [ + { name = "graphviz", specifier = ">=0.20" }, + { name = "ipykernel", specifier = ">=6.29" }, +] + +[[package]] +name = "mpmath" +version = "1.4.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c5/b0/6de8e78014ff1842a90cc9a56da6ccfb598a5390ed0257fcdb7d9680c18b/mpmath-1.4.1.tar.gz", hash = "sha256:efd6d1b75f09d69524a67609949812668b28e81ecbfe0ab449ced8c13e92642e", size = 2093211, upload-time = "2026-03-15T01:17:38.245Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/13/f2/abeec3db71d221ccd3cd89d206be1fabf5a3ee7178862f5fba23a59607e0/mpmath-1.4.1-py3-none-any.whl", hash = "sha256:dc4f0ea2304480d4a9a48a94c1020571558ade522b44a6912efac63a586e140f", size = 567787, upload-time = "2026-03-15T01:17:36.392Z" }, ] [[package]] @@ -2502,39 +2808,48 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/09/ed/559d2915dce85794bc0c36064043da170da50cd98746dcbddd85d5932017/nest_asyncio2-1.7.4-py3-none-any.whl", hash = "sha256:86e77b52c3d1496b294af3c944b44213b9b82a12a5ee590c0acc4ca4692ef6c7", size = 8543, upload-time = "2026-10-07T22:31:49.245Z" }, ] +[[package]] +name = "networkx" +version = "3.7" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/dc/76/3af777226b63a5e64a6b36b1ec5855c14e2b94a37096d4760e595fc43511/networkx-3.7.tar.gz", hash = "sha256:fd77a511bd90f39f3d016351345b52cf5319b813bdca01de3f755d3cca62e96a", size = 1866482, upload-time = "2026-09-21T16:45:16.974Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7e/cd/fe58041e9011f307c490e3e17dd48cc516448f7c698a3f2d9d9d65d7e6a8/networkx-3.7-py3-none-any.whl", hash = "sha256:e3fd2c13a7814cee3746340d8d7f8598a67f16a58bf47fb7f8793fab6efca1b0", size = 2142205, upload-time = "2026-09-21T16:45:14.609Z" }, +] + [[package]] name = "numba" -version = "0.68.1" +version = "0.68.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "llvmlite" }, { name = "numpy" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/0f/a4/a60b14d955b898ce00d815dfe14435ae3b30c1dd2587aa0a172e92310cf8/numba-0.68.1.tar.gz", hash = "sha256:9de461812470173a14eeb7e0bbd27c897dffe835402a33861166842fc5f6ea57", size = 2858572, upload-time = "2026-10-27T18:13:04.352Z" } +sdist = { url = "https://files.pythonhosted.org/packages/4e/cd/e8280f9ffa30fea9fabc5341223701231fcc5d53a31f51419d42d4bec3a6/numba-0.68.0.tar.gz", hash = "sha256:8a781de54b980b98f43bff7f1093701b5f07c80d031c7cfa8a87493d8bf73f2d", size = 2855363, upload-time = "2026-09-30T15:05:44.721Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d4/a7/2e54558d08bb64c8718ad398314605b6c73d154a593cf2bbf1360047fa4e/numba-0.68.1-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:7de5e5d00e6c8967fc861be2a015eb8ad701ab3cf65d7f4a2c4d950990cf65d3", size = 2762483, upload-time = "2026-10-27T18:12:24.865Z" }, - { url = "https://files.pythonhosted.org/packages/a5/4c/64fb7fe88e040e85a16e2c2924d36c0289529403de11e017e65d707d786c/numba-0.68.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fc764aa37deab88718de20151af0f53aa72d1c5cb3b54c6eb648473323f80a5c", size = 3602382, upload-time = "2026-10-27T18:12:26.361Z" }, - { url = "https://files.pythonhosted.org/packages/43/23/0813ab091f60403c33cb741392ae77db13324587748df6f52167bf3a2404/numba-0.68.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8b33fee239194b9b6cb9b176f3c2563b94e5882fd846748ad0cf960daeee5406", size = 3890001, upload-time = "2026-10-27T18:12:27.988Z" }, - { url = "https://files.pythonhosted.org/packages/e9/bb/c9b0129a57e82b97befeca60a53289359653eef33dd3bffd840898fa33aa/numba-0.68.1-cp312-cp312-win_amd64.whl", hash = "sha256:6d115039768cc2eb3cc99b32355ca507e1bbc653eca5492c83ab6399f218df27", size = 2832823, upload-time = "2026-10-27T18:12:29.726Z" }, - { url = "https://files.pythonhosted.org/packages/b3/2e/9f48e0a003ebb22a7ce7f54f18a67fc5df589c7db995c3b497bc23cb47e2/numba-0.68.1-cp312-cp312-win_arm64.whl", hash = "sha256:26064885ae0ffcd365e1801beacc524ac4a9bd306b7552749dcca42e0ef2fed3", size = 2814259, upload-time = "2026-10-27T18:12:31.321Z" }, - { url = "https://files.pythonhosted.org/packages/a0/55/e3e81201f42b9e04e397ab169bc4630b9e72c947f4b36d5dcb2e4c7fe6ba/numba-0.68.1-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:c9cc5e30f0ec71d1d6e706cd3f9f98218a0221ee8cf25bb2079bdc1a9c4ae65a", size = 2762336, upload-time = "2026-10-27T18:12:32.834Z" }, - { url = "https://files.pythonhosted.org/packages/34/ab/e33d11d6e13c017a7278291ed33281006f199ca489aa8f9c378a6f3bf310/numba-0.68.1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a4bdbff6ac4ea52a647c758e78403489a1b01a7ee9c2977c92f931c10802c078", size = 3562884, upload-time = "2026-10-27T18:12:34.499Z" }, - { url = "https://files.pythonhosted.org/packages/3a/69/21a7b7abc7327044be15b4f9258a10901ae339bb1d9fe354d662f16d466e/numba-0.68.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4d1b544f37fc237d16698a4266bb3d5b3c40ec8aa4c925a191ff09ec6d115310", size = 3850592, upload-time = "2026-10-27T18:12:36.289Z" }, - { url = "https://files.pythonhosted.org/packages/da/81/4eee3a003765c3116f3360f11b7d45e71bb6bfc09118b06bc34a3a5cb859/numba-0.68.1-cp313-cp313-win_amd64.whl", hash = "sha256:dc3f29d540be5fc60699dbac53fc04f246cbf503a4e2e8315f04b70fcd9f1ec7", size = 2832621, upload-time = "2026-10-27T18:12:37.993Z" }, - { url = "https://files.pythonhosted.org/packages/af/f3/97e267407250dd957a6e0ab72d2ebe3677f20528089b751cee2aefcdc96e/numba-0.68.1-cp313-cp313-win_arm64.whl", hash = "sha256:44f56e7c1e77d3380986f42e187ff13516aeac1f1771fe3826e65f003053d308", size = 2814027, upload-time = "2026-10-27T18:12:39.633Z" }, - { url = "https://files.pythonhosted.org/packages/1e/c4/f080d629b6d0daf66171b881b599ab51fa774aeecfdcdb22a6d3e4ea9a6e/numba-0.68.1-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:d372139235fcf11e3d81d1f145584e38c75a839b4d02f1f999cda1b134965eba", size = 2762528, upload-time = "2026-10-27T18:12:41.248Z" }, - { url = "https://files.pythonhosted.org/packages/a0/9e/fb5477c07d8f4e5c727aa9cd28ebb1419ff6866baad7d300a0403c1068f2/numba-0.68.1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dc54a2cb3ccd2ae30dbae56311bb397bbd1428d9cd8ccb82a70da3439360bb30", size = 3563534, upload-time = "2026-10-27T18:12:43.469Z" }, - { url = "https://files.pythonhosted.org/packages/59/1a/0e9a4cf86e470db73a27af634bc43219a475e258e8a66f2da173816543b5/numba-0.68.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b4d210701b32d1d4ffe26d5fc4e96c6b47e2c5d6c4c1a0f76dc48c156ef295ea", size = 3850743, upload-time = "2026-10-27T18:12:45.657Z" }, - { url = "https://files.pythonhosted.org/packages/99/bb/226377f6dce75072747fb94f3e4f1e544d448a8433178a7b98205676cf45/numba-0.68.1-cp314-cp314-win_amd64.whl", hash = "sha256:5d4bd6ff1923d0b32a2208eaf3e1940f4548a13fdba8bd1ee7893b8f4b8f55f8", size = 2834457, upload-time = "2026-10-27T18:12:47.419Z" }, - { url = "https://files.pythonhosted.org/packages/40/16/6a32095cc0a6f3b43bde46fc5c53ed0ad2b5f3267cffe40ae37d6c8fde82/numba-0.68.1-cp314-cp314-win_arm64.whl", hash = "sha256:9550e3f84ddca05d3cad1f2f780beed004a9b6c62fa12e995fb5bcb871d0cd6c", size = 2814272, upload-time = "2026-10-27T18:12:49.024Z" }, - { url = "https://files.pythonhosted.org/packages/ba/2e/8c5304e9cb9d391d9fc2428ce26f6c565c2a52076da00d8c37eb66c833ba/numba-0.68.1-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:c6f43dbbdcaac98a75a539b7c79ba490bd7265f24f454ac203de37bc5710ee71", size = 2765354, upload-time = "2026-10-27T18:12:50.777Z" }, - { url = "https://files.pythonhosted.org/packages/d4/c8/893430907c3933bcb713234152ebdefdb41951d508a5f646852ca040c20e/numba-0.68.1-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:10967c80d943d32fec1a28bad89b404c820778c5d472844661900399879cbe95", size = 3606698, upload-time = "2026-10-27T18:12:52.526Z" }, - { url = "https://files.pythonhosted.org/packages/11/85/b2e524942792a397daf6191ea8a660696b63b0842cc922ef9ff9d8b05ec9/numba-0.68.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:de5fbbd0bec5496dc0408bf1eeaad4ff64a2b1e3c66b4065e4c42523550ee3e1", size = 3889866, upload-time = "2026-10-27T18:12:54.305Z" }, - { url = "https://files.pythonhosted.org/packages/06/b5/4e1cc8045d866c0e990a3c4dd62c7614382d40a6ceb1878d0cb47618b1e0/numba-0.68.1-cp314-cp314t-win_amd64.whl", hash = "sha256:8b89ed029ec79d017af9101afd8f832b1f7eb1a366227a439437c17f38be6122", size = 2839987, upload-time = "2026-10-27T18:12:55.99Z" }, - { url = "https://files.pythonhosted.org/packages/a0/8f/f3588020608221594d9ce01c020493be30ec2f5da9709240c210ea6794a4/numba-0.68.1-cp315-cp315-macosx_12_0_arm64.whl", hash = "sha256:c8882360f6bf7c6ff59308dc0fe79508a613a6e92329d4064ddd3258462cef4d", size = 2762844, upload-time = "2026-10-27T18:12:57.598Z" }, - { url = "https://files.pythonhosted.org/packages/be/2e/222c3a9f0c919779c7a952edac1b1181d784612c96ce177dcd5a771a319a/numba-0.68.1-cp315-cp315-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f2170303a731542b5c16501a08b2b1cbb4596e5bb9ba6a661b65ed953e59b8a6", size = 3570103, upload-time = "2026-10-27T18:12:59.145Z" }, - { url = "https://files.pythonhosted.org/packages/2f/83/790215c294f99904634fa394ccb6407ac778e65aa10570cf891793a6bd2b/numba-0.68.1-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:674d9c19e591e4e706c85ed9c7129dfea02086096250cb957dbffb64ebf3dba4", size = 3855891, upload-time = "2026-10-27T18:13:01.146Z" }, - { url = "https://files.pythonhosted.org/packages/e6/1a/54f242debafba4187d62e79156fb02bb29311472808b9418367b0f437f29/numba-0.68.1-cp315-cp315-win_amd64.whl", hash = "sha256:bd238734c5bd4a7db5dd2e935d60dd9d485a5fa15b37396a2dd690b8b1d51742", size = 2833817, upload-time = "2026-10-27T18:13:02.834Z" }, + { url = "https://files.pythonhosted.org/packages/c5/cb/b6a39189f1f342baa04ad1055bb5f63ec4061ec1f80f6b34e90c68fe1e7f/numba-0.68.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:0fdaa2f0256862ebbcd9632ef01ba2a4b94e6d116029e5051a92340d4050a501", size = 2760509, upload-time = "2026-09-30T15:04:53.181Z" }, + { url = "https://files.pythonhosted.org/packages/af/4d/aa2cefeef784c5695790931938944f76ee66d3c7c640f62326f64642f1c6/numba-0.68.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e3ee1f49b62efbbb804f731f2bd602bd1f8b8d3cc13009f25d69955675f82407", size = 3600404, upload-time = "2026-09-30T15:04:55.11Z" }, + { url = "https://files.pythonhosted.org/packages/6f/40/2211b4ff48cccfb21d4c38fb56788d7a975189883efb8d549be9d51aba7d/numba-0.68.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:51fe913a70fe9a7a0b193757ff977a9e96c82ae936ae388aec8990814fffdf9d", size = 3888027, upload-time = "2026-09-30T15:04:57.698Z" }, + { url = "https://files.pythonhosted.org/packages/7e/2b/1b1f8b118cec28513665d8a53ff4f037d6c05720bd9e6f32f947c93c367f/numba-0.68.0-cp312-cp312-win_amd64.whl", hash = "sha256:530961dc7e41ee358eca2b828baf7b645ce6fa466d778bb9dc73855dd103c4f7", size = 2830891, upload-time = "2026-09-30T15:04:59.747Z" }, + { url = "https://files.pythonhosted.org/packages/97/0b/02626d27333ce1f67516a059e22d65f8f2309f227d3b828d2599183d5dc9/numba-0.68.0-cp312-cp312-win_arm64.whl", hash = "sha256:25aa7021e163701f9b3e8e77be81836a4b399500eef073d75bc906ad5eff46e9", size = 2812331, upload-time = "2026-09-30T15:05:01.802Z" }, + { url = "https://files.pythonhosted.org/packages/a2/4d/42754c94f8f909b9981fd44d28292a93bca6429d93f3e1ae58ac7de9b08b/numba-0.68.0-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:b8b29602f57df06c724fc53b1740887bc4332f202206771d46e47b25b485e904", size = 2760360, upload-time = "2026-09-30T15:05:04.386Z" }, + { url = "https://files.pythonhosted.org/packages/b3/1c/8bae32109a826a49666a9645012b98d6e09ad496932a877c97a2c39dde50/numba-0.68.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:df6f881c5695f472873d0979bab54261959b3174b6c98a71f6f8a43c3e088985", size = 3560908, upload-time = "2026-09-30T15:05:06.832Z" }, + { url = "https://files.pythonhosted.org/packages/aa/b1/0b504ae34d1b79a6482a0ffcbfd1b103dde02329c11525033e02633f7984/numba-0.68.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:be647fbc60c18c0323b34479f80173879654894eec58ad061f4b1901e294d854", size = 3848615, upload-time = "2026-09-30T15:05:08.976Z" }, + { url = "https://files.pythonhosted.org/packages/8d/a5/06d1dd4553dcc71a3a18defe9e6e26e3c011b566bc9060d4f6e4bca0e0ed/numba-0.68.0-cp313-cp313-win_amd64.whl", hash = "sha256:bf7435c81912e271a28a19c348ada5b3986e2409f95a067533c5f4aab8709295", size = 2830730, upload-time = "2026-09-30T15:05:11.232Z" }, + { url = "https://files.pythonhosted.org/packages/93/d8/6b01de5fa7b4c3866c0fb680833fd58b4fc48d1e7febb46e992f0b0f0e7b/numba-0.68.0-cp313-cp313-win_arm64.whl", hash = "sha256:50e3c81d8bf6956c7d7330a985bf1468efaa9e4c4539c9fa0ac6c7866ea6e369", size = 2812090, upload-time = "2026-09-30T15:05:13.455Z" }, + { url = "https://files.pythonhosted.org/packages/6e/71/a9031907dd0fba6cfce34004398a05f090b692be811dd1f38fdd874dd4e1/numba-0.68.0-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:bfc890c9ca517823dfae0444595ef50d883ade9d3e17759d9a7650e5d128d950", size = 2760551, upload-time = "2026-09-30T15:05:15.753Z" }, + { url = "https://files.pythonhosted.org/packages/74/70/c03aebc576ded2204e5bde9b86b215f0590a81261af333d4239b9f0aed0f/numba-0.68.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:34ccf54fd9c1d5f4ba00073b81bc492a681f5437c62917fe29813f457564e312", size = 3561561, upload-time = "2026-09-30T15:05:18.266Z" }, + { url = "https://files.pythonhosted.org/packages/3d/5f/2bd2fd4b99b0b5e76fea2f1fe149e05a7ec19a9a177758688bb82c7e3126/numba-0.68.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ea11c865265e39a6019e2f0fe62743825127b3b7bc4815916f5d5121fd9b262b", size = 3848766, upload-time = "2026-09-30T15:05:20.541Z" }, + { url = "https://files.pythonhosted.org/packages/0c/41/3e3528f3b0f9ffae69310d2e71f81ff74d272ee3b6c0600c4f4abaa31a80/numba-0.68.0-cp314-cp314-win_amd64.whl", hash = "sha256:9c03de7085f08ba11ab2444f252e822c14cee5fa02b73e84d5afd5e28b2bce0f", size = 2832584, upload-time = "2026-09-30T15:05:22.621Z" }, + { url = "https://files.pythonhosted.org/packages/8a/9d/1fe8be8f3a43d339222a4aed59be0b8f4920f10465d4606c0428250c63f7/numba-0.68.0-cp314-cp314-win_arm64.whl", hash = "sha256:f58c13a6e9bfef062311cb0d3c19f6c159b901213daa325e1db473946010cec7", size = 2812334, upload-time = "2026-09-30T15:05:24.848Z" }, + { url = "https://files.pythonhosted.org/packages/89/3b/e0e31617568553ca2b18bdf43844c44893dfb6620bde9a88296c257c5a81/numba-0.68.0-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:79160dc2a3ff0e02aaada2c385faa6de73d71a11f06419d29bb0a90042d243a3", size = 2763380, upload-time = "2026-09-30T15:05:27.064Z" }, + { url = "https://files.pythonhosted.org/packages/20/92/405b416800424b005c179c5b6417eee2aac1933839257ca50c855397774f/numba-0.68.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1a3aa5558ba1c316020a0c2f6042be6ae063cfc6eb0c7badb3a0c77d2b5308b7", size = 3604721, upload-time = "2026-09-30T15:05:29.164Z" }, + { url = "https://files.pythonhosted.org/packages/e1/52/fc100dc163e12ba6a8df4c4f6e34f55d24dc6e97095f935996406d8cc946/numba-0.68.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a08750c81fd5c2d9f2c169a73114efb907159401dde9ef4a3b629fa45e097cb7", size = 3887891, upload-time = "2026-09-30T15:05:31.234Z" }, + { url = "https://files.pythonhosted.org/packages/e1/e0/f2e074c5bf26f236c34075d390e77ed2a787c7350791b39b099b151e2033/numba-0.68.0-cp314-cp314t-win_amd64.whl", hash = "sha256:cad7d5f6fe8eb42a69c500d36c94a61d094f3b91a7a5581a31d1df2eb925d33a", size = 2838113, upload-time = "2026-09-30T15:05:33.274Z" }, + { url = "https://files.pythonhosted.org/packages/a5/85/d7cee7a6c65634bd25cb0109585785e5c8338f44db4b191c30291d9c7968/numba-0.68.0-cp315-cp315-macosx_12_0_arm64.whl", hash = "sha256:39f935bc854be87784675d9674f5503e56df5a501c95c95bdfb6b3c0b4b9ed1b", size = 2760868, upload-time = "2026-09-30T15:05:35.662Z" }, + { url = "https://files.pythonhosted.org/packages/d6/79/312e0cf6e835f700d42a223c1bd4a24b232892bded1ddf5e40bb3a329f55/numba-0.68.0-cp315-cp315-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7cec6809fe93824e243a8a8c93966b0bb5874a3b7c24c1194c3bafee0ab11f39", size = 3568127, upload-time = "2026-09-30T15:05:37.967Z" }, + { url = "https://files.pythonhosted.org/packages/5e/05/f31cd9e40f6d4ec6de38959e4736a917aa9d115fecc4a1979aceedcc083b/numba-0.68.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c1f1180e0332ad5143905288325485b52ac76102330811dc6f2c10088cf4cedc", size = 3853913, upload-time = "2026-09-30T15:05:40.247Z" }, + { url = "https://files.pythonhosted.org/packages/6c/28/059b2d1ea5616a5712fd722b2ec8e8278d14e4e4eb8845d36fe1658e6be8/numba-0.68.0-cp315-cp315-win_amd64.whl", hash = "sha256:a2d21bb9c4b4818a1e71721ebd19172f488591d548f08453593348b7048ba1fb", size = 2831865, upload-time = "2026-09-30T15:05:42.306Z" }, ] [[package]] @@ -2692,6 +3007,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/67/bd/6bf33ed31521c565931c037e9e81bac47c1acb000e850c6e24220e2a0c00/opentelemetry_semantic_conventions-0.66b2-py3-none-any.whl", hash = "sha256:4cbe61e5f9275d57ab31708446e7938ef4291ebbe6a7fca6f7a629c5acae87d8", size = 206280, upload-time = "2026-10-29T17:29:35.062Z" }, ] +[[package]] +name = "opt-einsum" +version = "3.4.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/8c/b9/2ac072041e899a52f20cf9510850ff58295003aa75525e58343591b0cbfb/opt_einsum-3.4.0.tar.gz", hash = "sha256:96ca72f1b886d148241348783498194c577fa30a8faac108586b14f1ba4473ac", size = 63004, upload-time = "2024-09-26T14:33:24.483Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/23/cd/066e86230ae37ed0be70aae89aabf03ca8d9f39c8aea0dec8029455b5540/opt_einsum-3.4.0-py3-none-any.whl", hash = "sha256:69bb92469f86a1565195ece4ac0323943e83477171b91d24c35afe028a90d7cd", size = 71932, upload-time = "2024-09-26T14:33:23.039Z" }, +] + [[package]] name = "packaging" version = "26.3" @@ -2884,13 +3208,36 @@ name = "pexpect" version = "4.9.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "ptyprocess" }, + { name = "ptyprocess", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/42/92/cc564bf6381ff43ce1f4d06852fc19a2f11d180f23dc32d9588bee2f149d/pexpect-4.9.0.tar.gz", hash = "sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f", size = 166450, upload-time = "2023-11-25T09:07:26.339Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/9e/c3/059298687310d527a58bb01f3b1965787ee3b40dce76752eda8b44e9a2c5/pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523", size = 63772, upload-time = "2023-11-25T06:56:14.81Z" }, ] +[[package]] +name = "pgmpy" +version = "1.1.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "huggingface-hub" }, + { name = "joblib" }, + { name = "networkx" }, + { name = "numpy" }, + { name = "opt-einsum" }, + { name = "pandas" }, + { name = "pyparsing" }, + { name = "scikit-base" }, + { name = "scikit-learn" }, + { name = "scipy" }, + { name = "statsmodels" }, + { name = "tqdm" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/72/9a/b94ccd1d6cbf2982937c26e54e887b47ee10f848ad53c4427965578a358d/pgmpy-1.1.2.tar.gz", hash = "sha256:a62a89352f139a5d459839e54e6bfa202a7d8749e6dc6d7ceec088a71529af45", size = 2183113, upload-time = "2026-04-30T11:34:49.538Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c6/5d/d03634ed296986abad834a69b0df21510cc9b6c40fb8afaed5df1c4b6074/pgmpy-1.1.2-py3-none-any.whl", hash = "sha256:e55c78763a4a45dd644a13b250cea86af0c7e08590cf35de489624f34a4d9a0b", size = 2446383, upload-time = "2026-04-30T11:34:47.189Z" }, +] + [[package]] name = "pillow" version = "13.0.0" @@ -2976,6 +3323,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7c/ae/ecbbbfd0e4343a6a521d49b3c8656fb4643dee2a4f6eaf941cf3280391a8/platformdirs-4.14.5-py3-none-any.whl", hash = "sha256:8e778c6fa421516f4d3369449f8df3b0e1b72c0e0005fe88e3ec772d0a14e750", size = 35402, upload-time = "2026-11-04T16:54:48.875Z" }, ] +[[package]] +name = "plotly" +version = "7.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "narwhals" }, + { name = "packaging" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/49/c3/72b369f5ed7701b04ab0ea3dcf83e9bbce71c0b3bc6f07f87568550d09ea/plotly-7.1.0.tar.gz", hash = "sha256:f860166a4a3d78c69cb1f4a15f28a5c8283eade98a282a698f3bb853a449ace5", size = 6689315, upload-time = "2026-09-15T19:21:21.75Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e5/7d/905a3a3d51087515719058c94cfbda2ff0fc14417c20d557ae3e82d8b250/plotly-7.1.0-py3-none-any.whl", hash = "sha256:dbb7fa18afce40d0a8e80d1bf162eceb3faa0ce5a77fe741ad09a74cf78f53f3", size = 9692368, upload-time = "2026-09-15T19:21:18.331Z" }, +] + [[package]] name = "pluggy" version = "1.6.0" @@ -3419,6 +3779,28 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" }, ] +[[package]] +name = "pymc" +version = "6.4.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "arviz" }, + { name = "better-optimize" }, + { name = "cachetools" }, + { name = "cloudpickle" }, + { name = "numpy" }, + { name = "pandas" }, + { name = "pytensor" }, + { name = "rich" }, + { name = "scipy" }, + { name = "threadpoolctl" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/44/5a/70267a0d8bdd83ca04b380774b496ed8ca7991b170be87af793e0beb5375/pymc-6.4.0.tar.gz", hash = "sha256:319348878ec698b6cc406320456b2bc00d80bea9bfb72b6ab02b2ce6b179e3b5", size = 566160, upload-time = "2026-11-01T16:52:44.606Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a6/9f/71ea589b6cab96142b078569f0d5ba6a27a99f39329a5f1d75c3149991ff/pymc-6.4.0-py3-none-any.whl", hash = "sha256:fa0dd3574b4465662f7aa70e8f1bd02dc2081e05a99ba65fb33c3f3614271f86", size = 619551, upload-time = "2026-11-01T16:52:42.948Z" }, +] + [[package]] name = "pymysql" version = "1.2.3" @@ -3490,6 +3872,38 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/57/5c/e788ad2f904c633520d9f283785e6177a66096b2efa356b46b4647a3240f/pyriemann-0.12-py2.py3-none-any.whl", hash = "sha256:74a90b2ef0938c94fe9bf90b6506991fc19da55850aae5fdf992026b3845d43a", size = 153585, upload-time = "2026-07-01T20:03:06.55Z" }, ] +[[package]] +name = "pytensor" +version = "3.3.8" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "filelock" }, + { name = "numba" }, + { name = "numpy" }, + { name = "scipy" }, + { name = "setuptools" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/7f/48/cf8d138faf9cd3fc86aa8e8df72ec585a0772864017cba9c0c92d8686541/pytensor-3.3.8.tar.gz", hash = "sha256:3e1737d99cdb185c8fa9e9011451ba3e765f685b2c77534f25eae2bad53a0b13", size = 5324067, upload-time = "2026-11-07T21:41:07.15Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/76/27/83b4564f75a7725accc0e1d8e29a5fe8a5cf3acce2d4d2a5e8ef57427438/pytensor-3.3.8-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:aff6bcb47859b665926d573c6e8463942b1aa0c182b6bfc81de8e06ddbb4d5eb", size = 1800107, upload-time = "2026-11-07T21:40:38.684Z" }, + { url = "https://files.pythonhosted.org/packages/ec/7f/e28df83a10724b6965bc652c36629b77849ec039fb5a96dde5a77f46a8a7/pytensor-3.3.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:63f2a02ec7cabbe696b2a4e3e10ee51f35d9f3f337698ead137326577a2ff6c3", size = 2340528, upload-time = "2026-11-07T21:40:40.639Z" }, + { url = "https://files.pythonhosted.org/packages/96/0b/5845e3f24a93e13cb0289230baaf90d1205879e674f3acacf6c849d310a9/pytensor-3.3.8-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:993010dc7d032a4f0d46acc04e7364c8a2c786871456cee9fd4f76466a6c8b1a", size = 2340860, upload-time = "2026-11-07T21:40:42.34Z" }, + { url = "https://files.pythonhosted.org/packages/fc/0e/a363971638b6bf22026688c9def023aed8579ffb0593efedcf60f6d5d951/pytensor-3.3.8-cp312-cp312-win_amd64.whl", hash = "sha256:7d5fc9ad2eacc2476da4d06be4f562d86c33df835abf86dd9eba59f6aa82713f", size = 1788603, upload-time = "2026-11-07T21:40:43.807Z" }, + { url = "https://files.pythonhosted.org/packages/95/ee/1c6630d94a841618cf2ba679faed4b870a3a618d1d74c314b9eda10ed879/pytensor-3.3.8-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1ecd6a05aaa5cec8ad93c50f4e1053f8a5dcf8567e95b5ba91a38d12168d9a63", size = 2006357, upload-time = "2026-11-07T21:40:45.534Z" }, + { url = "https://files.pythonhosted.org/packages/80/87/90ab24cccb5db4b471db314ad91a3180f312c8fd5a7e738f796fd6206426/pytensor-3.3.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:67313968d7df57330e22b14c9d128c9b33288ae23837e601c9f01df9847c53c0", size = 2544720, upload-time = "2026-11-07T21:40:47.305Z" }, + { url = "https://files.pythonhosted.org/packages/fa/26/d2cc1a1ed29c95e72ced96ae59a09f77bbada31337f5f0c3bc913ef094e1/pytensor-3.3.8-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e154ed2ff38c27668266c2343712036c4b5b80411809e85492a9d3268635b160", size = 2545836, upload-time = "2026-11-07T21:40:48.739Z" }, + { url = "https://files.pythonhosted.org/packages/f6/82/72e227973e196e28f8f15895528efbd1a74c0da64f121467ff21dedafe73/pytensor-3.3.8-cp313-cp313-win_amd64.whl", hash = "sha256:72424bdb44a4c15dda6d0a0828a673aa000463849329b761120d0eb1c9ce1f4d", size = 1996278, upload-time = "2026-11-07T21:40:50.388Z" }, + { url = "https://files.pythonhosted.org/packages/cc/72/5ade208b38d3980044158979fbf72c273f29d883aecafd5b54b4c705cbaa/pytensor-3.3.8-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:774f5b6413c47bc4371edc28b8fc5c0f209c653eb9289eb6efb4391d5b366f82", size = 2007282, upload-time = "2026-11-07T21:40:52.176Z" }, + { url = "https://files.pythonhosted.org/packages/41/37/a19c7325714af1a00b7142df47a58cb24015a86f0ad8c885717b23fb282c/pytensor-3.3.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e135d7b9a6281756df50639536cdff9f890a272f42046de03c086713826d6f90", size = 2539068, upload-time = "2026-11-07T21:40:53.929Z" }, + { url = "https://files.pythonhosted.org/packages/df/17/5c14e97b47676808d21edc288f54e01426e1effef8d4adcfc917afa3f3cc/pytensor-3.3.8-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:896ae3dd1501ea421ffd75d5272dc4d8aacdc2678992efe4ad8a6a25ff468d9b", size = 2539983, upload-time = "2026-11-07T21:40:55.804Z" }, + { url = "https://files.pythonhosted.org/packages/da/80/362f3baaf652225850ae39886d986d2c2a1ac66a9b99c60f68e9ac819321/pytensor-3.3.8-cp314-cp314-win_amd64.whl", hash = "sha256:4a3e229b3c9ae819f14295da9c33a92e8594f29ece7d1d6eae8d55818691b4c7", size = 1998997, upload-time = "2026-11-07T21:40:57.35Z" }, + { url = "https://files.pythonhosted.org/packages/38/f0/426e5a1edb67bfa1d3c5b2f1434c6677a0e9344d5f80db12f6e9a08367dd/pytensor-3.3.8-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:bff63300641d94dbc4020a0eb5779ee40aa2cd7966cc048fd46a0ef216505db2", size = 2013892, upload-time = "2026-11-07T21:40:59.088Z" }, + { url = "https://files.pythonhosted.org/packages/2c/d2/646a2aa237425a6deb18c749dd94b916a33ffe3a40d0a58d23df8b7d81e5/pytensor-3.3.8-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d25382f43a73c47a8697199053b238b1642c121e483f85fa89de2c6223715ae0", size = 2555864, upload-time = "2026-11-07T21:41:00.76Z" }, + { url = "https://files.pythonhosted.org/packages/e4/f0/d5524202c0cc5dd7035a9bffbed8c3083e8e24eee583d32beb595f3382ae/pytensor-3.3.8-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:64b4c0014871a584defc8fe7b9bc13195659534bb24987c42e8c815d091c5db4", size = 2550695, upload-time = "2026-11-07T21:41:02.303Z" }, + { url = "https://files.pythonhosted.org/packages/8e/3e/16f09be7b838825812af173c6df4778d0a529dc0ed4f9dd258f1c5bb47dd/pytensor-3.3.8-cp314-cp314t-win_amd64.whl", hash = "sha256:eeb7b21269458b8fbd377d4cf669c9405440d3ce52f00b3f951c8c0c810a225c", size = 2005121, upload-time = "2026-11-07T21:41:03.963Z" }, + { url = "https://files.pythonhosted.org/packages/27/a7/b887178832097dc8db829fe019b1a264cb6461acbd49a2786449fccc20cc/pytensor-3.3.8-py2.py3-none-any.whl", hash = "sha256:3438de92ecb706712fb4d2ef48580b4d705174f04f84ad1d52d07806d7f23662", size = 1682315, upload-time = "2026-11-07T21:41:05.447Z" }, +] + [[package]] name = "pytesseract" version = "0.3.13" @@ -3800,6 +4214,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a0/f4/c67b0b3f1b9245e8d266f0f112c500d50e5b4e83cb6f3b71b6528104182a/requests-2.34.2-py3-none-any.whl", hash = "sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0", size = 73075, upload-time = "2026-05-14T19:25:26.443Z" }, ] +[[package]] +name = "rich" +version = "15.0.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markdown-it-py" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680, upload-time = "2026-04-12T08:24:00.75Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" }, +] + [[package]] name = "rpds-py" version = "2026.9.1" @@ -3908,6 +4335,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b7/55/4b2fa381a583760aea5c92841e4e928a358e1c6511b129219e9c2826a226/rpds_py-2026.9.1-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:b242c27c8f836305a4a72df9cdd564386ac57b807bd252a063223331c9316b37", size = 346877, upload-time = "2026-10-04T16:32:34.061Z" }, ] +[[package]] +name = "scikit-base" +version = "1.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d9/e9/287707e71be93558076d873f92444fa788c1a11c259982a1967ad2071b0e/scikit_base-1.2.1.tar.gz", hash = "sha256:6cccfab1cf51e36141b731fe3248bd3c1a55361e965ddc7457be75ad8a9803eb", size = 136836, upload-time = "2026-11-08T20:24:26.859Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c1/b4/21adac81fbb522bdbb74c4809c7ea06fbde847a24c54b68dfed1519ff3dc/scikit_base-1.2.1-py3-none-any.whl", hash = "sha256:8695538dcf61c5439752b56baeca9d4ce52de012ddc4cee50ee67c910a9b5fb9", size = 163886, upload-time = "2026-11-08T20:24:25.324Z" }, +] + [[package]] name = "scikit-learn" version = "1.9.1" @@ -4044,6 +4480,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/83/11/00d3c3dfc25ad54e731d91449895a79e4bf2384dc3ac01809010ba88f6d5/seaborn-0.13.2-py3-none-any.whl", hash = "sha256:636f8336facf092165e27924f223d3c62ca560b1f2bb5dff7ab7fad265361987", size = 294914, upload-time = "2024-01-25T13:21:49.598Z" }, ] +[[package]] +name = "setuptools" +version = "84.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/70/b3/c19426f783614d625699a4b247faf628ea9ab1db228674491767b417f9e1/setuptools-84.2.1.tar.gz", hash = "sha256:3ff8b3b5492a0aa66960f4419365a86b84e013070d4313e4d4a6894f5d64d6bc", size = 1230289, upload-time = "2026-10-20T19:01:37.742Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/55/6dc6d6bb953bdfc52519a0059592c52b6e3b8ad51cf8256dffceb55b0610/setuptools-84.2.1-py3-none-any.whl", hash = "sha256:ca140b45d5325a9478f880e351484f62fef15f336462e449ca0c03c873d589c2", size = 876263, upload-time = "2026-10-20T19:01:35.678Z" }, +] + [[package]] name = "six" version = "1.17.0" @@ -4406,6 +4851,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ad/66/0d785f0bc5e4315a96c989bb476d0fc07ea4f85132550c7b156ca2035d52/traitlets-5.16.1-py3-none-any.whl", hash = "sha256:f775618166caa0396c8e337099240f2bd3e5e917d203b2e6fbe21a58d3cb1f6b", size = 86211, upload-time = "2026-08-03T08:32:34.48Z" }, ] +[[package]] +name = "truststore" +version = "0.10.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/9f/c5201d42a484c061e528825fc8e2d565f5abd50a4ced6fb7d29c4ec99b2b/truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd", size = 28091, upload-time = "2026-10-12T22:27:31.808Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/51/e9/3a7820be2bb0fe53b6bc9c3be26d3d1158004e4c3ab953aa6840b955b1e9/truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c", size = 19017, upload-time = "2026-10-12T22:27:30.377Z" }, +] + [[package]] name = "typeguard" version = "4.6.0" @@ -4585,7 +5039,7 @@ dependencies = [ { name = "flask" }, { name = "flask-cors" }, { name = "gunicorn" }, - { name = "models", extra = ["notebooks"] }, + { name = "models", extra = ["notebooks", "seer-survival", "survival-curves"] }, { name = "openpyxl" }, { name = "pandas" }, { name = "pdfplumber" }, @@ -4608,7 +5062,7 @@ requires-dist = [ { name = "flask", specifier = ">=3.0" }, { name = "flask-cors", specifier = ">=4.0" }, { name = "gunicorn", specifier = ">=23.0" }, - { name = "models", extras = ["notebooks"], editable = "../ISSSTELEON/models" }, + { name = "models", extras = ["notebooks", "survival-curves", "seer-survival"], editable = "../ISSSTELEON/models" }, { name = "openpyxl", specifier = ">=3.1" }, { name = "pandas", specifier = ">=2.0" }, { name = "pdfplumber", specifier = ">=0.11" }, @@ -4729,6 +5183,34 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/77/8b/1ea57b936b70f98e8e7620a352578096d778dbee95b262f73c066d210ffb/wrapt-2.5.2-py3-none-any.whl", hash = "sha256:61eb54e9540ea522c2c4752a57549a83d3c67e6704ed708403d28e067aaf90f0", size = 82025, upload-time = "2026-10-29T23:06:38.56Z" }, ] +[[package]] +name = "xarray" +version = "2026.9.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "numpy" }, + { name = "packaging" }, + { name = "pandas" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ff/f5/781c70b234f54e0401f4f7c4427a7486da38d50dbb138c7d7c55144b3d86/xarray-2026.9.0.tar.gz", hash = "sha256:6abc69694c22fa1f0fb2f357ff4e41d88beb4477ed71091f944b7dbf67ed54fe", size = 3176922, upload-time = "2026-09-29T23:06:25.807Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3f/44/3159af4fb3c868970a412e294320ed6bb1a9fbdfa6431050eda8e0b34b6e/xarray-2026.9.0-py3-none-any.whl", hash = "sha256:fe349fa871628b1a0a5217af3fe1283a2862d5485156e6eda354fffb81c3bb7c", size = 1445445, upload-time = "2026-09-29T23:06:23.686Z" }, +] + +[[package]] +name = "xarray-einstats" +version = "0.11.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "numpy" }, + { name = "scipy" }, + { name = "xarray" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/6f/70/adb14007ee636eadd2a404802f7bb340c6f123ea81cfca152ebd4b6e2660/xarray_einstats-0.11.0.tar.gz", hash = "sha256:69f48a60f62151d40c49fd6d9a6dc0b970aecef2813a33209e4dcde897fca48b", size = 34290, upload-time = "2026-07-20T15:32:38.448Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/30/7b/34a9ce89f7a1e78423ca5a66492341c4f7daf6d0e9668af427fc2a7bc099/xarray_einstats-0.11.0-py3-none-any.whl", hash = "sha256:9dc8372aeb5db233054ddde4e57cbbcd1eee6c2e1b6bbe85863881c09b4421b3", size = 39828, upload-time = "2026-07-20T15:32:37.169Z" }, +] + [[package]] name = "yarl" version = "1.25.1" -- 2.53.0 From 312e232978bd1fe977d50592e845617716a3ffe3 Mon Sep 17 00:00:00 2001 From: edgar Date: Sun, 22 Nov 2026 09:34:20 -0600 Subject: [PATCH 5/5] CaCu: the KPNC-like hospital with the route, deaths and a few cancer cases `con_cancer` takes the histories it adds to (`base`), so `--generador kpnc` goes through it like the simple generator: each woman gets her route notes (valuation, colposcopy and treatment, which dbt reads colposcopies and treatments from), some a death date, and 1 % more women are cancer cases with an invasive biopsy, for the survival model. A biopsy is requested at least a day after its cytology's report, so the valuation visit fits between them. --- src/dev_data/cacu/cancer.py | 14 +++++++++----- src/dev_data/cacu/kpnc.py | 6 ++++-- src/dev_data/cacu/proyecto.py | 5 ++++- tests/test_cacu_kpnc.py | 11 +++++++++++ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/dev_data/cacu/cancer.py b/src/dev_data/cacu/cancer.py index 0bf23d2..0285481 100644 --- a/src/dev_data/cacu/cancer.py +++ b/src/dev_data/cacu/cancer.py @@ -9,6 +9,7 @@ que lo que ya se generaba sigue igual (S-D19). Las proporciones son arbitrarias: tenga qué contar, no para interpretar nada. """ +from collections.abc import Callable from dataclasses import replace from datetime import date, timedelta @@ -121,17 +122,20 @@ def con_defuncion(h: Historia, azar: Azar, proporcion: float, *, temprana: bool return replace(h, defuncion=fecha) -def con_cancer(n: int, azar: Azar, *, proporcion_cancer: float = PROPORCION_CANCER) -> list[Historia]: - """Las `n` mujeres de `historias`, con su defunción si la tienen, y los casos de cáncer que se les agregan. +def con_cancer(n: int, azar: Azar, *, proporcion_cancer: float = PROPORCION_CANCER, + base: Callable[[int, Azar], list[Historia]] = historias) -> list[Historia]: + """Las `n` mujeres de `base` (`historias`, o el hospital tipo KPNC), con su ruta y su defunción si la tienen, y + los casos de cáncer que se les agregan. Los casos van a continuación, con las claves `CACU-9001` en adelante: no dependen de `n`, así que la historia de - cada mujer, la de siempre o un caso, es la misma pidan las que se pidan. + cada mujer, la de siempre o un caso, es la misma pidan las que se pidan. Las claves de `historias` tienen cuatro + cifras, así que con ellas `n` debe quedar debajo de los casos; las del hospital tipo KPNC tienen cinco y no chocan. """ - if n >= CLAVE_DE_LOS_CASOS: + if base is historias and n >= CLAVE_DE_LOS_CASOS: raise ValueError(f"`n` ({n}) debe ser menor que {CLAVE_DE_LOS_CASOS}, donde empieza la numeración de los casos") mujeres = [ con_defuncion(con_ruta(h, azar.derivar(f"ruta:{h.clave}")), azar.derivar(f"defuncion:{h.clave}"), PROPORCION_DEFUNCION) - for h in historias(n, azar) + for h in base(n, azar) ] casos = max(1, round(n * proporcion_cancer)) if n > 0 and proporcion_cancer > 0 else 0 for i in range(1, casos + 1): diff --git a/src/dev_data/cacu/kpnc.py b/src/dev_data/cacu/kpnc.py index e3e667b..99189da 100644 --- a/src/dev_data/cacu/kpnc.py +++ b/src/dev_data/cacu/kpnc.py @@ -19,7 +19,8 @@ import pandas as pd from dev_data.azar import Azar from dev_data.cacu.historias import ( - BIOPSIA_DESDE, BIOPSIA_HASTA, REPORTE_DESDE, REPORTE_HASTA, Biopsia, Citologia, Historia, _hace_anios, _notas, + BIOPSIA_DESDE, BIOPSIA_HASTA, REPORTE_DESDE, REPORTE_HASTA, SOLICITUD_DESDE, Biopsia, Citologia, Historia, + _hace_anios, _notas, ) from dev_data.catalogos import SATISFACTORIO @@ -58,7 +59,8 @@ def _historia(clave: str, visitas: pd.DataFrame, ingreso: float, origen: date, a citologias.append(Citologia(fecha, SATISFACTORIO, reporte, ESCAMOSAS[v.citologia], VPH[v.vph], glandulares="AGC" if v.citologia == "AGC" else None)) elif isinstance(v.histologia, str) and citologias: - solicitud = max(fecha, citologias[-1].fecha_reporte) + # al menos un día después del reporte de la citología: la cita de valoración cae entre los dos (`ruta`) + solicitud = max(fecha, citologias[-1].fecha_reporte + timedelta(days=SOLICITUD_DESDE)) reporte = solicitud + timedelta(days=a.derivar("reporte").entero(BIOPSIA_DESDE, BIOPSIA_HASTA)) if reporte > referencia: biopsias.append(Biopsia(len(citologias) - 1, solicitud, None, None)) diff --git a/src/dev_data/cacu/proyecto.py b/src/dev_data/cacu/proyecto.py index 8aacb99..2ecc802 100644 --- a/src/dev_data/cacu/proyecto.py +++ b/src/dev_data/cacu/proyecto.py @@ -11,6 +11,9 @@ from dev_data.proyecto import OpcionInvalida, Proyecto # Quién genera las historias (`poblar cacu --generador`): las proporciones fijas, o el hospital tipo KPNC de # bayes-pim (`dev_data.cacu.kpnc`, con el extra `kpnc`). GENERADORES = ("simple", "kpnc") +# Los casos de cáncer (con su biopsia invasora y, a veces, su defunción) que se agregan al hospital tipo KPNC, para +# la supervivencia: pocos, para no desplazar al cáncer que el propio hospital tipo KPNC produce. +PROPORCION_CANCER_KPNC = 0.01 def _generar(n: int, azar: Azar, generador: str | None = None) -> dict[str, list]: @@ -19,7 +22,7 @@ def _generar(n: int, azar: Azar, generador: str | None = None) -> dict[str, list if generador == "kpnc": from dev_data.cacu.kpnc import historias_kpnc # trae bayes-pim: solo cuando se pide - return a_filas(historias_kpnc(n, azar)) + return a_filas(con_cancer(n, azar, proporcion_cancer=PROPORCION_CANCER_KPNC, base=historias_kpnc)) raise OpcionInvalida(f"cacu no tiene el generador {generador!r}; tiene: {', '.join(GENERADORES)}") diff --git a/tests/test_cacu_kpnc.py b/tests/test_cacu_kpnc.py index 7d72513..9a64040 100644 --- a/tests/test_cacu_kpnc.py +++ b/tests/test_cacu_kpnc.py @@ -62,3 +62,14 @@ def test_the_project_offers_it_as_its_generator_option(): assert set(filas) == set(CACU.modelos) and filas["pacientes"] with pytest.raises(OpcionInvalida): CACU.generar(100, Azar(7, REFERENCIA), generador="otro") + + +def test_the_option_adds_the_route_deaths_and_cancer_cases_to_the_kpnc_women(): + """Fija: `--generador kpnc` pasa por `con_cancer` como el generador simple: las notas de la ruta (con las que dbt + reconoce colposcopías), defunciones y un 1 % de casos de cáncer con biopsia invasora. Falla si el hospital tipo + KPNC vuelve a salir sin ruta, que deja vacías las cohortes poscolposcopía y de supervivencia.""" + filas = CACU.generar(1000, Azar(7, REFERENCIA), generador="kpnc") + casos = [p for p in filas["pacientes"] if len(p.pac_id_hospital) == len("CACU-9001")] + assert len(casos) == 10 and any(p.pac_fecha_defuncion for p in filas["pacientes"]) + assert "CARCINOMA" in {b.bx_cin_grado for b in filas["biopsias"]} + assert "MEDICINA FAMILIAR" in {n.nm_especialidad for n in filas["notas"]} -- 2.53.0