Sanjayraju30 commited on
Commit
4f47b69
·
verified ·
1 Parent(s): 9bca5f9

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +12 -6
model.py CHANGED
@@ -1,24 +1,30 @@
 
 
1
  def score_opportunity(data):
2
- # Fake scoring logic based on weighted sum
3
  raw_score = (
4
  0.3 * (data['lead_score'] or 0) +
5
  0.2 * (data['email_count'] or 0) +
6
  0.2 * (data['meeting_count'] or 0) -
7
  0.1 * (data['close_date_gap'] or 0)
8
  )
9
- raw_score += 0.1 * (1 if data['stage'] == "Negotiation" else 0)
 
 
 
 
10
  raw_score = max(0, min(100, round(raw_score)))
11
 
12
- # Risk classification
13
  if raw_score >= 75:
14
  risk = "Low"
15
- recommendation = "High chance of closing. Prioritize this deal."
16
  elif raw_score >= 50:
17
  risk = "Medium"
18
- recommendation = "Moderate potential. Consider a follow-up soon."
19
  else:
20
  risk = "High"
21
- recommendation = "Low potential. Reassess engagement or de-prioritize."
22
 
23
  return {
24
  "score": raw_score,
 
1
+ # model.py
2
+
3
  def score_opportunity(data):
4
+ # Weighted score calculation
5
  raw_score = (
6
  0.3 * (data['lead_score'] or 0) +
7
  0.2 * (data['email_count'] or 0) +
8
  0.2 * (data['meeting_count'] or 0) -
9
  0.1 * (data['close_date_gap'] or 0)
10
  )
11
+ # Extra points if at negotiation stage
12
+ if data['stage'] == "Negotiation":
13
+ raw_score += 10
14
+
15
+ # Clip score between 0–100
16
  raw_score = max(0, min(100, round(raw_score)))
17
 
18
+ # Risk classification logic
19
  if raw_score >= 75:
20
  risk = "Low"
21
+ recommendation = "High chance of closing. Prioritize this deal."
22
  elif raw_score >= 50:
23
  risk = "Medium"
24
+ recommendation = "🔁 Moderate potential. Consider a follow-up soon."
25
  else:
26
  risk = "High"
27
+ recommendation = "⚠️ Low potential. Reassess or de-prioritize."
28
 
29
  return {
30
  "score": raw_score,