Files
ISSSTELEON/Transformation/models/_silver.yml
T
rockdrigo d6e2c68dbf dbt: silver's source mappings declared, and a test that no form maps to two targets while both are in force
How: `cat_sistema_fuente` and `cat_mapeo` are silver sources in every domain; the generic test
`vigencias_sin_traslape` self-joins the rows of the same form (compared null-safe) and fails on each pair
with a different target and overlapping validity, in portable SQL (`date_literal` for the open end). Its
arguments stay at the test's top level, which dbt-core 1.7 (the MySQL group) reads.

Implications: a mapping written past the application's check (by hand, by a script, by a restore) shows up
in `dbt test`. Checked on the three domains' seeded databases (pass) and with a planted clash (1 failure).
2026-11-13 15:35:01 -06:00

37 lines
1.3 KiB
YAML

version: 2
# Silver, the same tables in every domain: each domain has its own database, chosen by the profile
# (`--profile cacu|cama|tea`). Written by the Python load; dbt only reads them.
sources:
- name: silver
schema: "{{ target.schema }}"
tables:
- name: procedimiento
- name: observacion_clinica
- name: persona
- name: carga
- name: cat_estudio
- name: cat_resultado
- name: cat_valor
- name: cat_sistema_fuente
# How each source writes the catalog's codes. A study code or a spelling maps to one target while in force:
# the writer checks it, and this test finds rows written past it. Captions have no target here (their result
# is part of the form), so they never fail it.
- name: cat_mapeo
tests:
- vigencias_sin_traslape:
llave: mapeo_id
forma: [sistema_fuente_id, clase, resultado_id, forma_normalizada]
destino: [estudio_id, valor_id]
- name: dim_fecha
# Restricted gold the Python cycle writes: the cohort builds and the risk estimates scored on them. dbt only reads
# them, like silver.
- name: oro
schema: "{{ target.schema }}"
tables:
- name: cohorte_armado
- name: cohorte_miembro
- name: evaluacion_riesgo_lote
- name: evaluacion_riesgo