Spaces:
Running
Running
File size: 534 Bytes
877add7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | """Uncertainty estimates."""
from __future__ import annotations
from app.common.types import PolyGuardState
def estimate_uncertainty(state: PolyGuardState) -> float:
missing = 0
total = 3
if state.patient.labs.egfr is None:
missing += 1
if state.patient.labs.ast is None:
missing += 1
if state.patient.labs.alt is None:
missing += 1
base = missing / total
conflict_penalty = min(0.3, 0.1 * len(state.unresolved_conflicts))
return max(0.0, min(1.0, base + conflict_penalty))
|