maleo-enums 0.0.28__py3-none-any.whl → 0.0.30__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maleo/enums/cardinality.py +55 -34
- maleo/enums/connection.py +71 -40
- maleo/enums/environment.py +27 -18
- maleo/enums/expiration.py +25 -16
- maleo/enums/identity.py +47 -28
- maleo/enums/medical.py +79 -32
- maleo/enums/order.py +25 -14
- maleo/enums/organization.py +144 -47
- maleo/enums/service.py +234 -93
- maleo/enums/status.py +39 -24
- maleo/enums/system.py +38 -17
- maleo/enums/user.py +33 -16
- {maleo_enums-0.0.28.dist-info → maleo_enums-0.0.30.dist-info}/METADATA +7 -2
- maleo_enums-0.0.30.dist-info/RECORD +18 -0
- maleo_enums-0.0.28.dist-info/RECORD +0 -18
- {maleo_enums-0.0.28.dist-info → maleo_enums-0.0.30.dist-info}/WHEEL +0 -0
- {maleo_enums-0.0.28.dist-info → maleo_enums-0.0.30.dist-info}/licenses/LICENSE +0 -0
- {maleo_enums-0.0.28.dist-info → maleo_enums-0.0.30.dist-info}/top_level.txt +0 -0
maleo/enums/cardinality.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Cardinality(StrEnum):
|
|
@@ -8,36 +9,46 @@ class Cardinality(StrEnum):
|
|
|
8
9
|
SINGLE = "single"
|
|
9
10
|
|
|
10
11
|
@classmethod
|
|
11
|
-
def choices(cls) ->
|
|
12
|
+
def choices(cls) -> ListOfStrs:
|
|
12
13
|
return [e.value for e in cls]
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
CardinalityT = TypeVar("CardinalityT", bound=Cardinality)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
OptCardinality = Cardinality | None
|
|
18
|
+
OptCardinalityT = TypeVar("OptCardinalityT", bound=OptCardinality)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class CardinalityMixin(BaseModel, Generic[OptCardinalityT]):
|
|
22
|
+
cardinality: Annotated[OptCardinalityT, Field(..., description="Cardinality")]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
ListOfCardinalities = list[Cardinality]
|
|
19
26
|
ListOfCardinalitiesT = TypeVar("ListOfCardinalitiesT", bound=ListOfCardinalities)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
)
|
|
24
|
-
SequenceOfCardinalities = Sequence[Cardinality]
|
|
25
|
-
SequenceOfCardinalitiesT = TypeVar(
|
|
26
|
-
"SequenceOfCardinalitiesT", bound=SequenceOfCardinalities
|
|
27
|
-
)
|
|
28
|
-
OptionalSequenceOfCardinalities = Optional[SequenceOfCardinalities]
|
|
29
|
-
OptionalSequenceOfCardinalitiesT = TypeVar(
|
|
30
|
-
"OptionalSequenceOfCardinalitiesT", bound=OptionalSequenceOfCardinalities
|
|
27
|
+
OptListOfCardinalities = ListOfCardinalities | None
|
|
28
|
+
OptListOfCardinalitiesT = TypeVar(
|
|
29
|
+
"OptListOfCardinalitiesT", bound=OptListOfCardinalities
|
|
31
30
|
)
|
|
32
31
|
|
|
33
32
|
|
|
33
|
+
class CardinalitiesMixin(BaseModel, Generic[OptListOfCardinalitiesT]):
|
|
34
|
+
cardinalities: Annotated[
|
|
35
|
+
OptListOfCardinalitiesT, Field(..., description="Cardinalities")
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
SeqOfCardinalities = Sequence[Cardinality]
|
|
40
|
+
SeqOfCardinalitiesT = TypeVar("SeqOfCardinalitiesT", bound=SeqOfCardinalities)
|
|
41
|
+
OptSeqOfCardinalities = SeqOfCardinalities | None
|
|
42
|
+
OptSeqOfCardinalitiesT = TypeVar("OptSeqOfCardinalitiesT", bound=OptSeqOfCardinalities)
|
|
43
|
+
|
|
44
|
+
|
|
34
45
|
class Relationship(StrEnum):
|
|
35
46
|
# One origin
|
|
36
47
|
ONE_TO_ONE = "one_to_one"
|
|
37
48
|
ONE_TO_OPTIONAL_ONE = "one_to_optional_one"
|
|
38
49
|
ONE_TO_MANY = "one_to_many"
|
|
39
50
|
ONE_TO_OPTIONAL_MANY = "one_to_optional_many"
|
|
40
|
-
#
|
|
51
|
+
# Opt one origin
|
|
41
52
|
OPTIONAL_ONE_TO_ONE = "optional_one_to_one"
|
|
42
53
|
OPTIONAL_ONE_TO_OPTIONAL_ONE = "optional_one_to_optional_one"
|
|
43
54
|
OPTIONAL_ONE_TO_MANY = "optional_one_to_many"
|
|
@@ -47,31 +58,41 @@ class Relationship(StrEnum):
|
|
|
47
58
|
MANY_TO_OPTIONAL_ONE = "many_to_optional_one"
|
|
48
59
|
MANY_TO_MANY = "many_to_many"
|
|
49
60
|
MANY_TO_OPTIONAL_MANY = "many_to_optional_many"
|
|
50
|
-
#
|
|
61
|
+
# Opt many origin
|
|
51
62
|
OPTIONAL_MANY_TO_ONE = "optional_many_to_one"
|
|
52
63
|
OPTIONAL_MANY_TO_OPTIONAL_ONE = "optional_many_to_optional_one"
|
|
53
64
|
OPTIONAL_MANY_TO_MANY = "optional_many_to_many"
|
|
54
65
|
OPTIONAL_MANY_TO_OPTIONAL_MANY = "optional_many_to_optional_many"
|
|
55
66
|
|
|
56
67
|
@classmethod
|
|
57
|
-
def choices(cls) ->
|
|
68
|
+
def choices(cls) -> ListOfStrs:
|
|
58
69
|
return [e.value for e in cls]
|
|
59
70
|
|
|
60
71
|
|
|
61
72
|
RelationshipT = TypeVar("RelationshipT", bound=Relationship)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
OptRelationship = Relationship | None
|
|
74
|
+
OptRelationshipT = TypeVar("OptRelationshipT", bound=OptRelationship)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class RelationshipMixin(BaseModel, Generic[OptRelationshipT]):
|
|
78
|
+
relationship: Annotated[OptRelationshipT, Field(..., description="Relationship")]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
ListOfRelationships = list[Relationship]
|
|
65
82
|
ListOfRelationshipsT = TypeVar("ListOfRelationshipsT", bound=ListOfRelationships)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
)
|
|
70
|
-
SequenceOfRelationships = Sequence[Relationship]
|
|
71
|
-
SequenceOfRelationshipsT = TypeVar(
|
|
72
|
-
"SequenceOfRelationshipsT", bound=SequenceOfRelationships
|
|
73
|
-
)
|
|
74
|
-
OptionalSequenceOfRelationships = Optional[SequenceOfRelationships]
|
|
75
|
-
OptionalSequenceOfRelationshipsT = TypeVar(
|
|
76
|
-
"OptionalSequenceOfRelationshipsT", bound=OptionalSequenceOfRelationships
|
|
83
|
+
OptListOfRelationships = ListOfRelationships | None
|
|
84
|
+
OptListOfRelationshipsT = TypeVar(
|
|
85
|
+
"OptListOfRelationshipsT", bound=OptListOfRelationships
|
|
77
86
|
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class RelationshipsMixin(BaseModel, Generic[OptListOfRelationshipsT]):
|
|
90
|
+
relationships: Annotated[
|
|
91
|
+
OptListOfRelationshipsT, Field(..., description="Relationships")
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
SeqOfRelationships = Sequence[Relationship]
|
|
96
|
+
SeqOfRelationshipsT = TypeVar("SeqOfRelationshipsT", bound=SeqOfRelationships)
|
|
97
|
+
OptSeqOfRelationships = SeqOfRelationships | None
|
|
98
|
+
OptSeqOfRelationshipsT = TypeVar("OptSeqOfRelationshipsT", bound=OptSeqOfRelationships)
|
maleo/enums/connection.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Scheme(StrEnum):
|
|
@@ -10,23 +11,33 @@ class Scheme(StrEnum):
|
|
|
10
11
|
WSS = "wss"
|
|
11
12
|
|
|
12
13
|
@classmethod
|
|
13
|
-
def choices(cls) ->
|
|
14
|
+
def choices(cls) -> ListOfStrs:
|
|
14
15
|
return [e.value for e in cls]
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
SchemeT = TypeVar("SchemeT", bound=Scheme)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
OptScheme = Scheme | None
|
|
20
|
+
OptSchemeT = TypeVar("OptSchemeT", bound=OptScheme)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SchemeMixin(BaseModel, Generic[OptSchemeT]):
|
|
24
|
+
scheme: Annotated[OptSchemeT, Field(..., description="Scheme")]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
ListOfSchemes = list[Scheme]
|
|
21
28
|
ListOfSchemesT = TypeVar("ListOfSchemesT", bound=ListOfSchemes)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
OptListOfSchemes = ListOfSchemes | None
|
|
30
|
+
OptListOfSchemesT = TypeVar("OptListOfSchemesT", bound=OptListOfSchemes)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SchemesMixin(BaseModel, Generic[OptListOfSchemesT]):
|
|
34
|
+
schemes: Annotated[OptListOfSchemesT, Field(..., description="Schemes")]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
SeqOfSchemes = Sequence[Scheme]
|
|
38
|
+
SeqOfSchemesT = TypeVar("SeqOfSchemesT", bound=SeqOfSchemes)
|
|
39
|
+
OptSeqOfSchemes = SeqOfSchemes | None
|
|
40
|
+
OptSeqOfSchemesT = TypeVar("OptSeqOfSchemesT", bound=OptSeqOfSchemes)
|
|
30
41
|
|
|
31
42
|
|
|
32
43
|
class Protocol(StrEnum):
|
|
@@ -34,11 +45,11 @@ class Protocol(StrEnum):
|
|
|
34
45
|
WEBSOCKET = "websocket"
|
|
35
46
|
|
|
36
47
|
@classmethod
|
|
37
|
-
def choices(cls) ->
|
|
48
|
+
def choices(cls) -> ListOfStrs:
|
|
38
49
|
return [e.value for e in cls]
|
|
39
50
|
|
|
40
51
|
@classmethod
|
|
41
|
-
def from_scheme(cls, scheme:
|
|
52
|
+
def from_scheme(cls, scheme: Scheme | str) -> "Protocol":
|
|
42
53
|
# Normalize to Scheme if it's a string
|
|
43
54
|
if isinstance(scheme, str):
|
|
44
55
|
try:
|
|
@@ -62,23 +73,33 @@ class Method(StrEnum):
|
|
|
62
73
|
OPTIONS = "OPTIONS"
|
|
63
74
|
|
|
64
75
|
@classmethod
|
|
65
|
-
def choices(cls) ->
|
|
76
|
+
def choices(cls) -> ListOfStrs:
|
|
66
77
|
return [e.value for e in cls]
|
|
67
78
|
|
|
68
79
|
|
|
69
80
|
MethodT = TypeVar("MethodT", bound=Method)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
OptMethod = Method | None
|
|
82
|
+
OptMethodT = TypeVar("OptMethodT", bound=OptMethod)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class MethodMixin(BaseModel, Generic[OptMethodT]):
|
|
86
|
+
method: Annotated[OptMethodT, Field(..., description="Method")]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
ListOfMethods = list[Method]
|
|
73
90
|
ListOfMethodsT = TypeVar("ListOfMethodsT", bound=ListOfMethods)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
OptListOfMethods = ListOfMethods | None
|
|
92
|
+
OptListOfMethodsT = TypeVar("OptListOfMethodsT", bound=OptListOfMethods)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class MethodsMixin(BaseModel, Generic[OptListOfMethodsT]):
|
|
96
|
+
methods: Annotated[OptListOfMethodsT, Field(..., description="Methods")]
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
SeqOfMethods = Sequence[Method]
|
|
100
|
+
SeqOfMethodsT = TypeVar("SeqOfMethodsT", bound=SeqOfMethods)
|
|
101
|
+
OptSeqOfMethods = SeqOfMethods | None
|
|
102
|
+
OptSeqOfMethodsT = TypeVar("OptSeqOfMethodsT", bound=OptSeqOfMethods)
|
|
82
103
|
|
|
83
104
|
|
|
84
105
|
class Header(StrEnum):
|
|
@@ -165,20 +186,30 @@ class Header(StrEnum):
|
|
|
165
186
|
X_NEW_AUTHORIZATION = "x-new-authorization"
|
|
166
187
|
|
|
167
188
|
@classmethod
|
|
168
|
-
def choices(cls) ->
|
|
189
|
+
def choices(cls) -> ListOfStrs:
|
|
169
190
|
return [e.value for e in cls]
|
|
170
191
|
|
|
171
192
|
|
|
172
193
|
HeaderT = TypeVar("HeaderT", bound=Header)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
194
|
+
OptHeader = Header | None
|
|
195
|
+
OptHeaderT = TypeVar("OptHeaderT", bound=OptHeader)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class HeaderMixin(BaseModel, Generic[OptHeaderT]):
|
|
199
|
+
header: Annotated[OptHeaderT, Field(..., description="Header")]
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
ListOfHeaders = list[Header]
|
|
176
203
|
ListOfHeadersT = TypeVar("ListOfHeadersT", bound=ListOfHeaders)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
204
|
+
OptListOfHeaders = ListOfHeaders | None
|
|
205
|
+
OptListOfHeadersT = TypeVar("OptListOfHeadersT", bound=OptListOfHeaders)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class HeadersMixin(BaseModel, Generic[OptListOfHeadersT]):
|
|
209
|
+
headers: Annotated[OptListOfHeadersT, Field(..., description="Headers")]
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
SeqOfHeaders = Sequence[Header]
|
|
213
|
+
SeqOfHeadersT = TypeVar("SeqOfHeadersT", bound=SeqOfHeaders)
|
|
214
|
+
OptSeqOfHeaders = SeqOfHeaders | None
|
|
215
|
+
OptSeqOfHeadersT = TypeVar("OptSeqOfHeadersT", bound=OptSeqOfHeaders)
|
maleo/enums/environment.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Environment(StrEnum):
|
|
@@ -9,24 +10,32 @@ class Environment(StrEnum):
|
|
|
9
10
|
PRODUCTION = "production"
|
|
10
11
|
|
|
11
12
|
@classmethod
|
|
12
|
-
def choices(cls) ->
|
|
13
|
+
def choices(cls) -> ListOfStrs:
|
|
13
14
|
return [e.value for e in cls]
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
EnvironmentT = TypeVar("EnvironmentT", bound=Environment)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
OptEnvironment = Environment | None
|
|
19
|
+
OptEnvironmentT = TypeVar("OptEnvironmentT", bound=OptEnvironment)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class EnvironmentMixin(BaseModel, Generic[OptEnvironmentT]):
|
|
23
|
+
environment: Annotated[OptEnvironmentT, Field(..., description="Environment")]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
ListOfEnvironments = list[Environment]
|
|
20
27
|
ListOfEnvironmentsT = TypeVar("ListOfEnvironmentsT", bound=ListOfEnvironments)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
)
|
|
28
|
+
OptListOfEnvironments = ListOfEnvironments | None
|
|
29
|
+
OptListOfEnvironmentsT = TypeVar("OptListOfEnvironmentsT", bound=OptListOfEnvironments)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class EnvironmentsMixin(BaseModel, Generic[OptListOfEnvironmentsT]):
|
|
33
|
+
environments: Annotated[
|
|
34
|
+
OptListOfEnvironmentsT, Field(..., description="Environments")
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
SeqOfEnvironments = Sequence[Environment]
|
|
39
|
+
SeqOfEnvironmentsT = TypeVar("SeqOfEnvironmentsT", bound=SeqOfEnvironments)
|
|
40
|
+
OptSeqOfEnvironments = SeqOfEnvironments | None
|
|
41
|
+
OptSeqOfEnvironmentsT = TypeVar("OptSeqOfEnvironmentsT", bound=OptSeqOfEnvironments)
|
maleo/enums/expiration.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import IntEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.integer import ListOfInts
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Expiration(IntEnum):
|
|
@@ -21,22 +22,30 @@ class Expiration(IntEnum):
|
|
|
21
22
|
EXP_1MO = int(1 * 30 * 24 * 60 * 60)
|
|
22
23
|
|
|
23
24
|
@classmethod
|
|
24
|
-
def choices(cls) ->
|
|
25
|
+
def choices(cls) -> ListOfInts:
|
|
25
26
|
return [e.value for e in cls]
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
ExpirationT = TypeVar("ExpirationT", bound=Expiration)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
OptExpiration = Expiration | None
|
|
31
|
+
OptExpirationT = TypeVar("OptExpirationT", bound=OptExpiration)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ExpirationMixin(BaseModel, Generic[OptExpirationT]):
|
|
35
|
+
expiration: Annotated[OptExpirationT, Field(..., description="Expiration")]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
ListOfExpirations = list[Expiration]
|
|
32
39
|
ListOfExpirationsT = TypeVar("ListOfExpirationsT", bound=ListOfExpirations)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
)
|
|
40
|
+
OptListOfExpirations = ListOfExpirations | None
|
|
41
|
+
OptListOfExpirationsT = TypeVar("OptListOfExpirationsT", bound=OptListOfExpirations)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ExpirationsMixin(BaseModel, Generic[OptListOfExpirationsT]):
|
|
45
|
+
expirations: Annotated[OptListOfExpirationsT, Field(..., description="Expirations")]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
SeqOfExpirations = Sequence[Expiration]
|
|
49
|
+
SeqOfExpirationsT = TypeVar("SeqOfExpirationsT", bound=SeqOfExpirations)
|
|
50
|
+
OptSeqOfExpirations = SeqOfExpirations | None
|
|
51
|
+
OptSeqOfExpirationsT = TypeVar("OptSeqOfExpirationsT", bound=OptSeqOfExpirations)
|
maleo/enums/identity.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class BloodType(StrEnum):
|
|
@@ -10,25 +11,33 @@ class BloodType(StrEnum):
|
|
|
10
11
|
O = "o" # noqa: E741
|
|
11
12
|
|
|
12
13
|
@classmethod
|
|
13
|
-
def choices(cls) ->
|
|
14
|
+
def choices(cls) -> ListOfStrs:
|
|
14
15
|
return [e.value for e in cls]
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
BloodTypeT = TypeVar("BloodTypeT", bound=BloodType)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
OptBloodType = BloodType | None
|
|
20
|
+
OptBloodTypeT = TypeVar("OptBloodTypeT", bound=OptBloodType)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class BloodTypeMixin(BaseModel, Generic[OptBloodTypeT]):
|
|
24
|
+
blood_type: Annotated[OptBloodTypeT, Field(..., description="Blood Type")]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
ListOfBloodTypes = list[BloodType]
|
|
21
28
|
ListOfBloodTypesT = TypeVar("ListOfBloodTypesT", bound=ListOfBloodTypes)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
29
|
+
OptListOfBloodTypes = ListOfBloodTypes | None
|
|
30
|
+
OptListOfBloodTypesT = TypeVar("OptListOfBloodTypesT", bound=OptListOfBloodTypes)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class BloodTypesMixin(BaseModel, Generic[OptListOfBloodTypesT]):
|
|
34
|
+
blood_types: Annotated[OptListOfBloodTypesT, Field(..., description="Blood Types")]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
SeqOfBloodTypes = Sequence[BloodType]
|
|
38
|
+
SeqOfBloodTypesT = TypeVar("SeqOfBloodTypesT", bound=SeqOfBloodTypes)
|
|
39
|
+
OptSeqOfBloodTypes = SeqOfBloodTypes | None
|
|
40
|
+
OptSeqOfBloodTypesT = TypeVar("OptSeqOfBloodTypesT", bound=OptSeqOfBloodTypes)
|
|
32
41
|
|
|
33
42
|
|
|
34
43
|
class Gender(StrEnum):
|
|
@@ -37,20 +46,30 @@ class Gender(StrEnum):
|
|
|
37
46
|
MALE = "male"
|
|
38
47
|
|
|
39
48
|
@classmethod
|
|
40
|
-
def choices(cls) ->
|
|
49
|
+
def choices(cls) -> ListOfStrs:
|
|
41
50
|
return [e.value for e in cls]
|
|
42
51
|
|
|
43
52
|
|
|
44
53
|
GenderT = TypeVar("GenderT", bound=Gender)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
OptGender = Gender | None
|
|
55
|
+
OptGenderT = TypeVar("OptGenderT", bound=OptGender)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class GenderMixin(BaseModel, Generic[OptGenderT]):
|
|
59
|
+
gender: Annotated[OptGenderT, Field(..., description="Gender")]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
ListOfGenders = list[Gender]
|
|
48
63
|
ListOfGendersT = TypeVar("ListOfGendersT", bound=ListOfGenders)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
OptListOfGenders = ListOfGenders | None
|
|
65
|
+
OptListOfGendersT = TypeVar("OptListOfGendersT", bound=OptListOfGenders)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class GendersMixin(BaseModel, Generic[OptListOfGendersT]):
|
|
69
|
+
genders: Annotated[OptListOfGendersT, Field(..., description="Genders")]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
SeqOfGenders = Sequence[Gender]
|
|
73
|
+
SeqOfGendersT = TypeVar("SeqOfGendersT", bound=SeqOfGenders)
|
|
74
|
+
OptSeqOfGenders = SeqOfGenders | None
|
|
75
|
+
OptSeqOfGendersT = TypeVar("OptSeqOfGendersT", bound=OptSeqOfGenders)
|
maleo/enums/medical.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from enum import StrEnum
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, Sequence, TypeVar
|
|
4
|
+
from maleo.types.string import ListOfStrs
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
class
|
|
7
|
+
class MedicalRole(StrEnum):
|
|
7
8
|
# Level 1: Director category
|
|
8
9
|
DIRECTOR = "director"
|
|
9
10
|
PRESIDENT = "president"
|
|
@@ -72,48 +73,94 @@ class Role(StrEnum):
|
|
|
72
73
|
NUTRITIONIST = "nutritionist"
|
|
73
74
|
|
|
74
75
|
@classmethod
|
|
75
|
-
def choices(cls) ->
|
|
76
|
+
def choices(cls) -> ListOfStrs:
|
|
76
77
|
return [e.value for e in cls]
|
|
77
78
|
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
MedicalRoleT = TypeVar("MedicalRoleT", bound=MedicalRole)
|
|
81
|
+
OptMedicalRole = MedicalRole | None
|
|
82
|
+
OptMedicalRoleT = TypeVar("OptMedicalRoleT", bound=OptMedicalRole)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class SimpleMedicalRoleMixin(BaseModel, Generic[OptMedicalRoleT]):
|
|
86
|
+
role: Annotated[OptMedicalRoleT, Field(..., description="Medical Role")]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class FullMedicalRoleMixin(BaseModel, Generic[OptMedicalRoleT]):
|
|
90
|
+
medical_role: Annotated[OptMedicalRoleT, Field(..., description="Medical Role")]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
ListOfMedicalRoles = list[MedicalRole]
|
|
94
|
+
ListOfMedicalRolesT = TypeVar("ListOfMedicalRolesT", bound=ListOfMedicalRoles)
|
|
95
|
+
OptListOfMedicalRoles = ListOfMedicalRoles | None
|
|
96
|
+
OptListOfMedicalRolesT = TypeVar("OptListOfMedicalRolesT", bound=OptListOfMedicalRoles)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class SimpleMedicalRolesMixin(BaseModel, Generic[OptListOfMedicalRolesT]):
|
|
100
|
+
roles: Annotated[OptListOfMedicalRolesT, Field(..., description="Medical Roles")]
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class FullMedicalRolesMixin(BaseModel, Generic[OptListOfMedicalRolesT]):
|
|
104
|
+
medical_roles: Annotated[
|
|
105
|
+
OptListOfMedicalRolesT, Field(..., description="Medical Roles")
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
SeqOfMedicalRoles = Sequence[MedicalRole]
|
|
110
|
+
SeqOfMedicalRolesT = TypeVar("SeqOfMedicalRolesT", bound=SeqOfMedicalRoles)
|
|
111
|
+
OptSeqOfMedicalRoles = SeqOfMedicalRoles | None
|
|
112
|
+
OptSeqOfMedicalRolesT = TypeVar("OptSeqOfMedicalRolesT", bound=OptSeqOfMedicalRoles)
|
|
92
113
|
|
|
93
114
|
|
|
94
|
-
class
|
|
115
|
+
class MedicalService(StrEnum):
|
|
95
116
|
EMERGENCY = "emergency"
|
|
96
117
|
INPATIENT = "inpatient"
|
|
97
118
|
INTENSIVE = "intensive"
|
|
98
119
|
OUTPATIENT = "outpatient"
|
|
99
120
|
|
|
100
121
|
@classmethod
|
|
101
|
-
def choices(cls) ->
|
|
122
|
+
def choices(cls) -> ListOfStrs:
|
|
102
123
|
return [e.value for e in cls]
|
|
103
124
|
|
|
104
125
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
126
|
+
MedicalServiceT = TypeVar("MedicalServiceT", bound=MedicalService)
|
|
127
|
+
OptMedicalService = MedicalService | None
|
|
128
|
+
OptMedicalServiceT = TypeVar("OptMedicalServiceT", bound=OptMedicalService)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class SimpleMedicalServiceMixin(BaseModel, Generic[OptMedicalServiceT]):
|
|
132
|
+
service: Annotated[OptMedicalServiceT, Field(..., description="Medical Service")]
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class FullMedicalServiceMixin(BaseModel, Generic[OptMedicalServiceT]):
|
|
136
|
+
medical_service: Annotated[
|
|
137
|
+
OptMedicalServiceT, Field(..., description="Medical Service")
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
ListOfMedicalServices = list[MedicalService]
|
|
142
|
+
ListOfMedicalServicesT = TypeVar("ListOfMedicalServicesT", bound=ListOfMedicalServices)
|
|
143
|
+
OptListOfMedicalServices = ListOfMedicalServices | None
|
|
144
|
+
OptListOfMedicalServicesT = TypeVar(
|
|
145
|
+
"OptListOfMedicalServicesT", bound=OptListOfMedicalServices
|
|
113
146
|
)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class SimpleMedicalServicesMixin(BaseModel, Generic[OptListOfMedicalServicesT]):
|
|
150
|
+
services: Annotated[
|
|
151
|
+
OptListOfMedicalServicesT, Field(..., description="Medical Services")
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class FullMedicalServicesMixin(BaseModel, Generic[OptListOfMedicalServicesT]):
|
|
156
|
+
medical_services: Annotated[
|
|
157
|
+
OptListOfMedicalServicesT, Field(..., description="Medical Services")
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
SeqOfMedicalServices = Sequence[MedicalService]
|
|
162
|
+
SeqOfMedicalServicesT = TypeVar("SeqOfMedicalServicesT", bound=SeqOfMedicalServices)
|
|
163
|
+
OptSeqOfMedicalServices = SeqOfMedicalServices | None
|
|
164
|
+
OptSeqOfMedicalServicesT = TypeVar(
|
|
165
|
+
"OptSeqOfMedicalServicesT", bound=OptSeqOfMedicalServices
|
|
119
166
|
)
|