Skip to content

Commit 20f1f75

Browse files
FreddyFox892hf-kkleinKonstantin
authored
Improve Code documentation (#71)
* Improve Doku * Linter fix * update * harmonize: German names in single quotes, tag examples in back ticks --------- Co-authored-by: konstantin <[email protected]> Co-authored-by: Konstantin <[email protected]>
1 parent b6eaf6b commit 20f1f75

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

src/fundamend/models/anwendungshandbuch.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@dataclass(kw_only=True, eq=True, frozen=True)
1313
class Code:
1414
"""
15-
a single code element inside an AHB DataElement
15+
A single code element inside an AHB DataElement, indicated by the `<Code>` tag.
1616
"""
1717

1818
# Example:
@@ -27,8 +27,8 @@ class Code:
2727
@dataclass(kw_only=True, eq=True, frozen=True)
2828
class DataElement:
2929
"""
30-
A single data element inside a AHB Segment.
31-
This models both the 'Datenelement' and the 'Gruppendatenelement'
30+
A single data element, German 'Datenelement' inside an AHB Segment, indicated by the `<D_xxxx>` tag.
31+
This element can contain a single or multiple Code elements.
3232
"""
3333

3434
# Example:
@@ -43,7 +43,8 @@ class DataElement:
4343
@dataclass(eq=True, kw_only=True, frozen=True)
4444
class DataElementGroup:
4545
"""
46-
a group of data elements, German 'Datenelementgruppe' inside the AHB
46+
A group of data elements, German 'Datenelementgruppe' inside the AHB, indicated by the `<C_xxxx>` tag.
47+
This model can contain both the 'Datenelement' and the 'Gruppendatenelement'
4748
"""
4849

4950
# "Die Datenelementgruppe C0829 enthält mehrere Gruppendatenelemente. Diese Datenelementgruppe enthält das
@@ -67,7 +68,8 @@ class DataElementGroup:
6768
@dataclass(frozen=True, eq=True, unsafe_hash=True, kw_only=True)
6869
class Segment:
6970
"""
70-
a segment inside an AHB
71+
A segment inside an AHB, indicated by the `<S_xxxx>` tag.
72+
This model can contain both data elements and data element groups.
7173
"""
7274

7375
# Example:
@@ -92,7 +94,8 @@ class Segment:
9294
@dataclass(kw_only=True, eq=True, frozen=True)
9395
class SegmentGroup:
9496
"""
95-
a "Segmentgruppe" inside an AHB
97+
A 'Segmentgruppe' inside an AHB, indicated by the `<G_xxxx>` tag.
98+
This model can contain both Segments and segment groups.
9699
"""
97100

98101
# Example:
@@ -116,7 +119,9 @@ class SegmentGroup:
116119

117120
@dataclass(kw_only=True, eq=True, frozen=True)
118121
class Anwendungsfall:
119-
"""One Anwendungsfall "AWF" corresponds to one Prüfidentifikator or Type of Message"""
122+
"""
123+
One 'Anwendungsfall', indicated by `<AWF>` tag, corresponds to one Prüfidentifikator or type of Message
124+
"""
120125

121126
# Example:
122127
# <AWF Pruefidentifikator="25001" Beschreibung="Berechnungsformel" Kommunikation_von="NB an MSB / LF">
@@ -164,8 +169,8 @@ class Paket:
164169
@dataclass(kw_only=True, eq=True, frozen=True)
165170
class Anwendungshandbuch:
166171
"""
167-
Ein Anwendungshandbuch bündelt verschiedene Nachrichtentypen/Anwendungsfälle im selben Format oder mit der selben
168-
regulatorischen Grundlage und stellt gemeinsame Pakete & Bedingungen bereit.
172+
Ein Anwendungshandbuch, indicated by the `<AHB` tag, bündelt verschiedene Nachrichtentypen/Anwendungsfälle im
173+
selben Format oder mit der selben regulatorischen Grundlage und stellt gemeinsame Pakete & Bedingungen bereit.
169174
"""
170175

171176
# Example:

src/fundamend/models/messageimplementationguide.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MigStatus(StrEnum):
2626
@dataclass(kw_only=True, eq=True)
2727
class Code:
2828
"""
29-
a single code element inside a MIG Dataelement
29+
A single code element inside a MIG data element, indicated by the `<Code>` tag.
3030
"""
3131

3232
# Example:
@@ -40,7 +40,8 @@ class Code:
4040
class DataElement:
4141
"""
4242
A single data element inside a MIG Segment.
43-
This models both the 'Datenelement' and the 'Gruppendatenelement'
43+
This models both the 'Datenelement' and the 'Gruppendatenelement', indicated by the `<D_xxxx` tag.
44+
Are able to contain a single or multiple Code elements.
4445
"""
4546

4647
# pylint:disable=line-too-long
@@ -51,8 +52,8 @@ class DataElement:
5152
id: str # e.g. 'D_0065'
5253
name: str # e.g. 'Nachrichtentyp-Kennung'
5354
description: str | None = None # e.g. ''
54-
status_std: MigStatus
55-
status_specification: MigStatus
55+
status_std: MigStatus # e.g. M
56+
status_specification: MigStatus # e.g. M
5657
format_std: str #: e.g. 'an..6'
5758
format_specification: str #: e.g. 'an..6'
5859
codes: list[Code]
@@ -61,7 +62,8 @@ class DataElement:
6162
@dataclass(eq=True, kw_only=True)
6263
class DataElementGroup:
6364
"""
64-
a group of data elements, German 'Datenelementgruppe'.
65+
A group of data elements, German 'Datenelementgruppe', indicated by the `<C_xxxx>` tag.
66+
Are able to contain a single or multiple data elements.
6567
"""
6668

6769
# "Die Datenelementgruppe C0829 enthält mehrere Gruppendatenelemente. Diese Datenelementgruppe enthält das
@@ -84,15 +86,15 @@ class DataElementGroup:
8486
id: str # e.g. 'C_C082'
8587
name: str # e.g. 'Identifikation des Beteiligten'
8688
description: str | None = None # e.g. ''
87-
status_std: MigStatus
88-
status_specification: MigStatus
89+
status_std: MigStatus # e.g. C
90+
status_specification: MigStatus # e.g. R
8991
data_elements: list[DataElement]
9092

9193

9294
@dataclass(frozen=True, eq=True, order=True, unsafe_hash=True, kw_only=True)
9395
class Segment:
9496
"""
95-
a segment inside a MIG
97+
A segment inside a MIG, indicated by the `<S_xxxx>` tag. A segment contains data elements and data element groups.
9698
"""
9799

98100
# Example:
@@ -118,16 +120,16 @@ class Segment:
118120
number: str #: e.g. '00004'
119121
max_rep_std: int #: e.g. 1
120122
max_rep_specification: int #: e.g. 1
121-
status_std: MigStatus
122-
status_specification: MigStatus
123+
status_std: MigStatus # e.g. M
124+
status_specification: MigStatus # e.g. M
123125
example: str | None #: e.g. "NAD+MS+9900259000002::293'"
124126
data_elements: list[DataElement | DataElementGroup]
125127

126128

127129
@dataclass(kw_only=True, eq=True)
128130
class SegmentGroup:
129131
"""
130-
a "Segtmentgruppe"
132+
A 'Segmentgruppe' inside a MIG, indicated by the `<G_xxx>` tag. A segment contains segments and segments groups.
131133
"""
132134

133135
# pylint:disable=line-too-long

0 commit comments

Comments
 (0)