CaMa survival: the clinical scenarios are a shared module and stage 6 lists each scenario's risk factors; the live figure drops the unused options

This commit is contained in:
rockdrigo
2026-11-21 13:03:19 -06:00
parent 997aebd068
commit b1006a97d7
12 changed files with 237 additions and 141 deletions
-15
View File
@@ -440,21 +440,6 @@ def test_the_live_figure_scores_the_selected_members_with_the_production_model(m
assert len(grade3["km_adjusted"]["S"]) == grade3["months_max"] + 1 and len(grade3["weibull_fractional"]["S"]) == len(grade3["weibull"]["S"])
def test_the_live_options_list_the_values_the_limits_and_the_patients_own(members_frame):
"""Pins down: the options carry every covariate's values with their member counts, the period of the index dates, the
smallest selection that can be answered and, for a patient, her value of each covariate. Fails if a covariate is missing
or her values are not hers."""
from models.cama.survival import live
first = int(members_frame["pac_id"].iloc[0])
found = live.options(members_frame, first)
assert set(found["covariables"]) == set(FEATURES)
assert sum(v["n"] for v in found["covariables"]["grade"]) == len(members_frame)
assert found["paciente"]["grade"] == str(members_frame["grade"].iloc[0])
assert live.options(members_frame, 10**9)["paciente"] is None
@pytest.mark.parametrize("query", [
{"filtros": {"nope": ["x"]}},
{"filtros": {"grade": ["G1"], "er": ["NEGATIVO"], "her2": ["H3"]}},