rxfoundry.clients.swifty-api 0.0.680__py3-none-any.whl → 0.1.1005__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.
- rxfoundry/clients/swifty_api/__init__.py +37 -3
- rxfoundry/clients/swifty_api/api/__init__.py +3 -1
- rxfoundry/clients/swifty_api/api/async_api.py +2336 -52
- rxfoundry/clients/swifty_api/api/code_api.py +281 -0
- rxfoundry/clients/swifty_api/api/default_api.py +318 -0
- rxfoundry/clients/swifty_api/api/medication_api.py +647 -51
- rxfoundry/clients/swifty_api/api/patient_api.py +1126 -35
- rxfoundry/clients/swifty_api/api/pharmacist_api.py +24 -24
- rxfoundry/clients/swifty_api/api/pharmacy_api.py +48 -48
- rxfoundry/clients/swifty_api/api/prescriber_api.py +24 -24
- rxfoundry/clients/swifty_api/api/prescription_api.py +934 -130
- rxfoundry/clients/swifty_api/api/task_api.py +1835 -0
- rxfoundry/clients/swifty_api/api/tasks_api.py +374 -0
- rxfoundry/clients/swifty_api/api/validation_api.py +311 -0
- rxfoundry/clients/swifty_api/api/virtual_pharmacy_api.py +262 -0
- rxfoundry/clients/swifty_api/api/workflow_api.py +633 -0
- rxfoundry/clients/swifty_api/models/__init__.py +34 -2
- rxfoundry/clients/swifty_api/models/address.py +11 -10
- rxfoundry/clients/swifty_api/models/code_type.py +92 -0
- rxfoundry/clients/swifty_api/models/formulary.py +96 -0
- rxfoundry/clients/swifty_api/models/insurance.py +96 -0
- rxfoundry/clients/swifty_api/models/medication_instruction.py +92 -0
- rxfoundry/clients/swifty_api/models/medication_ref.py +100 -0
- rxfoundry/clients/swifty_api/models/patient.py +85 -2
- rxfoundry/clients/swifty_api/models/patient_activity_data.py +169 -0
- rxfoundry/clients/swifty_api/models/patient_activity_message.py +112 -0
- rxfoundry/clients/swifty_api/models/patient_activity_notification.py +9 -17
- rxfoundry/clients/swifty_api/models/patient_activity_notification_activity_data.py +39 -8
- rxfoundry/clients/swifty_api/models/patient_address_activity_notification.py +105 -0
- rxfoundry/clients/swifty_api/models/patient_address_data.py +25 -9
- rxfoundry/clients/swifty_api/models/patient_allergy.py +92 -0
- rxfoundry/clients/swifty_api/models/patient_condition.py +92 -0
- rxfoundry/clients/swifty_api/models/patient_data.py +13 -2
- rxfoundry/clients/swifty_api/models/patient_external_identifier.py +6 -5
- rxfoundry/clients/swifty_api/models/patient_health_profile_data.py +127 -0
- rxfoundry/clients/swifty_api/models/patient_insurance.py +106 -0
- rxfoundry/clients/swifty_api/models/patient_insurance_data.py +105 -0
- rxfoundry/clients/swifty_api/models/patient_medication.py +92 -0
- rxfoundry/clients/swifty_api/models/patient_name.py +99 -0
- rxfoundry/clients/swifty_api/models/patient_name_data.py +108 -0
- rxfoundry/clients/swifty_api/models/patient_phone_number.py +89 -0
- rxfoundry/clients/swifty_api/models/patient_phone_number_data.py +98 -0
- rxfoundry/clients/swifty_api/models/patient_task.py +115 -0
- rxfoundry/clients/swifty_api/models/patient_task_status.py +105 -0
- rxfoundry/clients/swifty_api/models/patient_task_type.py +45 -0
- rxfoundry/clients/swifty_api/models/prescription.py +35 -30
- rxfoundry/clients/swifty_api/models/prescription_change_request.py +24 -36
- rxfoundry/clients/swifty_api/models/prescription_change_request_and_response.py +145 -0
- rxfoundry/clients/swifty_api/models/prescription_change_request_response.py +134 -0
- rxfoundry/clients/swifty_api/models/prescription_data.py +126 -0
- rxfoundry/clients/swifty_api/models/prescription_message.py +100 -0
- rxfoundry/clients/swifty_api/models/prescription_message_task.py +109 -0
- rxfoundry/clients/swifty_api/models/prescription_message_task_status.py +99 -0
- rxfoundry/clients/swifty_api/models/prescription_message_task_type.py +43 -0
- rxfoundry/clients/swifty_api/models/prescription_message_type.py +53 -0
- rxfoundry/clients/swifty_api/models/prescription_patch.py +6 -2
- rxfoundry/clients/swifty_api/models/prescription_status_type.py +40 -0
- rxfoundry/clients/swifty_api/models/prescription_task.py +14 -12
- rxfoundry/clients/swifty_api/models/prescription_task_status.py +6 -2
- rxfoundry/clients/swifty_api/models/prescription_task_type.py +42 -0
- rxfoundry/clients/swifty_api/models/prescription_transfer_request_and_response.py +145 -0
- rxfoundry/clients/swifty_api/models/prescription_transfer_request_response.py +128 -0
- rxfoundry/clients/swifty_api/models/status_type.py +92 -0
- rxfoundry/clients/swifty_api/models/workflow.py +108 -0
- rxfoundry/clients/swifty_api/models/workflow_sub_task.py +96 -0
- rxfoundry/clients/swifty_api/models/workflow_sub_task_sub_task.py +155 -0
- rxfoundry/clients/swifty_api/models/workflow_task.py +111 -0
- rxfoundry/clients/swifty_api/models/workflow_task_task.py +155 -0
- rxfoundry/clients/swifty_api/models/workflow_type.py +55 -0
- {rxfoundry_clients_swifty_api-0.0.680.dist-info → rxfoundry_clients_swifty_api-0.1.1005.dist-info}/METADATA +1 -1
- rxfoundry_clients_swifty_api-0.1.1005.dist-info/RECORD +109 -0
- rxfoundry_clients_swifty_api-0.0.680.dist-info/RECORD +0 -64
- {rxfoundry_clients_swifty_api-0.0.680.dist-info → rxfoundry_clients_swifty_api-0.1.1005.dist-info}/WHEEL +0 -0
- {rxfoundry_clients_swifty_api-0.0.680.dist-info → rxfoundry_clients_swifty_api-0.1.1005.dist-info}/top_level.txt +0 -0
|
@@ -22,7 +22,13 @@ from pydantic import BaseModel, ConfigDict, StrictStr
|
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from rxfoundry.clients.swifty_api.models.address import Address
|
|
24
24
|
from rxfoundry.clients.swifty_api.models.code import Code
|
|
25
|
+
from rxfoundry.clients.swifty_api.models.insurance import Insurance
|
|
26
|
+
from rxfoundry.clients.swifty_api.models.patient_allergy import PatientAllergy
|
|
27
|
+
from rxfoundry.clients.swifty_api.models.patient_condition import PatientCondition
|
|
25
28
|
from rxfoundry.clients.swifty_api.models.patient_external_identifier import PatientExternalIdentifier
|
|
29
|
+
from rxfoundry.clients.swifty_api.models.patient_medication import PatientMedication
|
|
30
|
+
from rxfoundry.clients.swifty_api.models.patient_name import PatientName
|
|
31
|
+
from rxfoundry.clients.swifty_api.models.patient_phone_number import PatientPhoneNumber
|
|
26
32
|
from typing import Optional, Set
|
|
27
33
|
from typing_extensions import Self
|
|
28
34
|
|
|
@@ -43,7 +49,16 @@ class Patient(BaseModel):
|
|
|
43
49
|
alternate_phone: Optional[StrictStr] = None
|
|
44
50
|
email: Optional[StrictStr] = None
|
|
45
51
|
external_references: Optional[List[PatientExternalIdentifier]] = None
|
|
46
|
-
|
|
52
|
+
allergies: Optional[List[PatientAllergy]] = None
|
|
53
|
+
conditions: Optional[List[PatientCondition]] = None
|
|
54
|
+
medications: Optional[List[PatientMedication]] = None
|
|
55
|
+
insurances: Optional[List[Insurance]] = None
|
|
56
|
+
preferred_language: Optional[Code] = None
|
|
57
|
+
former_names: Optional[List[PatientName]] = None
|
|
58
|
+
former_phone_numbers: Optional[List[PatientPhoneNumber]] = None
|
|
59
|
+
former_addresses: Optional[List[Address]] = None
|
|
60
|
+
former_insurances: Optional[List[Insurance]] = None
|
|
61
|
+
__properties: ClassVar[List[str]] = ["uuid", "last_name", "first_name", "middle_name", "suffix", "prefix", "gender", "date_of_birth", "home_address", "primary_phone", "alternate_phone", "email", "external_references", "allergies", "conditions", "medications", "insurances", "preferred_language", "former_names", "former_phone_numbers", "former_addresses", "former_insurances"]
|
|
47
62
|
|
|
48
63
|
model_config = ConfigDict(
|
|
49
64
|
populate_by_name=True,
|
|
@@ -97,6 +112,65 @@ class Patient(BaseModel):
|
|
|
97
112
|
if _item_external_references:
|
|
98
113
|
_items.append(_item_external_references.to_dict())
|
|
99
114
|
_dict['external_references'] = _items
|
|
115
|
+
# override the default output from pydantic by calling `to_dict()` of each item in allergies (list)
|
|
116
|
+
_items = []
|
|
117
|
+
if self.allergies:
|
|
118
|
+
for _item_allergies in self.allergies:
|
|
119
|
+
if _item_allergies:
|
|
120
|
+
_items.append(_item_allergies.to_dict())
|
|
121
|
+
_dict['allergies'] = _items
|
|
122
|
+
# override the default output from pydantic by calling `to_dict()` of each item in conditions (list)
|
|
123
|
+
_items = []
|
|
124
|
+
if self.conditions:
|
|
125
|
+
for _item_conditions in self.conditions:
|
|
126
|
+
if _item_conditions:
|
|
127
|
+
_items.append(_item_conditions.to_dict())
|
|
128
|
+
_dict['conditions'] = _items
|
|
129
|
+
# override the default output from pydantic by calling `to_dict()` of each item in medications (list)
|
|
130
|
+
_items = []
|
|
131
|
+
if self.medications:
|
|
132
|
+
for _item_medications in self.medications:
|
|
133
|
+
if _item_medications:
|
|
134
|
+
_items.append(_item_medications.to_dict())
|
|
135
|
+
_dict['medications'] = _items
|
|
136
|
+
# override the default output from pydantic by calling `to_dict()` of each item in insurances (list)
|
|
137
|
+
_items = []
|
|
138
|
+
if self.insurances:
|
|
139
|
+
for _item_insurances in self.insurances:
|
|
140
|
+
if _item_insurances:
|
|
141
|
+
_items.append(_item_insurances.to_dict())
|
|
142
|
+
_dict['insurances'] = _items
|
|
143
|
+
# override the default output from pydantic by calling `to_dict()` of preferred_language
|
|
144
|
+
if self.preferred_language:
|
|
145
|
+
_dict['preferred_language'] = self.preferred_language.to_dict()
|
|
146
|
+
# override the default output from pydantic by calling `to_dict()` of each item in former_names (list)
|
|
147
|
+
_items = []
|
|
148
|
+
if self.former_names:
|
|
149
|
+
for _item_former_names in self.former_names:
|
|
150
|
+
if _item_former_names:
|
|
151
|
+
_items.append(_item_former_names.to_dict())
|
|
152
|
+
_dict['former_names'] = _items
|
|
153
|
+
# override the default output from pydantic by calling `to_dict()` of each item in former_phone_numbers (list)
|
|
154
|
+
_items = []
|
|
155
|
+
if self.former_phone_numbers:
|
|
156
|
+
for _item_former_phone_numbers in self.former_phone_numbers:
|
|
157
|
+
if _item_former_phone_numbers:
|
|
158
|
+
_items.append(_item_former_phone_numbers.to_dict())
|
|
159
|
+
_dict['former_phone_numbers'] = _items
|
|
160
|
+
# override the default output from pydantic by calling `to_dict()` of each item in former_addresses (list)
|
|
161
|
+
_items = []
|
|
162
|
+
if self.former_addresses:
|
|
163
|
+
for _item_former_addresses in self.former_addresses:
|
|
164
|
+
if _item_former_addresses:
|
|
165
|
+
_items.append(_item_former_addresses.to_dict())
|
|
166
|
+
_dict['former_addresses'] = _items
|
|
167
|
+
# override the default output from pydantic by calling `to_dict()` of each item in former_insurances (list)
|
|
168
|
+
_items = []
|
|
169
|
+
if self.former_insurances:
|
|
170
|
+
for _item_former_insurances in self.former_insurances:
|
|
171
|
+
if _item_former_insurances:
|
|
172
|
+
_items.append(_item_former_insurances.to_dict())
|
|
173
|
+
_dict['former_insurances'] = _items
|
|
100
174
|
return _dict
|
|
101
175
|
|
|
102
176
|
@classmethod
|
|
@@ -121,7 +195,16 @@ class Patient(BaseModel):
|
|
|
121
195
|
"primary_phone": obj.get("primary_phone"),
|
|
122
196
|
"alternate_phone": obj.get("alternate_phone"),
|
|
123
197
|
"email": obj.get("email"),
|
|
124
|
-
"external_references": [PatientExternalIdentifier.from_dict(_item) for _item in obj["external_references"]] if obj.get("external_references") is not None else None
|
|
198
|
+
"external_references": [PatientExternalIdentifier.from_dict(_item) for _item in obj["external_references"]] if obj.get("external_references") is not None else None,
|
|
199
|
+
"allergies": [PatientAllergy.from_dict(_item) for _item in obj["allergies"]] if obj.get("allergies") is not None else None,
|
|
200
|
+
"conditions": [PatientCondition.from_dict(_item) for _item in obj["conditions"]] if obj.get("conditions") is not None else None,
|
|
201
|
+
"medications": [PatientMedication.from_dict(_item) for _item in obj["medications"]] if obj.get("medications") is not None else None,
|
|
202
|
+
"insurances": [Insurance.from_dict(_item) for _item in obj["insurances"]] if obj.get("insurances") is not None else None,
|
|
203
|
+
"preferred_language": Code.from_dict(obj["preferred_language"]) if obj.get("preferred_language") is not None else None,
|
|
204
|
+
"former_names": [PatientName.from_dict(_item) for _item in obj["former_names"]] if obj.get("former_names") is not None else None,
|
|
205
|
+
"former_phone_numbers": [PatientPhoneNumber.from_dict(_item) for _item in obj["former_phone_numbers"]] if obj.get("former_phone_numbers") is not None else None,
|
|
206
|
+
"former_addresses": [Address.from_dict(_item) for _item in obj["former_addresses"]] if obj.get("former_addresses") is not None else None,
|
|
207
|
+
"former_insurances": [Insurance.from_dict(_item) for _item in obj["former_insurances"]] if obj.get("former_insurances") is not None else None
|
|
125
208
|
})
|
|
126
209
|
return _obj
|
|
127
210
|
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
SwiftyRX API
|
|
5
|
+
|
|
6
|
+
API for the SwiftyRX Backend
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.DEV-0
|
|
9
|
+
Contact: paul.tindall@rxfoundry.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
20
|
+
from typing import Any, List, Optional
|
|
21
|
+
from rxfoundry.clients.swifty_api.models.patient_address_data import PatientAddressData
|
|
22
|
+
from rxfoundry.clients.swifty_api.models.patient_data import PatientData
|
|
23
|
+
from rxfoundry.clients.swifty_api.models.patient_health_profile_data import PatientHealthProfileData
|
|
24
|
+
from rxfoundry.clients.swifty_api.models.patient_insurance_data import PatientInsuranceData
|
|
25
|
+
from pydantic import StrictStr, Field
|
|
26
|
+
from typing import Union, List, Set, Optional, Dict
|
|
27
|
+
from typing_extensions import Literal, Self
|
|
28
|
+
|
|
29
|
+
PATIENTACTIVITYDATA_ONE_OF_SCHEMAS = ["PatientAddressData", "PatientData", "PatientHealthProfileData", "PatientInsuranceData"]
|
|
30
|
+
|
|
31
|
+
class PatientActivityData(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
PatientActivityData
|
|
34
|
+
"""
|
|
35
|
+
# data type: PatientData
|
|
36
|
+
oneof_schema_1_validator: Optional[PatientData] = None
|
|
37
|
+
# data type: PatientAddressData
|
|
38
|
+
oneof_schema_2_validator: Optional[PatientAddressData] = None
|
|
39
|
+
# data type: PatientInsuranceData
|
|
40
|
+
oneof_schema_3_validator: Optional[PatientInsuranceData] = None
|
|
41
|
+
# data type: PatientHealthProfileData
|
|
42
|
+
oneof_schema_4_validator: Optional[PatientHealthProfileData] = None
|
|
43
|
+
actual_instance: Optional[Union[PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData]] = None
|
|
44
|
+
one_of_schemas: Set[str] = { "PatientAddressData", "PatientData", "PatientHealthProfileData", "PatientInsuranceData" }
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
validate_assignment=True,
|
|
48
|
+
protected_namespaces=(),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
56
|
+
if args:
|
|
57
|
+
if len(args) > 1:
|
|
58
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
59
|
+
if kwargs:
|
|
60
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
61
|
+
super().__init__(actual_instance=args[0])
|
|
62
|
+
else:
|
|
63
|
+
super().__init__(**kwargs)
|
|
64
|
+
|
|
65
|
+
@field_validator('actual_instance')
|
|
66
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
67
|
+
instance = PatientActivityData.model_construct()
|
|
68
|
+
error_messages = []
|
|
69
|
+
match = 0
|
|
70
|
+
# validate data type: PatientData
|
|
71
|
+
if not isinstance(v, PatientData):
|
|
72
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PatientData`")
|
|
73
|
+
else:
|
|
74
|
+
match += 1
|
|
75
|
+
# validate data type: PatientAddressData
|
|
76
|
+
if not isinstance(v, PatientAddressData):
|
|
77
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PatientAddressData`")
|
|
78
|
+
else:
|
|
79
|
+
match += 1
|
|
80
|
+
# validate data type: PatientInsuranceData
|
|
81
|
+
if not isinstance(v, PatientInsuranceData):
|
|
82
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PatientInsuranceData`")
|
|
83
|
+
else:
|
|
84
|
+
match += 1
|
|
85
|
+
# validate data type: PatientHealthProfileData
|
|
86
|
+
if not isinstance(v, PatientHealthProfileData):
|
|
87
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PatientHealthProfileData`")
|
|
88
|
+
else:
|
|
89
|
+
match += 1
|
|
90
|
+
if match > 1:
|
|
91
|
+
# more than 1 match
|
|
92
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in PatientActivityData with oneOf schemas: PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData. Details: " + ", ".join(error_messages))
|
|
93
|
+
elif match == 0:
|
|
94
|
+
# no match
|
|
95
|
+
raise ValueError("No match found when setting `actual_instance` in PatientActivityData with oneOf schemas: PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData. Details: " + ", ".join(error_messages))
|
|
96
|
+
else:
|
|
97
|
+
return v
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
101
|
+
return cls.from_json(json.dumps(obj))
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def from_json(cls, json_str: str) -> Self:
|
|
105
|
+
"""Returns the object represented by the json string"""
|
|
106
|
+
instance = cls.model_construct()
|
|
107
|
+
error_messages = []
|
|
108
|
+
match = 0
|
|
109
|
+
|
|
110
|
+
# deserialize data into PatientData
|
|
111
|
+
try:
|
|
112
|
+
instance.actual_instance = PatientData.from_json(json_str)
|
|
113
|
+
match += 1
|
|
114
|
+
except (ValidationError, ValueError) as e:
|
|
115
|
+
error_messages.append(str(e))
|
|
116
|
+
# deserialize data into PatientAddressData
|
|
117
|
+
try:
|
|
118
|
+
instance.actual_instance = PatientAddressData.from_json(json_str)
|
|
119
|
+
match += 1
|
|
120
|
+
except (ValidationError, ValueError) as e:
|
|
121
|
+
error_messages.append(str(e))
|
|
122
|
+
# deserialize data into PatientInsuranceData
|
|
123
|
+
try:
|
|
124
|
+
instance.actual_instance = PatientInsuranceData.from_json(json_str)
|
|
125
|
+
match += 1
|
|
126
|
+
except (ValidationError, ValueError) as e:
|
|
127
|
+
error_messages.append(str(e))
|
|
128
|
+
# deserialize data into PatientHealthProfileData
|
|
129
|
+
try:
|
|
130
|
+
instance.actual_instance = PatientHealthProfileData.from_json(json_str)
|
|
131
|
+
match += 1
|
|
132
|
+
except (ValidationError, ValueError) as e:
|
|
133
|
+
error_messages.append(str(e))
|
|
134
|
+
|
|
135
|
+
if match > 1:
|
|
136
|
+
# more than 1 match
|
|
137
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into PatientActivityData with oneOf schemas: PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData. Details: " + ", ".join(error_messages))
|
|
138
|
+
elif match == 0:
|
|
139
|
+
# no match
|
|
140
|
+
raise ValueError("No match found when deserializing the JSON string into PatientActivityData with oneOf schemas: PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData. Details: " + ", ".join(error_messages))
|
|
141
|
+
else:
|
|
142
|
+
return instance
|
|
143
|
+
|
|
144
|
+
def to_json(self) -> str:
|
|
145
|
+
"""Returns the JSON representation of the actual instance"""
|
|
146
|
+
if self.actual_instance is None:
|
|
147
|
+
return "null"
|
|
148
|
+
|
|
149
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
150
|
+
return self.actual_instance.to_json()
|
|
151
|
+
else:
|
|
152
|
+
return json.dumps(self.actual_instance)
|
|
153
|
+
|
|
154
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData]]:
|
|
155
|
+
"""Returns the dict representation of the actual instance"""
|
|
156
|
+
if self.actual_instance is None:
|
|
157
|
+
return None
|
|
158
|
+
|
|
159
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
160
|
+
return self.actual_instance.to_dict()
|
|
161
|
+
else:
|
|
162
|
+
# primitive type
|
|
163
|
+
return self.actual_instance
|
|
164
|
+
|
|
165
|
+
def to_str(self) -> str:
|
|
166
|
+
"""Returns the string representation of the actual instance"""
|
|
167
|
+
return pprint.pformat(self.model_dump())
|
|
168
|
+
|
|
169
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
SwiftyRX API
|
|
5
|
+
|
|
6
|
+
API for the SwiftyRX Backend
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.DEV-0
|
|
9
|
+
Contact: paul.tindall@rxfoundry.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from rxfoundry.clients.swifty_api.models.patient_task import PatientTask
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class PatientActivityMessage(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PatientActivityMessage
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
message_id: Optional[StrictStr] = Field(default=None, description="The id of the message created during the inbound activity notification")
|
|
32
|
+
message_type: Optional[StrictStr] = Field(default=None, description="The type of the message created during the inbound activity notification")
|
|
33
|
+
is_completed: Optional[StrictBool] = Field(default=None, description="Whether the message has been processed")
|
|
34
|
+
activity_tasks: Optional[List[PatientTask]] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["message_id", "message_type", "is_completed", "activity_tasks"]
|
|
36
|
+
|
|
37
|
+
@field_validator('message_type')
|
|
38
|
+
def message_type_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value is None:
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
if value not in set(['created', 'updated', 'deleted']):
|
|
44
|
+
raise ValueError("must be one of enum values ('created', 'updated', 'deleted')")
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
populate_by_name=True,
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_str(self) -> str:
|
|
55
|
+
"""Returns the string representation of the model using alias"""
|
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
57
|
+
|
|
58
|
+
def to_json(self) -> str:
|
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
|
60
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
61
|
+
return json.dumps(self.to_dict())
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of PatientActivityMessage from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each item in activity_tasks (list)
|
|
87
|
+
_items = []
|
|
88
|
+
if self.activity_tasks:
|
|
89
|
+
for _item_activity_tasks in self.activity_tasks:
|
|
90
|
+
if _item_activity_tasks:
|
|
91
|
+
_items.append(_item_activity_tasks.to_dict())
|
|
92
|
+
_dict['activity_tasks'] = _items
|
|
93
|
+
return _dict
|
|
94
|
+
|
|
95
|
+
@classmethod
|
|
96
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
97
|
+
"""Create an instance of PatientActivityMessage from a dict"""
|
|
98
|
+
if obj is None:
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
if not isinstance(obj, dict):
|
|
102
|
+
return cls.model_validate(obj)
|
|
103
|
+
|
|
104
|
+
_obj = cls.model_validate({
|
|
105
|
+
"message_id": obj.get("message_id"),
|
|
106
|
+
"message_type": obj.get("message_type"),
|
|
107
|
+
"is_completed": obj.get("is_completed"),
|
|
108
|
+
"activity_tasks": [PatientTask.from_dict(_item) for _item in obj["activity_tasks"]] if obj.get("activity_tasks") is not None else None
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|
|
@@ -19,28 +19,21 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
23
|
-
from
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from rxfoundry.clients.swifty_api.models.patient_activity_data import PatientActivityData
|
|
24
25
|
from typing import Optional, Set
|
|
25
26
|
from typing_extensions import Self
|
|
26
27
|
|
|
27
28
|
class PatientActivityNotification(BaseModel):
|
|
28
29
|
"""
|
|
29
|
-
A notification that a patient
|
|
30
|
+
A notification that a patient's primary information has been created, updated, or deleted
|
|
30
31
|
""" # noqa: E501
|
|
31
|
-
external_patient_id:
|
|
32
|
-
external_system_slug:
|
|
33
|
-
object_type: StrictStr = Field(description="The type of object that was created, updated, or deleted")
|
|
32
|
+
external_patient_id: Annotated[str, Field(strict=True, max_length=255)] = Field(description="The identifier for the patient in the context of the external system")
|
|
33
|
+
external_system_slug: Annotated[str, Field(strict=True, max_length=255)] = Field(description="The identifier for the external system that is managing the patient record")
|
|
34
34
|
action: StrictStr = Field(description="The action that was taken on the object")
|
|
35
|
-
activity_data:
|
|
36
|
-
__properties: ClassVar[List[str]] = ["external_patient_id", "external_system_slug", "
|
|
37
|
-
|
|
38
|
-
@field_validator('object_type')
|
|
39
|
-
def object_type_validate_enum(cls, value):
|
|
40
|
-
"""Validates the enum"""
|
|
41
|
-
if value not in set(['patient', 'address', 'insurance', 'allergies', 'conditions', 'medications']):
|
|
42
|
-
raise ValueError("must be one of enum values ('patient', 'address', 'insurance', 'allergies', 'conditions', 'medications')")
|
|
43
|
-
return value
|
|
35
|
+
activity_data: PatientActivityData
|
|
36
|
+
__properties: ClassVar[List[str]] = ["external_patient_id", "external_system_slug", "action", "activity_data"]
|
|
44
37
|
|
|
45
38
|
@field_validator('action')
|
|
46
39
|
def action_validate_enum(cls, value):
|
|
@@ -105,9 +98,8 @@ class PatientActivityNotification(BaseModel):
|
|
|
105
98
|
_obj = cls.model_validate({
|
|
106
99
|
"external_patient_id": obj.get("external_patient_id"),
|
|
107
100
|
"external_system_slug": obj.get("external_system_slug"),
|
|
108
|
-
"object_type": obj.get("object_type"),
|
|
109
101
|
"action": obj.get("action"),
|
|
110
|
-
"activity_data":
|
|
102
|
+
"activity_data": PatientActivityData.from_dict(obj["activity_data"]) if obj.get("activity_data") is not None else None
|
|
111
103
|
})
|
|
112
104
|
return _obj
|
|
113
105
|
|
|
@@ -20,11 +20,13 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, f
|
|
|
20
20
|
from typing import Any, List, Optional
|
|
21
21
|
from rxfoundry.clients.swifty_api.models.patient_address_data import PatientAddressData
|
|
22
22
|
from rxfoundry.clients.swifty_api.models.patient_data import PatientData
|
|
23
|
+
from rxfoundry.clients.swifty_api.models.patient_health_profile_data import PatientHealthProfileData
|
|
24
|
+
from rxfoundry.clients.swifty_api.models.patient_insurance_data import PatientInsuranceData
|
|
23
25
|
from pydantic import StrictStr, Field
|
|
24
26
|
from typing import Union, List, Set, Optional, Dict
|
|
25
27
|
from typing_extensions import Literal, Self
|
|
26
28
|
|
|
27
|
-
PATIENTACTIVITYNOTIFICATIONACTIVITYDATA_ONE_OF_SCHEMAS = ["PatientAddressData", "PatientData"]
|
|
29
|
+
PATIENTACTIVITYNOTIFICATIONACTIVITYDATA_ONE_OF_SCHEMAS = ["PatientAddressData", "PatientData", "PatientHealthProfileData", "PatientInsuranceData"]
|
|
28
30
|
|
|
29
31
|
class PatientActivityNotificationActivityData(BaseModel):
|
|
30
32
|
"""
|
|
@@ -34,8 +36,12 @@ class PatientActivityNotificationActivityData(BaseModel):
|
|
|
34
36
|
oneof_schema_1_validator: Optional[PatientData] = None
|
|
35
37
|
# data type: PatientAddressData
|
|
36
38
|
oneof_schema_2_validator: Optional[PatientAddressData] = None
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
# data type: PatientInsuranceData
|
|
40
|
+
oneof_schema_3_validator: Optional[PatientInsuranceData] = None
|
|
41
|
+
# data type: PatientHealthProfileData
|
|
42
|
+
oneof_schema_4_validator: Optional[PatientHealthProfileData] = None
|
|
43
|
+
actual_instance: Optional[Union[PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData]] = None
|
|
44
|
+
one_of_schemas: Set[str] = { "PatientAddressData", "PatientData", "PatientHealthProfileData", "PatientInsuranceData" }
|
|
39
45
|
|
|
40
46
|
model_config = ConfigDict(
|
|
41
47
|
validate_assignment=True,
|
|
@@ -43,6 +49,9 @@ class PatientActivityNotificationActivityData(BaseModel):
|
|
|
43
49
|
)
|
|
44
50
|
|
|
45
51
|
|
|
52
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
53
|
+
}
|
|
54
|
+
|
|
46
55
|
def __init__(self, *args, **kwargs) -> None:
|
|
47
56
|
if args:
|
|
48
57
|
if len(args) > 1:
|
|
@@ -68,12 +77,22 @@ class PatientActivityNotificationActivityData(BaseModel):
|
|
|
68
77
|
error_messages.append(f"Error! Input type `{type(v)}` is not `PatientAddressData`")
|
|
69
78
|
else:
|
|
70
79
|
match += 1
|
|
80
|
+
# validate data type: PatientInsuranceData
|
|
81
|
+
if not isinstance(v, PatientInsuranceData):
|
|
82
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PatientInsuranceData`")
|
|
83
|
+
else:
|
|
84
|
+
match += 1
|
|
85
|
+
# validate data type: PatientHealthProfileData
|
|
86
|
+
if not isinstance(v, PatientHealthProfileData):
|
|
87
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PatientHealthProfileData`")
|
|
88
|
+
else:
|
|
89
|
+
match += 1
|
|
71
90
|
if match > 1:
|
|
72
91
|
# more than 1 match
|
|
73
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in PatientActivityNotificationActivityData with oneOf schemas: PatientAddressData, PatientData. Details: " + ", ".join(error_messages))
|
|
92
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in PatientActivityNotificationActivityData with oneOf schemas: PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData. Details: " + ", ".join(error_messages))
|
|
74
93
|
elif match == 0:
|
|
75
94
|
# no match
|
|
76
|
-
raise ValueError("No match found when setting `actual_instance` in PatientActivityNotificationActivityData with oneOf schemas: PatientAddressData, PatientData. Details: " + ", ".join(error_messages))
|
|
95
|
+
raise ValueError("No match found when setting `actual_instance` in PatientActivityNotificationActivityData with oneOf schemas: PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData. Details: " + ", ".join(error_messages))
|
|
77
96
|
else:
|
|
78
97
|
return v
|
|
79
98
|
|
|
@@ -100,13 +119,25 @@ class PatientActivityNotificationActivityData(BaseModel):
|
|
|
100
119
|
match += 1
|
|
101
120
|
except (ValidationError, ValueError) as e:
|
|
102
121
|
error_messages.append(str(e))
|
|
122
|
+
# deserialize data into PatientInsuranceData
|
|
123
|
+
try:
|
|
124
|
+
instance.actual_instance = PatientInsuranceData.from_json(json_str)
|
|
125
|
+
match += 1
|
|
126
|
+
except (ValidationError, ValueError) as e:
|
|
127
|
+
error_messages.append(str(e))
|
|
128
|
+
# deserialize data into PatientHealthProfileData
|
|
129
|
+
try:
|
|
130
|
+
instance.actual_instance = PatientHealthProfileData.from_json(json_str)
|
|
131
|
+
match += 1
|
|
132
|
+
except (ValidationError, ValueError) as e:
|
|
133
|
+
error_messages.append(str(e))
|
|
103
134
|
|
|
104
135
|
if match > 1:
|
|
105
136
|
# more than 1 match
|
|
106
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into PatientActivityNotificationActivityData with oneOf schemas: PatientAddressData, PatientData. Details: " + ", ".join(error_messages))
|
|
137
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into PatientActivityNotificationActivityData with oneOf schemas: PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData. Details: " + ", ".join(error_messages))
|
|
107
138
|
elif match == 0:
|
|
108
139
|
# no match
|
|
109
|
-
raise ValueError("No match found when deserializing the JSON string into PatientActivityNotificationActivityData with oneOf schemas: PatientAddressData, PatientData. Details: " + ", ".join(error_messages))
|
|
140
|
+
raise ValueError("No match found when deserializing the JSON string into PatientActivityNotificationActivityData with oneOf schemas: PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData. Details: " + ", ".join(error_messages))
|
|
110
141
|
else:
|
|
111
142
|
return instance
|
|
112
143
|
|
|
@@ -120,7 +151,7 @@ class PatientActivityNotificationActivityData(BaseModel):
|
|
|
120
151
|
else:
|
|
121
152
|
return json.dumps(self.actual_instance)
|
|
122
153
|
|
|
123
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], PatientAddressData, PatientData]]:
|
|
154
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], PatientAddressData, PatientData, PatientHealthProfileData, PatientInsuranceData]]:
|
|
124
155
|
"""Returns the dict representation of the actual instance"""
|
|
125
156
|
if self.actual_instance is None:
|
|
126
157
|
return None
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
SwiftyRX API
|
|
5
|
+
|
|
6
|
+
API for the SwiftyRX Backend
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.DEV-0
|
|
9
|
+
Contact: paul.tindall@rxfoundry.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from rxfoundry.clients.swifty_api.models.patient_address_data import PatientAddressData
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class PatientAddressActivityNotification(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
A notification that a patient's address information has been created, updated, or deleted
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
external_patient_id: StrictStr = Field(description="The identifier for the patient in the context of the external system")
|
|
32
|
+
external_system_slug: StrictStr = Field(description="The identifier for the external system that is managing the patient record")
|
|
33
|
+
action: StrictStr = Field(description="The action that was taken on the object")
|
|
34
|
+
activity_data: PatientAddressData
|
|
35
|
+
__properties: ClassVar[List[str]] = ["external_patient_id", "external_system_slug", "action", "activity_data"]
|
|
36
|
+
|
|
37
|
+
@field_validator('action')
|
|
38
|
+
def action_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value not in set(['created', 'updated', 'deleted']):
|
|
41
|
+
raise ValueError("must be one of enum values ('created', 'updated', 'deleted')")
|
|
42
|
+
return value
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
populate_by_name=True,
|
|
46
|
+
validate_assignment=True,
|
|
47
|
+
protected_namespaces=(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def to_str(self) -> str:
|
|
52
|
+
"""Returns the string representation of the model using alias"""
|
|
53
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
54
|
+
|
|
55
|
+
def to_json(self) -> str:
|
|
56
|
+
"""Returns the JSON representation of the model using alias"""
|
|
57
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
58
|
+
return json.dumps(self.to_dict())
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
+
"""Create an instance of PatientAddressActivityNotification from a JSON string"""
|
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
|
64
|
+
|
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
|
67
|
+
|
|
68
|
+
This has the following differences from calling pydantic's
|
|
69
|
+
`self.model_dump(by_alias=True)`:
|
|
70
|
+
|
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
|
72
|
+
were set at model initialization. Other fields with value `None`
|
|
73
|
+
are ignored.
|
|
74
|
+
"""
|
|
75
|
+
excluded_fields: Set[str] = set([
|
|
76
|
+
])
|
|
77
|
+
|
|
78
|
+
_dict = self.model_dump(
|
|
79
|
+
by_alias=True,
|
|
80
|
+
exclude=excluded_fields,
|
|
81
|
+
exclude_none=True,
|
|
82
|
+
)
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of activity_data
|
|
84
|
+
if self.activity_data:
|
|
85
|
+
_dict['activity_data'] = self.activity_data.to_dict()
|
|
86
|
+
return _dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of PatientAddressActivityNotification from a dict"""
|
|
91
|
+
if obj is None:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
if not isinstance(obj, dict):
|
|
95
|
+
return cls.model_validate(obj)
|
|
96
|
+
|
|
97
|
+
_obj = cls.model_validate({
|
|
98
|
+
"external_patient_id": obj.get("external_patient_id"),
|
|
99
|
+
"external_system_slug": obj.get("external_system_slug"),
|
|
100
|
+
"action": obj.get("action"),
|
|
101
|
+
"activity_data": PatientAddressData.from_dict(obj["activity_data"]) if obj.get("activity_data") is not None else None
|
|
102
|
+
})
|
|
103
|
+
return _obj
|
|
104
|
+
|
|
105
|
+
|