English names: orchestration (cycle, context, runner, repositories), its steps, fields and CLI, recomputation, follow_up and reports

This commit is contained in:
2026-11-08 17:28:24 -06:00
parent 2296598896
commit 82504bd0bf
35 changed files with 506 additions and 508 deletions
+6 -6
View File
@@ -1,9 +1,9 @@
"""What this module covers: the timeline `repositorios_de` wires into `ctx.repos.plata` is dbt's view
"""What this module covers: the timeline `repositories_of` wires into `ctx.repos.silver` is dbt's view
`cacu_linea_de_tiempo`, the one the models' pipelines, the cohort builds and the measures' strata read: silver's
facts as the indicator kit's own timeline gave them, plus the procedures dbt infers from them.
Fixtures: `base` (from `conftest.py`), the CaCu fixture database, loaded and with dbt's views created
(`catalogos`, `cargar`, `modelos`; needs `DBT_MANIFEST`); `kit_rows`, the rows the kit's timeline query gave on
(`catalogs`, `load`, `event_models`; needs `DBT_MANIFEST`); `kit_rows`, the rows the kit's timeline query gave on
that data (`fixtures/kit_cacu_timeline.json`, without `conocida_en`, which is each run's load time).
"""
@@ -28,7 +28,7 @@ def proyecto():
def loaded(base):
if not os.environ.get("DBT_MANIFEST"):
pytest.skip("DBT_MANIFEST isn't set: `dbt compile` in Transformation writes it")
base.correr("catalogos", "cargar", "modelos")
base.run("catalogs", "load", "event_models")
return base
@@ -47,7 +47,7 @@ def test_the_timeline_is_the_kit_s_plus_the_inferred_procedures(loaded, kit_rows
"""Pins down: the wired repository reads dbt's view, which holds every row the kit's timeline held, in its
order and with a date as `fecha`, plus inferred procedures. Fails if the orchestration binds another query, or
the view stops giving one of the kit's rows."""
rows = loaded.ctx.repos.plata.timeline.read(until=CORTE)
rows = loaded.ctx.repos.silver.timeline.read(until=CORTE)
assert as_kit(rows) == kit_rows
assert {row["tipo"] for row in rows} & INFERRED
assert all(isinstance(row["fecha"], date) for row in rows)
@@ -56,7 +56,7 @@ def test_the_timeline_is_the_kit_s_plus_the_inferred_procedures(loaded, kit_rows
def test_the_patient_filter_keeps_only_those_patients(loaded, kit_rows):
"""Pins down: `patients` keeps those patients' rows, all of them. Fails if the filter is dropped or misapplied."""
patients = sorted({int(row["pac_id"]) for row in kit_rows})[:2]
rows = loaded.ctx.repos.plata.timeline.read(patients=patients, until=CORTE)
rows = loaded.ctx.repos.silver.timeline.read(patients=patients, until=CORTE)
assert {row["pac_id"] for row in rows} == set(patients)
assert as_kit(rows) == [row for row in kit_rows if int(row["pac_id"]) in patients]
@@ -64,7 +64,7 @@ def test_the_patient_filter_keeps_only_those_patients(loaded, kit_rows):
def test_known_until_cuts_at_what_was_loaded(loaded):
"""Pins down: `known_until` compares with the load's time as a datetime: before the load nothing is known,
after it everything is. Fails if the cut is ignored, applied to the clinical date, or compared as text."""
timeline = loaded.ctx.repos.plata.timeline
timeline = loaded.ctx.repos.silver.timeline
everything = timeline.read(until=CORTE)
known = {row["conocida_en"] for row in everything}
assert all(isinstance(at, datetime) and at.tzinfo is not None for at in known)