Catálogo sin los indicadores marcados como ocultos
listar_indicadores salta las definiciones con extension.publicacion.oculto (indicadores_kit, feature/ulises); su id sigue respondiendo en datos, metadatos y figuras. Provisional para TEA: K01, K08, M04 y M15 no se muestran; quedan 16 con M21 y M22. Pruebas: 145 passed; test_app.py::test_predict_not_implemented da error en Windows (archivo temporal en uso), igual que antes del cambio. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-2
@@ -9,7 +9,7 @@ PERIODOS = ",".join(fixtures.PERIODOS)
|
|||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def client(tmp_path_factory):
|
def client(tmp_path_factory):
|
||||||
"""Una base de TEA temporal, con los 18 indicadores calculados, por `TEA_DATABASE_URL`."""
|
"""Una base de TEA temporal, con los 20 indicadores calculados (16 en el catálogo), por `TEA_DATABASE_URL`."""
|
||||||
# Dentro de la fixture: la configuración de Persistance se lee al importarla,
|
# Dentro de la fixture: la configuración de Persistance se lee al importarla,
|
||||||
# y test_app.py debe alcanzar a fijar CACU_DATABASE_URL antes.
|
# y test_app.py debe alcanzar a fijar CACU_DATABASE_URL antes.
|
||||||
from persistance.db import get_tea_engine
|
from persistance.db import get_tea_engine
|
||||||
@@ -42,7 +42,8 @@ def test_listar_indicadores(client):
|
|||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
lista = response.get_json()
|
lista = response.get_json()
|
||||||
assert [fila["id"] for fila in lista] == sorted(DEFINICIONES)
|
visibles = [id_ for id_, medida in DEFINICIONES.items() if not medida.extension.publicacion.oculto]
|
||||||
|
assert [fila["id"] for fila in lista] == sorted(visibles)
|
||||||
for fila in lista:
|
for fila in lista:
|
||||||
medida = DEFINICIONES[fila["id"]]
|
medida = DEFINICIONES[fila["id"]]
|
||||||
assert fila["titulo"] == medida.title
|
assert fila["titulo"] == medida.title
|
||||||
@@ -50,6 +51,17 @@ def test_listar_indicadores(client):
|
|||||||
assert fila["figuras"] == figuras_de(medida)
|
assert fila["figuras"] == figuras_de(medida)
|
||||||
|
|
||||||
|
|
||||||
|
def test_los_ocultos_no_salen_en_el_catalogo_pero_responden(client):
|
||||||
|
"""Provisional (oct 2026): K01, K08, M04 y M15 no se muestran; quedan 16 en el catálogo."""
|
||||||
|
ocultos = {"K01_evaluacion_3_meses", "K08_eeg_sueno", "M04_dias_entrevista_ados2", "M15_grado_hipoacusia"}
|
||||||
|
ids = {fila["id"] for fila in client.get("/tea/indicadores").get_json()}
|
||||||
|
|
||||||
|
assert len(ids) == 16
|
||||||
|
assert not ids & ocultos
|
||||||
|
assert {"M21_diagnosticados_con_eeg", "M22_diagnosticados_sin_eeg"} <= ids
|
||||||
|
assert client.get("/tea/indicadores/K01_evaluacion_3_meses/metadatos").status_code == 200
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("indicador", sorted(DEFINICIONES))
|
@pytest.mark.parametrize("indicador", sorted(DEFINICIONES))
|
||||||
def test_figura_de_cada_indicador(client, indicador):
|
def test_figura_de_cada_indicador(client, indicador):
|
||||||
for figura in figuras_de(DEFINICIONES[indicador]):
|
for figura in figuras_de(DEFINICIONES[indicador]):
|
||||||
|
|||||||
@@ -91,7 +91,12 @@ def registrar_indicadores(
|
|||||||
tablas = tablas_de(proyecto)
|
tablas = tablas_de(proyecto)
|
||||||
|
|
||||||
def listar_indicadores():
|
def listar_indicadores():
|
||||||
return _json([resumen_de(id_, medida) for id_, medida in definiciones.items()])
|
# Los marcados `oculto` en su TOML no salen en el catálogo; su id sigue respondiendo.
|
||||||
|
return _json([
|
||||||
|
resumen_de(id_, medida)
|
||||||
|
for id_, medida in definiciones.items()
|
||||||
|
if not medida.extension.publicacion.oculto
|
||||||
|
])
|
||||||
|
|
||||||
def _periodos_o_los_que_haya(sesion: Session, medida: Measure, periodos: list[str]) -> list[str]:
|
def _periodos_o_los_que_haya(sesion: Session, medida: Measure, periodos: list[str]) -> list[str]:
|
||||||
"""Los pedidos; sin pedir ninguno, los que tienen reporte del primer tipo que publica."""
|
"""Los pedidos; sin pedir ninguno, los que tienen reporte del primer tipo que publica."""
|
||||||
|
|||||||
Reference in New Issue
Block a user