rxfoundry.clients.swifty-api 0.0.668__py3-none-any.whl → 0.1.1008__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.
Files changed (75) hide show
  1. rxfoundry/clients/swifty_api/__init__.py +38 -3
  2. rxfoundry/clients/swifty_api/api/__init__.py +3 -1
  3. rxfoundry/clients/swifty_api/api/async_api.py +2336 -52
  4. rxfoundry/clients/swifty_api/api/code_api.py +281 -0
  5. rxfoundry/clients/swifty_api/api/default_api.py +318 -0
  6. rxfoundry/clients/swifty_api/api/medication_api.py +647 -51
  7. rxfoundry/clients/swifty_api/api/patient_api.py +1429 -49
  8. rxfoundry/clients/swifty_api/api/pharmacist_api.py +24 -24
  9. rxfoundry/clients/swifty_api/api/pharmacy_api.py +48 -48
  10. rxfoundry/clients/swifty_api/api/prescriber_api.py +24 -24
  11. rxfoundry/clients/swifty_api/api/prescription_api.py +934 -130
  12. rxfoundry/clients/swifty_api/api/task_api.py +1835 -0
  13. rxfoundry/clients/swifty_api/api/tasks_api.py +374 -0
  14. rxfoundry/clients/swifty_api/api/validation_api.py +311 -0
  15. rxfoundry/clients/swifty_api/api/virtual_pharmacy_api.py +262 -0
  16. rxfoundry/clients/swifty_api/api/workflow_api.py +633 -0
  17. rxfoundry/clients/swifty_api/models/__init__.py +35 -2
  18. rxfoundry/clients/swifty_api/models/address.py +11 -10
  19. rxfoundry/clients/swifty_api/models/code_type.py +92 -0
  20. rxfoundry/clients/swifty_api/models/create_patient_request.py +98 -0
  21. rxfoundry/clients/swifty_api/models/formulary.py +96 -0
  22. rxfoundry/clients/swifty_api/models/insurance.py +96 -0
  23. rxfoundry/clients/swifty_api/models/medication_instruction.py +92 -0
  24. rxfoundry/clients/swifty_api/models/medication_ref.py +100 -0
  25. rxfoundry/clients/swifty_api/models/patient.py +88 -3
  26. rxfoundry/clients/swifty_api/models/patient_activity_data.py +169 -0
  27. rxfoundry/clients/swifty_api/models/patient_activity_message.py +112 -0
  28. rxfoundry/clients/swifty_api/models/patient_activity_notification.py +9 -17
  29. rxfoundry/clients/swifty_api/models/patient_activity_notification_activity_data.py +39 -8
  30. rxfoundry/clients/swifty_api/models/patient_address_activity_notification.py +105 -0
  31. rxfoundry/clients/swifty_api/models/patient_address_data.py +25 -9
  32. rxfoundry/clients/swifty_api/models/patient_allergy.py +92 -0
  33. rxfoundry/clients/swifty_api/models/patient_condition.py +92 -0
  34. rxfoundry/clients/swifty_api/models/patient_data.py +13 -2
  35. rxfoundry/clients/swifty_api/models/patient_external_identifier.py +6 -5
  36. rxfoundry/clients/swifty_api/models/patient_health_profile_data.py +127 -0
  37. rxfoundry/clients/swifty_api/models/patient_insurance.py +106 -0
  38. rxfoundry/clients/swifty_api/models/patient_insurance_data.py +105 -0
  39. rxfoundry/clients/swifty_api/models/patient_medication.py +92 -0
  40. rxfoundry/clients/swifty_api/models/patient_name.py +99 -0
  41. rxfoundry/clients/swifty_api/models/patient_name_data.py +108 -0
  42. rxfoundry/clients/swifty_api/models/patient_phone_number.py +89 -0
  43. rxfoundry/clients/swifty_api/models/patient_phone_number_data.py +98 -0
  44. rxfoundry/clients/swifty_api/models/patient_task.py +115 -0
  45. rxfoundry/clients/swifty_api/models/patient_task_status.py +105 -0
  46. rxfoundry/clients/swifty_api/models/patient_task_type.py +45 -0
  47. rxfoundry/clients/swifty_api/models/prescription.py +35 -30
  48. rxfoundry/clients/swifty_api/models/prescription_change_request.py +24 -36
  49. rxfoundry/clients/swifty_api/models/prescription_change_request_and_response.py +145 -0
  50. rxfoundry/clients/swifty_api/models/prescription_change_request_response.py +134 -0
  51. rxfoundry/clients/swifty_api/models/prescription_data.py +126 -0
  52. rxfoundry/clients/swifty_api/models/prescription_message.py +100 -0
  53. rxfoundry/clients/swifty_api/models/prescription_message_task.py +109 -0
  54. rxfoundry/clients/swifty_api/models/prescription_message_task_status.py +99 -0
  55. rxfoundry/clients/swifty_api/models/prescription_message_task_type.py +43 -0
  56. rxfoundry/clients/swifty_api/models/prescription_message_type.py +53 -0
  57. rxfoundry/clients/swifty_api/models/prescription_patch.py +6 -2
  58. rxfoundry/clients/swifty_api/models/prescription_status_type.py +40 -0
  59. rxfoundry/clients/swifty_api/models/prescription_task.py +14 -12
  60. rxfoundry/clients/swifty_api/models/prescription_task_status.py +6 -2
  61. rxfoundry/clients/swifty_api/models/prescription_task_type.py +42 -0
  62. rxfoundry/clients/swifty_api/models/prescription_transfer_request_and_response.py +145 -0
  63. rxfoundry/clients/swifty_api/models/prescription_transfer_request_response.py +128 -0
  64. rxfoundry/clients/swifty_api/models/status_type.py +92 -0
  65. rxfoundry/clients/swifty_api/models/workflow.py +108 -0
  66. rxfoundry/clients/swifty_api/models/workflow_sub_task.py +96 -0
  67. rxfoundry/clients/swifty_api/models/workflow_sub_task_sub_task.py +155 -0
  68. rxfoundry/clients/swifty_api/models/workflow_task.py +111 -0
  69. rxfoundry/clients/swifty_api/models/workflow_task_task.py +155 -0
  70. rxfoundry/clients/swifty_api/models/workflow_type.py +55 -0
  71. {rxfoundry_clients_swifty_api-0.0.668.dist-info → rxfoundry_clients_swifty_api-0.1.1008.dist-info}/METADATA +1 -1
  72. rxfoundry_clients_swifty_api-0.1.1008.dist-info/RECORD +110 -0
  73. {rxfoundry_clients_swifty_api-0.0.668.dist-info → rxfoundry_clients_swifty_api-0.1.1008.dist-info}/WHEEL +1 -1
  74. rxfoundry_clients_swifty_api-0.0.668.dist-info/RECORD +0 -64
  75. {rxfoundry_clients_swifty_api-0.0.668.dist-info → rxfoundry_clients_swifty_api-0.1.1008.dist-info}/top_level.txt +0 -0
@@ -18,11 +18,17 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
- from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, StrictBool, 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,17 @@ 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
- __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"]
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
+ is_registered: Optional[StrictBool] = None
62
+ __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", "is_registered"]
47
63
 
48
64
  model_config = ConfigDict(
49
65
  populate_by_name=True,
@@ -97,6 +113,65 @@ class Patient(BaseModel):
97
113
  if _item_external_references:
98
114
  _items.append(_item_external_references.to_dict())
99
115
  _dict['external_references'] = _items
116
+ # override the default output from pydantic by calling `to_dict()` of each item in allergies (list)
117
+ _items = []
118
+ if self.allergies:
119
+ for _item_allergies in self.allergies:
120
+ if _item_allergies:
121
+ _items.append(_item_allergies.to_dict())
122
+ _dict['allergies'] = _items
123
+ # override the default output from pydantic by calling `to_dict()` of each item in conditions (list)
124
+ _items = []
125
+ if self.conditions:
126
+ for _item_conditions in self.conditions:
127
+ if _item_conditions:
128
+ _items.append(_item_conditions.to_dict())
129
+ _dict['conditions'] = _items
130
+ # override the default output from pydantic by calling `to_dict()` of each item in medications (list)
131
+ _items = []
132
+ if self.medications:
133
+ for _item_medications in self.medications:
134
+ if _item_medications:
135
+ _items.append(_item_medications.to_dict())
136
+ _dict['medications'] = _items
137
+ # override the default output from pydantic by calling `to_dict()` of each item in insurances (list)
138
+ _items = []
139
+ if self.insurances:
140
+ for _item_insurances in self.insurances:
141
+ if _item_insurances:
142
+ _items.append(_item_insurances.to_dict())
143
+ _dict['insurances'] = _items
144
+ # override the default output from pydantic by calling `to_dict()` of preferred_language
145
+ if self.preferred_language:
146
+ _dict['preferred_language'] = self.preferred_language.to_dict()
147
+ # override the default output from pydantic by calling `to_dict()` of each item in former_names (list)
148
+ _items = []
149
+ if self.former_names:
150
+ for _item_former_names in self.former_names:
151
+ if _item_former_names:
152
+ _items.append(_item_former_names.to_dict())
153
+ _dict['former_names'] = _items
154
+ # override the default output from pydantic by calling `to_dict()` of each item in former_phone_numbers (list)
155
+ _items = []
156
+ if self.former_phone_numbers:
157
+ for _item_former_phone_numbers in self.former_phone_numbers:
158
+ if _item_former_phone_numbers:
159
+ _items.append(_item_former_phone_numbers.to_dict())
160
+ _dict['former_phone_numbers'] = _items
161
+ # override the default output from pydantic by calling `to_dict()` of each item in former_addresses (list)
162
+ _items = []
163
+ if self.former_addresses:
164
+ for _item_former_addresses in self.former_addresses:
165
+ if _item_former_addresses:
166
+ _items.append(_item_former_addresses.to_dict())
167
+ _dict['former_addresses'] = _items
168
+ # override the default output from pydantic by calling `to_dict()` of each item in former_insurances (list)
169
+ _items = []
170
+ if self.former_insurances:
171
+ for _item_former_insurances in self.former_insurances:
172
+ if _item_former_insurances:
173
+ _items.append(_item_former_insurances.to_dict())
174
+ _dict['former_insurances'] = _items
100
175
  return _dict
101
176
 
102
177
  @classmethod
@@ -121,7 +196,17 @@ class Patient(BaseModel):
121
196
  "primary_phone": obj.get("primary_phone"),
122
197
  "alternate_phone": obj.get("alternate_phone"),
123
198
  "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
199
+ "external_references": [PatientExternalIdentifier.from_dict(_item) for _item in obj["external_references"]] if obj.get("external_references") is not None else None,
200
+ "allergies": [PatientAllergy.from_dict(_item) for _item in obj["allergies"]] if obj.get("allergies") is not None else None,
201
+ "conditions": [PatientCondition.from_dict(_item) for _item in obj["conditions"]] if obj.get("conditions") is not None else None,
202
+ "medications": [PatientMedication.from_dict(_item) for _item in obj["medications"]] if obj.get("medications") is not None else None,
203
+ "insurances": [Insurance.from_dict(_item) for _item in obj["insurances"]] if obj.get("insurances") is not None else None,
204
+ "preferred_language": Code.from_dict(obj["preferred_language"]) if obj.get("preferred_language") is not None else None,
205
+ "former_names": [PatientName.from_dict(_item) for _item in obj["former_names"]] if obj.get("former_names") is not None else None,
206
+ "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,
207
+ "former_addresses": [Address.from_dict(_item) for _item in obj["former_addresses"]] if obj.get("former_addresses") is not None else None,
208
+ "former_insurances": [Insurance.from_dict(_item) for _item in obj["former_insurances"]] if obj.get("former_insurances") is not None else None,
209
+ "is_registered": obj.get("is_registered")
125
210
  })
126
211
  return _obj
127
212
 
@@ -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, Optional
23
- from rxfoundry.clients.swifty_api.models.patient_activity_notification_activity_data import PatientActivityNotificationActivityData
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 or its related information has been created, updated, or deleted
30
+ A notification that a patient's primary information has been created, updated, or deleted
30
31
  """ # 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
- 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: Optional[PatientActivityNotificationActivityData] = None
36
- __properties: ClassVar[List[str]] = ["external_patient_id", "external_system_slug", "object_type", "action", "activity_data"]
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": PatientActivityNotificationActivityData.from_dict(obj["activity_data"]) if obj.get("activity_data") is not None else None
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
- actual_instance: Optional[Union[PatientAddressData, PatientData]] = None
38
- one_of_schemas: Set[str] = { "PatientAddressData", "PatientData" }
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
+