mosaic-python-client 0.2.0__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.
- mosaic_client/__init__.py +17 -0
- mosaic_client/epix/__init__.py +115 -0
- mosaic_client/epix/client.py +772 -0
- mosaic_client/epix/models.py +487 -0
- mosaic_client/epix/schemas.py +379 -0
- mosaic_client/gpas/__init__.py +13 -0
- mosaic_client/gpas/client.py +342 -0
- mosaic_client/gpas/models.py +70 -0
- mosaic_client/gpas/schemas.py +53 -0
- mosaic_client/helpers.py +115 -0
- mosaic_python_client-0.2.0.dist-info/METADATA +290 -0
- mosaic_python_client-0.2.0.dist-info/RECORD +14 -0
- mosaic_python_client-0.2.0.dist-info/WHEEL +4 -0
- mosaic_python_client-0.2.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains classes for easy (de-)serialization of SOAP requests and responses
|
|
3
|
+
using marshmallow.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from marshmallow import Schema, fields, post_load
|
|
7
|
+
|
|
8
|
+
from mosaic_client.epix.models import (
|
|
9
|
+
Balanced,
|
|
10
|
+
BatchRequestConfig,
|
|
11
|
+
BloomFilterConfig,
|
|
12
|
+
Contact,
|
|
13
|
+
Deduplication,
|
|
14
|
+
Domain,
|
|
15
|
+
DomainConfiguration,
|
|
16
|
+
FieldMatchingConfig,
|
|
17
|
+
FullContact,
|
|
18
|
+
FullIdentity,
|
|
19
|
+
Identifier,
|
|
20
|
+
IdentifierDomain,
|
|
21
|
+
Identity,
|
|
22
|
+
MatchingConfig,
|
|
23
|
+
Person,
|
|
24
|
+
PreprocessingField,
|
|
25
|
+
Privacy,
|
|
26
|
+
Reason,
|
|
27
|
+
ResponseEntry,
|
|
28
|
+
Source,
|
|
29
|
+
SourceField,
|
|
30
|
+
Validation,
|
|
31
|
+
Validator,
|
|
32
|
+
ValidatorConfig,
|
|
33
|
+
ValidatorGroup,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class SourceSchema(Schema):
|
|
38
|
+
name = fields.Str(required=True)
|
|
39
|
+
description = fields.Str(load_default=None)
|
|
40
|
+
label = fields.Str(load_default=None)
|
|
41
|
+
entry_date = fields.DateTime(data_key="entryDate")
|
|
42
|
+
update_date = fields.DateTime(data_key="updateDate")
|
|
43
|
+
|
|
44
|
+
@post_load
|
|
45
|
+
def make_source(self, data, **kwargs):
|
|
46
|
+
return Source(**data)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class IdentifierDomainSchema(Schema):
|
|
50
|
+
name = fields.Str(required=True)
|
|
51
|
+
label = fields.Str(required=True)
|
|
52
|
+
oid = fields.Str(load_default=None)
|
|
53
|
+
description = fields.Str(load_default=None)
|
|
54
|
+
entry_date = fields.DateTime(data_key="entryDate", load_default=None)
|
|
55
|
+
update_date = fields.DateTime(data_key="updateDate", load_default=None)
|
|
56
|
+
|
|
57
|
+
@post_load
|
|
58
|
+
def make_identifier_domain(self, data, **kwargs):
|
|
59
|
+
return IdentifierDomain(**data)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class IdentifierSchema(Schema):
|
|
63
|
+
value = fields.Str(required=True)
|
|
64
|
+
identifier_domain = fields.Nested(IdentifierDomainSchema(), required=True, data_key="identifierDomain")
|
|
65
|
+
entry_date = fields.DateTime(data_key="entryDate", load_default=None)
|
|
66
|
+
description = fields.Str(load_default=None)
|
|
67
|
+
fresh = fields.Bool()
|
|
68
|
+
|
|
69
|
+
@post_load
|
|
70
|
+
def make_identifier(self, data, **kwargs):
|
|
71
|
+
return Identifier(**data)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class ContactSchema(Schema):
|
|
75
|
+
city = fields.Str(load_default=None)
|
|
76
|
+
country = fields.Str(load_default=None)
|
|
77
|
+
country_code = fields.Str(data_key="countryCode", load_default=None)
|
|
78
|
+
district = fields.Str(load_default=None)
|
|
79
|
+
email = fields.Str(load_default=None)
|
|
80
|
+
external_date = fields.DateTime(data_key="externalDate", load_default=None)
|
|
81
|
+
municipality_key = fields.Str(data_key="municipalityKey", load_default=None)
|
|
82
|
+
phone = fields.Str(load_default=None)
|
|
83
|
+
state = fields.Str(load_default=None)
|
|
84
|
+
street = fields.Str(load_default=None)
|
|
85
|
+
zip_code = fields.Str(data_key="zipCode", load_default=None)
|
|
86
|
+
|
|
87
|
+
@post_load
|
|
88
|
+
def make_contact(self, data, **kwargs):
|
|
89
|
+
return Contact(**data)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class FullContactSchema(ContactSchema):
|
|
93
|
+
contact_created = fields.DateTime(data_key="contactCreated", load_default=None)
|
|
94
|
+
contact_id = fields.Int(data_key="contactId", load_default=None)
|
|
95
|
+
contact_last_edited = fields.DateTime(data_key="contactLastEdited", load_default=None)
|
|
96
|
+
contact_version = fields.Int(data_key="contactVersion", load_default=None)
|
|
97
|
+
deactivated = fields.Bool()
|
|
98
|
+
identity_id = fields.Int(data_key="identityId", load_default=None)
|
|
99
|
+
|
|
100
|
+
@post_load
|
|
101
|
+
def make_contact(self, data, **kwargs):
|
|
102
|
+
return FullContact(**data)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class IdentitySchema(Schema):
|
|
106
|
+
birth_date = fields.DateTime(data_key="birthDate", load_default=None)
|
|
107
|
+
birth_place = fields.Str(data_key="birthPlace", load_default=None)
|
|
108
|
+
civil_status = fields.Str(data_key="civilStatus", load_default=None)
|
|
109
|
+
degree = fields.Str(load_default=None)
|
|
110
|
+
external_date = fields.DateTime(data_key="externalDate", load_default=None)
|
|
111
|
+
first_name = fields.Str(data_key="firstName", load_default=None)
|
|
112
|
+
gender = fields.Str(load_default=None)
|
|
113
|
+
identifiers = fields.List(fields.Nested(IdentifierSchema()))
|
|
114
|
+
last_name = fields.Str(data_key="lastName", load_default=None)
|
|
115
|
+
middle_name = fields.Str(data_key="middleName", load_default=None)
|
|
116
|
+
mother_tongue = fields.Str(data_key="motherTongue", load_default=None)
|
|
117
|
+
mothers_maiden_name = fields.Str(data_key="mothersMaidenName", load_default=None)
|
|
118
|
+
nationality = fields.Str(load_default=None)
|
|
119
|
+
vital_status = fields.Str(data_key="vitalStatus", load_default=None)
|
|
120
|
+
death_date = fields.DateTime(data_key="dateOfDeath", load_default=None)
|
|
121
|
+
prefix = fields.Str(load_default=None)
|
|
122
|
+
race = fields.Str(load_default=None)
|
|
123
|
+
religion = fields.Str(load_default=None)
|
|
124
|
+
suffix = fields.Str(load_default=None)
|
|
125
|
+
value_1 = fields.Str(data_key="value1", load_default=None)
|
|
126
|
+
value_2 = fields.Str(data_key="value2", load_default=None)
|
|
127
|
+
value_3 = fields.Str(data_key="value3", load_default=None)
|
|
128
|
+
value_4 = fields.Str(data_key="value4", load_default=None)
|
|
129
|
+
value_5 = fields.Str(data_key="value5", load_default=None)
|
|
130
|
+
value_6 = fields.Str(data_key="value6", load_default=None)
|
|
131
|
+
value_7 = fields.Str(data_key="value7", load_default=None)
|
|
132
|
+
value_8 = fields.Str(data_key="value8", load_default=None)
|
|
133
|
+
value_9 = fields.Str(data_key="value9", load_default=None)
|
|
134
|
+
value_10 = fields.Str(data_key="value10", load_default=None)
|
|
135
|
+
contacts = fields.List(fields.Nested(ContactSchema()))
|
|
136
|
+
|
|
137
|
+
@post_load
|
|
138
|
+
def make_identity(self, data, **kwargs):
|
|
139
|
+
return Identity(**data)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class FullIdentitySchema(IdentitySchema):
|
|
143
|
+
deactivated = fields.Bool()
|
|
144
|
+
identity_created = fields.DateTime(data_key="identityCreated", load_default=None)
|
|
145
|
+
identity_id = fields.Int(data_key="identityId", load_default=None)
|
|
146
|
+
identity_last_edited = fields.DateTime(data_key="identityLastEdited", load_default=None)
|
|
147
|
+
identity_version = fields.Int(data_key="identityVersion", load_default=None)
|
|
148
|
+
person_id = fields.Int(data_key="personId", load_default=None)
|
|
149
|
+
source = fields.Nested(SourceSchema(), load_default=None)
|
|
150
|
+
contacts = fields.List(fields.Nested(FullContactSchema()))
|
|
151
|
+
|
|
152
|
+
@post_load
|
|
153
|
+
def make_identity(self, data, **kwargs):
|
|
154
|
+
return FullIdentity(**data)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class PersonSchema(Schema):
|
|
158
|
+
deactivated = fields.Bool(required=True)
|
|
159
|
+
mpi_id = fields.Nested(IdentifierSchema(), required=True, data_key="mpiId")
|
|
160
|
+
person_created = fields.DateTime(required=True, data_key="personCreated")
|
|
161
|
+
person_id = fields.Int(required=True, data_key="personId")
|
|
162
|
+
person_last_edited = fields.DateTime(required=True, data_key="personLastEdited")
|
|
163
|
+
other_identities = fields.List(fields.Nested(FullIdentitySchema()), data_key="otherIdentities")
|
|
164
|
+
reference_identity = fields.Nested(FullIdentitySchema(), required=True, data_key="referenceIdentity")
|
|
165
|
+
domain_name = fields.Str(data_key="domainName", required=True)
|
|
166
|
+
|
|
167
|
+
@post_load
|
|
168
|
+
def make_person(self, data, **kwargs):
|
|
169
|
+
return Person(**data)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class ResponseEntrySchema(Schema):
|
|
173
|
+
match_status = fields.Str(required=True, data_key="matchStatus")
|
|
174
|
+
mpi_error_code = fields.Str(data_key="mpiErrorCode", load_default=None)
|
|
175
|
+
person = fields.Nested(PersonSchema(), required=True)
|
|
176
|
+
|
|
177
|
+
@post_load
|
|
178
|
+
def make_response_entry(self, data, **kwargs):
|
|
179
|
+
return ResponseEntry(**data)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class BatchRequestConfigSchema(Schema):
|
|
183
|
+
force_reference_update = fields.Bool(required=True, data_key="forceReferenceUpdate")
|
|
184
|
+
save_action = fields.Str(required=True, data_key="saveAction")
|
|
185
|
+
|
|
186
|
+
@post_load
|
|
187
|
+
def make_batch_request_config(self, data, **kwargs):
|
|
188
|
+
return BatchRequestConfig(**data)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class ReasonSchema(Schema):
|
|
192
|
+
name = fields.Str(required=True)
|
|
193
|
+
description = fields.Str(load_default=None)
|
|
194
|
+
|
|
195
|
+
@post_load
|
|
196
|
+
def make_reason(self, data, **kwargs):
|
|
197
|
+
return Reason(**data)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class DeduplicationSchema(Schema):
|
|
201
|
+
reasons = fields.List(fields.Nested(ReasonSchema()))
|
|
202
|
+
|
|
203
|
+
@post_load
|
|
204
|
+
def make_deduplication(self, data, **kwargs):
|
|
205
|
+
return Deduplication(**data)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class SourceFieldSchema(Schema):
|
|
209
|
+
name = fields.Str(required=True)
|
|
210
|
+
seed = fields.Int(required=True)
|
|
211
|
+
|
|
212
|
+
@post_load
|
|
213
|
+
def make_source_field(self, data, **kwargs):
|
|
214
|
+
return SourceField(**data)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class BalancedSchema(Schema):
|
|
218
|
+
seed = fields.Int(required=True)
|
|
219
|
+
|
|
220
|
+
@post_load
|
|
221
|
+
def make_balanced(self, data, **kwargs):
|
|
222
|
+
return Balanced(**data)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class BloomFilterConfigSchema(Schema):
|
|
226
|
+
storing_field = fields.Str(required=True, data_key="field")
|
|
227
|
+
algorithm = fields.Str(required=True)
|
|
228
|
+
alphabet = fields.Str(required=True)
|
|
229
|
+
balanced = fields.Nested(BalancedSchema(), load_default=None)
|
|
230
|
+
bits_per_ngram = fields.Int(required=True, data_key="bitsPerNgram")
|
|
231
|
+
fold = fields.Int(required=True)
|
|
232
|
+
length = fields.Int(required=True)
|
|
233
|
+
ngrams = fields.Int(required=True)
|
|
234
|
+
source_fields = fields.List(fields.Nested(SourceFieldSchema()), data_key="sourceFields")
|
|
235
|
+
|
|
236
|
+
@post_load
|
|
237
|
+
def make_bloom_filter_config(self, data, **kwargs):
|
|
238
|
+
return BloomFilterConfig(**data)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
class PrivacySchema(Schema):
|
|
242
|
+
boom_filter_configs = fields.List(fields.Nested(BloomFilterConfigSchema(), data_key="bloomFilterConfigs"))
|
|
243
|
+
|
|
244
|
+
@post_load
|
|
245
|
+
def make_privacy(self, data, **kwargs):
|
|
246
|
+
return Privacy(**data)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class ValidatorSchema(Schema):
|
|
250
|
+
qualified_class_name = fields.Str(required=True, data_key="qualifiedClassName")
|
|
251
|
+
criterion = fields.Str(required=True)
|
|
252
|
+
|
|
253
|
+
@post_load
|
|
254
|
+
def make_validator(self, data, **kwargs):
|
|
255
|
+
return Validator(**data)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class ValidatorGroupSchema(Schema):
|
|
259
|
+
operator = fields.Str(required=True)
|
|
260
|
+
validators = fields.List(fields.Nested(ValidatorSchema()))
|
|
261
|
+
validator_groups = fields.List(fields.Nested("self"), data_key="validatorGroups")
|
|
262
|
+
|
|
263
|
+
@post_load
|
|
264
|
+
def make_validator_group(self, data, **kwargs):
|
|
265
|
+
return ValidatorGroup(**data)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class ValidatorConfigSchema(Schema):
|
|
269
|
+
field_name = fields.Str(required=True, data_key="fieldName")
|
|
270
|
+
validator = fields.Nested(ValidatorSchema(), required=True)
|
|
271
|
+
validator_group = fields.Nested(ValidatorGroupSchema(), load_default=None, data_key="validatorGroup")
|
|
272
|
+
|
|
273
|
+
@post_load
|
|
274
|
+
def make_validator_config(self, data, **kwargs):
|
|
275
|
+
return ValidatorConfig(**data)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
class ValidationSchema(Schema):
|
|
279
|
+
validation_configs = fields.List(fields.Nested(ValidatorConfigSchema()), data_key="validationConfigs")
|
|
280
|
+
|
|
281
|
+
@post_load
|
|
282
|
+
def make_validation(self, data, **kwargs):
|
|
283
|
+
return Validation(**data)
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
class PreprocessingFieldSchema(Schema):
|
|
287
|
+
field_name = fields.Str(required=True, data_key="fieldName")
|
|
288
|
+
complex_transformation_classes = fields.List(fields.Str(), data_key="complexTransformationClasses")
|
|
289
|
+
simple_filter_types = fields.Dict(
|
|
290
|
+
keys=fields.Str(),
|
|
291
|
+
values=fields.List(fields.Dict()),
|
|
292
|
+
data_key="simpleFilterTypes",
|
|
293
|
+
load_default=None,
|
|
294
|
+
)
|
|
295
|
+
simple_transformation_types = fields.Dict(
|
|
296
|
+
keys=fields.Str(),
|
|
297
|
+
values=fields.List(fields.Dict()),
|
|
298
|
+
data_key="simpleTransformationTypes",
|
|
299
|
+
load_default=None,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
@post_load
|
|
303
|
+
def make_preprocessing_field(self, data, **kwargs):
|
|
304
|
+
return PreprocessingField(**data)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
class FieldMatchingConfigSchema(Schema):
|
|
308
|
+
name = fields.Str(required=True)
|
|
309
|
+
algorithm = fields.Str(required=True)
|
|
310
|
+
blocking_mode = fields.Str(required=True, data_key="blockingMode")
|
|
311
|
+
blocking_threshold = fields.Float(required=True, data_key="blockingThreshold")
|
|
312
|
+
matching_threshold = fields.Float(required=True, data_key="matchingThreshold")
|
|
313
|
+
weight = fields.Int(required=True)
|
|
314
|
+
multiple_values_separator = fields.Int(data_key="multipleValuesSeparator")
|
|
315
|
+
penalty_both_short = fields.Float(data_key="penaltyBothShort")
|
|
316
|
+
penalty_not_a_perfect_match = fields.Float(data_key="penaltyNotAPerfectMatch")
|
|
317
|
+
penalty_one_short = fields.Float(data_key="penaltyOneShort")
|
|
318
|
+
|
|
319
|
+
@post_load
|
|
320
|
+
def make_field_matching_config(self, data, **kwargs):
|
|
321
|
+
return FieldMatchingConfig(**data)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
class MatchingConfigSchema(Schema):
|
|
325
|
+
matching_fields = fields.List(fields.Nested(FieldMatchingConfigSchema()), data_key="fields", attribute="fields")
|
|
326
|
+
number_of_threads = fields.Int(data_key="numberOfThreads")
|
|
327
|
+
parallel_matching_after = fields.Int(data_key="parallelMatchingAfter")
|
|
328
|
+
threshold_automatic_match = fields.Float(data_key="thresholdAutomaticMatch")
|
|
329
|
+
threshold_possible_match = fields.Float(data_key="thresholdPossibleMatch")
|
|
330
|
+
use_cemfim = fields.Bool(data_key="useCEMFIM")
|
|
331
|
+
|
|
332
|
+
@post_load
|
|
333
|
+
def make_matching_config(self, data, **kwargs):
|
|
334
|
+
return MatchingConfig(**data)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
class DomainConfigurationSchema(Schema):
|
|
338
|
+
mpi_generator = fields.Str(data_key="mpiGenerator")
|
|
339
|
+
mpi_prefix = fields.Str(data_key="mpiPrefix", required=True)
|
|
340
|
+
persist_mode = fields.Str(data_key="persistMode")
|
|
341
|
+
deduplication = fields.Nested(DeduplicationSchema(), load_default=None)
|
|
342
|
+
privacy = fields.Nested(PrivacySchema(), load_default=None)
|
|
343
|
+
update_behaviour = fields.Str(data_key="updateBehaviour")
|
|
344
|
+
validation = fields.Nested(ValidationSchema(), load_default=None)
|
|
345
|
+
required_fields = fields.List(fields.Str(), data_key="requiredFields", required=True)
|
|
346
|
+
use_notifications = fields.Bool(data_key="useNotifications")
|
|
347
|
+
limit_search_for_low_memory = fields.Bool(data_key="limitSearchForLowMemory")
|
|
348
|
+
value_field_mapping = fields.Dict(
|
|
349
|
+
keys=fields.Str(),
|
|
350
|
+
values=fields.List(fields.Dict()),
|
|
351
|
+
data_key="valueFieldMapping",
|
|
352
|
+
load_default=None,
|
|
353
|
+
)
|
|
354
|
+
preprocessing_fields = fields.List(fields.Nested(PreprocessingFieldSchema()), data_key="preprocessingFields")
|
|
355
|
+
matching_config = fields.Nested(MatchingConfigSchema(), data_key="matchingConfig")
|
|
356
|
+
matching_mode = fields.Str(data_key="matchingMode")
|
|
357
|
+
|
|
358
|
+
@post_load
|
|
359
|
+
def make_domain_configuration(self, data, **kwargs):
|
|
360
|
+
return DomainConfiguration(**data)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
class DomainSchema(Schema):
|
|
364
|
+
name = fields.Str(required=True)
|
|
365
|
+
label = fields.Str(required=True)
|
|
366
|
+
mpi_domain = fields.Nested(IdentifierDomainSchema(), required=True, data_key="mpiDomain")
|
|
367
|
+
safe_source = fields.Nested(SourceSchema(), required=True, data_key="safeSource")
|
|
368
|
+
config_objects = fields.Nested(DomainConfigurationSchema(), data_key="configObjects", required=True)
|
|
369
|
+
description = fields.Str(load_default=None)
|
|
370
|
+
in_use = fields.Bool(data_key="inUse")
|
|
371
|
+
matching_mode = fields.Str(data_key="matchingMode")
|
|
372
|
+
entry_date = fields.DateTime(data_key="entryDate")
|
|
373
|
+
update_date = fields.DateTime(data_key="updateDate")
|
|
374
|
+
person_count = fields.Int(data_key="personCount")
|
|
375
|
+
config = fields.Str()
|
|
376
|
+
|
|
377
|
+
@post_load
|
|
378
|
+
def make_domain(self, data, **kwargs):
|
|
379
|
+
return Domain(**data)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from mosaic_client.gpas.client import GPASClient
|
|
2
|
+
from mosaic_client.gpas.models import Domain, DomainConfig, DomainResponse
|
|
3
|
+
from mosaic_client.gpas.schemas import DomainConfigSchema, DomainResponseSchema, DomainSchema
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"Domain",
|
|
7
|
+
"DomainConfig",
|
|
8
|
+
"DomainConfigSchema",
|
|
9
|
+
"DomainResponse",
|
|
10
|
+
"DomainResponseSchema",
|
|
11
|
+
"DomainSchema",
|
|
12
|
+
"GPASClient",
|
|
13
|
+
]
|