helix.fhir.client.sdk 4.2.12__py3-none-any.whl → 4.2.14__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.
@@ -883,6 +883,8 @@ class FhirClient(
883
883
  fhir_client._client_id = self._client_id
884
884
  fhir_client._auth_server_url = self._auth_server_url
885
885
  fhir_client._login_token = self._login_token
886
+ fhir_client._access_token = self._access_token
887
+ fhir_client._access_token_expiry_date = self._access_token_expiry_date
886
888
  fhir_client._refresh_token_function = self._refresh_token_function
887
889
  fhir_client._exclude_status_codes_from_retry = self._exclude_status_codes_from_retry
888
890
  fhir_client._chunk_size = self._chunk_size
@@ -905,6 +907,8 @@ class FhirClient(
905
907
  fhir_client._trace_request_function = self._trace_request_function
906
908
  fhir_client._log_all_response_urls = self._log_all_response_urls
907
909
  fhir_client._create_operation_outcome_for_error = self._create_operation_outcome_for_error
910
+ if self._max_concurrent_requests is not None:
911
+ fhir_client.set_max_concurrent_requests(self._max_concurrent_requests)
908
912
  return fhir_client
909
913
 
910
914
  def set_log_all_response_urls(self, value: bool) -> FhirClient:
@@ -128,6 +128,9 @@ class FhirClientProtocol(Protocol):
128
128
  _create_operation_outcome_for_error: bool | None
129
129
  """ whether to create OperationOutcome resource for errors """
130
130
 
131
+ _max_concurrent_requests: int | None
132
+ """ maximum number of concurrent requests to make to the FHIR server """
133
+
131
134
  async def get_access_token_async(self) -> GetAccessTokenResult: ...
132
135
 
133
136
  async def _send_fhir_request_async(
@@ -210,3 +213,5 @@ class FhirClientProtocol(Protocol):
210
213
  ) -> AsyncGenerator[FhirMergeResourceResponse, None]:
211
214
  # this is just here to tell Python this returns a generator
212
215
  yield None # type: ignore[misc]
216
+
217
+ def set_persistent_session(self, session: ClientSession | None) -> "FhirClientProtocol": ...
@@ -74,10 +74,13 @@ class RetryableAioHttpClient:
74
74
  self.persistent_session: ClientSession | None = persistent_session
75
75
 
76
76
  async def __aenter__(self) -> "RetryableAioHttpClient":
77
- if self.persistent_session is not None:
78
- self.session = self.persistent_session
79
- else:
80
- self.session = self.fn_get_session()
77
+ # Clear a stale persistent session if closed
78
+ if self.persistent_session is not None and self.persistent_session.closed:
79
+ self.persistent_session = None
80
+
81
+ # Use an existing persistent session or create a new one
82
+ self.session = self.persistent_session if self.persistent_session is not None else self.fn_get_session()
83
+
81
84
  return self
82
85
 
83
86
  async def __aexit__(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: helix.fhir.client.sdk
3
- Version: 4.2.12
3
+ Version: 4.2.14
4
4
  Summary: helix.fhir.client.sdk
5
5
  Home-page: https://github.com/icanbwell/helix.fhir.client.sdk
6
6
  Author: Imran Qureshi
@@ -3,7 +3,7 @@ helix_fhir_client_sdk/dictionary_parser.py,sha256=WrGkVAxMlUvVycRVrX7UZt2oP2e_Vk
3
3
  helix_fhir_client_sdk/dictionary_writer.py,sha256=V7Bx9Z69s0LRYF6Lc6Xp0d-Gj0BnAVKA1vBuwf3JORE,1486
4
4
  helix_fhir_client_sdk/fhir_auth_mixin.py,sha256=p2QIYrCv7ZktutY7SzYizmHADahxBddRTSCqX1EKyHc,14465
5
5
  helix_fhir_client_sdk/fhir_bundle_appender.py,sha256=t1hs7p_vXKC9MUFyUnN9dTuDhRF-kw-kkgVFtGHv9QQ,11749
6
- helix_fhir_client_sdk/fhir_client.py,sha256=vSkgWVgNlRkdu7RFPkD1-4BF9N88PnRXhCTSqUJqHlI,34930
6
+ helix_fhir_client_sdk/fhir_client.py,sha256=P8xhTVNnJuo5UGbg5nrFOlAR4DAOlEstH27YtFHub00,35201
7
7
  helix_fhir_client_sdk/fhir_delete_mixin.py,sha256=1YiKddTJTUzzrRvG7WgSisXY8rfJAHPAEXTsOevrom8,6521
8
8
  helix_fhir_client_sdk/fhir_merge_mixin.py,sha256=YTUODvc2rqXhk5_kwNMFPykm1I9_omww2WUcDExMESg,15264
9
9
  helix_fhir_client_sdk/fhir_merge_resources_mixin.py,sha256=d5x41uL__yxMcaAnYDdmbpt529ZsOZcO0EBvnV1HSGI,36002
@@ -44,7 +44,7 @@ helix_fhir_client_sdk/queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
44
44
  helix_fhir_client_sdk/queue/request_queue_mixin.py,sha256=L5HgWWARj-JoM7v4cradNonDK1aO1BQyl2MWZknP_PY,21806
45
45
  helix_fhir_client_sdk/responses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  helix_fhir_client_sdk/responses/bundle_expander.py,sha256=ilR5eMgciSgzsdQvKB6bHtn9jtpvn3uS-EBz-hrahzo,1065
47
- helix_fhir_client_sdk/responses/fhir_client_protocol.py,sha256=cKt0lNYFc5HPWZcHaaW8UFO7iHl16QmG93sbDKFJVvs,6785
47
+ helix_fhir_client_sdk/responses/fhir_client_protocol.py,sha256=QbkKa3x6czhy-QCLN1icctBSXBlLnll1Lj9kMdFm914,7002
48
48
  helix_fhir_client_sdk/responses/fhir_delete_response.py,sha256=0K11vyfZ0LtL-G61NHzDqHrZgEHjMVZr00VWpWcktZA,2941
49
49
  helix_fhir_client_sdk/responses/fhir_get_response.py,sha256=3PXvFoMZ7ix2ZzucIjY-49RL3foLR07dD57BdulyMGI,17657
50
50
  helix_fhir_client_sdk/responses/fhir_merge_response.py,sha256=uvUjEGJgMDlAkcc5_LjgAsTFZqREQMlV79sbxUZwtwE,2862
@@ -104,7 +104,7 @@ helix_fhir_client_sdk/utilities/hash_util.py,sha256=YNUy7-IC_OtC0l-T45UO9UkA-_ps
104
104
  helix_fhir_client_sdk/utilities/list_chunker.py,sha256=2h2k5CCFmOhICaugOx6UI-9dh4q5w1lVdF7WQLX0LCM,1456
105
105
  helix_fhir_client_sdk/utilities/ndjson_chunk_streaming_parser.py,sha256=3TCYfWVCEpJbqRxqlSDsGnFnraO4T9bxzYdShvu6Pos,1954
106
106
  helix_fhir_client_sdk/utilities/practitioner_generator.py,sha256=gneCAXNDNEphBY-Nc2nMQBbEWJgHcjvv3S8JQ75yiJI,3778
107
- helix_fhir_client_sdk/utilities/retryable_aiohttp_client.py,sha256=pxB4N0nkNBo2LT59tr1WnLBqiyr0J6l2OfXVMad1WJU,20898
107
+ helix_fhir_client_sdk/utilities/retryable_aiohttp_client.py,sha256=yjZ0hUWNG4JD8sWgPGXYmYsY_wzaJM0cWD_Vo2LG8Sg,21095
108
108
  helix_fhir_client_sdk/utilities/retryable_aiohttp_response.py,sha256=DvNX6WO1m2Hz6LoI5CwSPDECPd8oDsqRCVsyq_Oxf-0,3542
109
109
  helix_fhir_client_sdk/utilities/retryable_aiohttp_url_result.py,sha256=Gdmvn6qIM2JF0YOhobQUHY41fCxvYyaths_CZs0iJfo,616
110
110
  helix_fhir_client_sdk/utilities/url_checker.py,sha256=_JRSIvu7WNXh2OA79HJbEEiomGT-quGhAUGh44-9824,3580
@@ -130,10 +130,10 @@ helix_fhir_client_sdk/validators/async_fhir_validator.py,sha256=Bgiw5atbc5YzBYpk
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.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
133
+ helix_fhir_client_sdk-4.2.14.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
- tests/test_fhir_client_clone.py,sha256=ZjC0ctog5r8Ba0ZD94ggwbnbQMeQdxk5pTt3zTpE8rQ,2832
136
+ tests/test_fhir_client_clone.py,sha256=tKL-Kz9sUc1mTkaGO0QQtgO5_8ZuBdDICm_oNTV12sY,4030
137
137
  tests/test_get_nested_property.py,sha256=dA7eNmPJuwzQTViORRmJkcn9RAZzxeajSxUghobHpAo,2381
138
138
  tests/async/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
139
139
  tests/async/test_async_fhir_client_fetch_response_in_chunks.py,sha256=Ql95DuOqaidFL6u553f-Bkp4Rsd662C__NA-5sw0KL0,3993
@@ -212,7 +212,7 @@ tests_integration/test_emr_server_auth.py,sha256=2I4QUAspQN89uGf6JB2aVuYaBeDnRJz
212
212
  tests_integration/test_firely_fhir.py,sha256=ll6-plwQrKfdrEyfbw0wLTC1jB-Qei1Mj-81tYTl5eQ,697
213
213
  tests_integration/test_merge_vs_smart_merge_behavior.py,sha256=LrIuyxzw0YLaTjcRtG0jzy0M6xSv9qebmdBtMPDcacQ,3733
214
214
  tests_integration/test_staging_server_graph.py,sha256=5RfMxjhdX9o4-n_ZRvze4Sm8u8NjRijRLDpqiz8qD_0,7132
215
- helix_fhir_client_sdk-4.2.12.dist-info/METADATA,sha256=5eIjcGvbBwNeb90I6olYBeLlpLDlSZrLTEO1xwopu04,5845
216
- helix_fhir_client_sdk-4.2.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
217
- helix_fhir_client_sdk-4.2.12.dist-info/top_level.txt,sha256=BRnDS6ceQxs-4u2jXznATObgP8G2cGAerlH0ZS4sJ6M,46
218
- helix_fhir_client_sdk-4.2.12.dist-info/RECORD,,
215
+ helix_fhir_client_sdk-4.2.14.dist-info/METADATA,sha256=k5OlcbCO8MQ7ButJErmJBVXEV7nOSZ9oDHlXxomX_a4,5845
216
+ helix_fhir_client_sdk-4.2.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
217
+ helix_fhir_client_sdk-4.2.14.dist-info/top_level.txt,sha256=BRnDS6ceQxs-4u2jXznATObgP8G2cGAerlH0ZS4sJ6M,46
218
+ helix_fhir_client_sdk-4.2.14.dist-info/RECORD,,
@@ -2,6 +2,8 @@
2
2
  Tests for FhirClient.clone() method to ensure all properties are properly copied.
3
3
  """
4
4
 
5
+ from datetime import UTC, datetime, timedelta
6
+
5
7
  from compressedfhir.utilities.compressed_dict.v1.compressed_dict_storage_mode import (
6
8
  CompressedDictStorageMode,
7
9
  )
@@ -76,3 +78,35 @@ def test_default_storage_mode_is_raw() -> None:
76
78
  """Test that the default storage mode is 'raw'"""
77
79
  fhir_client = FhirClient()
78
80
  assert fhir_client._storage_mode.storage_type == "raw"
81
+
82
+
83
+ def test_clone_preserves_access_token() -> None:
84
+ """Test that clone() preserves access token and expiry date"""
85
+ expiry_date = datetime.now(UTC) + timedelta(hours=1)
86
+ fhir_client = (
87
+ FhirClient()
88
+ .url("http://example.com")
89
+ .set_access_token("test-access-token-12345")
90
+ .set_access_token_expiry_date(expiry_date)
91
+ )
92
+
93
+ assert fhir_client._access_token == "test-access-token-12345"
94
+ assert fhir_client._access_token_expiry_date == expiry_date
95
+
96
+ # Clone and verify access token is preserved
97
+ cloned_client = fhir_client.clone()
98
+
99
+ assert cloned_client._access_token == "test-access-token-12345"
100
+ assert cloned_client._access_token_expiry_date == expiry_date
101
+
102
+
103
+ def test_clone_preserves_max_concurrent_requests() -> None:
104
+ """Test that clone() preserves max_concurrent_requests setting"""
105
+ fhir_client = FhirClient().url("http://example.com").set_max_concurrent_requests(10)
106
+
107
+ assert fhir_client._max_concurrent_requests == 10
108
+
109
+ # Clone and verify max_concurrent_requests is preserved
110
+ cloned_client = fhir_client.clone()
111
+
112
+ assert cloned_client._max_concurrent_requests == 10