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 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
def __init__(self, type_, created, name, coordinates): self.id = get_random_id() self.type = type_ self.created = created self.card = barnum.create_cc_number() self.phone = barnum.create_phone() self.identification = [ get_random_id(), name, barnum.create_birthday(18, 80).toordinal() ] zipcode, city, state = barnum.create_city_state_zip() longitude, latitude = coordinates[zipcode] self.location = [zipcode, city, state, longitude, latitude]
def createManufacturerData(numberValues, lastIndex): valuesList = list() phonePattern = re.compile(r'^\D*(\d{3})\D*(\d{3})\D*(\d{4})\D*(\d*)$') for i in range(numberValues): address = barnum.create_city_state_zip() phone = phonePattern.search(barnum.create_phone()).groups() # Create list with all the values for the MANUFACTURER table valuesList.append([ lastIndex + i, # MAN_CODE attribute barnum.create_company_name(), # MAN_COMPANY barnum.create_street(), # MAN_STREET address[1], # MAN_CITY address[2], # MAN_STATE int(address[0]), # MAN_ZIP int(phone[0]), # MAN_AREACODE phone[1] + "-" + phone[2], # MAN_PHONE ((barnum.create_cc_number())[1])[0] # MAN_ACCNUM ]) return valuesList
def generate(): record_list = [] meter_list = load_db() if len(meter_list) == 0: print('ERROR - empty file!!!!!!!') else: for meter in meter_list: # Fullname name_tuple = barnum.create_name() fullname = name_tuple[0] + ' ' + name_tuple[1] # Zip, city, state zip_tuple = barnum.create_city_state_zip() zipcode = zip_tuple[0] city = zip_tuple[1] state = zip_tuple[2] # House no. and street street = barnum.create_street() # Phone no. phone = barnum.create_phone() # create and print cis data record cis_data_row = [ str(uuid.uuid4()), fullname, zipcode, city, state, street, phone, meter ] print(cis_data_row) record_list.append(cis_data_row) write('cis_data.csv', record_list)
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 else: print '! %s' % ((zipcode, city, state), ) except: print '!' print traceback.print_exc()
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()