Skip to content

Commit

Permalink
ignore ahb tables where no pruefi is provided (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaDaniel committed Jul 11, 2024
1 parent eeeb3b2 commit cf2e14e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/kohlrahbi/ahb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ def extract_pruefis_from_table(table: Table) -> list[str]:

def table_header_contains_text_pruefidentifikator(table: Table) -> bool:
"""Checks if the table header contains the text 'Prüfidentifikator'."""
return table.row_cells(0)[-1].paragraphs[-1].text.startswith("Prüfidentifikator") # type:ignore[no-any-return]
pattern = r"Prüfidentifikator(?:\t){0,10}\t\d+"
# "matches "Prüfidentifikator" followed by at least 1 tab separated numbers, max 11 pruefis is chosen arbitrarily
return bool(re.search(pattern, table.row_cells(0)[-1].text))


def get_pruefi_to_file_mapping(basic_input_path: Path, format_version: EdifactFormatVersion) -> dict[str, str]:
Expand Down

0 comments on commit cf2e14e

Please sign in to comment.