from typing import Optional def reliability_for( source: str, section: Optional[str] = None, age_days: Optional[int] = None, corroborated: bool = False, verification_status: Optional[str] = None, ) -> str: """Compute reliability level for a sourced fact. Args: source: "10-K", "10-Q", "transcript", or "news" section: e.g. "MD&A", "Risk Factors", "transcript" age_days: how many days old the source is (None = unknown) corroborated: True if the same claim appears in ≥2 independent sources Returns: "HIGH", "MEDIUM", or "LOW" """ # Fail closed: absence of deterministic verification is never promotable. if verification_status != "VERIFIED": return "LOW" if source in ("10-K", "10-Q"): if section == "Risk Factors": return "MEDIUM" return "HIGH" if source == "transcript": return "MEDIUM" # The metrics tool emits only rows with verified SEC period lineage. Analyst # data still lacks a licensed historical point-in-time snapshot. if source == "metrics": return "HIGH" if source == "analyst": return "LOW" if source == "news": if age_days is not None and age_days > 30: return "LOW" return "LOW" return "LOW" # unknown source