Subhajit Chakraborty commited on
Commit
7607c3d
·
1 Parent(s): 145772b

update(12)

Browse files
src/app.py CHANGED
@@ -193,9 +193,11 @@ if st.session_state.page == "Enrich Companies":
193
  "approx_revenue": lead_revenue,
194
  "business_type": lead_business_type,
195
  "website_url": lead_web_url,
 
196
  }
197
  lead_data = {"companies": [lead_data]}
198
  cleaned_data = clean_json.clean_json_f(lead_data)
 
199
  cleaned_data_obj = json.loads(cleaned_data)
200
  cleaned_data_obj = add_leads_f(
201
  main_lead_info_file, cleaned_data_obj
 
193
  "approx_revenue": lead_revenue,
194
  "business_type": lead_business_type,
195
  "website_url": lead_web_url,
196
+ "score": None
197
  }
198
  lead_data = {"companies": [lead_data]}
199
  cleaned_data = clean_json.clean_json_f(lead_data)
200
+ print(cleaned_data)
201
  cleaned_data_obj = json.loads(cleaned_data)
202
  cleaned_data_obj = add_leads_f(
203
  main_lead_info_file, cleaned_data_obj
src/post_extraction_tools/clean_json.py CHANGED
@@ -31,11 +31,13 @@ def clean_json_f(input_json: object) -> str:
31
  "email": company.get("email", "").strip() if company.get("email") else None,
32
  "approx_revenue": company.get("approx_revenue", "").strip() if company.get("approx_revenue") else None,
33
  "business_type": company.get("business_type", "").strip(),
34
- "website_url": company.get("website_url", "").strip()
 
35
  }
36
  cleaned_companies.append(cleaned_company)
37
 
38
  cleaned_data = {"companies": cleaned_companies}
 
39
  return json.dumps(cleaned_data, indent=2)
40
 
41
  except json.JSONDecodeError:
 
31
  "email": company.get("email", "").strip() if company.get("email") else None,
32
  "approx_revenue": company.get("approx_revenue", "").strip() if company.get("approx_revenue") else None,
33
  "business_type": company.get("business_type", "").strip(),
34
+ "website_url": company.get("website_url", "").strip(),
35
+ "score": company.get("score", None)
36
  }
37
  cleaned_companies.append(cleaned_company)
38
 
39
  cleaned_data = {"companies": cleaned_companies}
40
+ print(cleaned_data)
41
  return json.dumps(cleaned_data, indent=2)
42
 
43
  except json.JSONDecodeError:
src/post_extraction_tools/lead_scoring.py CHANGED
@@ -71,7 +71,7 @@ class LeadScoring:
71
  def score(self, leads: object, conditions: object):
72
  # scored_leads = []
73
  for lead in leads["companies"]:
74
- if "score" not in lead:
75
  score = 0
76
  if "industry_type" in conditions:
77
  try:
 
71
  def score(self, leads: object, conditions: object):
72
  # scored_leads = []
73
  for lead in leads["companies"]:
74
+ if lead["score"] is None:
75
  score = 0
76
  if "industry_type" in conditions:
77
  try: