def generate_pharmacy(): name = barnum.create_company_name() street, city, state, zip = generate_address() email = barnum.create_email() phone = barnum.create_phone(zip) fax = barnum.create_phone(zip) return name, street, city, state, zip, email, phone, fax
def seed_data(connection, cursor): log("Seeding data...") cursor.executemany( item_insert, [(barnum.create_nouns(), random.choice(categories), random.randint(item_price_min * 100, item_price_max * 100) / 100, random.randint(item_inventory_min, item_inventory_max)) for i in range(item_seed_count)]) cursor.executemany(user_insert, [(barnum.create_email(), (random.randint(0, 10) > 8)) for i in range(user_seed_count)]) connection.commit() log("Seeding data DONE.")
def test_register(self): allow_flash(self.driver, yaml_utils.get("constant.yaml", "host")) username = barnum.create_name(False).lower() email = barnum.create_email() self.register_page.get(url_regerister) self.register_page.read_law() self.register_page.input_info(username, "123456", email) self.register_page.submit() self.register_page.upload_icon(autoitExe_file) self.register_page.skip() self.register_page.skip() self.register_page.skip() self.register_page.toProfile() result = self.register_page.get_name() self.assertEqual(result, username)
def generate_facility(count=1): random.seed() facilities = [] for x in range(0, count): street, city, state, postal_code = generate_address() name = barnum.create_company_name() billing = random_truth(0.8) assignment = 0 if billing: assignment = random_truth(0.8) # TODO domain_id, pos_code, facility_id, website facility = { 'name': name, 'street': street, 'city': city, 'state': state, 'country_code': 'US', 'postal_code': postal_code, 'phone': barnum.create_phone(postal_code), 'fax': barnum.create_phone(postal_code), 'tax_id_type': "EI", 'federal_ein': random.randint(10000000000, 99999999999), 'facility_npi': random.randint(1000000000, 9999999999), 'website': '', 'email': barnum.create_email(name=name), 'billing_location': billing, 'accepts_assignment': assignment, 'service_location': 1, 'color': generate_hex_color(), 'primary_business_entity': 1, 'pos_code': '21', 'attn': '', 'domain_identifier': '', 'facility_id': '%s-%s' % (name, str(random.randint(10000, 99999))) } facilities.append(facility) return facilities
item_id BIGINT UNSIGNED REFERENCES item(id), status TINYINT UNSIGNED DEFAULT 1, quantity INT UNSIGNED DEFAULT 1, purchase_price DECIMAL(12,2), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP );""") connection.commit() print("Seeding data...") cursor.executemany( item_insert, [(barnum.create_nouns(), random.randint(itemPriceMin * 100, itemPriceMax * 100) / 100, random.randint(itemInventoryMin, itemInventoryMax)) for i in range(itemSeedCount)]) cursor.executemany(user_insert, [(barnum.create_email(), (random.randint(0, 10) > 8)) for i in range(userSeedCount)]) connection.commit() print("Getting item ID and PRICEs...") cursor.execute("SELECT id, price FROM shop.items") item_prices = [(row[0], row[1]) for row in cursor] print("Preparing to loop + seed kafka pageviews and purchases") for i in range(purchaseGenCount): # Get a user and item to purchase purchase_item = random.choice(item_prices) purchase_user = random.randint(0, userSeedCount - 1) purchase_quantity = random.randint(1, 5)
for n in range(0, random.randint(1, 4)): creditcard = barnum.create_cc_number() document['CreditCard'].append({ "Type": creditcard[0], "Number": get_credit_card_number(creditcard[1][0]) }) if (random.random() < 0.8): if (random.random() < 0.9): document['JobTitle'] = barnum.create_job_title() if (random.random() < 0.9): document['Company'] = barnum.create_company_name() if (random.random() < 0.8): if (random.random() < 0.6): document['Email'] = barnum.create_email(name=name) else: document['Email'] = [ barnum.create_email(name=name), barnum.create_email(name=name) ] if (random.random() < 0.8): phone = barnum.create_phone(zipcode) if (random.random() < 0.75): document['Phone'] = phone else: toremove = ['(', ')', '-'] document['Phone'] = int( phone.translate(None, ' '.join(toremove))) id = collection.insert_one(document).inserted_id print document
def generate_patients(count=1): random.seed() patients = [] for x in range(0, count): sex = 'Male' if random.randint(0, 1) % 2 else 'Female' fname, lname = barnum.create_name(gender=sex) mname = barnum.create_name(False, sex) if random_truth(0.27) == 1 else '' street, city, state, postal_code = generate_address() dob = barnum.create_birthday(1, 100) patient = { 'title': generate_title(sex), 'language': '', 'financial': '', 'fname': fname, 'lname': lname, 'mname': mname, 'DOB': dob.strftime("%Y-%m-%d"), 'street': street, 'postal_code': postal_code, 'city': city, 'state': state, 'country_code': 'US', 'drivers_license': random_drivers_license(lname[0], int(dob.strftime("%y"))), 'ss': random.randint(100000000, 999999999), 'occupation': barnum.create_job_title(), 'phone_home': barnum.create_phone(postal_code), 'phone_biz': barnum.create_phone(postal_code), 'phone_contact': barnum.create_phone(postal_code), 'phone_cell': barnum.create_phone(postal_code), 'pharmacy_id': 1, 'status': '', 'contact_relationship': '', 'date': barnum.create_date(past=True).strftime("%Y-%m-%d"), 'sex': sex, 'referrer': '', 'referrerID': '', 'providerID': 0, 'ref_providerID': 0, 'email': barnum.create_email(name=(fname, lname)), 'email_direct': '', 'ethnoracial': '', 'race': '', 'ethnicity': '', 'religion': '', 'interpretter': '', 'migrantseasonal': '', 'family_size': random.randint(1, 8), 'monthly_income': '', 'billing_note': '', 'homeless': '', 'financial_review': barnum.create_date(past=True).strftime("%Y-%m-%d"), 'pubpid': '', 'pid': str(random.randint(1, 99999999999)), 'hipaa_mail': 'yes' if random_truth(0.90) == 1 else 'no', 'hipaa_voice': 'yes' if random_truth(0.75) == 1 else 'no', 'hipaa_notice': 'yes' if random_truth(0.93) == 1 else 'no', 'hipaa_message': 'yes' if random_truth(0.90) == 1 else 'no', 'hipaa_allowsms': 'yes' if random_truth(0.50) == 1 else 'no', 'hipaa_allowemail': 'yes' if random_truth(0.70) == 1 else 'no', } patients.append(patient) return patients
def main(): rok = 1 iloscbiur = 10 IloscAdresow = 20 IloscHoteli = 20 IloscTransportu = 20 IloscOsob = 10 lives = 10 Wycieczki = 10 transports = 10 rezyduje = 10 participate = 10 Employee = 10 typHotelu = ['*', '**', '***', '****', '*****', 'motel'] typTransportu = ['statek', 'pociag', 'autokar'] typWycieczki = ['Objazdowa', 'Wypoczynkowa', 'Planowana'] MaxDiscount = 30 trip_notes = ['transport delay', 'natural catastrophy', 'none', 'none'] typ_zaplaty = ['cash', 'card', 'bank transfer'] pozycja = ['biurowy', 'manager', 'CEO'] Teryt = [ '02', '04', '06', '08', '10', '12', '14', '16', '18', '20 ', '22', '28' ] random.seed() ##Hotel (addres , nazwa , typ E_mal , phone file = open("hotel.txt", "w") for x in range(IloscHoteli): rekord = str(random.randint( 1, IloscAdresow)) + ('|') + Ba.create_company_name() + ( '|') + random.choice(typHotelu) + ('|') + Ba.create_email() + ( '|') + Ba.create_phone() + ('|') file.write(rekord + '\n') file.close() print('Koniec ładowania hotelu') random.seed() # Transport (addres ID , nazwa , typTransportu, discount , E_mail , phone file = open("transport.txt", "w") for x in range(IloscTransportu): rekord = str(random.randint( 1, IloscAdresow)) + ('|') + Ba.create_company_name() + ( '|') + random.choice(typTransportu) + ('|') + str( random.randint( 0, MaxDiscount)) + ('|') + Ba.create_email() + ( '|') + Ba.create_phone() + ('|') file.write(rekord + '\n') file.close() ##Transports (Trip , Company) file = open("Transports.txt", "w") for x in range(transports): rekord = str(random.randint(1, Wycieczki)) + ('|') + str( random.randint(1, IloscTransportu)) + ('|') file.write(rekord + '\n') file.close() ##Osoby (name , surname , Age , e-mail , PhoneNo) random.seed() file = open("osoby.txt", "w") for x in range(IloscOsob): rekord = names.get_first_name() + ('|') + names.get_last_name() + ( '|') + str(Ba.create_birthday(3, 80)) + ( '|') + Ba.create_email() + ('|') + Ba.create_phone() + ('|') file.write(rekord + '\n') if x % 13 == 0: file1 = open("Employee.txt", "a") rozpocz = Ba.create_birthday(0, 2) if x % 3 == 0: finish = str(rozpocz + timedelta(days=(random.randint(1, 300)))) else: finish = 'none' rekord1 = str(x) + ('|') + str(rozpocz) + ('|') + str(finish) + ( '|') + str(random.choice(pozycja)) + ('|') + random.choice( Teryt) + str(random.randint(1, 10)) + ('|') file1.write(rekord1 + '\n') file1.close() file.close() ##Lives (osoba , adres) file = open("lives.txt", "w") for x in range(lives): rekord = str(random.randint(1, IloscOsob)) + ('|') + str( random.randint(1, IloscAdresow)) + ('|') file.write(rekord + '\n') file.close() ##rezyduje (Trip , Company) file = open("Residences.txt", "w") for x in range(rezyduje): rekord = str(random.randint(1, Wycieczki)) + ('|') + str( random.randint(1, IloscHoteli)) + ('|') file.write(rekord + '\n') file.close() ##Trips file = open("Trips.txt", "w") for x in range(Wycieczki): data = Ba.create_birthday(rok, rok + 1) rekord = str(data) + ('|') + str(data + timedelta(days=( random.randint(1, 14)))) + ('|') + random.choice(typWycieczki) + ( '|') + random.choice(trip_notes) + ('|') file.write(rekord + '\n') file1 = open("Participate.txt", "w") file2 = open("Bill.txt", "w") partisiopanty = random.randint(8, 30) for x in range(partisiopanty): invoice_date = data - timedelta(days=(random.randint(70, 120))) rekord1 = str(random.randint(1, IloscOsob)) + ('|') + str( random.randint(1, Wycieczki)) + ('|') + str(x) + ('|') rekord2 = str(random.randint( 1, Employee)) + ('|') + str(invoice_date) + ('|') + str( invoice_date + timedelta(days=(random.randint(2, 30)))) + ( '|') + str(random.randint(300, 3000)) + ('|') + str( random.choice(typ_zaplaty)) + ('|') file1.write(rekord1 + '\n') file2.write(rekord2 + '\n') file1.close() file2.close() file.close()