def multi_page_legal(browser, legal_table, document, number_pages): legal_data = drop_last_line( title_strip(join_column_without_title(legal_table))) for current_page in range(number_pages - 1): next_legal_table(legal_table, document, (current_page + 2)) legal_table = get_legal_table(browser) legal_data = f'{legal_data}\n{drop_last_line(title_strip(join_column_without_title(legal_table)))}'
def record_document_type_and_number(browser, abstract, document): document_type, reception_number = access_document_type_and_number( browser, abstract, document) document.reception_number = reception_number record_value(abstract, 'document type', update_sentence_case_extras(title_strip(document_type))) handle_reception_number(abstract, document)
def record_document_type(general_information, dictionary): document_type = check_list_elements(general_information, row_titles["document_type"]) if document_type == not_applicable or document_type in bad_document_types: document_type = check_list_elements(general_information, row_titles["alt_document_type"]) dictionary["Document Type"].append(title_strip(document_type))
def prepare_name_search(): name = title_strip(search_name) if name == '': name = request_new_name() while request_yes_or_no(f'The current name to be searched is "{name}", is this correct?') is False: clear_terminal() name = request_new_name() clear_terminal() return Document(type="name", value=name)
def access_field_value(browser, document, id, field_type): field = locate_element_by_id(browser, id, field_type, document=document) if field_type.endswith('date'): return date_from_string(get_field_value(field).split(' ')[0]) elif field_type == 'document type': return update_sentence_case_extras(title_strip(get_field_value(field))) else: if field_type == 'reception number': document.reception_number = get_field_value(field) return get_field_value(field)
def record_date(row, dataframe, document, type): date = access_date(title_strip(row), document, type) dataframe[f'{type.title()} Date'].append(date)
def record_legal(abstract, document_table, document): legal = title_strip(document_table.text) record_value(abstract, 'legal', legal)
def record_grantee(abstract, rows): grantee = check_rows(abstract, rows, abstract.county.titles["Row Titles"]["grantee"]) record_value(abstract, 'grantee', title_strip(grantee))
def record_document_type(abstract, rows): document_type = check_rows( abstract, rows, abstract.county.titles["Row Titles"]["document_type"]) record_value(abstract, 'document type', title_strip(document_type))
def record_grantee_information(browser, dictionary, document): grantee_table = locate_document_table(browser, document, grantee_id, "grantee") grantee = title_strip(join_column_without_title(grantee_table)) dictionary["Grantee"].append(drop_hyphen(grantee))
def handle_legal_tables(browser, legal_table, document): number_pages = get_number_legal_pages(legal_table) if number_pages == 1: return title_strip(join_column_without_title(legal_table)) else: return multi_page_legal(browser, legal_table, document, number_pages)