File size: 1,343 Bytes
35676b4
 
 
 
 
 
 
 
7880373
35676b4
 
 
 
 
 
 
 
 
 
 
 
7880373
 
 
 
35676b4
 
7880373
 
35676b4
 
 
 
7880373
 
 
 
 
 
 
 
35676b4
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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