maleo-identity 0.1.1__py3-none-any.whl → 0.1.3__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.

Potentially problematic release.


This version of maleo-identity might be problematic. Click here for more details.

maleo/identity/dtos.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from datetime import date
2
- from pydantic import BaseModel, Field, model_validator
3
- from typing import Annotated, Generic, Self, TypeVar, Type
2
+ from pydantic import BaseModel, Field
3
+ from typing import Annotated, Generic, TypeVar, Type
4
4
  from maleo.enums.identity import (
5
5
  OptBloodType,
6
6
  BloodTypeMixin,
@@ -26,17 +26,15 @@ from maleo.schemas.mixins.identity import (
26
26
  IntUserId,
27
27
  BirthDate,
28
28
  DateOfBirth,
29
- IntSourceId,
30
- IntTargetId,
31
29
  )
32
- from maleo.schemas.mixins.timestamp import DataTimestamp
30
+ from maleo.schemas.mixins.timestamp import LifecycleTimestamp
33
31
  from maleo.types.datetime import OptDate
34
32
  from maleo.types.string import OptStr
35
33
  from .mixins.common import IdCard, FullName, BirthPlace, PlaceOfBirth
36
34
  from .mixins.organization_registration_code import Code, MaxUses, CurrentUses
37
- from .mixins.organization_relation import IsBidirectional, Metadata
35
+ from .mixins.organization_relation import IsBidirectional, Meta
38
36
  from .mixins.organization import Key as OrganizationKey, Name as OrganizationName
39
- from .mixins.patient import Passport
37
+ from .mixins.patient import PatientIdentifier
40
38
  from .mixins.user_profile import (
41
39
  LeadingTitle,
42
40
  FirstName,
@@ -46,7 +44,6 @@ from .mixins.user_profile import (
46
44
  AvatarName,
47
45
  )
48
46
  from .mixins.user import Username, Email, Phone
49
- from .validators.patient import validate_id_card_or_passport
50
47
 
51
48
 
52
49
  class PatientDTO(
@@ -56,17 +53,12 @@ class PatientDTO(
56
53
  DateOfBirth[date],
57
54
  PlaceOfBirth[OptStr],
58
55
  FullName[str],
59
- Passport[OptStr],
60
- IdCard[OptStr],
61
- IntOrganizationId[int],
56
+ PatientIdentifier,
62
57
  SimpleDataStatusMixin[DataStatusEnum],
63
- DataTimestamp,
58
+ LifecycleTimestamp,
64
59
  DataIdentifier,
65
60
  ):
66
- @model_validator(mode="after")
67
- def chk_id_card_or_passport(self) -> Self:
68
- validate_id_card_or_passport(self.id_card, self.passport)
69
- return self
61
+ pass
70
62
 
71
63
 
72
64
  class OrganizationRegistrationCodeDTO(
@@ -75,7 +67,7 @@ class OrganizationRegistrationCodeDTO(
75
67
  Code[str],
76
68
  IntOrganizationId[int],
77
69
  SimpleDataStatusMixin[DataStatusEnum],
78
- DataTimestamp,
70
+ LifecycleTimestamp,
79
71
  DataIdentifier,
80
72
  ):
81
73
  pass
@@ -96,7 +88,7 @@ class StandardOrganizationDTO(
96
88
  OrganizationKey[str],
97
89
  FullOrganizationTypeMixin[OrganizationType],
98
90
  SimpleDataStatusMixin[DataStatusEnum],
99
- DataTimestamp,
91
+ LifecycleTimestamp,
100
92
  DataIdentifier,
101
93
  ):
102
94
  pass
@@ -108,35 +100,51 @@ class SourceOrganizationDTOMixin(BaseModel):
108
100
  ]
109
101
 
110
102
 
103
+ class SourceOrganizationRelationDTO(
104
+ Meta,
105
+ IsBidirectional[bool],
106
+ SourceOrganizationDTOMixin,
107
+ SimpleDataStatusMixin[DataStatusEnum],
108
+ LifecycleTimestamp,
109
+ DataIdentifier,
110
+ ):
111
+ pass
112
+
113
+
114
+ class SourceOrganizationRelationsDTOMixin(BaseModel):
115
+ sources: Annotated[
116
+ list[SourceOrganizationRelationDTO],
117
+ Field(list[SourceOrganizationRelationDTO](), description="Sources"),
118
+ ] = list[SourceOrganizationRelationDTO]()
119
+
120
+
111
121
  class TargetOrganizationDTOMixin(BaseModel):
112
122
  target: Annotated[
113
123
  StandardOrganizationDTO, Field(..., description="Target organization")
114
124
  ]
115
125
 
116
126
 
117
- class OrganizationRelationDTO(
118
- Metadata,
127
+ class TargetOrganizationRelationDTO(
128
+ Meta,
119
129
  IsBidirectional[bool],
120
130
  TargetOrganizationDTOMixin,
121
- IntTargetId[int],
122
- SourceOrganizationDTOMixin,
123
- IntSourceId[int],
124
131
  SimpleDataStatusMixin[DataStatusEnum],
125
- DataTimestamp,
132
+ LifecycleTimestamp,
126
133
  DataIdentifier,
127
134
  ):
128
135
  pass
129
136
 
130
137
 
131
- class OrganizationRelationsDTOMixin(BaseModel):
132
- relations: Annotated[
133
- list[OrganizationRelationDTO],
134
- Field(list[OrganizationRelationDTO](), description="Relations"),
135
- ] = list[OrganizationRelationDTO]()
138
+ class TargetOrganizationRelationsDTOMixin(BaseModel):
139
+ targets: Annotated[
140
+ list[TargetOrganizationRelationDTO],
141
+ Field(list[TargetOrganizationRelationDTO](), description="Targets"),
142
+ ] = list[TargetOrganizationRelationDTO]()
136
143
 
137
144
 
138
145
  class FullOrganizationDTO(
139
- OrganizationRelationsDTOMixin,
146
+ TargetOrganizationRelationsDTOMixin,
147
+ SourceOrganizationRelationsDTOMixin,
140
148
  OrganizationRegistrationCodeDTOMixin,
141
149
  StandardOrganizationDTO,
142
150
  ):
@@ -157,7 +165,7 @@ class UserMedicalRoleDTO(
157
165
  IntOrganizationId[int],
158
166
  IntUserId[int],
159
167
  SimpleDataStatusMixin[DataStatusEnum],
160
- DataTimestamp,
168
+ LifecycleTimestamp,
161
169
  DataIdentifier,
162
170
  ):
163
171
  pass
@@ -175,7 +183,7 @@ class UserOrganizationRoleDTO(
175
183
  IntOrganizationId[int],
176
184
  IntUserId[int],
177
185
  SimpleDataStatusMixin[DataStatusEnum],
178
- DataTimestamp,
186
+ LifecycleTimestamp,
179
187
  DataIdentifier,
180
188
  ):
181
189
  pass
@@ -203,7 +211,7 @@ class UserProfileDTO(
203
211
  IdCard[OptStr],
204
212
  IntUserId[int],
205
213
  SimpleDataStatusMixin[DataStatusEnum],
206
- DataTimestamp,
214
+ LifecycleTimestamp,
207
215
  DataIdentifier,
208
216
  ):
209
217
  pass
@@ -222,7 +230,7 @@ class UserSystemRoleDTO(
222
230
  FullSystemRoleMixin[SystemRole],
223
231
  IntUserId[int],
224
232
  SimpleDataStatusMixin[DataStatusEnum],
225
- DataTimestamp,
233
+ LifecycleTimestamp,
226
234
  DataIdentifier,
227
235
  ):
228
236
  pass
@@ -246,7 +254,7 @@ class StandardUserDTO(
246
254
  Username[str],
247
255
  FullUserTypeMixin[UserType],
248
256
  SimpleDataStatusMixin[DataStatusEnum],
249
- DataTimestamp,
257
+ LifecycleTimestamp,
250
258
  DataIdentifier,
251
259
  ):
252
260
  pass
@@ -257,7 +265,7 @@ class UserOrganizationDTO(
257
265
  UserOrganizationRolesDTOMixin,
258
266
  OrganizationDTOMixin[StandardOrganizationDTO],
259
267
  SimpleDataStatusMixin[DataStatusEnum],
260
- DataTimestamp,
268
+ LifecycleTimestamp,
261
269
  DataIdentifier,
262
270
  ):
263
271
  pass
@@ -289,7 +297,7 @@ class UserAndOrganizationDTO(
289
297
  OrganizationDTOMixin[StandardOrganizationDTO],
290
298
  UserDTOMixin[StandardUserDTO],
291
299
  SimpleDataStatusMixin[DataStatusEnum],
292
- DataTimestamp,
300
+ LifecycleTimestamp,
293
301
  DataIdentifier,
294
302
  ):
295
303
  pass
@@ -2,6 +2,15 @@ from enum import StrEnum
2
2
  from maleo.types.string import ListOfStrs
3
3
 
4
4
 
5
+ class Granularity(StrEnum):
6
+ STANDARD = "standard"
7
+ FULL = "full"
8
+
9
+ @classmethod
10
+ def choices(cls) -> ListOfStrs:
11
+ return [e.value for e in cls]
12
+
13
+
5
14
  class IdentifierType(StrEnum):
6
15
  ID = "id"
7
16
  UUID = "uuid"
@@ -8,7 +8,5 @@ class IsBidirectional(BaseModel, Generic[OptBoolT]):
8
8
  is_bidirectional: Annotated[OptBoolT, Field(..., description="Is Bidirectional")]
9
9
 
10
10
 
11
- class Metadata(BaseModel):
12
- metadata: Annotated[
13
- OptListOfAnyOrStrToAnyDict, Field(None, description="Metadata")
14
- ] = None
11
+ class Meta(BaseModel):
12
+ meta: Annotated[OptListOfAnyOrStrToAnyDict, Field(None, description="Meta")] = None
@@ -1,8 +1,20 @@
1
- from pydantic import Field
2
- from typing import Annotated, Generic
1
+ from pydantic import Field, model_validator
2
+ from typing import Annotated, Generic, Self
3
3
  from maleo.schemas.mixins.identity import Passport as BasePassport
4
- from maleo.types.string import OptStrT
4
+ from maleo.types.string import OptStr, OptStrT
5
+ from .common import IdCard
5
6
 
6
7
 
7
8
  class Passport(BasePassport, Generic[OptStrT]):
8
9
  passport: Annotated[OptStrT, Field(..., description="Passport", max_length=9)]
10
+
11
+
12
+ class PatientIdentifier(
13
+ Passport[OptStr],
14
+ IdCard[OptStr],
15
+ ):
16
+ @model_validator(mode="after")
17
+ def chk_id_card_or_passport(self) -> Self:
18
+ if self.id_card is None and self.passport is None:
19
+ raise ValueError("Either ID Card or Passport must exist")
20
+ return self
maleo/identity/models.py CHANGED
@@ -94,6 +94,29 @@ class Patient(
94
94
  )
95
95
 
96
96
 
97
+ class OrganizationRegistrationCode(
98
+ DataStatus,
99
+ DataTimestamp,
100
+ DataIdentifier,
101
+ ):
102
+ __tablename__ = "organization_registration_codes"
103
+ organization_id: Mapped[int] = mapped_column(
104
+ Integer,
105
+ ForeignKey("organizations.id", ondelete="CASCADE", onupdate="CASCADE"),
106
+ unique=True,
107
+ nullable=False,
108
+ )
109
+ code: Mapped[str] = mapped_column(
110
+ name="code", type_=String(36), unique=True, nullable=False
111
+ )
112
+ max_uses: Mapped[int] = mapped_column(
113
+ name="max_uses", type_=Integer, nullable=False, default=1
114
+ )
115
+ current_uses: Mapped[int] = mapped_column(
116
+ name="current_uses", type_=Integer, nullable=False, default=0
117
+ )
118
+
119
+
97
120
  class OrganizationRelation(
98
121
  DataStatus,
99
122
  DataTimestamp,
@@ -123,29 +146,6 @@ class OrganizationRelation(
123
146
  )
124
147
 
125
148
 
126
- class OrganizationRegistrationCode(
127
- DataStatus,
128
- DataTimestamp,
129
- DataIdentifier,
130
- ):
131
- __tablename__ = "organization_registration_codes"
132
- organization_id: Mapped[int] = mapped_column(
133
- Integer,
134
- ForeignKey("organizations.id", ondelete="CASCADE", onupdate="CASCADE"),
135
- unique=True,
136
- nullable=False,
137
- )
138
- code: Mapped[str] = mapped_column(
139
- name="code", type_=String(36), unique=True, nullable=False
140
- )
141
- max_uses: Mapped[int] = mapped_column(
142
- name="max_uses", type_=Integer, nullable=False, default=1
143
- )
144
- current_uses: Mapped[int] = mapped_column(
145
- name="current_uses", type_=Integer, nullable=False, default=0
146
- )
147
-
148
-
149
149
  class Organization(
150
150
  DataStatus,
151
151
  DataTimestamp,
@@ -1,6 +1,6 @@
1
1
  from datetime import date
2
- from pydantic import BaseModel, Field, model_validator
3
- from typing import Annotated, Generic, Self, TypeVar, Type
2
+ from pydantic import BaseModel, Field
3
+ from typing import Annotated, Generic, TypeVar, Type
4
4
  from maleo.enums.identity import OptRhesus, RhesusMixin
5
5
  from maleo.metadata.schemas.organization_role import (
6
6
  FullOrganizationRoleMixin,
@@ -38,19 +38,17 @@ from maleo.schemas.mixins.identity import (
38
38
  IntUserId,
39
39
  BirthDate,
40
40
  DateOfBirth,
41
- IntSourceId,
42
- IntTargetId,
43
41
  )
44
- from maleo.schemas.mixins.timestamp import DataTimestamp
42
+ from maleo.schemas.mixins.timestamp import LifecycleTimestamp
45
43
  from maleo.types.datetime import OptDate
46
44
  from maleo.types.integer import OptInt
47
45
  from maleo.types.string import OptStr
48
46
  from ..mixins.common import IdCard, FullName, BirthPlace, PlaceOfBirth
49
47
  from ..mixins.api_key import APIKey
50
48
  from ..mixins.organization_registration_code import Code, MaxUses, CurrentUses
51
- from ..mixins.organization_relation import IsBidirectional, Metadata
49
+ from ..mixins.organization_relation import IsBidirectional, Meta
52
50
  from ..mixins.organization import Key as OrganizationKey, Name as OrganizationName
53
- from ..mixins.patient import Passport
51
+ from ..mixins.patient import PatientIdentifier
54
52
  from ..mixins.user_profile import (
55
53
  LeadingTitle,
56
54
  FirstName,
@@ -60,7 +58,6 @@ from ..mixins.user_profile import (
60
58
  AvatarUrl,
61
59
  )
62
60
  from ..mixins.user import Username, Email, Phone
63
- from ..validators.patient import validate_id_card_or_passport
64
61
 
65
62
 
66
63
  class APIKeySchema(
@@ -68,7 +65,7 @@ class APIKeySchema(
68
65
  IntOrganizationId[OptInt],
69
66
  IntUserId[int],
70
67
  SimpleDataStatusMixin[DataStatusEnum],
71
- DataTimestamp,
68
+ LifecycleTimestamp,
72
69
  DataIdentifier,
73
70
  ):
74
71
  pass
@@ -81,17 +78,12 @@ class PatientSchema(
81
78
  DateOfBirth[date],
82
79
  PlaceOfBirth[OptStr],
83
80
  FullName[str],
84
- Passport[OptStr],
85
- IdCard[OptStr],
86
- IntOrganizationId[int],
81
+ PatientIdentifier,
87
82
  SimpleDataStatusMixin[DataStatusEnum],
88
- DataTimestamp,
83
+ LifecycleTimestamp,
89
84
  DataIdentifier,
90
85
  ):
91
- @model_validator(mode="after")
92
- def chk_id_card_or_passport(self) -> Self:
93
- validate_id_card_or_passport(self.id_card, self.passport)
94
- return self
86
+ pass
95
87
 
96
88
 
97
89
  class OrganizationRegistrationCodeSchema(
@@ -100,7 +92,7 @@ class OrganizationRegistrationCodeSchema(
100
92
  Code[str],
101
93
  IntOrganizationId[int],
102
94
  SimpleDataStatusMixin[DataStatusEnum],
103
- DataTimestamp,
95
+ LifecycleTimestamp,
104
96
  DataIdentifier,
105
97
  ):
106
98
  pass
@@ -121,7 +113,7 @@ class StandardOrganizationSchema(
121
113
  OrganizationKey[str],
122
114
  FullOrganizationTypeMixin[KeyOrStandardOrganizationTypeSchema],
123
115
  SimpleDataStatusMixin[DataStatusEnum],
124
- DataTimestamp,
116
+ LifecycleTimestamp,
125
117
  DataIdentifier,
126
118
  ):
127
119
  pass
@@ -133,34 +125,51 @@ class SourceOrganizationSchemaMixin(BaseModel):
133
125
  ]
134
126
 
135
127
 
128
+ class SourceOrganizationRelationSchema(
129
+ Meta,
130
+ IsBidirectional[bool],
131
+ SourceOrganizationSchemaMixin,
132
+ SimpleDataStatusMixin[DataStatusEnum],
133
+ LifecycleTimestamp,
134
+ DataIdentifier,
135
+ ):
136
+ pass
137
+
138
+
139
+ class SourceOrganizationRelationsSchemaMixin(BaseModel):
140
+ sources: Annotated[
141
+ list[SourceOrganizationRelationSchema],
142
+ Field(list[SourceOrganizationRelationSchema](), description="Sources"),
143
+ ] = list[SourceOrganizationRelationSchema]()
144
+
145
+
136
146
  class TargetOrganizationSchemaMixin(BaseModel):
137
147
  target: Annotated[
138
148
  StandardOrganizationSchema, Field(..., description="Target organization")
139
149
  ]
140
150
 
141
151
 
142
- class OrganizationRelationSchema(
143
- Metadata,
152
+ class TargetOrganizationRelationSchema(
153
+ Meta,
144
154
  IsBidirectional[bool],
145
155
  TargetOrganizationSchemaMixin,
146
- IntTargetId[int],
147
- SourceOrganizationSchemaMixin,
148
- IntSourceId[int],
149
156
  SimpleDataStatusMixin[DataStatusEnum],
150
- DataTimestamp,
157
+ LifecycleTimestamp,
151
158
  DataIdentifier,
152
159
  ):
153
160
  pass
154
161
 
155
162
 
156
- class OrganizationRelationsSchemaMixin(BaseModel):
157
- relations: Annotated[
158
- list[OrganizationRelationSchema],
159
- Field(list[OrganizationRelationSchema](), description="Relations"),
160
- ] = list[OrganizationRelationSchema]()
163
+ class TargetOrganizationRelationsSchemaMixin(BaseModel):
164
+ targets: Annotated[
165
+ list[TargetOrganizationRelationSchema],
166
+ Field(list[TargetOrganizationRelationSchema](), description="Targets"),
167
+ ] = list[TargetOrganizationRelationSchema]()
161
168
 
162
169
 
163
170
  class FullOrganizationSchema(
171
+ TargetOrganizationRelationsSchemaMixin,
172
+ SourceOrganizationRelationsSchemaMixin,
164
173
  OrganizationRegistrationCodeSchemaMixin,
165
174
  StandardOrganizationSchema,
166
175
  ):
@@ -185,7 +194,7 @@ class UserMedicalRoleSchema(
185
194
  IntOrganizationId[int],
186
195
  IntUserId[int],
187
196
  SimpleDataStatusMixin[DataStatusEnum],
188
- DataTimestamp,
197
+ LifecycleTimestamp,
189
198
  DataIdentifier,
190
199
  ):
191
200
  pass
@@ -203,7 +212,7 @@ class UserOrganizationRoleSchema(
203
212
  IntOrganizationId[int],
204
213
  IntUserId[int],
205
214
  SimpleDataStatusMixin[DataStatusEnum],
206
- DataTimestamp,
215
+ LifecycleTimestamp,
207
216
  DataIdentifier,
208
217
  ):
209
218
  pass
@@ -231,7 +240,7 @@ class UserProfileSchema(
231
240
  IdCard[OptStr],
232
241
  IntUserId[int],
233
242
  SimpleDataStatusMixin[DataStatusEnum],
234
- DataTimestamp,
243
+ LifecycleTimestamp,
235
244
  DataIdentifier,
236
245
  ):
237
246
  pass
@@ -250,7 +259,7 @@ class UserSystemRoleSchema(
250
259
  FullSystemRoleMixin[KeyOrStandardSystemRoleSchema],
251
260
  IntUserId[int],
252
261
  SimpleDataStatusMixin[DataStatusEnum],
253
- DataTimestamp,
262
+ LifecycleTimestamp,
254
263
  DataIdentifier,
255
264
  ):
256
265
  pass
@@ -274,7 +283,7 @@ class StandardUserSchema(
274
283
  Username[str],
275
284
  FullUserTypeMixin[KeyOrStandardUserTypeSchema],
276
285
  SimpleDataStatusMixin[DataStatusEnum],
277
- DataTimestamp,
286
+ LifecycleTimestamp,
278
287
  DataIdentifier,
279
288
  ):
280
289
  pass
@@ -285,7 +294,7 @@ class UserOrganizationSchema(
285
294
  UserOrganizationRolesSchemaMixin,
286
295
  OrganizationSchemaMixin[StandardOrganizationSchema],
287
296
  SimpleDataStatusMixin[DataStatusEnum],
288
- DataTimestamp,
297
+ LifecycleTimestamp,
289
298
  DataIdentifier,
290
299
  ):
291
300
  pass
@@ -317,7 +326,7 @@ class UserAndOrganizationSchema(
317
326
  OrganizationSchemaMixin[StandardOrganizationSchema],
318
327
  UserSchemaMixin[StandardUserSchema],
319
328
  SimpleDataStatusMixin[DataStatusEnum],
320
- DataTimestamp,
329
+ LifecycleTimestamp,
321
330
  DataIdentifier,
322
331
  ):
323
332
  pass
@@ -38,9 +38,9 @@ from ..types.organization import IdentifierValueType
38
38
 
39
39
 
40
40
  class Expand(BaseModel):
41
- expand: Annotated[
42
- OptListOfExpandableFields, Field(None, description="Expand", min_length=1)
43
- ] = None
41
+ expand: Annotated[OptListOfExpandableFields, Field(None, description="Expand")] = (
42
+ None
43
+ )
44
44
 
45
45
 
46
46
  class CreateQuery(Expand):
@@ -33,12 +33,12 @@ from maleo.types.dict import StrToAnyDict
33
33
  from maleo.types.integer import OptListOfInts
34
34
  from maleo.types.uuid import OptListOfUUIDs
35
35
  from ..enums.organization_relation import IdentifierType
36
- from ..mixins.organization_relation import IsBidirectional, Metadata
36
+ from ..mixins.organization_relation import IsBidirectional, Meta
37
37
  from ..types.organization_relation import IdentifierValueType
38
38
 
39
39
 
40
40
  class CreateParameter(
41
- Metadata,
41
+ Meta,
42
42
  IsBidirectional[bool],
43
43
  SimpleOrganizationRelationMixin[OrganizationRelation],
44
44
  IntTargetId[int],
@@ -140,11 +140,11 @@ class ReadSingleParameter(BaseReadSingleParameter[IdentifierType, IdentifierValu
140
140
  )
141
141
 
142
142
 
143
- class FullUpdateData(Metadata, IsBidirectional[bool]):
143
+ class FullUpdateData(Meta, IsBidirectional[bool]):
144
144
  pass
145
145
 
146
146
 
147
- class PartialUpdateData(Metadata, IsBidirectional[OptBool]):
147
+ class PartialUpdateData(Meta, IsBidirectional[OptBool]):
148
148
  pass
149
149
 
150
150
 
@@ -1,6 +1,6 @@
1
1
  from datetime import date
2
- from pydantic import BaseModel, Field, model_validator
3
- from typing import Annotated, Generic, Literal, Self, TypeVar, overload
2
+ from pydantic import BaseModel, Field
3
+ from typing import Annotated, Generic, Literal, TypeVar, overload
4
4
  from uuid import UUID
5
5
  from maleo.enums.identity import (
6
6
  OptBloodType,
@@ -45,15 +45,14 @@ from maleo.types.string import OptStr, OptListOfStrs
45
45
  from maleo.types.uuid import OptListOfUUIDs
46
46
  from ..enums.patient import IdentifierType, OptListOfExpandableFields
47
47
  from ..mixins.common import IdCard, FullName, PlaceOfBirth
48
- from ..mixins.patient import Passport
48
+ from ..mixins.patient import PatientIdentifier
49
49
  from ..types.patient import IdentifierValueType
50
- from ..validators.patient import validate_id_card_or_passport
51
50
 
52
51
 
53
52
  class Expand(BaseModel):
54
- expand: Annotated[
55
- OptListOfExpandableFields, Field(None, description="Expand", min_length=1)
56
- ] = None
53
+ expand: Annotated[OptListOfExpandableFields, Field(None, description="Expand")] = (
54
+ None
55
+ )
57
56
 
58
57
 
59
58
  class CreateQuery(Expand):
@@ -67,14 +66,10 @@ class CreateData(
67
66
  DateOfBirth[date],
68
67
  PlaceOfBirth[OptStr],
69
68
  FullName[str],
70
- Passport[OptStr],
71
- IdCard[OptStr],
69
+ PatientIdentifier,
72
70
  IntOrganizationId[int],
73
71
  ):
74
- @model_validator(mode="after")
75
- def chk_id_card_or_passport(self) -> Self:
76
- validate_id_card_or_passport(self.id_card, self.passport)
77
- return self
72
+ pass
78
73
 
79
74
 
80
75
  class CreateParameter(CreateQuery, CreateData):
@@ -183,7 +178,7 @@ class FullUpdateData(
183
178
  DateOfBirth[date],
184
179
  PlaceOfBirth[OptStr],
185
180
  FullName[str],
186
- Passport[OptStr],
181
+ PatientIdentifier,
187
182
  IdCard[OptStr],
188
183
  ):
189
184
  pass
@@ -196,7 +191,7 @@ class PartialUpdateData(
196
191
  DateOfBirth[OptDate],
197
192
  PlaceOfBirth[OptStr],
198
193
  FullName[OptStr],
199
- Passport[OptStr],
194
+ PatientIdentifier,
200
195
  IdCard[OptStr],
201
196
  ):
202
197
  pass
@@ -43,9 +43,9 @@ from ..types.user import IdentifierValueType
43
43
 
44
44
 
45
45
  class Expand(BaseModel):
46
- expand: Annotated[
47
- OptListOfExpandableFields, Field(None, description="Expand", min_length=1)
48
- ] = None
46
+ expand: Annotated[OptListOfExpandableFields, Field(None, description="Expand")] = (
47
+ None
48
+ )
49
49
 
50
50
 
51
51
  class CreateParameter(
@@ -54,9 +54,9 @@ from ..types.user_profile import IdentifierValueType
54
54
 
55
55
 
56
56
  class Expand(BaseModel):
57
- expand: Annotated[
58
- OptListOfExpandableFields, Field(None, description="Expand", min_length=1)
59
- ] = None
57
+ expand: Annotated[OptListOfExpandableFields, Field(None, description="Expand")] = (
58
+ None
59
+ )
60
60
 
61
61
 
62
62
  class CoreCreateData(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo-identity
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: MaleoIdentity service package
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: Proprietary
@@ -1,6 +1,6 @@
1
1
  maleo/identity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- maleo/identity/dtos.py,sha256=Zc7ApGe5UgrlKUajHHNHS8i9B4_YSNL0sxG5bYA8obM,7459
3
- maleo/identity/models.py,sha256=uG_L670oLnWXfUWoq3bya62MoUtAh5M-Sdju4L33iVc,10223
2
+ maleo/identity/dtos.py,sha256=Jsvz9qIi9-ojYLp_zwByahH1_rVZ4znDP_JhFn0HT7g,7648
3
+ maleo/identity/models.py,sha256=aBYbkkd07BzH2zRq3q_D80xMR8DdhCiw1eQ2EYa9ZTQ,10223
4
4
  maleo/identity/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  maleo/identity/constants/api_key.py,sha256=e7CsTodUBgyoX30SJUnYx457WBZeRFyyeaOFGsZ-7mY,264
6
6
  maleo/identity/constants/organization.py,sha256=Jeewz4VlaTmuHHDqNZUZyLD3bdndQjpx9K0EabhCFUM,259
@@ -17,7 +17,7 @@ maleo/identity/enums/api_key.py,sha256=WST6RsRrvJGeSL5ugVeZNKXReGsh9GEPDxmRy-owi
17
17
  maleo/identity/enums/organization.py,sha256=6dALM4rhK9EEsSIQzanW6S0KfhzfHSZ2-VAS7AHAK28,591
18
18
  maleo/identity/enums/organization_registration_code.py,sha256=ZkteIpOW6MOLEHBbmDUaRGalTlTWUIRlimz-FohBWiM,282
19
19
  maleo/identity/enums/organization_relation.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
20
- maleo/identity/enums/patient.py,sha256=JYnVPKZV_hhdygkVut5B1YS3BMknHPzDmthiT7EfwkY,467
20
+ maleo/identity/enums/patient.py,sha256=ddOoy16JTzHX5n1STDnPO0U3lqxGtFmPNwd7KdDhAVI,633
21
21
  maleo/identity/enums/user.py,sha256=Cpp3Oj_NwqF6-fHGruF16TNFProu10ybX1k0HATPcPw,767
22
22
  maleo/identity/enums/user_medical_role.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
23
23
  maleo/identity/enums/user_organization_role.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
@@ -28,21 +28,21 @@ maleo/identity/mixins/api_key.py,sha256=btlTZkJxhLyxj0T50ZBJnSUwiDIJl4Dz7oNl7Ftc
28
28
  maleo/identity/mixins/common.py,sha256=diWtUiPMI_ypHtDrmI5y8IArxCdomo9Gt6X69iFhyuw,905
29
29
  maleo/identity/mixins/organization.py,sha256=KMl7Zz_SXu6SvF_1fTibN2vORFGWH7P22cxS_T4KXmE,574
30
30
  maleo/identity/mixins/organization_registration_code.py,sha256=G-kgdf2IzKENEyZcV6IXT69eAemnqR1vph3hhG3l1y4,508
31
- maleo/identity/mixins/organization_relation.py,sha256=fALtOSx9gIEuzDdykKAWiPkCjStJxo4q8UzUTAdoq2s,453
32
- maleo/identity/mixins/patient.py,sha256=ziNj9Sn_fvQWGmod1GSFpmtwjYLUCICAmL_u0zbokk8,304
31
+ maleo/identity/mixins/organization_relation.py,sha256=kf7vDF7-564cIy6g_scxoWaumsJW0xraK3QdyJk_-Qw,427
32
+ maleo/identity/mixins/patient.py,sha256=1zW6u_b8DM-7dSHfqX6HWJbQsRLKD2H1unEUnZco5MI,665
33
33
  maleo/identity/mixins/user.py,sha256=UHoMgFJXptE9x9QsR07KG2bgp5OlCNqvYjEtP9S3TIY,1054
34
34
  maleo/identity/mixins/user_profile.py,sha256=LFHAzGD-3wli6YJGfl9-Sy0gtQHkhgvrZ5EzOfl1vXY,1174
35
35
  maleo/identity/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  maleo/identity/schemas/api_key.py,sha256=UnQfnoEMkFgOfWDKai6wWNyD5QsovyoOov6jN52QPKI,3713
37
- maleo/identity/schemas/common.py,sha256=dnLQO321jEDqkzM8CC5sKrr6urlq2J0ZX94vPkP7xM0,8740
38
- maleo/identity/schemas/organization.py,sha256=hcKYw-fObxvme2PUkU9jWk0dgj6XIQdU4gIs-Z3JY08,5391
37
+ maleo/identity/schemas/common.py,sha256=h-NZ1oDYsY1vj8IyM2Ct4F5CunEHwhx2RcOdUZCx36Q,8989
38
+ maleo/identity/schemas/organization.py,sha256=8V1DSDMGXyF1gsfpOK0fN-djbKQxNey1Rr5YLO_ZEg0,5379
39
39
  maleo/identity/schemas/organization_registration_code.py,sha256=jAP7MGb_28wh1WoBZDl2FSJBxKFRH56YSQvMFQ5_iyo,4731
40
- maleo/identity/schemas/organization_relation.py,sha256=ZQauGidff-cAFY1gS9i3XRwauyWLg1f8xFES7mL6B8M,5083
41
- maleo/identity/schemas/patient.py,sha256=pV4qukuUXqlLNR2_2AlzvpmxZueNbLzIczdpiWE7_wc,6221
42
- maleo/identity/schemas/user.py,sha256=M2aYjNrhiw1tTjjNdyFaAFYfdACOROegqyBo3hsDVY4,5285
40
+ maleo/identity/schemas/organization_relation.py,sha256=xEdOuZ6J4r7R4heEagd_UtioYJla73LZs1qloSSEs4I,5067
41
+ maleo/identity/schemas/patient.py,sha256=4nBjz5K-AYJnVIIMA5PHGX7UxG0UtNEM0t6g5SP-jkY,5957
42
+ maleo/identity/schemas/user.py,sha256=rxMV24k0KB4FVwR9lmv1SiLNqTbzwRTUItgJie2LMJc,5273
43
43
  maleo/identity/schemas/user_medical_role.py,sha256=YzYsjMRKIA4CWdfOlGoPqWFl4v2JTj2EBwOWhNtUKSQ,4893
44
44
  maleo/identity/schemas/user_organization_role.py,sha256=MW1Ry1HnGrASmP2Mulk3Pfk1_mIOlLTBARerOA0TowI,4983
45
- maleo/identity/schemas/user_profile.py,sha256=zC1yCFg1cUsIYMjQghi6n7y-lxi4Y7PqN-dSbZILB8s,6594
45
+ maleo/identity/schemas/user_profile.py,sha256=saFmMuQ-TNlE--hoUxNVeXt4ZUalJaOVxqmYGkCiJ6I,6582
46
46
  maleo/identity/schemas/user_system_role.py,sha256=CRI8KgNpcjJU9EBtEc75-vUmC64J5ZgigFO6IRWuRKM,4665
47
47
  maleo/identity/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
48
  maleo/identity/types/api_key.py,sha256=pjWzyAh1p0DTS6v2ImYv849iF-T0PbEM8qlrwN3c-2o,190
@@ -58,10 +58,8 @@ maleo/identity/types/user_system_role.py,sha256=6KIDk7kCWBlrloNLfIElflS5N8oBYqPe
58
58
  maleo/identity/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  maleo/identity/utils/organization.py,sha256=jU-PLlxPbsRciid82p-ScdLSydspI-5ofJX7KL5qmDo,1611
60
60
  maleo/identity/utils/user.py,sha256=Mk1NTrViz1nBJxtPZRWdQmYHjTPxxc61a02eyikEBoU,1459
61
- maleo/identity/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
- maleo/identity/validators/patient.py,sha256=b4krKsXMuwUCXYuzCeUXtOXNTaEkKtQaAYmAmuVYIgo,221
63
- maleo_identity-0.1.1.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
64
- maleo_identity-0.1.1.dist-info/METADATA,sha256=CGrcEG56vdmk1T69LIT2n8FDjfa1nLSwts7VLwEMz_E,3583
65
- maleo_identity-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
66
- maleo_identity-0.1.1.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
67
- maleo_identity-0.1.1.dist-info/RECORD,,
61
+ maleo_identity-0.1.3.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
62
+ maleo_identity-0.1.3.dist-info/METADATA,sha256=Les5ugTSugq3zOtLB5EAEm78c3l7s_K0lYFhlFWbPNc,3583
63
+ maleo_identity-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
64
+ maleo_identity-0.1.3.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
65
+ maleo_identity-0.1.3.dist-info/RECORD,,
File without changes
@@ -1,6 +0,0 @@
1
- from maleo.types.string import OptStr
2
-
3
-
4
- def validate_id_card_or_passport(id_card: OptStr, passport: OptStr):
5
- if id_card is None and passport is None:
6
- raise ValueError("Either ID Card and Passport must exist")