def generate_output(mobile_id): plan = generate_plan() # expiration_date = fake.date_between(start_date=plan[1], end_date='now') launch_date = random.randint(365, 720) expiration_date = random.randint(launch_date, 1400) writer.export_data([mobile_id + 14, plan[0], expiration_date, launch_date], settings.location + "mobile_plans.csv")
def having_ip(): old_chance = random.randint(1, 100) if old_chance < 30: client = writer.get_row("output/T0-T1/having_ip.csv", random.randint(1, writer.count_row("output/T0-T1/having_ip.csv") - 1)) phone = client[0] cli_id = client[1] else: client = writer.get_row(settings.location + "client.csv", random.randint(1, writer.count_row(settings.location + "client.csv") - 1)) phone = client[7] cli_id = client[0] ip_plan = writer.get_row(settings.location + "internet_plans.csv", random.randint(1, writer.count_row(settings.location + "internet_plans.csv") - 1)) i_id = ip_plan[0] contract = random.randint(365, 720) ip = [phone, cli_id, # The id itself i_id, contract, # The date random.randint(contract, 1400), # Permanence random.choice([100, 150, 200, 250, 300, 350, 400]), # Price random.choice([" ", 300, 400, 500]), # Minutes ] writer.export_data(ip, settings.location+"having_ip.csv")
def generate_output(): numeric_id = general.generate_id() plan = generate_internet_plan() internet_plan = [numeric_id, plan[0], plan[1], plan[2], plan[3], expiration_date, plan[4]] contract_date = fake.date_between(start_date=plan[4], end_date='now') expiration_date = mobile.fake.date_between(start_date=contract_date, end_date='now') writer.export_data(internet_plan, "output/internet_plans.csv")
def having_mp(): old_chance = random.randint(1, 100) if old_chance < 20: client = writer.get_row( "output/T0-T1/having_mp.csv", random.randint(1, writer.count_row("output/T0-T1/having_mp.csv")) - 1) cli_id = client[2] phone = client[0] else: client = writer.get_row( settings.location + "client.csv", random.randint( 1, writer.count_row(settings.location + "client.csv") - 1)) cli_id = client[0] phone = client[7] mb_plan = writer.get_row( settings.location + "mobile_plans.csv", random.randint( 1, writer.count_row(settings.location + "mobile_plans.csv") - 1)) mb_id = mb_plan[0] contract = random.randint(365, 720) mp = [ phone, mb_id, cli_id, # The id itself contract, # The date random.randint(contract, 1400), random.choice([200, 250, 350, 400]), # Price random.choice([" ", 500, 400, 600, 700, 800]), # Minutes random.choice([" ", 100, 200, 300, 400, 500]) # Internet ] writer.export_data(mp, settings.location + "having_mp.csv")
def client_output(): numeric_id = general.generate_id() pesel = general.generate_pesel(fake.date_of_birth()) contract = fake.date_between(start_date=plan[4], end_date='now') permanence = fake.date_between(start_date=contract, end_date='now') client_mobile = [numeric_id, pesel, contract, permanence] writer.export_data(client_mobile, "output/client_mobile.csv")
def generate_output(i_id): plan = generate_internet_plan() # contract_date = fake.date_between(start_date=plan[3], end_date='now') contract_date = random.randint(365, 720) expiration_date = random.randint(contract_date, 1400) # expiration_date = mobile.fake.date_between(start_date=contract_date, end_date='now') internet_plan = [i_id+14, plan[0], plan[1], expiration_date, contract_date] writer.export_data(internet_plan, settings.location+"internet_plans.csv")
def generate_output(): pesel = general.generate_pesel(the_date) call_id = general.generate_id() call = generate_call(the_date) writer.export_data([call_id, pesel, "Here should be department id", call[0], call[1], call[2], call[3]], "calls.csv")
def generate_output(): import main person = generate_client() pesel = general.generate_pesel(person["birthdate"]) person_rows = [ pesel, main.divide(person["name"])[0], main.divide(person["name"])[1], person["mail"], person["residence"].replace("\n", " "), generate_phone("pl") ] writer.export_data(person_rows, "output/client.csv")
def generate_output(cli_id): person = generate_client() pesel = general.generate_pesel(person["birthdate"]) region = random.choice( ["Masovia", "Kuyavia", "Podlasie", "Pemrania", "Pomerelia", "Silesia"]) person_rows = [ cli_id + 1500, pesel, person["name"], region, fake.city(), fake.postcode(), fake.street_address(), generate_phone() ] writer.export_data(person_rows, "output/T1-T2/client.csv")
def generate_date(): ''' months = {v: k for k, v in enumerate(calendar.month_abbr)} if settings.location == "output/T1-T2/": previous = writer.get_row("output/T0-T1/date.csv", writer.count_row("output/T0-T1/date.csv")-1) additional_id = previous[0] quarter = previous[1] start_year = previous[2] start_month = months[previous[3][:3]] start_day = previous[4] else: ''' start_year = settings.starting_year start_month = 3 start_day = 17 quarter = 1 additional_id = 720 for i in range(settings.days_count): if start_month == 2: days = 28 elif (start_month % 2) == 0: days = 30 else: days = 31 if start_day >= days: start_day = 1 start_month = start_month + 1 if start_month > 3: quarter = 2 if start_month > 6: quarter = 3 if start_month > 9: quarter = 4 if start_month >= 12: start_month = 1 start_year = start_year + 1 quarter = 1 date = str(start_year) + "-" + str(start_month) + "-" + str(start_day) start_day = start_day + 1 writer.export_data([ i + additional_id, quarter, start_year, calendar.month_name[start_month], date ], settings.location + "/date.csv")
def answer_call(some_id): if some_id != 0: departments = [ "DEPT_SALES", "DEPT_MAIN", "DEPT_SUPPORT", "DEPT_CANCEL" ] if settings.location == "output/T1-T2/": departments.append("DEPT_UPDATE") departments.append("DEPT_UPGRADE") dept_id = random.choice(departments) # "DEPT_UPGRADE"]) client_id = writer.get_row( settings.location + "/client.csv", random.randint( 1, writer.count_row(settings.location + "/client.csv") - 1))[0] tele_id = writer.get_row( settings.location + "/operators.csv", random.randint( 1, writer.count_row(settings.location + "/operators.csv") - 1)) call = writer.get_row( settings.location + "/calls.csv", random.randint( 1, writer.count_row(settings.location + "/calls.csv") - 1)) date = random.randint(1, settings.days_count) satisfaction = call[1] response = call[2] if response == "SHORT": response = random.randint(0, 3) elif response == "ACCEPTABLE": response = random.randint(3, 6) else: response = random.randint(6, 10) salary = tele_id[3] call = [ some_id + settings.additional_id_calls, client_id, dept_id, tele_id[0], salary, date, satisfaction, response ] writer.export_data(call, settings.location + "/answer.csv")
def generate_output(call_id): call = generate_call() writer.export_data( [call_id + settings.additional_id_calls, call[0], call[1]], settings.location + "/calls.csv")
def generate_output(): numeric_id = general.generate_id() expiration_date = fake.date_between(start_date=plan[4], end_date='now') writer.export_data( [numeric_id, plan[0], plan[1], plan[2], expiration_date, plan[3]], "output/mobile_plans.csv")
def new_operators(amount): for i in range(amount): writer.export_data(generate_operator(i), settings.location + "/operators.csv")
def generate_output(): names = ["Sales", "Maintenance", "Support", "Anti-Cancellation"] name = random.choice(names) numeric_id = general.generate_id() departments = [numeric_id, name] writer.export_data(departments, "output/departments.csv")