Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ebd_names to TableMetaData and GraphMetaData; therefore remove sub_chapter #286

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ ebd_table: EbdTable # this is the result of scraping the docx file
ebd_table = EbdTable( # this data shouldn't be handwritten
metadata=EbdTableMetaData(
ebd_code="E_0003",
chapter="7.39 AD: Bestellung der Aggregationsebene der Bilanzkreissummenzeitreihe auf Ebene der Regelzone",
sub_chapter="7.39.1 E_0003_Bestellung der Aggregationsebene RZ prüfen",
chapter="MaBiS",
section="7.39 AD: Bestellung der Aggregationsebene der Bilanzkreissummenzeitreihe auf Ebene der Regelzone",
ebd_name="Bestellung der Aggregationsebene RZ prüfen",
role="ÜNB",
),
rows=[
Expand Down
3 changes: 2 additions & 1 deletion src/rebdhuhn/graph_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ def convert_table_to_graph(table: EbdTable) -> EbdGraph:
graph_metadata = EbdGraphMetaData(
ebd_code=table.metadata.ebd_code,
chapter=table.metadata.chapter,
sub_chapter=table.metadata.sub_chapter,
section=table.metadata.section,
ebd_name=table.metadata.ebd_name,
role=table.metadata.role,
)
return EbdGraph(metadata=graph_metadata, graph=graph, multi_step_instructions=table.multi_step_instructions)
2 changes: 1 addition & 1 deletion src/rebdhuhn/graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def convert_graph_to_dot(ebd_graph: EbdGraph) -> str:
_mark_last_common_ancestors(nx_graph)
header = (
f'<B><FONT POINT-SIZE="18">{ebd_graph.metadata.chapter}</FONT></B><BR/><BR/>'
f'<B><FONT POINT-SIZE="16">{ebd_graph.metadata.sub_chapter}</FONT></B><BR/><BR/><BR/><BR/>'
f'<B><FONT POINT-SIZE="16">{ebd_graph.metadata.section}</FONT></B><BR/><BR/><BR/><BR/>'
)
dot_attributes: dict[str, str] = {f"'{ADD_INDENT}labelloc": '"t"', "label": f"<{header}>"}
dot_code = "digraph D {\n"
Expand Down
11 changes: 8 additions & 3 deletions src/rebdhuhn/models/ebd_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ class EbdGraphMetaData:
chapter: str = attrs.field(validator=attrs.validators.instance_of(str))
"""
Chapter from the EDI@Energy Document
e.g. MaBis
"""
section: str = attrs.field(validator=attrs.validators.instance_of(str))
"""
Section from the EDI@Energy Document
e.g. '7.24 AD: Übermittlung Datenstatus für die Bilanzierungsgebietssummenzeitreihe vom BIKO an ÜNB und NB'
"""
sub_chapter: str = attrs.field(validator=attrs.validators.instance_of(str))
ebd_name: str = attrs.field(validator=attrs.validators.instance_of(str))
"""
Sub Chapter from the EDI@Energy Document
e.g. '7.24.1 Datenstatus nach erfolgter Bilanzkreisabrechnung vergeben'
EBD name from the EDI@Energy Document
e.g. 'E_0003_Bestellung der Aggregationsebene RZ prüfen'
"""
role: str = attrs.field(validator=attrs.validators.instance_of(str))
"""
Expand Down
11 changes: 8 additions & 3 deletions src/rebdhuhn/models/ebd_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,22 @@ class EbdTableMetaData:
chapter: str = attrs.field(validator=attrs.validators.instance_of(str))
"""
Chapter from the EDI@Energy Document
e.g. '7.24 AD: Übermittlung Datenstatus für die Bilanzierungsgebietssummenzeitreihe vom BIKO an ÜNB und NB'
e.g. MaBiS
"""
sub_chapter: str = attrs.field(validator=attrs.validators.instance_of(str))
section: str = attrs.field(validator=attrs.validators.instance_of(str))
"""
Sub Chapter from the EDI@Energy Document
Section from the EDI@Energy Document
e.g. '7.24.1 Datenstatus nach erfolgter Bilanzkreisabrechnung vergeben'
"""
role: str = attrs.field(validator=attrs.validators.instance_of(str))
"""
e.g. 'BIKO' for "Prüfende Rolle: 'BIKO'"
"""
ebd_name: str = attrs.field(validator=attrs.validators.instance_of(str))
"""
EBD name from the EDI@Energy Document
e.g. 'E_0003_Bestellung der Aggregationsebene RZ prüfen'
"""
remark: Optional[str] = attrs.field(
default=None, validator=attrs.validators.optional(attrs.validators.instance_of(str))
)
Expand Down
2 changes: 1 addition & 1 deletion src/rebdhuhn/plantuml.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def convert_graph_to_plantuml(graph: EbdGraph) -> str:
"title\n"
f"{graph.metadata.chapter}\n"
"\n"
f"{graph.metadata.sub_chapter}\n"
f"{graph.metadata.section}\n"
"\n"
"\n"
"\n"
Expand Down
3 changes: 2 additions & 1 deletion unittests/e0266.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
metadata=EbdTableMetaData(
ebd_code="E_0266",
chapter="WiM Strom",
sub_chapter="9.26.3: AD Abrechnung einer für den ESA erbrachten Leistung",
section="9.26.3: AD Abrechnung einer für den ESA erbrachten Leistung",
ebd_name="E_0266 Some Name",
role="ESA",
),
rows=[
Expand Down
6 changes: 5 additions & 1 deletion unittests/e0401.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

e_0401 = EbdTable(
metadata=EbdTableMetaData(
ebd_code="E_0401", chapter="GPKE", sub_chapter="6.2.1: AD: Lieferende LF an NB", role="NB"
ebd_code="E_0401",
chapter="GPKE",
section="6.2.1: AD: Lieferende LF an NB",
ebd_name="6.2.1 E_0401_Abmeldung prüfen",
role="NB",
),
rows=[
EbdTableRow(
Expand Down
8 changes: 7 additions & 1 deletion unittests/e0404.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
from rebdhuhn.models import EbdCheckResult, EbdTable, EbdTableMetaData, EbdTableRow, EbdTableSubRow

e_0404 = EbdTable(
metadata=EbdTableMetaData(ebd_code="E_0404", chapter="GPKE", sub_chapter="6.4.4: AD: Lieferbeginn", role="NB"),
metadata=EbdTableMetaData(
ebd_code="E_0404",
chapter="GPKE",
section="6.4.4: AD: Lieferbeginn",
ebd_name="E_0404_Lieferbeginn prüfen",
role="NB",
),
rows=[
EbdTableRow(
step_number="1",
Expand Down
3 changes: 2 additions & 1 deletion unittests/e0454.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
metadata=EbdTableMetaData(
ebd_code="E_0454",
chapter="GPKE",
sub_chapter="6.27.2: AD: Information über die Zuordnung einer Marktlokation zur Datenaggregation durch den ÜNB",
section="6.27.2: AD: Information über die Zuordnung einer Marktlokation zur Datenaggregation durch den ÜNB",
ebd_name="E_0404_Information prüfen",
role="ÜNB",
),
rows=[
Expand Down
6 changes: 5 additions & 1 deletion unittests/e0459.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

table_e0459 = EbdTable(
metadata=EbdTableMetaData(
ebd_code="E_0459", chapter="GPKE", sub_chapter="6.7.4: AD: Netznutzungsabrechnung", role="LF"
ebd_code="E_0459",
chapter="GPKE",
section="6.7.4: AD: Netznutzungsabrechnung",
ebd_name="E_0459_Prüfen, ob Antwort auf Stornierung erforderlich",
role="LF",
),
rows=[
EbdTableRow(
Expand Down
8 changes: 7 additions & 1 deletion unittests/e0462.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
from rebdhuhn.models import EbdCheckResult, EbdTable, EbdTableMetaData, EbdTableRow, EbdTableSubRow

table_e0462 = EbdTable(
metadata=EbdTableMetaData(ebd_code="E_0462", chapter="GPKE", sub_chapter="6.4.1: AD: Lieferbeginn", role="NB"),
metadata=EbdTableMetaData(
ebd_code="E_0462",
chapter="GPKE",
section="6.4.1: AD: Lieferbeginn",
ebd_name="E_0462_Prüfen, ob Anmeldung direkt ablehnbar",
role="NB",
),
rows=[
EbdTableRow(
step_number="1",
Expand Down
3 changes: 2 additions & 1 deletion unittests/e0529.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
metadata=EbdTableMetaData(
ebd_code="E_0529",
chapter="GPKE",
sub_chapter="6.36.6: AD Bestellung einer Konfiguration vom NB an MSB",
section="6.36.6: AD Bestellung einer Konfiguration vom NB an MSB",
ebd_name="E_0529_Some",
role="MSB",
),
rows=[
Expand Down
12 changes: 8 additions & 4 deletions unittests/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
metadata=EbdTableMetaData(
ebd_code="E_0003",
chapter="7.39 AD: Bestellung der Aggregationsebene der Bilanzkreissummenzeitreihe auf Ebene der Regelzone",
sub_chapter="7.39.1 E_0003_Bestellung der Aggregationsebene RZ prüfen",
section="7.39.1 E_0003_Bestellung der Aggregationsebene RZ prüfen",
ebd_name="E_0003_Bestellung der Aggregationsebene RZ prüfen",
role="ÜNB",
),
rows=[
Expand Down Expand Up @@ -60,7 +61,8 @@
metadata=EbdTableMetaData(
ebd_code="E_0025",
chapter="7.41 AD: Übermittlung Prüfmitteilung für die Bilanzkreissummenzeitreihe vom BKV an BIKO und ÜNB",
sub_chapter="7.41.2 E_0025_Prüfmitteilung prüfen",
section="7.41.2 E_0025_Prüfmitteilung prüfen",
ebd_name="E_0025_Prüfmitteilung prüfen",
role="BIKO",
),
rows=[
Expand Down Expand Up @@ -158,7 +160,8 @@
metadata=EbdTableMetaData(
ebd_code="E_0015",
chapter="7.17 AD: Aktivierung eines MaBiS-ZP für Bilanzierungsgebietssummenzeitreihen vom ÜNB an BIKO und NB",
sub_chapter="7.17.1 E_0015_MaBiS-ZP Aktivierung prüfen",
section="7.17.1 E_0015_MaBiS-ZP Aktivierung prüfen",
ebd_name="E_0015_MaBiS-ZP Aktivierung prüfen",
role="BIKO",
),
rows=[
Expand Down Expand Up @@ -332,7 +335,8 @@
metadata=EbdTableMetaData(
ebd_code="E_0401",
chapter="6.2 AD: Lieferende LF an NB",
sub_chapter="6.2.1 E_0401_Abmeldung prüfen",
section="6.2.1 E_0401_Abmeldung prüfen",
ebd_name="E_0401_Abmeldung prüfen",
role="NB", # NB=VNB
),
rows=[
Expand Down
6 changes: 4 additions & 2 deletions unittests/test_ebd_table_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class TestEbdTableModels:
metadata=EbdTableMetaData(
ebd_code="E_0015",
chapter="7.17 AD: AD: Aktivierung eines MaBiS-ZP für Bilanzierungsgebietssummenzeitreihen vom ÜNB an BIKO und NB",
sub_chapter="7.17.1 E_0015_MaBiS-ZP Aktivierung prüfen",
section="7.17.1 E_0015_MaBiS-ZP Aktivierung prüfen",
ebd_name="E_0404_Lieferbeginn prüfen",
role="BIKO",
),
rows=[
Expand Down Expand Up @@ -175,7 +176,8 @@ def test_collect_answer_codes_instruction(self) -> None:
metadata=EbdTableMetaData(
ebd_code="E_0453",
chapter="6.18 AD: Stammdatensynchronisation",
sub_chapter="6.18.1 E_0453_Änderung prüfen",
section="6.18.1 E_0453_Änderung prüfen",
ebd_name="E_0404_Lieferbeginn prüfen",
role="ÜNB",
),
multi_step_instructions=[
Expand Down
12 changes: 8 additions & 4 deletions unittests/test_table_to_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ def test_table_e0401_too_complex_for_plantuml(self) -> None:
metadata=EbdGraphMetaData(
ebd_code=table_e0003.metadata.ebd_code,
chapter=table_e0003.metadata.chapter,
sub_chapter=table_e0003.metadata.sub_chapter,
section=table_e0003.metadata.section,
ebd_name=table_e0003.metadata.ebd_name,
role=table_e0003.metadata.role,
),
graph=DiGraph(),
Expand All @@ -430,7 +431,8 @@ def test_table_e0401_too_complex_for_plantuml(self) -> None:
metadata=EbdGraphMetaData(
ebd_code=table_e0025.metadata.ebd_code,
chapter=table_e0025.metadata.chapter,
sub_chapter=table_e0025.metadata.sub_chapter,
section=table_e0025.metadata.section,
ebd_name=table_e0025.metadata.ebd_name,
role=table_e0025.metadata.role,
),
graph=DiGraph(),
Expand All @@ -443,7 +445,8 @@ def test_table_e0401_too_complex_for_plantuml(self) -> None:
metadata=EbdGraphMetaData(
ebd_code=table_e0015.metadata.ebd_code,
chapter=table_e0015.metadata.chapter,
sub_chapter=table_e0015.metadata.sub_chapter,
section=table_e0015.metadata.section,
ebd_name=table_e0015.metadata.ebd_name,
role=table_e0015.metadata.role,
),
graph=DiGraph(),
Expand All @@ -456,7 +459,8 @@ def test_table_e0401_too_complex_for_plantuml(self) -> None:
metadata=EbdGraphMetaData(
ebd_code=table_e0401.metadata.ebd_code,
chapter=table_e0401.metadata.chapter,
sub_chapter=table_e0401.metadata.sub_chapter,
section=table_e0401.metadata.section,
ebd_name=table_e0401.metadata.ebd_name,
role=table_e0401.metadata.role,
),
graph=DiGraph(),
Expand Down