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)
if rlocation.address[-3:] == "USA": break print ': %s, %s, %s' % (zipcode, city, state) print ': %s' % rlocation print "." if location != None: name = barnum.create_name() now = datetime.utcnow() then = now - timedelta(2 * 365) when = random_date(then, now) birthday = barnum.create_birthday() document = { "_id": create_object_id(when), "Name": ' '.join(name), "Address": { "Street": barnum.create_street(), "City": city, "State": state, "Zip": zipcode, "Location": { "type": "Point", "coordinates": [ location.longitude + offset(), location.latitude + offset() ] } }, "DOB": { "Date": birthday.strftime("%B %d, %Y"), "Day": birthday.strftime("%A")
def generate_address(): street = barnum.create_street() zip, city, state = barnum.create_city_state_zip() return street, city, state, zip
print("Seleccione una opción:") print("1. Generar archivo json") print("2. insertar en base de datos mongo") option = int(input("Opción: ")) for ehr in range(n_health_records): patient_history = {} if option == 1: patient_history["_id"] = {"$oid":str(ObjectId())} patient_history["nombre"] = process_data(names.get_first_name(), option) patient_history["apellidos"] = process_data(names.get_last_name() + " " + names.get_last_name(), option) patient_history["rut"] = str( random.randint(11111111,99999999) ) + '-' + str( random.randint(1,9) ) patient_history["direccion"] = process_data(barnum.create_street(), option) patient_history["fecha_nacimiento"] = process_data(randomDate(), option) patient_history["ciudad"] = process_data(random.choice(constant.CITIES), option) patient_history["es_atendido_ahora"] = False patient_history["activo"] = True """ if option == 1: patient_history["profesionales_que_atendieron"] = random.sample(constant.HC_PROFESSIONAL_ID, random.randint(1,len(constant.HC_PROFESSIONAL_ID)))#len(constant.HC_PROFESSIONAL_ID) n_sessions = len(patient_history["profesionales_que_atendieron"]) if option == 2: patient_history["profesionales_que_atendieron"] = [{"user_id":random.choice([117, 118]), "fecha":"07/02/2021"}] n_sessions = random.randint(1,15) """ n_sessions = random.randint(1,15) patient_history["sesiones_medica"] = []