generated from Hochfrequenz/tmdsclient.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add method to download events from Event Controller (#140)
* feat: add method to download events from Event Controller * pylint/caplog --------- Co-authored-by: Konstantin <konstantin.klein+github@hochfrequenz.de>
- Loading branch information
Showing
4 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
models for the event controller | ||
""" | ||
|
||
from itertools import pairwise | ||
from uuid import UUID | ||
|
||
from pydantic import BaseModel, RootModel | ||
|
||
|
||
class EventHeader(BaseModel): | ||
""" | ||
model returned by /api/Event/prozess/<id goes here> | ||
""" | ||
|
||
number: int | ||
name: str | ||
id: UUID | ||
|
||
|
||
class EventHeaders(RootModel[list[EventHeader]]): | ||
"""wrapper around a list of EventHeaders""" | ||
|
||
@property | ||
def is_continuous(self) -> bool: | ||
""" | ||
returns true iff all event numbers are continuous. | ||
a gap like: 1,2,3,5 indicates that there is a problem with the event at position 4 | ||
""" | ||
number_pairs = pairwise(sorted((x.number for x in self.root))) | ||
return all(abs(x - y) == 1 for x, y in number_pairs) | ||
|
||
|
||
__all__ = ["EventHeader", "EventHeaders"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
[ | ||
{ | ||
"number": 0, | ||
"name": "ProzessErzeugt-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 1, | ||
"name": "FooXMLEmpfangen-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 2, | ||
"name": "MappingDurchführen-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 4, | ||
"name": "MeLoIdentifizieren-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 5, | ||
"name": "FooAntwortSenden-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 8, | ||
"name": "MesslokationGeaendert-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 9, | ||
"name": "EigentuemerIdentifizieren-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 10, | ||
"name": "EigentuemerIdentifizieren-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 12, | ||
"name": "GeschaeftspartnerIdentifiziert-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 13, | ||
"name": "ProzessWartenBeendet-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 14, | ||
"name": "VertraegeAnBarSenden-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 15, | ||
"name": "VertraegeAnBarGesendet-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 16, | ||
"name": "VertragVonBarBestaetigtEvent-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 17, | ||
"name": "MarktdatenAnBarSenden-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
}, | ||
{ | ||
"number": 18, | ||
"name": "ProzessStatusGeändert-1.0.0", | ||
"id": "d7e40c6e-c7ae-4ef5-b821-aa55fe085909" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters