diff --git a/src/kohlrahbi/ahb/ahbtable.py b/src/kohlrahbi/ahb/ahbtable.py index 774bb3f9..c6e7bfde 100644 --- a/src/kohlrahbi/ahb/ahbtable.py +++ b/src/kohlrahbi/ahb/ahbtable.py @@ -31,6 +31,7 @@ class AhbTable: """ table: pd.DataFrame + metadata: list[str] = [] def fill_segment_gruppe_segment_dataelement(self) -> None: """ @@ -75,7 +76,7 @@ def from_ahb_sub_table(cls, ahb_sub_table: AhbSubTable) -> "AhbTable": """ Create an AHB table from an AHB sub table """ - return cls(table=ahb_sub_table.table) + return cls(table=ahb_sub_table.table, metadata=ahb_sub_table.table_meta_data.metadata) def append_ahb_sub_table(self, ahb_sub_table: AhbSubTable) -> None: """ diff --git a/src/kohlrahbi/seed.py b/src/kohlrahbi/seed.py index d63747d8..ff7d996d 100644 --- a/src/kohlrahbi/seed.py +++ b/src/kohlrahbi/seed.py @@ -40,6 +40,7 @@ class Seed: middle_cell_left_indent_position: int = 0 tabstop_positions: list[int] = [] last_two_row_types: list[RowType] = [] + metadata: list[str] = [] # why this classmethod? # to decouple the data structure of Elixir from the input data @@ -71,6 +72,9 @@ def from_table(cls, docx_table: Table) -> "Seed": middle_cell_left_indent_position = middle_cell_indicator_paragraph.paragraph_format.left_indent tabstop_positions = get_tabstop_positions(middle_cell_indicator_paragraph) + # metadata + metadata = table_header.pruefi_meta_data + base_column_names: list = [ "Segment Gruppe", "Segment", @@ -90,4 +94,5 @@ def from_table(cls, docx_table: Table) -> "Seed": middle_cell_left_indent_position=middle_cell_left_indent_position, tabstop_positions=tabstop_positions, last_two_row_types=last_two_row_types, + metadata=metadata, ) diff --git a/src/kohlrahbi/unfoldedahb/unfoldedahbtable.py b/src/kohlrahbi/unfoldedahb/unfoldedahbtable.py index a72af357..3af8769b 100644 --- a/src/kohlrahbi/unfoldedahb/unfoldedahbtable.py +++ b/src/kohlrahbi/unfoldedahb/unfoldedahbtable.py @@ -216,6 +216,8 @@ def from_ahb_table(cls, ahb_table: AhbTable, pruefi: str): unfolded_ahb_lines=unfolded_ahb_lines, meta_data=UnfoldedAhbTableMetaData( pruefidentifikator=pruefi, + beschreibung=ahb_table.metadata[0].name, + kommunikation_von=ahb_table.metadata[0].communication_direction, ), ) @@ -306,7 +308,11 @@ def convert_to_flat_ahb(self) -> FlatAnwendungshandbuch: """ Converts the unfolded AHB to a flat AHB. """ - meta = AhbMetaInformation(pruefidentifikator=self.meta_data.pruefidentifikator) + meta = AhbMetaInformation( + pruefidentifikator=self.meta_data.pruefidentifikator, + description=self.meta_data.beschreibung, + direction=self.meta_data.kommunikation_von, + ) lines: list[AhbLine] = [] for unfolded_ahb_line in self.unfolded_ahb_lines: diff --git a/src/kohlrahbi/unfoldedahb/unfoldedahbtablemetadata.py b/src/kohlrahbi/unfoldedahb/unfoldedahbtablemetadata.py index f8fc8ed4..85395c84 100644 --- a/src/kohlrahbi/unfoldedahb/unfoldedahbtablemetadata.py +++ b/src/kohlrahbi/unfoldedahb/unfoldedahbtablemetadata.py @@ -13,3 +13,5 @@ class UnfoldedAhbTableMetaData: """ pruefidentifikator: str + beschreibung: str + kommunikation_von: str