|
|
|
@@ -293,3 +293,46 @@ Proposals that come up while doing a task and aren't resolved inside it. Each on
|
|
|
|
|
from the indicator catalog and the gold YAML; one Hamilton node per indicator reads that declaration,
|
|
|
|
|
as a MetricFlow `ratio` metric would.
|
|
|
|
|
- **Issue:** #162
|
|
|
|
|
|
|
|
|
|
## G-GEN-1. Source terminology as catalog tables, editable from the UI
|
|
|
|
|
- **Where:** `Core/core/catalogos/<dominio>.toml` (`codigos_hospital`, `etiquetas_fuente`, `alias`), the silver
|
|
|
|
|
load's enum maps, `WebApi/webapi/orchestration/reference/source_mapping.py` (the mapping's rules) and
|
|
|
|
|
`observacion_clinica.valor_fuente`.
|
|
|
|
|
- **What happens:** how a lab provider or a medical-record header writes our codes lives in the catalog's TOML
|
|
|
|
|
and in code. A provider change (new captions, spellings or test codes) needs a commit, a release and a deploy,
|
|
|
|
|
and a deploy would overwrite any change made outside git.
|
|
|
|
|
- **What it conflicts with:** rule 4 (two new tables); rule 2 (versioning has to work on every engine, so SQL
|
|
|
|
|
Server's temporal tables can only be an add-on).
|
|
|
|
|
- **Proposal:**
|
|
|
|
|
1. Our codes (`cat_estudio`, `cat_resultado`, `cat_valor`) stay in the TOML, reviewed in git.
|
|
|
|
|
2. How each source writes them moves to two tables, the database being their system of record:
|
|
|
|
|
`cat_sistema_fuente` (who sends the data, by `fuente_tabla` and validity dates) and `cat_mapeo` (FHIR's
|
|
|
|
|
ConceptMap: `clase` estudio, etiqueta or valor; the form and its normalized form; target; validity;
|
|
|
|
|
`registrado_por`, `registrado_en`, `motivo`). Append-only; a deploy only inserts missing seed rows.
|
|
|
|
|
3. The mapping is a partial, non-injective function `(system, resultado_id, normalized form, date) -> valor_id`
|
|
|
|
|
into `cat_valor`. `source_mapping.check_function` already enforces it on the TOML; the UI and the API
|
|
|
|
|
apply it on every save. `source_mapping.resolve` is the remap's rule: no mapping or two disagreeing
|
|
|
|
|
mappings give no code, and the observation goes back to the out-of-catalog queue.
|
|
|
|
|
4. A remap step on every cycle and on demand rewrites only `valor_id` where the code changes, under a
|
|
|
|
|
`carga` of its own (`conocida_en` keeps reports cut before it reproducible). A new caption or study code
|
|
|
|
|
needs a re-extraction or a reload instead.
|
|
|
|
|
5. A queue screen (source text with no code), a mappings screen per system, a curator role, and a
|
|
|
|
|
`ConceptMap` endpoint.
|
|
|
|
|
6. Versioning: validity dates in the table (what the pipeline reads, every engine); in production SQL Server,
|
|
|
|
|
system-versioned temporal tables on both tables for the edit audit, a SQL Server-only revision that's a
|
|
|
|
|
no-op elsewhere.
|
|
|
|
|
- **Open questions:** where a report records the mappings it used (`toml_sha`, `huella` or `parametros`);
|
|
|
|
|
mappings per system only or also global; whether the temporal tables are in scope now.
|
|
|
|
|
- **Evidence:** draft and SQLite demo in `mock/borradores/catalogo-mapeo/` (`PROPUESTA.md`, `01_tablas.sql`,
|
|
|
|
|
`02_demo.py`): seeding from the TOML changes 0 stored observations; a new lab's 5 unmapped spellings land in
|
|
|
|
|
the queue and, once mapped and remapped, reach dbt's timeline, the stratifiers and the invasive-cancer event
|
|
|
|
|
unchanged.
|
|
|
|
|
- **Found in:** #163 (CaMa values read from reports), 2026-11-13.
|
|
|
|
|
- **Status:** approved by the owner on 2026-11-13 and implemented on `feature/163-source-terminology` (every
|
|
|
|
|
repository rebased on `dev`): ISSSTELEON `66c4ba5` (Core tables), `74eb5a4` (a revision per domain),
|
|
|
|
|
`14dff24` (`SourceMappingRepository`), `d6e2c68` (dbt's `vigencias_sin_traslape` on `cat_mapeo`),
|
|
|
|
|
`72d092d` (pointers); WebApi `64d3d72` (`source_mapping`: `check_function`, `resolve`), `73cbf0c` (seeding in
|
|
|
|
|
the `catalogs` step, `register` checking the function on write). Layers 1 (write check), 2 (`UNIQUE` and
|
|
|
|
|
check constraints) and 3 (dbt test) are in; pandera is left for a bulk import of mappings. Still open: loads
|
|
|
|
|
read the TOML's aliases, not `cat_mapeo`; the remap step; the UI screens; the `ConceptMap` endpoint;
|
|
|
|
|
migrations verified on SQLite only.
|
|
|
|
|