def create_participants(uds=True, medication=True): '''Create a fake participant, and optionally associated UDS and meds''' gender_list = list(Gender) race_list = list(Race) for _ in range(DEFAULT_NUMBER_PARTICIPANTS): last_four = fake.ssn(taxpayer_identification_number_type="SSN")[-4:] profile = fake.profile() gender = random.choice(gender_list) race = random.choice(race_list) participant = Participant( first_name=fake.first_name(), last_name=fake.last_name(), pp_id=fake.password(length=5, special_chars=False, digits=True, lower_case=False), gender=gender.value, race=race.value, last_four_ssn=last_four, date_of_birth=profile['birthdate'], start_date=fake.date_time(), ) participant.full_clean() participant.save() if uds: create_uds_results(participant) if medication: create_medication(participant)
def create_participants(): """Create a fake participant, and optionally associated UDS and meds""" gender_list = list(Gender) race_list = list(Race) insurers = Insurer.objects.all() for _ in range(DEFAULT_NUMBER_PARTICIPANTS): last_four = fake.ssn(taxpayer_identification_number_type="SSN")[-4:] profile = fake.profile() gender = random.choice(gender_list) race = random.choice(race_list) participant = Participant( first_name=fake.first_name(), last_name=fake.last_name(), pp_id=fake.password( length=5, special_chars=False, digits=True, lower_case=False ), gender=gender.value, race=race.value, last_four_ssn=last_four, date_of_birth=profile["birthdate"], start_date=fake.date_time(), is_insured=random_bool(), insurer=random.choice(insurers), ) participant.full_clean() participant.save()
def create_participants(): gender_list = list(Gender) race_list = list(Race) for _ in range(10): last_four = fake.ssn(taxpayer_identification_number_type="SSN")[-4:] profile = fake.profile() gender = random.choice(gender_list) race = random.choice(race_list) participant = Participant( first_name=fake.first_name(), last_name=fake.last_name(), pp_id="todo", gender=gender.value, race=race.value, last_four_ssn=last_four, date_of_birth=profile['birthdate'], start_date=fake.date_time(), ) participant.full_clean() participant.save() create_uds_results(participant) create_medication(participant)