in microservices/extraction_service/src/utils/table_extractor.py [0:0]
def get_table_using_header(page, inp_header):
"""uses the page info to extract the table
Args:
page (dict): dict that contains a table info
inp_header (list): list of column names to
match with the header of a table
"""
for pg_num in page:
for table_num in page[pg_num]:
if isinstance(table_num, int):
table_dict = page[pg_num][table_num]
table_header = [val[0] for val in table_dict["headers"]]
if TableExtractor.compare_lists(table_header, inp_header) >= 0.70:
return table_dict, table_header
else:
continue
Logger.error("Input headers does not match up to 70% with any table.")
return None