""" Generate realistic property listings + insurance + documents data. Run: python data/generate_data.py """ import json, random, sqlite3 from pathlib import Path from datetime import date, timedelta random.seed(42) LOCATIONS = [ "Andheri West","Andheri East","Bandra West","Bandra East", "Juhu","Versova","Santacruz West","Santacruz East", "Khar","Vile Parle","Goregaon","Malad","Kandivali", "Borivali","Dadar","Worli","Lower Parel","Prabhadevi", "Powai","Vikhroli","Ghatkopar","Mulund","Thane", "Navi Mumbai","Kharghar","Panvel","Ulwe","Dombivli", "Kalyan","Mira Road","Vasai","Nalasopara", ] PREMIUM = {"Bandra West","Juhu","Worli","Lower Parel","Prabhadevi","Khar","Santacruz West"} BUILDERS = [ "Lodha Group","Godrej Properties","Oberoi Realty","Hiranandani", "Shapoorji Pallonji","Runwal Group","Rustomjee","Kalpataru", "L&T Realty","Mahindra Lifespaces","Prestige Group", "Raymond Realty","Piramal Realty","Tata Housing", ] PROP_TYPES = ["Apartment","Flat","Villa","Row House","Penthouse","Studio","Duplex"] FURNISHINGS = ["Fully Furnished","Semi Furnished","Unfurnished"] STATUSES = ["Ready to Move","Under Construction","Ready to Move","Ready to Move"] AMENITIES_POOL = [ "Gym","Swimming Pool","Club House","Parking","Security","Power Backup","Lift", "Garden","Jogging Track","Kids Play Area","Indoor Games","CCTV","Intercom", "Visitor Parking","Terrace","Co-working Space","Library","Mini Theatre","Pet-friendly", ] INS_COMPANIES = [ "New India Assurance","HDFC ERGO","Bajaj Allianz","ICICI Lombard", "National Insurance","Oriental Insurance","United India", ] INS_STATUSES = ["ACTIVE","ACTIVE","ACTIVE","PENDING","EXPIRED"] DOCUMENT_TYPES = [ "Sale Agreement","NOC from Society","Occupation Certificate", "Property Card","Index II","Stamp Duty Receipt","Possession Letter", "Title Search Report","Encumbrance Certificate","Building Plan Approval", ] DOC_STATUSES = ["RECEIVED","PENDING","RECEIVED","RECEIVED","MISSING"] def price_range(bhk, location): base = {1:(0.45,1.2),2:(0.9,2.5),3:(1.5,4.5),4:(3.0,8.0),5:(6.0,18.0)} lo,hi = base.get(bhk,(1.0,3.0)) if location in PREMIUM: lo,hi = lo*1.6, hi*2.0 return round(random.uniform(lo,hi),2) def area_range(bhk): ranges = {1:(380,550),2:(650,950),3:(1000,1600),4:(1800,3000),5:(3200,6000)} lo,hi = ranges.get(bhk,(600,1200)) return random.randint(lo,hi) properties, insurance, documents = [], [], [] pid = 1001 for _ in range(300): bhk = random.choices([1,2,3,4,5], weights=[15,35,30,15,5])[0] location = random.choice(LOCATIONS) ptype = random.choice(PROP_TYPES) price = price_range(bhk, location) area = area_range(bhk) floors = random.randint(10,45) floor = random.randint(1,floors) amenities= random.sample(AMENITIES_POOL, k=random.randint(5,12)) furnish = random.choice(FURNISHINGS) status = random.choice(STATUSES) builder = random.choice(BUILDERS) society = f"{builder.split()[0]} {random.choice(['Grandeur','Heights','Residences','Enclave','Greens','Palms','Towers','Estates','Park','Vista','Elysium','Artesia'])}" age = random.randint(0,15) ppsf = round((price*100)/(area/100), 0) city = "Mumbai" if location not in ["Thane","Navi Mumbai","Kharghar","Panvel","Ulwe","Dombivli","Kalyan","Mira Road","Vasai","Nalasopara"] else "MMR" prop = { "id": pid, "title": f"{bhk} BHK {ptype} in {location}", "bhk": bhk, "type": ptype, "location": location, "city": city, "price_cr": price, "price_display": f"₹{price} Cr", "area_sqft": area, "price_per_sqft": int(ppsf), "floor": floor, "total_floors": floors, "furnishing": furnish, "amenities": amenities, "parking": "Parking" in amenities, "pool": "Swimming Pool" in amenities, "age_years": age, "status": status, "builder": builder, "society": society, "bedrooms": bhk, "bathrooms": bhk if bhk<=3 else bhk-1, "balconies": random.randint(1,min(bhk,3)), "facing": random.choice(["East","West","North","South","North-East","North-West"]), "listed_days_ago": random.randint(1,90), "contact": f"+91-9{random.randint(100000000,999999999)}", "description": ( f"Spacious {bhk} BHK {ptype.lower()} in {society}, {location}. " f"{'Ready to move. ' if status=='Ready to Move' else 'Under construction. '}" f"{furnish} unit, {area} sqft, floor {floor}/{floors}. " f"Key amenities: {', '.join(amenities[:5])}. " f"Priced at ₹{price} Cr (₹{int(ppsf):,}/sqft). Built by {builder}." ), "available": True, "featured": random.random() < 0.1, } properties.append(prop) # Insurance record ins_status = random.choice(INS_STATUSES) start = date.today() - timedelta(days=random.randint(10,350)) expiry = start + timedelta(days=365) insurance.append({ "property_id": pid, "company": random.choice(INS_COMPANIES), "policy_no": f"POL-{pid}-{random.randint(10000,99999)}", "status": ins_status, "start_date": start.isoformat(), "expiry_date": expiry.isoformat(), "premium_annual": random.randint(8000,45000), "followup_person": random.choice(["Rajan Sharma","Priya Ghosh","Amit Das","Sneha Patil","Rahul Mehta"]), "followup_contact": f"+91-9{random.randint(100000000,999999999)}", "notes": random.choice(["Renewal reminder sent","Follow up urgently","Paid","","On hold"]), }) # 2-4 documents per property doc_types = random.sample(DOCUMENT_TYPES, k=random.randint(2,5)) for dt in doc_types: documents.append({ "property_id": pid, "document_type": dt, "status": random.choice(DOC_STATUSES), "received_date": (date.today() - timedelta(days=random.randint(0,180))).isoformat() if random.random()>0.3 else None, "notes": "", }) pid += 1 # Save JSON DATA_DIR = Path(__file__).parent (DATA_DIR / "properties.json").write_text(json.dumps(properties, indent=2)) print(f"Generated {len(properties)} properties, {len(insurance)} insurance records, {len(documents)} documents") print(f"Price range: ₹{min(p['price_cr'] for p in properties)} – ₹{max(p['price_cr'] for p in properties)} Cr") print(f"Locations: {len(set(p['location'] for p in properties))}")