File size: 885 Bytes
579b95c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
def score_opportunity(data):
    # Fake scoring logic based on weighted sum
    raw_score = (
        0.3 * (data['lead_score'] or 0) +
        0.2 * (data['email_count'] or 0) +
        0.2 * (data['meeting_count'] or 0) -
        0.1 * (data['close_date_gap'] or 0)
    )
    raw_score += 0.1 * (1 if data['stage'] == "Negotiation" else 0)
    raw_score = max(0, min(100, round(raw_score)))

    # Risk classification
    if raw_score >= 75:
        risk = "Low"
        recommendation = "High chance of closing. Prioritize this deal."
    elif raw_score >= 50:
        risk = "Medium"
        recommendation = "Moderate potential. Consider a follow-up soon."
    else:
        risk = "High"
        recommendation = "Low potential. Reassess engagement or de-prioritize."

    return {
        "score": raw_score,
        "risk": risk,
        "recommendation": recommendation
    }