Example #1
0
 def __init__(self):
     self.person = Person(locale='zh')
     self.address = Address(locale='zh')
     self.code = Code()
     self.business = Business(locale='zh')
     self.text = Text(locale='zh')
     self.datetime = Datetime(locale='zh')
     self.file = File()
     self.path = Path()
     self.internet = Internet()
     self.structure = Structure()
Example #2
0
def generate_menu_items(amount):
    date = Datetime()
    food = Food()
    business = Business()
    text = Text()
    code = Code()
    num = Numbers()

    model = "core.menuitem"
    items = []
    count = 1

    for _ in range(amount):
        fields = {"created": date.datetime(), "modified": date.datetime(), "title": food.dish()}
        fields["slug"] = f'{fields["title"].replace(" ", "-")}-{code.issn()}'
        fields["content"] = text.quote()
        fields["price"] = num.between(1, 100)
        fields["category"] = None
        fields["draft"] = False

        single = {
            "model": model,
            "pk": count,
            "fields": fields
        }

        count += 1
        items.append(single)

    with open("menu.json", "w") as f:
        json.dump(items, f, cls=DjangoJSONEncoder)
Example #3
0
def code(locale):
    """

    :param locale:
    :return:
    """
    return Code(locale)
Example #4
0
def generate_news_items(amount):
    date = Datetime()
    text = Text()
    num = Numbers()
    code = Code()

    model = "core.newsitem"
    items = []
    count = 1

    for _ in range(amount):
        fields = {}
        fields["created"] = date.datetime()
        fields["modified"] = date.datetime()
        fields["title"] = text.title()
        fields["slug"] = slugify(f"{fields['title']}-{code.ean()}")
        fields["content"] = text.text(6)
        fields["draft"] = False
        fields["category"] = random.randint(1, 3)

        single = {
            "model": model,
            "pk": count,
            "fields": fields
        }

        count += 1
        items.append(single)

    with open("news.json", "w") as f:
        json.dump(items, f, cls=DjangoJSONEncoder)
Example #5
0
class CSVData:
    def __init__(self):
        self.person = Person(locale='zh')
        self.address = Address(locale='zh')
        self.code = Code()
        self.business = Business(locale='zh')
        self.text = Text(locale='zh')
        self.datetime = Datetime(locale='zh')
        self.file = File()
        self.path = Path()
        self.internet = Internet()
        self.structure = Structure()

    def mime_data(self):
        # col1 = self.person.full_name()
        col1 = self.person.last_name() + self.person.first_name()
        col2 = self.address.city()
        col3 = self.address.street_name()
        col4 = self.address.calling_code()
        col5 = self.address.longitude()
        col6 = self.code.imei()
        col7 = self.business.company()
        col8 = self.text.hex_color()
        col9 = self.datetime.formatted_datetime()
        col10 = self.datetime.time()

        col11 = self.file.file_name()
        col12 = self.path.dev_dir()
        col13 = self.internet.ip_v4()
        col14 = self.internet.ip_v6()
        col15 = self.internet.home_page()
        col16 = self.internet.stock_image()
        col17 = self.internet.user_agent()
        col18 = self.internet.mac_address()
        col19 = self.person.email()
        col20 = self.person.telephone()

        col21 = self.code.issn()
        col22 = self.person.social_media_profile()
        col23 = self.structure.html()

        line = '\"{0}\", \"{1}\", \"{2}\", \"{3}\", {4}, \"{5}\", \"{6}\" , \"{7}\" , \"{8}\" , \"{9}\" , \"{10}\" , \"{11}\" , \"{12}\" , \"{13}\" , \"{14}\" , \"{15}\" , \"{16}\" , \"{17}\" , \"{18}\" , \"{19}\" , \"{20}\" , \"{21}\" , \"{22}\"\n'.format(
                col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12, col13, col14, col15, col16, col17, col18, col19, col20, col21, col22, col23)

        # line = "mime data"
        # print(line)
        return line
Example #6
0
def generate_initial_date(obs=50):
    data = []
    for i in range(1, obs):
        first_name = Person().name()
        last_name = Person().last_name()
        item = {
            'id': i,
            'first_name': first_name,
            'last_name': last_name,
            'company_id': Code().pin(mask='##-####-######'),
            'title': Person().occupation(),
            'email': f"{first_name}.{last_name}@company.com",
            'salary': random.randint(55000, 160000),
            'performance_score': random.normalvariate(2.5, 1),
        }
        data.append(item)
    return data
Example #7
0
    def ii_push_record(self, in_record: object) -> bool:
        """
        Responsible for pushing records out.
        Called when an input record is being sent to the plugin.
        :param in_record: The data for the incoming record.
        :return: False if there's a downstream error, or if there's an error with the field name, otherwise True.
        """

        if not self.parent.is_initialized:
            return False

        #create the new fields
        record_value = None
        for field in enumerate(self.record_info_out):
            if field[1].name == 'address_full_address':
                mimesis_object = Address(self.parent.Locale)
                record_value = mimesis_object.address()
            if field[1].name == 'address_coordinates':
                mimesis_object = Address(self.parent.Locale)
                record_value = str(mimesis_object.coordinates())
            if field[1].name == 'address_country':
                mimesis_object = Address(self.parent.Locale)
                record_value = mimesis_object.country()
            if field[1].name == 'address_postal_code':
                mimesis_object = Address(self.parent.Locale)
                record_value = mimesis_object.postal_code()
            if field[1].name == 'code_imei':
                mimesis_object = Code(self.parent.Locale)
                record_value = mimesis_object.imei()
            if field[1].name == 'code_isbn':
                mimesis_object = Code(self.parent.Locale)
                record_value = mimesis_object.isbn()
            if field[1].name == 'code_pin':
                mimesis_object = Code(self.parent.Locale)
                record_value = mimesis_object.pin()
            if field[1].name == 'food_dish':
                mimesis_object = Food(self.parent.Locale)
                record_value = mimesis_object.dish()
            if field[1].name == 'food_fruit':
                mimesis_object = Food(self.parent.Locale)
                record_value = mimesis_object.fruit()
            if field[1].name == 'food_vegetables':
                mimesis_object = Food(self.parent.Locale)
                record_value = mimesis_object.vegetable()
            '''if field[1].name == 'game_gaming_platform':
                mimesis_object = Games(self.parent.Locale)
                record_value = mimesis_object.gaming_platform()
            if field[1].name == 'game_titles':
                mimesis_object = Games(self.parent.Locale)
                record_value = mimesis_object.game()'''
            if field[1].name == 'person_blood_type':
                mimesis_object = Person(self.parent.Locale)
                record_value = mimesis_object.blood_type()
            if field[1].name == 'person_email':
                mimesis_object = Person(self.parent.Locale)
                record_value = mimesis_object.email()
            if field[1].name == 'person_full_name':
                mimesis_object = Person(self.parent.Locale)
                record_value = mimesis_object.full_name()
            if field[1].name == 'person_nationality':
                mimesis_object = Person(self.parent.Locale)
                record_value = mimesis_object.nationality()
            if field[1].name == 'person_occupation':
                mimesis_object = Person(self.parent.Locale)
                record_value = mimesis_object.occupation()
            if field[1].name == 'person_telephone':
                mimesis_object = Person(self.parent.Locale)
                record_value = mimesis_object.telephone()
            if field[1].name == 'science_atomic_number':
                mimesis_object = Science(self.parent.Locale)
                record_value = str(mimesis_object.atomic_number())
            if field[1].name == 'science_chemical_element':
                mimesis_object = Science(self.parent.Locale)
                record_value = mimesis_object.chemical_element()
            if field[1].name == 'transport_airplane':
                mimesis_object = Transport(self.parent.Locale)
                record_value = mimesis_object.airplane()
            if field[1].name == 'transport_car':
                mimesis_object = Transport(self.parent.Locale)
                record_value = mimesis_object.car()
            if field[1].name == 'transport_truck':
                mimesis_object = Transport(self.parent.Locale)
                record_value = mimesis_object.truck()
            if field[1].name == 'transport_vehicle_reg_code':
                mimesis_object = Transport(self.parent.Locale)
                record_value = mimesis_object.vehicle_registration_code()
                #pdb.set_trace()
            self.record_info_out[field[0]].set_from_string(self.record_creator, record_value)
        out_record = self.record_creator.finalize_record()
        #self.parent.output_anchor.push_record(out_record, False)
        self.record_creator.reset()


        # Copy the data from the incoming record into the outgoing record.
        self.record_creator.reset()
        self.record_copier.done_adding()
        self.record_copier.copy(self.record_creator, in_record)

        # Push the record downstream and quit if there's a downstream error.
        if not self.parent.output_anchor.push_record(out_record):
            return False

        return True
Example #8
0
    def pi_push_all_records(self, n_record_limit: int) -> bool:
        """
        Called when a tool has no incoming data connection.
        :param n_record_limit: Set it to <0 for no limit, 0 for no records, and >0 to specify the number of records.
        :return: True for success, False for failure.
        """

        if not self.is_initialized:
            return False

        # Save a reference to the RecordInfo passed into this function in the global namespace, so we can access it later.
        record_info_out = Sdk.RecordInfo(self.alteryx_engine)

        # Adds the new field to the record.
        for field in self.column_name:
            self.output_field = record_info_out.add_field(field, self.output_type, size=self.field_size)

        # Lets the downstream tools know what the outgoing record metadata will look like, based on record_info_out.
        self.output_anchor.init(record_info_out)
        # Creating a new, empty record creator based on record_info_out's record layout.
        record_creator = record_info_out.construct_record_creator()

        #import pdb; pdb.set_trace()

        #sophs code:
        for record in range(self.record_limit):
            for field in enumerate(record_info_out):
                if field[1].name == 'address_full_address':
                    mimesis_object = Address(self.Locale)
                    record_value = mimesis_object.address()
                if field[1].name == 'address_coordinates':
                    mimesis_object = Address(self.Locale)
                    record_value = str(mimesis_object.coordinates())
                if field[1].name == 'address_country':
                    mimesis_object = Address(self.Locale)
                    record_value = mimesis_object.country()
                if field[1].name == 'address_postal_code':
                    mimesis_object = Address(self.Locale)
                    record_value = mimesis_object.postal_code()
                if field[1].name == 'code_imei':
                    mimesis_object = Code(self.Locale)
                    record_value = mimesis_object.imei()
                if field[1].name == 'code_isbn':
                    mimesis_object = Code(self.Locale)
                    record_value = mimesis_object.isbn()
                if field[1].name == 'code_pin':
                    mimesis_object = Code(self.Locale)
                    record_value = mimesis_object.pin()
                if field[1].name == 'food_dish':
                    mimesis_object = Food(self.Locale)
                    record_value = mimesis_object.dish()
                if field[1].name == 'food_fruit':
                    mimesis_object = Food(self.Locale)
                    record_value = mimesis_object.fruit()
                if field[1].name == 'food_vegetables':
                    mimesis_object = Food(self.Locale)
                    record_value = mimesis_object.vegetable()
                '''if field[1].name == 'game_gaming_platform':
                    mimesis_object = Games(self.Locale)
                    record_value = mimesis_object.gaming_platform()
                if field[1].name == 'game_titles':
                    mimesis_object = Games(self.Locale)
                    record_value = mimesis_object.game()'''
                if field[1].name == 'person_blood_type':
                    mimesis_object = Person(self.Locale)
                    record_value = mimesis_object.blood_type()
                if field[1].name == 'person_email':
                    mimesis_object = Person(self.Locale)
                    record_value = mimesis_object.email()
                if field[1].name == 'person_full_name':
                    mimesis_object = Person(self.Locale)
                    record_value = mimesis_object.full_name()
                if field[1].name == 'person_nationality':
                    mimesis_object = Person(self.Locale)
                    record_value = mimesis_object.nationality()
                if field[1].name == 'person_occupation':
                    mimesis_object = Person(self.Locale)
                    record_value = mimesis_object.occupation()
                if field[1].name == 'person_telephone':
                    mimesis_object = Person(self.Locale)
                    record_value = mimesis_object.telephone()
                if field[1].name == 'science_atomic_number':
                    mimesis_object = Science(self.Locale)
                    record_value = str(mimesis_object.atomic_number())
                if field[1].name == 'science_chemical_element':
                    mimesis_object = Science(self.Locale)
                    record_value = mimesis_object.chemical_element()
                if field[1].name == 'transport_airplane':
                    mimesis_object = Transport(self.Locale)
                    record_value = mimesis_object.airplane()
                if field[1].name == 'transport_car':
                    mimesis_object = Transport(self.Locale)
                    record_value = mimesis_object.car()
                if field[1].name == 'transport_truck':
                    mimesis_object = Transport(self.Locale)
                    record_value = mimesis_object.truck()
                if field[1].name == 'transport_vehicle_reg_code':
                    mimesis_object = Transport(self.Locale)
                    record_value = mimesis_object.vehicle_registration_code()
                record_info_out[field[0]].set_from_string(record_creator, record_value)
            out_record = record_creator.finalize_record()
            self.output_anchor.push_record(out_record, False)
            record_creator.reset()


        # Make sure that the output anchor is closed.
        self.output_anchor.close()
        return True
Example #9
0
def code():
    return Code()
Example #10
0
    def ii_push_record(self, in_record: object) -> bool:
        """
        Responsible for pushing records out.
        Called when an input record is being sent to the plugin.
        :param in_record: The data for the incoming record.
        :return: False if there's a downstream error, or if there's an error with the field name, otherwise True.
        """

        if not self.parent.is_initialized:
            return False

        #create the new fields
        record_value = None
        for field in enumerate(self.record_info_out):
            if field[1].name == 'number_float':
                mimesis_object = Numbers()
                record_value = str(
                    mimesis_object.float_number(end=10000, precision=6))
            if field[1].name == 'number_float_positive':
                mimesis_object = Numbers()
                record_value = str(
                    mimesis_object.float_number(start=0,
                                                end=10000,
                                                precision=6))
            if field[1].name == 'number_int':
                mimesis_object = Numbers()
                record_value = str(
                    mimesis_object.integer_number(start=-32767, end=32767))
            if field[1].name == 'number_int_positive':
                mimesis_object = Numbers()
                record_value = str(
                    mimesis_object.integer_number(start=0, end=32767))
            if field[1].name == 'address_street_address':
                mimesis_object = Address(self.Locale)
                record_value = mimesis_object.address()
            if field[1].name == 'address_coordinates':
                mimesis_object = Address(self.Locale)
                record_value = str(mimesis_object.coordinates())
            if field[1].name == 'address_country':
                mimesis_object = Address(self.Locale)
                record_value = mimesis_object.country(allow_random=True)
            if field[1].name == 'address_postal_code':
                mimesis_object = Address(self.Locale)
                record_value = mimesis_object.postal_code()
            if field[1].name == 'code_imei':
                mimesis_object = Code()
                record_value = mimesis_object.imei()
            if field[1].name == 'code_isbn':
                mimesis_object = Code()
                record_value = mimesis_object.isbn()
            if field[1].name == 'code_pin':
                mimesis_object = Code()
                record_value = mimesis_object.pin()
            if field[1].name == 'food_dish':
                mimesis_object = Food(self.Locale)
                record_value = mimesis_object.dish()
            if field[1].name == 'food_fruit':
                mimesis_object = Food(self.Locale)
                record_value = mimesis_object.fruit()
            if field[1].name == 'food_vegetables':
                mimesis_object = Food(self.Locale)
                record_value = mimesis_object.vegetable()
            if field[1].name == 'internet_url':
                mimesis_object = Internet()
                record_value = mimesis_object.home_page()
            if field[1].name == 'internet_ipv4':
                mimesis_object = Internet()
                record_value = mimesis_object.ip_v4()
            if field[1].name == 'internet_mac':
                mimesis_object = Internet()
                record_value = mimesis_object.mac_address()
            if field[1].name == 'person_blood_type':
                mimesis_object = Person(self.Locale)
                record_value = mimesis_object.blood_type()
            if field[1].name == 'person_email':
                mimesis_object = Person(self.Locale)
                record_value = mimesis_object.email()
            if field[1].name == 'person_full_name':
                mimesis_object = Person(self.Locale)
                record_value = mimesis_object.full_name()
            if field[1].name == 'person_nationality':
                mimesis_object = Person(self.Locale)
                record_value = mimesis_object.nationality()
            if field[1].name == 'person_occupation':
                mimesis_object = Person(self.Locale)
                record_value = mimesis_object.occupation()
            if field[1].name == 'person_telephone':
                mimesis_object = Person(self.Locale)
                record_value = mimesis_object.telephone()
            if field[1].name == 'science_atomic_number':
                mimesis_object = Science(self.Locale)
                record_value = str(mimesis_object.atomic_number())
            if field[1].name == 'science_chemical_element':
                mimesis_object = Science(self.Locale)
                record_value = mimesis_object.chemical_element()
            if field[1].name == 'transport_airplane':
                mimesis_object = Transport()
                record_value = mimesis_object.airplane()
            if field[1].name == 'transport_car':
                mimesis_object = Transport()
                record_value = mimesis_object.car()
            if field[1].name == 'transport_truck':
                mimesis_object = Transport()
                record_value = mimesis_object.truck()
            if field[1].name == 'transport_vehicle_reg_code':
                mimesis_object = Transport()
                record_value = mimesis_object.vehicle_registration_code()
            if field[1].name == 'business_company_name':
                mimesis_object = Business()
                record_value = mimesis_object.company()
            if field[1].name == 'business_company_type':
                mimesis_object = Business()
                record_value = mimesis_object.company_type()
            if field[1].name == 'file_filename':
                mimesis_object = File()
                record_value = mimesis_object.file_name()
            if field[1].name == 'file_file_extension':
                mimesis_object = File()
                record_value = mimesis_object.extension()
            if field[1].name == 'file_mime_type':
                mimesis_object = File()
                record_value = mimesis_object.mime_type()
            if field[1].name == 'file_size':
                mimesis_object = File()
                record_value = mimesis_object.size()
            self.record_info_out[field[0]].set_from_string(
                self.record_creator, record_value)
        out_record = self.record_creator.finalize_record()
        #self.parent.output_anchor.push_record(out_record, False)
        self.record_creator.reset()

        # Copy the data from the incoming record into the outgoing record.
        self.record_creator.reset()
        self.record_copier.done_adding()
        self.record_copier.copy(self.record_creator, in_record)

        # Push the record downstream and quit if there's a downstream error.
        if not self.parent.output_anchor.push_record(out_record):
            return False

        return True
Example #11
0
 def _codes(self, seed):
     return Code(seed=seed), Code(seed=seed)
Example #12
0
import cProfile
from mimesis import Person, Numbers, Food, Datetime, Code
import random

person = Person('ru')
num = Numbers()
products = Food('ru')
card_code = Code()
date_time = Datetime()

array_transaction_type = ["Cash", "Card"]
array_product_prices = []
array_orders = []
array_orders_price = []
array_clients_id = []
array_transaction_id = []

file_clients = open('clients_table.txt', 'w')
file_products = open('products_table.txt', 'w')
file_bonuscards = open('bonuscards_table.txt', 'w')
file_orders = open('orders_table.txt', 'w')
file_transactions = open('transactions_table.txt', 'w')


def create_and_shuffle_array(size, array):
    for i in range(size):
        array.append(i)
    random.shuffle(array)


#client table
Example #13
0
    def new_data_contragent_SNG(self, role, type_company):
        extra = (b.RussiaSpecProvider, )
        data_company = Field(locales.RU, providers=extra)

        new_user_SNG = {
            "login":
            Person(locales.RU).username(),
            "password":
            "******",
            "user_mail":
            Person(locales.RU).email(),
            "first_name_user":
            Person(locales.RU).name(Gender.MALE),
            "last_name_user":
            Person(locales.RU).last_name(Gender.MALE),
            "job_user":
            Person('ru').occupation(),
            "user_phone":
            Person('ru').telephone('8##########'),
            "resident":
            2,
            "role":
            role,
            "type_company":
            type_company,
            "name_company":
            Business(locales.RU).company_type() + ' \"' +
            Business(locales.RU).company() + '\"',
            "register_number":
            data_company('kpp'),
            "tin":
            data_company('snils'),
            "inn":
            data_company('inn'),
            "general_email":
            Person(locales.EN).email(),
            "general_phone":
            Person('ru').telephone('7##########'),
            "country":
            "Беларусь",
            "index":
            Address('ru').postal_code(),
            "region":
            "Минск",
            "city":
            Address('ru').city(),
            "street":
            Address('ru').street_suffix() + " " + Address('ru').street_name(),
            "house":
            Address('ru').street_number(),
            "last_name":
            Person(locales.RU).last_name(Gender.FEMALE),
            "first_name":
            Person(locales.RU).name(Gender.FEMALE),
            "middle_name":
            Person(locales.RU).name(Gender.FEMALE),
            "job":
            Person('ru').occupation(),
            "bank_account":
            Code().imei(),
            "iban":
            Code().ean(),
            "bank_name":
            "Sberbank_Belarus",
            "bank_swift":
            "SABRRUMM"
        }

        return new_user_SNG
class Fakers:
    CODE = Code('en')
    DATETIME = Datetime('en')
    PERSON = Personal('en')
    TEXT = Text('en')
Example #15
0
 def code(self):
     return Code()
Example #16
0
 def c2(self, seed):
     return Code(seed=seed)
def createData(num):
    # authors
    for i in range(random.randint(num // 4, num * 4)):
        authors.append({"name": Person().full_name()})

    # publisher
    for i in range(random.randint(num // 4, num * 4)):
        publisher.append({"name": Business().company()})

    # tag
    for i in range(random.randint(num // 4, num * 4)):
        tags.append({"value": Text().word()})

    # users
    for i in range(random.randint(num // 4, num)):
        users.append({
            "name": Person().full_name(),
            "password": Person().password(),
            "username": Person().username(),
            "email": Person().email(),
            "usertype": random.choice(ut),
        })

    # messages
    for i in range(random.randint(num // 2, num * 8)):
        messages.append({
            "text":
            Text().sentence(),
            "user_id":
            Numbers().between(minimum=1, maximum=len(users)),
            "timestamp":
            Datetime().datetime(start=2016, end=2018)
        })

    # books
    for i in range(random.randint(num // 4, num * 4)):
        if random.random() < 0.4:
            books.append({
                "pages":
                Numbers().between(minimum=100, maximum=1000),
                "title":
                Text().quote(),
                "year":
                Datetime().year(minimum=2013, maximum=2018),
                "isbn":
                Code().isbn(),
                "adddate":
                Datetime().date(start=2013, end=2018),
                # "issuetime": "NULL",
                "publisher_id":
                Numbers().between(minimum=1, maximum=len(publisher)),
                # "user_id": "NULL"
            })
        else:
            opendate = Datetime().year(minimum=2013, maximum=2018)
            adddate = Datetime().date(start=opendate, end=2018)
            books.append({
                "pages":
                Numbers().between(minimum=100, maximum=1000),
                "title":
                Text().quote(),
                "year":
                opendate,
                "isbn":
                Code().isbn(),
                "adddate":
                adddate,
                "issuetime":
                Datetime().datetime(start=adddate.year, end=2018),
                "publisher_id":
                Numbers().between(minimum=1, maximum=len(publisher)),
                "user_id":
                Numbers().between(minimum=1, maximum=len(users))
            })

    # Periodical
    for i in range(random.randint(num // 4, num * 4)):
        if random.random() < 0.4:
            periodicals.append({
                "title":
                Text().quote(),
                "year":
                Datetime().year(minimum=2013, maximum=2018),
                "isbn":
                Code().isbn(),
                "adddate":
                Datetime().date(start=2013, end=2018),
                # "issuetime": "NULL",
                "publisher_id":
                Numbers().between(minimum=1, maximum=len(publisher)),
                # "user_id": "NULL",
                "volume":
                Numbers().between(minimum=1, maximum=10)
            })
        else:
            opendate = Datetime().year(minimum=2013, maximum=2018)
            adddate = Datetime().date(start=opendate, end=2018)
            periodicals.append({
                "title":
                Text().quote(),
                "year":
                opendate,
                "isbn":
                Code().isbn(),
                "adddate":
                adddate,
                "issuetime":
                Datetime().datetime(start=adddate.year, end=2018),
                "publisher_id":
                Numbers().between(minimum=1, maximum=len(publisher)),
                "user_id":
                Numbers().between(minimum=1, maximum=len(users)),
                "volume":
                Numbers().between(minimum=1, maximum=10)
            })

    # papers
    for i in range(random.randint(num // 4, num * 2)):
        papers.append({
            "name":
            Text().quote(),
            "periodical_id":
            Numbers().between(minimum=1, maximum=len(periodicals))
        })

    # book author
    for i in range(len(books)):
        bookauthor.append({
            "book_id":
            i + 1,
            "author_id":
            Numbers().between(minimum=1, maximum=len(authors))
        })

    # paper author
    for i in range(len(papers)):
        authorpaper.append({
            "paper_id":
            i + 1,
            "author_id":
            Numbers().between(minimum=1, maximum=len(authors))
        })

    # book tag
    for i in range(len(books)):
        booktag.append({
            "book_id":
            i + 1,
            "tag_id":
            Numbers().between(minimum=1, maximum=len(tags))
        })

    # periodical tag
    for i in range(len(periodicals)):
        periodicaltag.append({
            "periodical_id":
            i + 1,
            "tag_id":
            Numbers().between(minimum=1, maximum=len(tags))
        })

    # book history tag
    for i in range(random.randint(num, num * 4)):
        boid = Numbers().between(minimum=1, maximum=len(books))
        issd = Datetime().date(start=books[boid - 1]["adddate"].year, end=2018)
        retd = Datetime().date(start=issd.year, end=2018)
        bhistory.append({
            "issuedate":
            issd,
            "returndate":
            retd,
            "book_id":
            boid,
            "user_id":
            Numbers().between(minimum=1, maximum=len(users)),
        })

    # periodical history tag
    for i in range(random.randint(num, num * 4)):
        boid = Numbers().between(minimum=1, maximum=len(periodicals))
        issd = Datetime().date(start=periodicals[boid - 1]["adddate"].year,
                               end=2018)
        retd = Datetime().date(start=issd.year, end=2018)
        phistory.append({
            "issuedate":
            issd,
            "returndate":
            retd,
            "periodical_id":
            boid,
            "user_id":
            Numbers().between(minimum=1, maximum=len(users)),
        })

    temp = ['Students', 'Faculty', 'Staff', 'Guest']
    mb = [3, 6, 4, 2]
    md = [15, 30, 30, 7]
    for i in range(4):
        capacity.append({
            "usertype": temp[i],
            "maxbooks": mb[i],
            "maxdays": md[i],
        })

    # discipline
    for i in range(len(books)):
        discipline.append({
            "discipline": Text().word(),
            "book_id": i + 1,
        })