Skip to content

Commit

Permalink
Add description and direction to json
Browse files Browse the repository at this point in the history
  • Loading branch information
hf-sheese committed Nov 16, 2023
1 parent 429e616 commit 30a78e3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/kohlrahbi/ahb/ahbtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class AhbTable:
"""

table: pd.DataFrame
metadata: list[str] = []

def fill_segment_gruppe_segment_dataelement(self) -> None:
"""
Expand Down Expand Up @@ -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:
"""
Expand Down
5 changes: 5 additions & 0 deletions src/kohlrahbi/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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,
)
8 changes: 7 additions & 1 deletion src/kohlrahbi/unfoldedahb/unfoldedahbtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
)

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions src/kohlrahbi/unfoldedahb/unfoldedahbtablemetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ class UnfoldedAhbTableMetaData:
"""

pruefidentifikator: str
beschreibung: str
kommunikation_von: str

0 comments on commit 30a78e3

Please sign in to comment.