helix.fhir.client.sdk 4.2.24__py3-none-any.whl → 4.2.26__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.
@@ -81,6 +81,7 @@ class SimulatedGraphProcessorMixin(ABC, FhirClientProtocol):
81
81
  add_cached_bundles_to_result: bool = True,
82
82
  input_cache: RequestCache | None = None,
83
83
  compare_hash: bool = True,
84
+ append_without_duplicate_removal: bool = False,
84
85
  ) -> AsyncGenerator[FhirGetResponse, None]:
85
86
  """
86
87
  Asynchronously simulate a FHIR $graph query with advanced processing capabilities.
@@ -237,7 +238,13 @@ class SimulatedGraphProcessorMixin(ABC, FhirClientProtocol):
237
238
 
238
239
  start_time = time.time()
239
240
  # Combine and process responses
240
- parent_response = cast(FhirGetBundleResponse, parent_response.extend(child_responses))
241
+ if not append_without_duplicate_removal:
242
+ parent_response = cast(FhirGetBundleResponse, parent_response.extend(child_responses))
243
+ else:
244
+ parent_response = cast(
245
+ FhirGetBundleResponse,
246
+ parent_response._append_without_duplicate_removal(child_responses),
247
+ )
241
248
  if logger:
242
249
  logger.info(f"Parent_response.extend time: {time.time() - start_time}")
243
250
 
@@ -1154,6 +1161,7 @@ class SimulatedGraphProcessorMixin(ABC, FhirClientProtocol):
1154
1161
  add_cached_bundles_to_result: bool = True,
1155
1162
  input_cache: RequestCache | None = None,
1156
1163
  compare_hash: bool = True,
1164
+ append_without_duplicate_removal: bool = False,
1157
1165
  ) -> FhirGetResponse:
1158
1166
  """
1159
1167
  Simulates the $graph query on the FHIR server
@@ -1206,6 +1214,7 @@ class SimulatedGraphProcessorMixin(ABC, FhirClientProtocol):
1206
1214
  add_cached_bundles_to_result=add_cached_bundles_to_result,
1207
1215
  input_cache=input_cache,
1208
1216
  compare_hash=compare_hash,
1217
+ append_without_duplicate_removal=append_without_duplicate_removal,
1209
1218
  )
1210
1219
  )
1211
1220
  assert result, "No result returned from simulate_graph_async"
@@ -125,6 +125,15 @@ class FhirGetResponse:
125
125
  @abstractmethod
126
126
  def _append(self, other_response: "FhirGetResponse") -> "FhirGetResponse": ...
127
127
 
128
+ def _append_without_duplicate_removal(self, others: list["FhirGetResponse"]) -> "FhirGetResponse":
129
+ """
130
+ Append the responses from others to self without duplicate removal.
131
+
132
+ :param others: list of FhirGetResponse objects to append to current one
133
+ :return: self
134
+ """
135
+ return self._extend(others=others)
136
+
128
137
  def append(self, other_response: "FhirGetResponse") -> "FhirGetResponse":
129
138
  """
130
139
  Append the responses from other to self
@@ -115,13 +115,32 @@ class FhirGetBundleResponse(FhirGetResponse):
115
115
  """
116
116
  other_response_entries: FhirBundleEntryList = other_response.get_bundle_entries()
117
117
 
118
- if len(other_response_entries) > 0:
118
+ if len(other_response_entries):
119
119
  # only append if there are entries in the other response
120
120
  if self._bundle_entries is None:
121
- self._bundle_entries = FhirBundleEntryList()
122
- from collections import deque
121
+ self._bundle_entries = other_response_entries
122
+ else:
123
+ self._bundle_entries.extend(other_response_entries)
124
+
125
+ return self
126
+
127
+ def _append_without_duplicate_removal(self, others: list["FhirGetResponse"]) -> "FhirGetResponse":
128
+ """
129
+ Append the responses from other to self without duplicate removal
123
130
 
124
- deque.extend(self._bundle_entries, other_response_entries)
131
+ :param others: list of FhirGetResponse objects to append to current one
132
+ :return: self
133
+ """
134
+ if self._bundle_entries is None:
135
+ self._bundle_entries = FhirBundleEntryList()
136
+
137
+ from collections import deque
138
+
139
+ for other_response in others:
140
+ other_response_entries: FhirBundleEntryList = other_response.get_bundle_entries()
141
+ if len(other_response_entries) > 0:
142
+ # only append if there are entries in the other response
143
+ deque.extend(self._bundle_entries, other_response_entries)
125
144
 
126
145
  return self
127
146
 
@@ -73,7 +73,7 @@ class TestFhirGetBundleResponse:
73
73
  assert response._bundle_metadata.id_ == "test-bundle-id"
74
74
  assert response._bundle_metadata.type_ == "searchset"
75
75
 
76
- def test_append(self, sample_bundle_response: dict[str, Any]) -> None:
76
+ def test_append_unique(self, sample_bundle_response: dict[str, Any]) -> None:
77
77
  """Test appending another response."""
78
78
  results_by_url: list[RetryableAioHttpUrlResult] = []
79
79
 
@@ -113,8 +113,7 @@ class TestFhirGetBundleResponse:
113
113
 
114
114
  first_response.append(second_response)
115
115
 
116
- # Updating it to 4 since we have integrated cache and do not do same lookups again so we do not need to remove duplicates here.
117
- assert len(first_response.get_bundle_entries()) == 4
116
+ assert len(first_response.get_bundle_entries()) == 2
118
117
 
119
118
  def test_get_resources(self, sample_bundle_response: dict[str, Any]) -> None:
120
119
  """Test getting resources from the response."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: helix.fhir.client.sdk
3
- Version: 4.2.24
3
+ Version: 4.2.26
4
4
  Summary: helix.fhir.client.sdk
5
5
  Home-page: https://github.com/icanbwell/helix.fhir.client.sdk
6
6
  Author: Imran Qureshi
@@ -32,7 +32,7 @@ helix_fhir_client_sdk/graph/fhir_graph_mixin.py,sha256=z0j9FmO2bOnmzgQmczfkWC70u
32
32
  helix_fhir_client_sdk/graph/graph_definition.py,sha256=FTa1GLjJ6oooAhNw7SPk-Y8duB-5WtJtnwADao-afaI,3878
33
33
  helix_fhir_client_sdk/graph/graph_link_parameters.py,sha256=3rknHL6SBgpT2A1fr-AikEFrR_9nIJUotZ82XFzROLo,599
34
34
  helix_fhir_client_sdk/graph/graph_target_parameters.py,sha256=fdYQpPZxDnyWyevuwDwxeTXOJoE2PgS5QhPaXpwtFcU,705
35
- helix_fhir_client_sdk/graph/simulated_graph_processor_mixin.py,sha256=vNoiTL3wgo9slfwn-a8YsIeiwZIxVWVBaCQ-Ne1_4Gk,60460
35
+ helix_fhir_client_sdk/graph/simulated_graph_processor_mixin.py,sha256=qPzjqGS7q2nj6HZIQoMJoMNIEXVD21-b6cmkC5FI31U,60919
36
36
  helix_fhir_client_sdk/graph/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  helix_fhir_client_sdk/graph/test/test_graph_mixin.py,sha256=LNd4LVjryVLgzWeTXMDpsbdauXl7u3LMfj9irnNfb_k,5469
38
38
  helix_fhir_client_sdk/graph/test/test_simulate_graph_processor_mixin.py,sha256=EQDfhqJfUrP6SptXRP7ayEN7g5cZQMA00ccXzeXiSXM,46312
@@ -46,7 +46,7 @@ helix_fhir_client_sdk/responses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
46
46
  helix_fhir_client_sdk/responses/bundle_expander.py,sha256=ilR5eMgciSgzsdQvKB6bHtn9jtpvn3uS-EBz-hrahzo,1065
47
47
  helix_fhir_client_sdk/responses/fhir_client_protocol.py,sha256=IWM7LNQ1ZbgaySLGqpCwWAKyArT5HgBdNhkmSEivNMo,7100
48
48
  helix_fhir_client_sdk/responses/fhir_delete_response.py,sha256=0K11vyfZ0LtL-G61NHzDqHrZgEHjMVZr00VWpWcktZA,2941
49
- helix_fhir_client_sdk/responses/fhir_get_response.py,sha256=v0ndKFb6o8PNqYYxGlLETzQnxGmwK3YympH4gotXpY4,17550
49
+ helix_fhir_client_sdk/responses/fhir_get_response.py,sha256=5WoI8AFQ4h54RvOFcorpaBQk1JlqGnZPnAGxZcsmvp0,17900
50
50
  helix_fhir_client_sdk/responses/fhir_merge_response.py,sha256=uvUjEGJgMDlAkcc5_LjgAsTFZqREQMlV79sbxUZwtwE,2862
51
51
  helix_fhir_client_sdk/responses/fhir_response_processor.py,sha256=fOSvqWjVI1BA6aDxxu9aqEvcKxtnFRmU2hMrgtmUCUM,34056
52
52
  helix_fhir_client_sdk/responses/fhir_update_response.py,sha256=_6zZz85KQP69WFxejlX8BBWAKWtzsMGSJjR_zqhl_m4,2727
@@ -54,14 +54,14 @@ helix_fhir_client_sdk/responses/get_result.py,sha256=hkbZeu9h-01ZZckAuckn6UDR9GX
54
54
  helix_fhir_client_sdk/responses/paging_result.py,sha256=tpmfdgrtaAmmViVxlw-EBHoe0PVjSQW9zicwRmhUVpI,1360
55
55
  helix_fhir_client_sdk/responses/resource_separator.py,sha256=jugaEkJYunx8VGVFCLwWNSjrBlI8DDm61LzSx9oR8iE,3230
56
56
  helix_fhir_client_sdk/responses/get/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
- helix_fhir_client_sdk/responses/get/fhir_get_bundle_response.py,sha256=ryNaHVBZOxsf3uKMhKrFIUCnpmC8h_X7d3-0mzwoqhQ,18659
57
+ helix_fhir_client_sdk/responses/get/fhir_get_bundle_response.py,sha256=Xw3yl8Du0nI1hrmZTi7vqPsm8Iu-oby3mnAAgd6pOYw,19420
58
58
  helix_fhir_client_sdk/responses/get/fhir_get_error_response.py,sha256=oNdKs_r7K4qRHD7fyeDhZz3v0wGTT2esAPPtDhxOyeI,12325
59
59
  helix_fhir_client_sdk/responses/get/fhir_get_list_by_resource_type_response.py,sha256=ssfb1IB2QTvqwWRzFs_VqPKH6mwcnWNo3iVh82M-Jso,13775
60
60
  helix_fhir_client_sdk/responses/get/fhir_get_list_response.py,sha256=KT5g6MjB9yWWUaSZpx1jK9Tm2yVmcFyZMHBBnDDAPtU,11858
61
61
  helix_fhir_client_sdk/responses/get/fhir_get_response_factory.py,sha256=OrizzAVoXvxnQbBxszeS9PUtbzg97RGNEJfD4PuOLig,6815
62
62
  helix_fhir_client_sdk/responses/get/fhir_get_single_response.py,sha256=pLjjDyxBvA_FNI7sGU2hM9urue3Bzrrwo_RcrOD5yz8,9755
63
63
  helix_fhir_client_sdk/responses/get/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
- helix_fhir_client_sdk/responses/get/test/test_get_bundle_response.py,sha256=DF4sjy074jiro8jASavd-2hMkjIR6sIdIytzhIyBRuU,19674
64
+ helix_fhir_client_sdk/responses/get/test/test_get_bundle_response.py,sha256=k66eMtb0e4QcWYeF_M3TUrwCXQgD5EOcpUaijzg7a2I,19545
65
65
  helix_fhir_client_sdk/responses/get/test/test_get_error_response.py,sha256=8P4zGgeHe-6OaSX152ixFW4W0iG2scK89O0VY_YcxuY,7613
66
66
  helix_fhir_client_sdk/responses/get/test/test_get_list_by_resource_type_response.py,sha256=eIZlhTYg5Iqh0vTmVAlesenQDyT8eCmFs1U4JngIM8w,12942
67
67
  helix_fhir_client_sdk/responses/get/test/test_get_list_response.py,sha256=vOsdgqSd5TwwgbwEX_kYvDyOnqAaKBKGAZFr4EZpGDM,14428
@@ -130,7 +130,7 @@ helix_fhir_client_sdk/validators/async_fhir_validator.py,sha256=i1BC98hZF6JhMQQz
130
130
  helix_fhir_client_sdk/validators/fhir_validator.py,sha256=HWBldSEB9yeKIcnLcV8R-LoTzwT_OMu8SchtUUBKzys,2331
131
131
  helix_fhir_client_sdk/validators/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
132
132
  helix_fhir_client_sdk/validators/test/test_async_fhir_validator.py,sha256=RmSowjPUdZee5nYuYujghxWyqJ20cu7U0lJFtFT-ZBs,3285
133
- helix_fhir_client_sdk-4.2.24.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
133
+ helix_fhir_client_sdk-4.2.26.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
134
134
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
135
135
  tests/logger_for_test.py,sha256=UC-7F6w6fDsUIYf37aRnvUdiUUVk8qkJEUSuO17NQnI,1525
136
136
  tests/test_fhir_client_clone.py,sha256=c5y1rWJ32nBSUnK1FfyymY005dNowd4Nf1xrbuQolNk,5368
@@ -213,7 +213,7 @@ tests_integration/test_emr_server_auth.py,sha256=2I4QUAspQN89uGf6JB2aVuYaBeDnRJz
213
213
  tests_integration/test_firely_fhir.py,sha256=ll6-plwQrKfdrEyfbw0wLTC1jB-Qei1Mj-81tYTl5eQ,697
214
214
  tests_integration/test_merge_vs_smart_merge_behavior.py,sha256=LrIuyxzw0YLaTjcRtG0jzy0M6xSv9qebmdBtMPDcacQ,3733
215
215
  tests_integration/test_staging_server_graph.py,sha256=5RfMxjhdX9o4-n_ZRvze4Sm8u8NjRijRLDpqiz8qD_0,7132
216
- helix_fhir_client_sdk-4.2.24.dist-info/METADATA,sha256=cRV2bCk9JHlcp77O6pjLf6xQLzhsTLBheoVsA4plp0o,7210
217
- helix_fhir_client_sdk-4.2.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
218
- helix_fhir_client_sdk-4.2.24.dist-info/top_level.txt,sha256=BRnDS6ceQxs-4u2jXznATObgP8G2cGAerlH0ZS4sJ6M,46
219
- helix_fhir_client_sdk-4.2.24.dist-info/RECORD,,
216
+ helix_fhir_client_sdk-4.2.26.dist-info/METADATA,sha256=u3xzHMJVqLGpWobmBDUQ_zEdg-C23KShPjN7_mGmPok,7210
217
+ helix_fhir_client_sdk-4.2.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
218
+ helix_fhir_client_sdk-4.2.26.dist-info/top_level.txt,sha256=BRnDS6ceQxs-4u2jXznATObgP8G2cGAerlH0ZS4sJ6M,46
219
+ helix_fhir_client_sdk-4.2.26.dist-info/RECORD,,