Skip to content

Commit 8336d90

Browse files
authored
feat: extend EbdTableMetadata with version and (original) release date (#416)
1 parent 287b93a commit 8336d90

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

src/rebdhuhn/models/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616
ToNoEdge,
1717
ToYesEdge,
1818
)
19-
from rebdhuhn.models.ebd_table import EbdCheckResult, EbdTable, EbdTableMetaData, EbdTableRow, EbdTableSubRow
19+
from rebdhuhn.models.ebd_table import (
20+
EbdCheckResult,
21+
EbdDocumentReleaseInformation,
22+
EbdTable,
23+
EbdTableMetaData,
24+
EbdTableRow,
25+
EbdTableSubRow,
26+
)
2027

2128
__all__ = [
2229
"DecisionNode",
30+
"EbdDocumentReleaseInformation",
2331
"EbdGraph",
2432
"EbdGraphEdge",
2533
"EbdGraphMetaData",

src/rebdhuhn/models/ebd_table.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,46 @@
44
An EbdTable is the EDI@Energy raw representation of an "Entscheidungsbaum".
55
"""
66

7+
from datetime import date
78
from typing import List, Optional
89

910
import attrs
1011

1112

12-
# pylint:disable=too-few-public-methods
13+
@attrs.define(auto_attribs=True, kw_only=True)
14+
class EbdDocumentReleaseInformation:
15+
"""
16+
Contains information from the title (first) page of the EDI@Energy document which contains all EBDs.
17+
"""
18+
19+
version: str = attrs.field(validator=attrs.validators.instance_of(str))
20+
"""
21+
the version of the .docx document/file on which this EBD table is based.
22+
E.g. '4.0b', because (proper) semantic versioning is for loosers ;)
23+
"""
24+
release_date: Optional[date] = attrs.field(
25+
default=None, validator=attrs.validators.optional(attrs.validators.instance_of(date))
26+
)
27+
"""
28+
date on which the .docx document/file was released.
29+
This corresponds to the 'Stand' field in the EDI@Energy document title page, e.g. '2025-06-23'.
30+
It might be updated even if the version and original_release_date stay the same to indicate there was a
31+
'Fehlerkorrektur' in the document.
32+
"""
33+
# https://imgflip.com/i/a2saev
34+
35+
original_release_date: Optional[date] = attrs.field(
36+
default=None, validator=attrs.validators.optional(attrs.validators.instance_of(date))
37+
)
38+
"""
39+
date on which the EBD was originally released; It's called 'Ursprüngliches Publikationsdatum' on the EBD document
40+
title page. E.g. '2024-10-01'.
41+
"""
42+
# I think that one could validate that if a `release_date` is set, then the `original_release_date` must be set and
43+
# before it. But we don't add this validation yet, because we all know the data integrity is... to be improved.
44+
45+
46+
# pylint:disable=too-few-public-methods, too-many-instance-attributes
1347
@attrs.define(auto_attribs=True, kw_only=True)
1448
class EbdTableMetaData:
1549
"""
@@ -47,6 +81,13 @@ class EbdTableMetaData:
4781
da keine Antwort gegeben wird und ausschließlich die Liste versandt wird.'
4882
"""
4983

84+
release_information: Optional[EbdDocumentReleaseInformation] = attrs.field(
85+
default=None, validator=attrs.validators.optional(attrs.validators.instance_of(EbdDocumentReleaseInformation))
86+
)
87+
"""
88+
metadata of the entire EBD document (not the single EBD table)
89+
"""
90+
5091

5192
@attrs.define(auto_attribs=True, kw_only=True)
5293
class EbdCheckResult:

0 commit comments

Comments
 (0)