def create_visits(output=True, uds=True, medication=True): """Create fake visits and front desk events, depending on Participants and Programs. Visits are created using now(), i.e. today""" participants = Participant.objects.all() p_s_maps = ProgramServiceMap.objects.all() for _ in range(DEFAULT_NUMBER_VISITS): v = Visit() v.participant = random.choice(participants) # v.created_at = pytz.utc.localize(fake.date_time()) v.created_at = timezone.now() v.program_service_map = random.choice(p_s_maps) v.urgency = random.choice(list(UrgencyLevel)).name v.notes = fake.sentence(nb_words=10, variable_nb_words=True, ext_word_list=None) v.full_clean() v.save() # Create FrontDeskEvents to correspond to the Visit, which always begins with ARRIVED arrived(v) if uds: create_uds_results(v) if medication: create_medication(v) if output: print( "Created visit: {} {}, {}, {}, {}".format( v.participant.first_name, v.participant.last_name, v.created_at, v.program.name, v.notes, ) )
def create_visits(output=True): '''Create fake visits and front desk events, depending on Participants and Programs. Visits are created using now(), i.e. today''' participants = Participant.objects.all() programs = Program.objects.all() for _ in range(DEFAULT_NUMBER_VISITS): v = Visit() v.participant = random.choice(participants) #v.created_at = pytz.utc.localize(fake.date_time()) v.created_at = timezone.now() v.program = random.choice(programs) v.notes = fake.sentence(nb_words=10, variable_nb_words=True, ext_word_list=None) v.full_clean() v.save() #Create FrontDeskEvents to correspond to the Visit, which always begins with ARRIVED arrived(v) if output: print("Created visit: {} {}, {}, {}, {}". format(v.participant.first_name, v.participant.last_name, v.created_at, v.program.name, v.notes))
def create_visits(output=True, uds=True, medication=True): """Create fake visits and front desk events, depending on Participants and Programs. Visits are created using now(), i.e. today""" participants = Participant.objects.all() services = Service.objects.all().select_related() sep_program_id = Program.objects.get(name="SEP").pk for _ in range(DEFAULT_NUMBER_VISITS): v = Visit() v.participant = random.choice(participants) # v.created_at = pytz.utc.localize(fake.date_time()) v.created_at = timezone.now() service = random.choice(services) v.service = service v.program = service.program v.urgency = random.choice(list(UrgencyLevel)).name v.notes = fake.sentence(nb_words=10, variable_nb_words=True, ext_word_list=None) v.full_clean() v.save() if v.program.pk == sep_program_id: # sep program does not have a queue. TODO: update program model to have isqueueable boolean or similar continue # Create FrontDeskEvents to correspond to the Visit, which always begins with ARRIVED arrived(v) if uds: create_uds_results(v) if medication: create_medication(v) if output: print( "Created visit: {} {}, {}, {}, {}".format( v.participant.first_name, v.participant.last_name, v.created_at, v.program.name, v.notes, ) )