Predictive Care Support

Appointment Attendance & No-Show Predictor

Identify patients who may benefit from a warm reminder call or telehealth option using our clinical logistic regression model (python/no_show_predictor.py).

Patient & Scheduling Parameters

z = -0.528
14d
29 yrs
1
5
Predicted No-Show Probability
37%Moderate Risk
Lead time (14d)
+0.73
Prior attendance (1/5 missed)
+0.67
SMS & Email Reminder Active
-0.62
Patient age (29 yrs)
+0.28
Transit distance (12 km)
+0.26

Python Component · python/no_show_predictor.py

# python/no_show_predictor.py
import math
from dataclasses import dataclass

@dataclass
class PatientBookingFeatures:
    lead_time_days: int
    prior_missed_appointments: int
    total_past_appointments: int
    patient_age: int
    sms_reminder: bool
    distance_km: float
    chronic_conditions: int = 0
    visit_type: str = "In-Person"

class AppointmentNoShowModel:
    INTERCEPT = -1.85

    def predict_proba(self, f: PatientBookingFeatures) -> dict:
        z = self.INTERCEPT
        z += max(0, min(180, f.lead_time_days)) * 0.052
        prior_rate = (f.prior_missed_appointments / f.total_past_appointments) if f.total_past_appointments > 0 else 0.0
        z += (prior_rate * 2.15) + (min(f.prior_missed_appointments, 6) * 0.24)
        z += -0.62 if f.sms_reminder else 0.38
        if 18 <= f.patient_age <= 32:
            z += 0.28
        elif f.patient_age >= 60:
            z += -0.18
        z += -0.35 if f.visit_type == "Telehealth" else (f.distance_km * 0.022)
        if f.chronic_conditions > 0:
            z += -0.16 * min(f.chronic_conditions, 3)

        prob = max(2, min(96, round((1.0 / (1.0 + math.exp(-z))) * 100)))
        risk = "High" if prob >= 50 else ("Moderate" if prob >= 25 else "Low")
        return {"probability_percent": prob, "risk_level": risk, "log_odds": round(z, 3)}