smart_lead_boost / enrich.py
Vadhana's picture
Create enrich.py
c9c54fe verified
# enrich.py
import pandas as pd
import random
# Simulate enrichment for now
def enrich_company_info(name, website):
return {
"LinkedIn Employees": random.randint(10, 1000),
"Tech Stack": random.choice(["React, Node.js", "PHP, MySQL", "Django, PostgreSQL"]),
"Funding (USD)": random.choice([None, 500000, 2000000, 10000000]),
"Glassdoor Rating": round(random.uniform(2.5, 4.9), 1),
"SSL Secure": website.startswith("https")
}
def score_lead(row):
score = 0
if row["LinkedIn Employees"] > 100: score += 20
if row["Funding (USD)"] and row["Funding (USD)"] > 1000000: score += 30
if row["Glassdoor Rating"] > 4: score += 20
if "React" in row["Tech Stack"] or "Django" in row["Tech Stack"]: score += 20
if row["SSL Secure"]: score += 10
return score
def enrich_and_score(df):
enriched_data = []
for _, row in df.iterrows():
company_info = enrich_company_info(row['Company Name'], row['Website'])
full_data = {**row, **company_info}
enriched_data.append(full_data)
enriched_df = pd.DataFrame(enriched_data)
enriched_df["Lead Score (0-100)"] = enriched_df.apply(score_lead, axis=1)
return enriched_df