Spaces:
Sleeping
Sleeping
File size: 2,837 Bytes
2f14900 | 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | # utils.py
# Just some helpers and constants for the Indian job market
# Nothing fancy here, just keeping things organised
# Major Indian cities - metro first, then tier-2
METRO_CITIES = [
"Bangalore", "Mumbai", "Delhi", "Hyderabad", "Chennai",
"Kolkata", "Pune", "Ahmedabad",
]
TIER2_CITIES = [
"Noida", "Gurugram", "Navi Mumbai", "Thane", "Coimbatore",
"Indore", "Jaipur", "Lucknow", "Bhopal", "Nagpur",
"Chandigarh", "Kochi", "Visakhapatnam", "Surat", "Vadodara",
"Tirupati", "Nashik", "Mysore", "Mangalore",
]
ALL_CITIES = ["Any / Remote"] + METRO_CITIES + sorted(TIER2_CITIES)
# Experience buckets - kept simple
EXPERIENCE_LEVELS = [
"Fresher (0 yrs)",
"1β2 years",
"3β5 years",
"5β8 years",
"8+ years",
]
# Notice periods - very common in Indian companies
NOTICE_PERIODS = [
"Immediate / No notice",
"15 days",
"1 month (30 days)",
"2 months (60 days)",
"3 months (90 days)",
]
# Salary ranges in LPA (Lakhs Per Annum)
# 1 LPA = Rs 1,00,000 per year
SALARY_RANGES = [
"Any",
"0β3 LPA",
"3β6 LPA",
"6β10 LPA",
"10β15 LPA",
"15β25 LPA",
"25+ LPA",
]
# Popular job domains/roles in India
JOB_DOMAINS = [
"Software Engineering",
"Data Science / ML / AI",
"Product Management",
"DevOps / Cloud",
"UI/UX Design",
"Business Analyst",
"Marketing / Digital Marketing",
"Sales / Business Development",
"HR / Talent Acquisition",
"Finance / Accounts",
"Operations",
"Customer Support",
"Fresher / Entry Level",
]
def format_salary_lpa(value_lpa):
"""Format a salary number as LPA string."""
if value_lpa < 1:
return f"βΉ{int(value_lpa * 100)}K per year"
return f"βΉ{value_lpa:.1f} LPA"
def parse_salary_range(label):
"""Convert salary range label like '6β10 LPA' to (min, max) tuple."""
if "Any" in label:
return (0.0, 9999.0)
if "25+" in label:
return (25.0, 9999.0)
clean = label.replace("LPA", "").replace("βΉ", "").strip()
parts = clean.split("β")
try:
return (float(parts[0].strip()), float(parts[1].strip()))
except Exception:
return (0.0, 9999.0)
def experience_to_years(label):
"""Convert experience label to (min_years, max_years)."""
if "Fresher" in label:
return (0, 0)
if "8+" in label:
return (8, 30)
try:
parts = label.split("β") if "β" in label else label.split("-")
lo = int(parts[0].strip().split()[0])
hi = int(parts[1].strip().split()[0])
return (lo, hi)
except Exception:
return (0, 30)
def truncate(text, max_len=180):
"""Trim long strings so they don't overflow cards."""
if not text:
return ""
return text[:max_len] + "β¦" if len(text) > max_len else text
|