8.9 KiB
Demo: hospital data → ingestion UI → indicators dashboard
End-to-end walkthrough on the shared dev server: pull the team's simulated
hospital data through the Conectar datos ingestion UI (which calls
WebApi's /imports/* endpoints), compute the indicators with the team's own
Orquestacion pipeline, and explore them in the team's own Dashboard de
indicadores.
Verified end to end for CaCu on 2026-10-23. TEA and CaMa follow the same steps (see §6); they were ingested and computed by script earlier, but not yet clicked through this UI flow.
1. What is running
| Piece | Where |
|---|---|
| WebApp (ingestion UI + dashboard) | http://10.0.10.41:9541 |
| WebApi | http://10.0.10.41:9540 (the WebApp proxies to it, no need to open it) |
Simulated hospital MySQL (team's dev-data-prueba stack) |
container hospital, port 3306, reachable only from inside Docker |
| Our databases | SQLite files in the issteleon-staging_webapi_data volume, under /data/demo/ |
Compose project issteleon-staging, checkout at
/srv/shared-notebooks/ISSSTELEON-wt/staging, configured by its .env
(ports, hospital network, database URLs). It is isolated from the team's own
environments. It only joins their dev-data-prueba_default network to read
the hospital mirror.
You need network access to 10.0.10.41 (VPN) and SSH as admon for §4.
2. Before the demo: start from empty databases (optional)
The current /data/demo/ databases already hold the CaCu import from the
verification run. To show ingestion from zero, point the stack at a new,
empty directory. Nothing is deleted:
ssh admon@10.0.10.41
cd /srv/shared-notebooks/ISSSTELEON-wt/staging
sed -i 's#/data/demo/#/data/demo2/#g' .env # pick any new directory name
docker compose -p issteleon-staging up -d webapi # migrations run on startup
The entrypoint creates the directory and runs every Alembic migration (CaCu, CaMa, TEA, governance) before gunicorn starts.
Browser tip: if a password manager is installed, dismiss its autofill popup on the connection form and don't save the password. Its overlay can block the page.
3. Ingest CaCu through the UI
-
Open http://10.0.10.41:9541 → Cargar información.
-
Pick the CaCu domain toggle (top left).
-
Conectar una base de datos → MySQL, then:
- Servidor
hospital, Puerto3306 - Base de datos
hospital_cacu - Usuario
hospital, Contraseñahospital(disposable mirror account) - Probar conexión shows "Conexión correcta (mysql)" → Conectar.
Talking point: the dialog states the connection is read-only and only allows
SELECT. The backend enforces this (SqlSourcePolicy: one SELECT statement, never the app's own databases), not just the UI. - Servidor
-
The connection lists 4 tables. For each one, click its → arrow, check the destination and click Crear flujo:
Source table Destination Rows pacientePaciente 300 citologiacervicalCitologiaCervical 442 biopsiacervicalBiopsiaCervical 7 notamedicaNotaMedica 221 The destination is pre-selected ("Sugerida") and the column mapping is filled automatically (6/6, 19/19, 10/10, 26/26 fields). Open a flow's Mapeo tab to show how source columns line up with target fields, and Datos to preview real rows.
-
Validar todo: every flow turns Válido, 0 errors. Validation runs the same schema checks the commit will (types, catalogs, required fields).
-
Cargar a la base opens a summary: 970 valid rows in 4 flows, "en una sola transacción: si algo falla en la base, no se escribe nada".
- Omitirlo (default): an existing record is reported as a conflict.
- Actualizarlo: upsert on the natural key shown under each destination
(e.g.
pac_id_hospital,pac_id_hospital + ord_numero_hospital).
Click Cargar 970 filas → "Carga completa: 970 insertadas, 0 actualizadas, 0 omitidas."
-
Explorar la base shows the rows now stored, per table.
Talking points:
- Parents are written before children, and each child's patient FK is
resolved from
pac_id_hospitalwithin the same transaction. After the load, all 442 citologías, 7 biopsias and 221 notes are linked to a patient. - Running the same load again with Actualizarlo updates instead of duplicating.
- Switching engines (MySQL, MariaDB, PostgreSQL, SQL Server) only changes
*_DATABASE_URL. The same SQL connector reads from any of them.
4. Compute the indicators (team's Orquestacion pipeline)
The team's design (MD-16) keeps the kit itself calculation-only, and the orchestration graph does the writes. It runs inside the WebApi container:
ssh admon@10.0.10.41
docker exec -w /app/Orquestacion issteleon-staging-webapi-1 \
uv run --no-sync python -m orquestacion ciclo cacu --desde 2024 --hasta 2026 --permitir-sin-definir
Expected (about 30 s): migrar → cargar (442) → cargar_resultados (879) → vistas (12) → registro → definiciones (9) → calcular (9) → observar (300) → verificar_vinculos → cohortes (1). That gives 9 CaCu indicators and the
cacu/cohorte_vigilancia cohort. python -m orquestacion grafo cacu prints
the graph as Mermaid, which is useful for explaining the architecture.
The data spans 2024-01 to 2026-01, hence --desde 2024 --hasta 2026.
5. Explore the dashboard
Open http://10.0.10.41:9541/indicadores/cacu (or Indicadores on the home page → CaCu).
What you should see with the CaCu data above:
- Indicadores destacados (latest visible period, 2025-S2):
- Pacientes evaluadas: 112 pacientes. Cross-check: 112 distinct patients have a citología taken in 2025-S2.
- Tasa de confirmación histopatológica: 1.8 % (2 of 112).
- Tiempo de tamizaje a diagnóstico: 57 días (mediana), Q1–Q3 37.5–109.5.
- Indicadores gráficos, 6 published indicators: confirmation rate per semester with confidence intervals, distribution of cytology results (LIEBG, ASC-H, LIEAG, carcinoma in situ, "Sin dato"…), screening-to-diagnosis box plot, cytology turnaround time, patients with abnormal cytology, and biopsy results.
- "Distribución de resultados de biopsia" shows "No hay valores visibles". This is expected: only 7 biopsies, below the kit's small-cell suppression threshold. It is privacy protection working, not a bug.
- Try Filtros generales (granularity semester/month, mode), the "Cómo leer" help, the chart-type selector ("Representación gráfica") and "Fijar indicador".
The dashboard, the figures (Plotly JSON generated server-side by
indicadores_kit.serving.figuras) and the /{domain}/indicadores/* routes
are the team's own code from dev. We only wired them into our shell.
6. TEA and CaMa
Same steps, other database and toggle:
| Domain | Toggle | Base de datos | Pipeline |
|---|---|---|---|
| TEA | TEA | hospital (10 tables) |
ciclo tea --desde 2024 --hasta 2026 --permitir-sin-definir |
| CaMa | CaMa | hospital_cama |
ciclo cama --desde 2024 --hasta 2026 --permitir-sin-definir |
TEA specifics: the patient flow must include pac_id → pac_id (the
destination now shows "8 campos · clave pac_id"). Every other TEA table
references the patient by that source id. Load pacientes in the same batch
as, or before, the rest.
Earlier scripted runs against the same hospital data produced 23 TEA
indicators (5 published) and 8 CaMa. In CaMa, the kit's own
verificar_vinculos reports every biopsia_resultado as otra_paciente.
That is a linkage issue in the seed data to raise with Edgar's team, not an
ingestion error.
7. What makes it production-ready (summary for Q&A)
- Read-only, policy-checked SQL sources: single
SELECTonly; the app's own databases are refused; credentials are never stored. - Atomic batches: a whole multi-table load is one transaction.
- Validation before writing: same schemas at preview and commit;
catalog values (e.g. Bethesda, BI-RADS incl.
B4A/B4B/B4C) are normalized or rejected with a reason. - Idempotent re-imports: natural keys per table and an explicit skip/update choice.
- Cross-source linking and merging: FKs resolved from hospital ids; "combinar duplicados" fills one record from several sources (CSV, SQL, scanned PDFs via OCR/NLP, EDF files).
- Database-agnostic: SQLite, MySQL/MariaDB, PostgreSQL, SQL Server by connection string. Migrations are verified on SQLite and MySQL 8.
- Deployment: migrations on startup, gunicorn with long timeouts for OCR,
Orquestacionwith MySQL/PostgreSQL drivers in the image,index.htmlservedno-cacheso a redeploy reaches users immediately.
8. Known limits (say them before someone asks)
- Computing indicators is a CLI step (§4); there is no button in the UI yet.
- No login yet (Módulo-00); the SQL connection credentials travel with each request from the browser.
- SQL connections live in the browser tab only: reloading the page means connecting again.