CaMa: the patient import takes the recurrence variables again, recurrence trains on the cohort export, the second survival route is retired

This commit is contained in:
Roberto Treviño Cervantes
2026-11-22 19:51:20 -06:00
parent 1fbeabb872
commit 88c9694a46
7 changed files with 21 additions and 181 deletions
+7 -10
View File
@@ -50,7 +50,7 @@ def test_the_catalog_lists_the_trainable_scenarios_and_not_the_pipeline_settings
assert ("cama", "survival") in entries and ("cacu", "cin2_logistic") in entries
assert entries[("tea", "eeg")]["kind"] == "referencia" and entries[("cama", "survival")]["kind"] == "cohorte"
assert ("cama", "seer_survival") not in entries
assert entries[("cama", "recurrence")]["kind"] == "referencia" # trained on its external files, not on a dbt cohort
assert entries[("cama", "recurrence")]["kind"] == "cohorte" # the patients loaded from METABRIC and SCAN-B
@pytest.mark.parametrize("code,estado", [
@@ -118,15 +118,12 @@ def test_tea_trains_on_a_local_reference_folder_when_one_is_configured(monkeypat
assert "--manifest" not in tea and "--reference-dir" not in cama
def test_a_scenario_with_external_data_trains_without_a_dbt_export_or_manifest(monkeypatch):
"""Pins down: CaMa's recurrence scenario, whose training data are files, is started with no `--export`, `--manifest` or dbt
manifest, while CaMa's survival scenario still is. Fails if an external scenario is refused for want of a manifest or run
through the cohort export, which would train it on the wrong data."""
monkeypatch.delenv("DBT_MANIFEST", raising=False)
def test_cama_recurrence_trains_on_the_cohort_export_like_survival(monkeypatch):
"""Pins down: CaMa's recurrence scenario, trained on the patients loaded from METABRIC and SCAN-B, is started with the
cohort export and the dbt manifest, as survival is. Fails if it is run without a database build, which would leave it
with no patients."""
monkeypatch.setenv("DBT_MANIFEST", "m.json")
recurrence = training_jobs._command("cama", "recurrence")
monkeypatch.setenv("DBT_MANIFEST", "m.json")
survival = training_jobs._command("cama", "survival")
assert "--export" not in recurrence and "--manifest" not in recurrence
assert "--export" in survival and survival[survival.index("--manifest") + 1] == "m.json"
assert "--export" in recurrence and recurrence[recurrence.index("--manifest") + 1] == "m.json"