maleo-enums 0.0.27__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 +59 -18
- maleo/enums/connection.py +74 -25
- maleo/enums/environment.py +28 -9
- maleo/enums/expiration.py +26 -9
- maleo/enums/identity.py +49 -16
- maleo/enums/medical.py +81 -20
- maleo/enums/order.py +26 -9
- maleo/enums/organization.py +152 -29
- maleo/enums/service.py +241 -54
- maleo/enums/status.py +38 -13
- maleo/enums/system.py +38 -11
- maleo/enums/user.py +34 -9
- {maleo_enums-0.0.27.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.27.dist-info/RECORD +0 -18
- {maleo_enums-0.0.27.dist-info → maleo_enums-0.0.30.dist-info}/WHEEL +0 -0
- {maleo_enums-0.0.27.dist-info → maleo_enums-0.0.30.dist-info}/licenses/LICENSE +0 -0
- {maleo_enums-0.0.27.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,17 +9,37 @@ 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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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]
|
|
26
|
+
ListOfCardinalitiesT = TypeVar("ListOfCardinalitiesT", bound=ListOfCardinalities)
|
|
27
|
+
OptListOfCardinalities = ListOfCardinalities | None
|
|
28
|
+
OptListOfCardinalitiesT = TypeVar(
|
|
29
|
+
"OptListOfCardinalitiesT", bound=OptListOfCardinalities
|
|
30
|
+
)
|
|
31
|
+
|
|
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)
|
|
22
43
|
|
|
23
44
|
|
|
24
45
|
class Relationship(StrEnum):
|
|
@@ -27,7 +48,7 @@ class Relationship(StrEnum):
|
|
|
27
48
|
ONE_TO_OPTIONAL_ONE = "one_to_optional_one"
|
|
28
49
|
ONE_TO_MANY = "one_to_many"
|
|
29
50
|
ONE_TO_OPTIONAL_MANY = "one_to_optional_many"
|
|
30
|
-
#
|
|
51
|
+
# Opt one origin
|
|
31
52
|
OPTIONAL_ONE_TO_ONE = "optional_one_to_one"
|
|
32
53
|
OPTIONAL_ONE_TO_OPTIONAL_ONE = "optional_one_to_optional_one"
|
|
33
54
|
OPTIONAL_ONE_TO_MANY = "optional_one_to_many"
|
|
@@ -37,21 +58,41 @@ class Relationship(StrEnum):
|
|
|
37
58
|
MANY_TO_OPTIONAL_ONE = "many_to_optional_one"
|
|
38
59
|
MANY_TO_MANY = "many_to_many"
|
|
39
60
|
MANY_TO_OPTIONAL_MANY = "many_to_optional_many"
|
|
40
|
-
#
|
|
61
|
+
# Opt many origin
|
|
41
62
|
OPTIONAL_MANY_TO_ONE = "optional_many_to_one"
|
|
42
63
|
OPTIONAL_MANY_TO_OPTIONAL_ONE = "optional_many_to_optional_one"
|
|
43
64
|
OPTIONAL_MANY_TO_MANY = "optional_many_to_many"
|
|
44
65
|
OPTIONAL_MANY_TO_OPTIONAL_MANY = "optional_many_to_optional_many"
|
|
45
66
|
|
|
46
67
|
@classmethod
|
|
47
|
-
def choices(cls) ->
|
|
68
|
+
def choices(cls) -> ListOfStrs:
|
|
48
69
|
return [e.value for e in cls]
|
|
49
70
|
|
|
50
71
|
|
|
51
72
|
RelationshipT = TypeVar("RelationshipT", bound=Relationship)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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]
|
|
82
|
+
ListOfRelationshipsT = TypeVar("ListOfRelationshipsT", bound=ListOfRelationships)
|
|
83
|
+
OptListOfRelationships = ListOfRelationships | None
|
|
84
|
+
OptListOfRelationshipsT = TypeVar(
|
|
85
|
+
"OptListOfRelationshipsT", bound=OptListOfRelationships
|
|
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,17 +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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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]
|
|
28
|
+
ListOfSchemesT = TypeVar("ListOfSchemesT", bound=ListOfSchemes)
|
|
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)
|
|
24
41
|
|
|
25
42
|
|
|
26
43
|
class Protocol(StrEnum):
|
|
@@ -28,11 +45,11 @@ class Protocol(StrEnum):
|
|
|
28
45
|
WEBSOCKET = "websocket"
|
|
29
46
|
|
|
30
47
|
@classmethod
|
|
31
|
-
def choices(cls) ->
|
|
48
|
+
def choices(cls) -> ListOfStrs:
|
|
32
49
|
return [e.value for e in cls]
|
|
33
50
|
|
|
34
51
|
@classmethod
|
|
35
|
-
def from_scheme(cls, scheme:
|
|
52
|
+
def from_scheme(cls, scheme: Scheme | str) -> "Protocol":
|
|
36
53
|
# Normalize to Scheme if it's a string
|
|
37
54
|
if isinstance(scheme, str):
|
|
38
55
|
try:
|
|
@@ -56,17 +73,33 @@ class Method(StrEnum):
|
|
|
56
73
|
OPTIONS = "OPTIONS"
|
|
57
74
|
|
|
58
75
|
@classmethod
|
|
59
|
-
def choices(cls) ->
|
|
76
|
+
def choices(cls) -> ListOfStrs:
|
|
60
77
|
return [e.value for e in cls]
|
|
61
78
|
|
|
62
79
|
|
|
63
80
|
MethodT = TypeVar("MethodT", bound=Method)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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]
|
|
90
|
+
ListOfMethodsT = TypeVar("ListOfMethodsT", bound=ListOfMethods)
|
|
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)
|
|
70
103
|
|
|
71
104
|
|
|
72
105
|
class Header(StrEnum):
|
|
@@ -153,14 +186,30 @@ class Header(StrEnum):
|
|
|
153
186
|
X_NEW_AUTHORIZATION = "x-new-authorization"
|
|
154
187
|
|
|
155
188
|
@classmethod
|
|
156
|
-
def choices(cls) ->
|
|
189
|
+
def choices(cls) -> ListOfStrs:
|
|
157
190
|
return [e.value for e in cls]
|
|
158
191
|
|
|
159
192
|
|
|
160
193
|
HeaderT = TypeVar("HeaderT", bound=Header)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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]
|
|
203
|
+
ListOfHeadersT = TypeVar("ListOfHeadersT", bound=ListOfHeaders)
|
|
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,14 +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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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]
|
|
27
|
+
ListOfEnvironmentsT = TypeVar("ListOfEnvironmentsT", bound=ListOfEnvironments)
|
|
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,14 +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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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]
|
|
39
|
+
ListOfExpirationsT = TypeVar("ListOfExpirationsT", bound=ListOfExpirations)
|
|
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,17 +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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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]
|
|
28
|
+
ListOfBloodTypesT = TypeVar("ListOfBloodTypesT", bound=ListOfBloodTypes)
|
|
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)
|
|
24
41
|
|
|
25
42
|
|
|
26
43
|
class Gender(StrEnum):
|
|
@@ -29,14 +46,30 @@ class Gender(StrEnum):
|
|
|
29
46
|
MALE = "male"
|
|
30
47
|
|
|
31
48
|
@classmethod
|
|
32
|
-
def choices(cls) ->
|
|
49
|
+
def choices(cls) -> ListOfStrs:
|
|
33
50
|
return [e.value for e in cls]
|
|
34
51
|
|
|
35
52
|
|
|
36
53
|
GenderT = TypeVar("GenderT", bound=Gender)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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]
|
|
63
|
+
ListOfGendersT = TypeVar("ListOfGendersT", bound=ListOfGenders)
|
|
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,34 +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
|
-
ListOfRoles = List[Role]
|
|
83
|
-
OptionalListOfRoles = Optional[ListOfRoles]
|
|
84
|
-
SequenceOfRoles = Sequence[Role]
|
|
85
|
-
OptionalSequenceOfRoles = Optional[SequenceOfRoles]
|
|
80
|
+
MedicalRoleT = TypeVar("MedicalRoleT", bound=MedicalRole)
|
|
81
|
+
OptMedicalRole = MedicalRole | None
|
|
82
|
+
OptMedicalRoleT = TypeVar("OptMedicalRoleT", bound=OptMedicalRole)
|
|
86
83
|
|
|
87
84
|
|
|
88
|
-
class
|
|
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)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class MedicalService(StrEnum):
|
|
89
116
|
EMERGENCY = "emergency"
|
|
90
117
|
INPATIENT = "inpatient"
|
|
91
118
|
INTENSIVE = "intensive"
|
|
92
119
|
OUTPATIENT = "outpatient"
|
|
93
120
|
|
|
94
121
|
@classmethod
|
|
95
|
-
def choices(cls) ->
|
|
122
|
+
def choices(cls) -> ListOfStrs:
|
|
96
123
|
return [e.value for e in cls]
|
|
97
124
|
|
|
98
125
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
|
146
|
+
)
|
|
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
|
|
166
|
+
)
|
maleo/enums/order.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 Order(StrEnum):
|
|
@@ -8,14 +9,30 @@ class Order(StrEnum):
|
|
|
8
9
|
DESC = "desc"
|
|
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
|
OrderT = TypeVar("OrderT", bound=Order)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
OptOrder = Order | None
|
|
18
|
+
OptOrderT = TypeVar("OptOrderT", bound=OptOrder)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class OrderMixin(BaseModel, Generic[OptOrderT]):
|
|
22
|
+
order: Annotated[OptOrderT, Field(..., description="Order")]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
ListOfOrders = list[Order]
|
|
26
|
+
ListOfOrdersT = TypeVar("ListOfOrdersT", bound=ListOfOrders)
|
|
27
|
+
OptListOfOrders = ListOfOrders | None
|
|
28
|
+
OptListOfOrdersT = TypeVar("OptListOfOrdersT", bound=OptListOfOrders)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class OrdersMixin(BaseModel, Generic[OptListOfOrdersT]):
|
|
32
|
+
orders: Annotated[OptListOfOrdersT, Field(..., description="Orders")]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
SeqOfOrders = Sequence[Order]
|
|
36
|
+
SeqOfOrdersT = TypeVar("SeqOfOrdersT", bound=SeqOfOrders)
|
|
37
|
+
OptSeqOfOrders = SeqOfOrders | None
|
|
38
|
+
OptSeqOfOrdersT = TypeVar("OptSeqOfOrdersT", bound=OptSeqOfOrders)
|