Files
models/tests/test_cacu_hpv_required.py
T

14 lines
611 B
Python

import pandas as pd
from core import cacu
from models.cacu import features as f
def test_without_an_hpv_result_she_is_not_evaluated():
day = pd.Timestamp("2025-01-01")
rows = [(p, day, day, "bethesda", "NILM") for p in ("negative", "positive", "none")]
rows += [("negative", day, day, "hpv", "negative"), ("positive", day, day, "hpv", "positive")]
events = pd.DataFrame(rows, columns=["person_id", "index_date", "date", "type", "value_code"])
found = f.index_results(events, cacu.KPNC)
assert dict(zip(found["person_id"], found["hpv_positive"])) == {"negative": 0.0, "positive": 1.0}