TheJackBright's picture
Deploy GitHub root master to Space
c296d62
"""Tabular feature extraction."""
from __future__ import annotations
from app.common.types import PatientProfile
def build_tabular_features(patient: PatientProfile) -> dict[str, float]:
return {
"age": float(patient.age),
"med_count": float(len(patient.medications)),
"frailty": float(patient.frailty_score),
"adherence": float(patient.adherence_estimate),
"egfr": float(patient.labs.egfr or 60.0),
"ast": float(patient.labs.ast or 30.0),
"alt": float(patient.labs.alt or 30.0),
"inr": float(patient.labs.inr or 1.2),
"glucose": float(patient.labs.glucose or 110.0),
"specialist_conflict_count": float(len(patient.specialist_conflicts)),
"ade_history_count": float(len(patient.prior_ade_history)),
"monitoring_gap_count": float(len(patient.monitoring_gaps)),
}