hubble-sdk-python 0.3.1__py3-none-any.whl → 0.3.2__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.
hubble_sdk/_hubble.py CHANGED
@@ -132,6 +132,19 @@ def _require_fhir_namespace(base_url: str, url: httpx.URL, shown: str) -> None:
132
132
  raise HubbleError(f"Invalid FHIR path: {shown!r}")
133
133
 
134
134
 
135
+ def _pdf_export_url(
136
+ base_url: str, connection: str | None, version: str | None, combined: bool
137
+ ) -> httpx.URL:
138
+ if combined and (not version or not connection):
139
+ raise HubbleError("A combined PDF requires version and connection.")
140
+ url = _fhir_url(base_url, "Patient/$pdf")
141
+ if connection is not None:
142
+ url = url.copy_set_param("connection", connection)
143
+ if combined:
144
+ url = url.copy_set_param("combined", "true")
145
+ return url
146
+
147
+
135
148
  def _pdf_export(
136
149
  resp: httpx.Response, file: httpx.Response | None = None, version: str | None = None
137
150
  ) -> PdfExport:
@@ -330,6 +343,7 @@ class Hubble:
330
343
  *,
331
344
  connection: str | None = None,
332
345
  version: str | None = None,
346
+ combined: bool = False,
333
347
  timeout: float = _EXPORT_TIMEOUT,
334
348
  ) -> PdfExport:
335
349
  """The patient's records as PDF via ``Patient/$pdf``: a ZIP of per-source
@@ -337,10 +351,10 @@ class Hubble:
337
351
 
338
352
  Pass ``version`` (a ``Hubble-Version``, such as ``"2026-11-01"``) for that
339
353
  version's export instead. It is built in the background, so this waits up
340
- to ``timeout`` seconds for it, then downloads it."""
341
- url = _fhir_url(self.base_url, "Patient/$pdf")
342
- if connection is not None:
343
- url = url.copy_set_param("connection", connection)
354
+ to ``timeout`` seconds for it, then downloads it. Set ``combined=True``
355
+ with ``version`` and ``connection`` for one PDF containing that source's
356
+ summary and documents instead of the archive. Defaults to false."""
357
+ url = _pdf_export_url(self.base_url, connection, version, combined)
344
358
  if version is None:
345
359
  return _pdf_export(self._consent_get(consent_id, url, None))
346
360
  return _versioned_pdf_export(
@@ -676,6 +690,7 @@ class PatientSession:
676
690
  *,
677
691
  connection: str | None = None,
678
692
  version: str | None = None,
693
+ combined: bool = False,
679
694
  timeout: float = _EXPORT_TIMEOUT,
680
695
  ) -> PdfExport:
681
696
  """Export the patient's records as PDF via ``Patient/$pdf``.
@@ -689,11 +704,11 @@ class PatientSession:
689
704
 
690
705
  Pass ``version`` (a ``Hubble-Version``, such as ``"2026-11-01"``) for that
691
706
  version's export instead. It is built in the background, so this waits up
692
- to ``timeout`` seconds for it, then downloads it."""
707
+ to ``timeout`` seconds for it, then downloads it. Set ``combined=True``
708
+ with ``version`` and ``connection`` for one PDF containing that source's
709
+ summary and documents instead of the archive. Defaults to false."""
693
710
  retry = self.refresh_token is not None
694
- url = _fhir_url(self._hubble.base_url, "Patient/$pdf")
695
- if connection is not None:
696
- url = url.copy_set_param("connection", connection)
711
+ url = _pdf_export_url(self._hubble.base_url, connection, version, combined)
697
712
  if version is None:
698
713
  return _pdf_export(self._fhir_request(url, retry))
699
714
  return _versioned_pdf_export(
@@ -779,8 +794,8 @@ class PdfExport:
779
794
  ``content`` is the raw body — a ZIP of per-source PDFs (with a
780
795
  ``manifest.json`` naming each file and marking it complete/partial/failed),
781
796
  or a single PDF when ``connection`` was set. With a ``version``, it is that
782
- version's export, described in the API reference. The counts come from the
783
- response headers; a non-zero ``sources_failed`` means some records are
797
+ version's archive, or one PDF if ``combined=True`` was requested. The counts
798
+ come from the response headers; a non-zero ``sources_failed`` means some records are
784
799
  missing. ``version`` is the ``Hubble-Version`` served, or ``None`` when none
785
800
  was asked for."""
786
801
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: hubble-sdk-python
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Python client for the Hubble Patient Access API.
5
5
  Project-URL: Homepage, https://github.com/hubble-dot-ai/hubble-sdks
6
6
  Project-URL: Repository, https://github.com/hubble-dot-ai/hubble-sdks
@@ -81,6 +81,27 @@ export = hub.export_pdf(consent_id, connection=connection_id) # one sour
81
81
 
82
82
  Reuse one `Hubble` client so its token is reused too.
83
83
 
84
+ ### Combined PDF exports
85
+
86
+ Pass `version`, `connection`, and `combined=True` to download one PDF containing
87
+ the source's summary and documents. The helper requests background generation,
88
+ waits for completion, and downloads the file.
89
+
90
+ ```python
91
+ export = hub.export_pdf(
92
+ consent_id,
93
+ version="2026-11-01",
94
+ connection=connection_id,
95
+ combined=True,
96
+ )
97
+ # export.content contains the PDF bytes; export.content_type is "application/pdf".
98
+ ```
99
+
100
+ `session.export_pdf` accepts the same options without the consent ID. With a
101
+ version and `combined` omitted or false, the result is a records archive (ZIP).
102
+ Calls without a version keep their existing behavior. `timeout` controls the
103
+ wait for background generation in seconds and defaults to ten minutes.
104
+
84
105
  ### The device flow
85
106
 
86
107
  Existing integrations can keep using the device flow, which waits for the
@@ -1,5 +1,5 @@
1
1
  hubble_sdk/__init__.py,sha256=ZWHqgD53YvB-IHk4GT26Z9J6IZGd-OdmjraHePXDcj4,1789
2
- hubble_sdk/_hubble.py,sha256=AYmB5S2c1BrRSUDOihL7y6pajfQl6OztIH1vLMwYbio,35452
2
+ hubble_sdk/_hubble.py,sha256=PYtitUsIX0kYIRthJZMlUgT8w792a9TsuinfArCm8fU,36199
3
3
  hubble_sdk/_params.py,sha256=CeR3ksQk2QOoRAFmy8Pu1kGICcrBQ_wnOLpo9Yfiwlo,3046
4
4
  hubble_sdk/_webhooks.py,sha256=5luPbiJwfozo7q1t95oyWGnphZhtlW27RpuHviuGMJI,8150
5
5
  hubble_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -66,7 +66,7 @@ hubble_sdk/_generated/models/provider_seed.py,sha256=H-OqWFvhcwwp9dNMsYDlAQdk_LN
66
66
  hubble_sdk/_generated/models/token_request.py,sha256=6gDAneGZQymGmK41_fpm0mwLoyz5kP_JokqWs-u0JRY,2403
67
67
  hubble_sdk/_generated/models/token_request_grant_type.py,sha256=B0M3WPS5YhXOc4Cc9ZQXId4pjCtFGYwZ-Aofz2Cq6fk,1178
68
68
  hubble_sdk/_generated/models/token_response.py,sha256=HORaPEpLNuPdCtGMlR-CXt8sQEYQH6gEp0gNTpQoFeE,2121
69
- hubble_sdk_python-0.3.1.dist-info/METADATA,sha256=_pH56Dgap96l6aoVguNiZyBsM_z5w3ahV4gHHqCGyhY,6231
70
- hubble_sdk_python-0.3.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
71
- hubble_sdk_python-0.3.1.dist-info/licenses/LICENSE,sha256=S8zTUFi7pK2HOg-wSn6bFAWbNAO4Lt1UiyDu_vcqO6w,1063
72
- hubble_sdk_python-0.3.1.dist-info/RECORD,,
69
+ hubble_sdk_python-0.3.2.dist-info/METADATA,sha256=fNKv0Xm1G2x1Ck-1Y6bpbzvhrvIF7mn0i1TyT7_Iri4,6986
70
+ hubble_sdk_python-0.3.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
71
+ hubble_sdk_python-0.3.2.dist-info/licenses/LICENSE,sha256=S8zTUFi7pK2HOg-wSn6bFAWbNAO4Lt1UiyDu_vcqO6w,1063
72
+ hubble_sdk_python-0.3.2.dist-info/RECORD,,