-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprovider_struct.py
More file actions
48 lines (32 loc) · 1.39 KB
/
provider_struct.py
File metadata and controls
48 lines (32 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from marshmallow import Schema, fields, post_load, validate
from typing import Set
from medical_group_struct import MedicalGroupStruct, MedicalGroupStructSchema
class ProviderStruct:
def __init__(self,
first_name: str,
last_name: str,
npi: str,
medical_group: MedicalGroupStruct = None,
supported_offices_uids: Set[str] = None) -> None:
self.first_name: str = first_name
self.last_name: str = last_name
self.npi: str = npi
# Important Note: This is the provider that this PCP was practicing at
# the time when we ingested the data. It is possible that individual claims
# could happen at different NPI/TIN association.
self.medical_group: MedicalGroupStruct = medical_group
self.supported_offices_uids = supported_offices_uids or set()
def name(self):
if self.first_name or self.last_name:
return self.first_name + ' ' + self.last_name
else:
return '- -'
class ProviderStructSchema(Schema):
first_name = fields.Str(validate=validate.Length(max=200))
last_name = fields.Str(validate=validate.Length(max=200))
npi = fields.Str(required=True, validate=validate.Length(max=20))
medical_group = fields.Nested(MedicalGroupStructSchema)
supported_offices_uids = fields.List(fields.Str())
@post_load
def make_provider_struct(self, data):
return ProviderStruct(**data)