예제 #1
0
def add_125_field(project):
    field_list = read_table(project)
    number_of_threads = 8
    length_of_chunks = math.ceil(len(field_list) / number_of_threads)
    list_chunks = list(chunks(field_list, length_of_chunks))
    for chunk_index, chunk in enumerate(list_chunks):
        thread = Thread(target=add_125_field_for_chunk, args=(chunk, 'test'))
        thread.start()
예제 #2
0
def run_function_on_chunks(project, function, additional_argument='test', number_of_threads=8):
    complete_list = table_reader_service.read_table(project)
    length_of_chunks = math.ceil(len(complete_list) / number_of_threads)
    list_chunks = list(chunks(complete_list, length_of_chunks))
    for chunk_index, chunk in enumerate(list_chunks):
        thread = Thread(target=function,
                        args=(chunk, additional_argument))
        thread.start()
예제 #3
0
def correct_holding_signatures(project):
    holding_list = table_reader_service.read_table(project)
    number_of_threads = 8
    length_of_chunks = math.ceil(len(holding_list) / number_of_threads)
    list_chunks = list(chunks(holding_list, length_of_chunks))
    for chunk_index, chunk in enumerate(list_chunks):
        thread = Thread(target=correct_holding_signatures_for_chunk,
                        args=(chunk, 'test'))
        thread.start()
예제 #4
0
def correct_process_type_by_mms(project, department):
    item_list = table_reader_service.read_table(project)
    number_of_threads = 8
    length_of_chunks = math.ceil(len(item_list) / number_of_threads)
    list_chunks = list(chunks(item_list, length_of_chunks))
    for chunk_index, chunk in enumerate(list_chunks):
        thread = Thread(target=correct_process_type_by_mms_for_chunk,
                        args=(chunk, department))
        thread.start()
예제 #5
0
def correct_item_shelfmarks(project):
    item_list = table_reader_service.read_table(project)
    number_of_threads = 8
    length_of_chunks = math.ceil(len(item_list) / number_of_threads)
    list_chunks = list(chunks(item_list, length_of_chunks))
    for chunk_index, chunk in enumerate(list_chunks):
        thread = Thread(target=correct_item_shelfmarks_for_chunk,
                        args=(chunk, 'test'))
        thread.start()
예제 #6
0
def set_holding_signatures(project):
    holdings_list = read_table(project)
    logging.info('{} holdings in list'.format(len(holdings_list)))
    holdings_list.drop_duplicates(inplace=True)
    logging.info('{} holdings in deduplicated list'.format(len(holdings_list)))
    number_of_threads = 8
    length_of_chunks = math.ceil(len(holdings_list) / number_of_threads)
    list_chunks = list(chunks(holdings_list, length_of_chunks))
    for chunk_index, chunk in enumerate(list_chunks):
        thread = Thread(target=set_holding_shelfmark_for_chunk,
                        args=(chunk, 'test'))
        thread.start()
예제 #7
0
            collection_id = row['Collection_IDs'][0]
            alma_electronic_service.add_portfolios_to_collection(project=project, portfolio_id=portfolio_id,
                                                                 service_id=service_id, collection_id=collection_id)


if __name__ == '__main__':
    # den Namen des Laufs angeben. Dieser definiert den name der Log-Datei und den Typ an Liste, die geladen wird.
    project = 'marks'

    new_run = False

    electronic_library = 'E0001'

    if new_run:
        # Excel-Tabelle mit Abrufkennzeichen einlesen
        table = read_table(project=project)
    else:
        table = table_reader_service.reload_table(project=project, index=1)

    # den Namen der Logdatei festlegen
    log_file = 'data/output/{}.log'.format(project)

    # den Logger konfigurieren (Dateinamen, Level)
    logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', filename=log_file, level=logging.INFO)

    logging.info('running new project {}'.format(project))

    # die Gesamtzahl der Einträge abrufen
    # table = collect_number_of_entries(project=project, table=table)

    # die MMS-IDs hinzuschreiben
예제 #8
0
def run_project(project):
    log_file = 'data/output/transfer_{}.log'.format(project)

    for handler in logging.root.handlers[:]:
        logging.root.removeHandler(handler)

    # den Logger konfigurieren (Dateinamen, Level)
    logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s',
                        filename=log_file,
                        level=logging.DEBUG)

    logging.info('starting project {}'.format(project))

    transfer_project = transfer_service.load_project(project)
    table = table_reader_service.read_transfer_table(transfer_project)
    # table = get_mms_ids(table)
    # table = get_holding_ids(table)
    table = transfer_field(table, project)
    table.to_excel('result.xlsx')


if __name__ == '__main__':
    # projects = ['field_125']
    projects = ['delete_852_z']
    for project in projects:
        table = table_reader_service.read_table(project)
        get_mms_ids(table)
        process_holdings(table)

    logging.info('finished')