phenoml 0.0.15__py3-none-any.whl → 0.0.17__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.
@@ -22,10 +22,10 @@ class BaseClientWrapper:
22
22
 
23
23
  def get_headers(self) -> typing.Dict[str, str]:
24
24
  headers: typing.Dict[str, str] = {
25
- "User-Agent": "phenoml/AUTO",
25
+ "User-Agent": "phenoml/v0.0.17",
26
26
  "X-Fern-Language": "Python",
27
27
  "X-Fern-SDK-Name": "phenoml",
28
- "X-Fern-SDK-Version": "v0.0.15",
28
+ "X-Fern-SDK-Version": "v0.0.17",
29
29
  **(self.get_custom_headers() or {}),
30
30
  }
31
31
  headers["Authorization"] = f"Bearer {self._get_token()}"
@@ -3,6 +3,11 @@
3
3
  # isort: skip_file
4
4
 
5
5
  from .types import (
6
+ CreateMultiResponse,
7
+ CreateMultiResponseBundle,
8
+ CreateMultiResponseBundleEntryItem,
9
+ CreateMultiResponseBundleEntryItemRequest,
10
+ CreateMultiResponseResourcesItem,
6
11
  CreateRequestResource,
7
12
  DocumentRequestFileType,
8
13
  DocumentRequestResource,
@@ -14,6 +19,11 @@ from .errors import BadRequestError, FailedDependencyError, ForbiddenError, Inte
14
19
 
15
20
  __all__ = [
16
21
  "BadRequestError",
22
+ "CreateMultiResponse",
23
+ "CreateMultiResponseBundle",
24
+ "CreateMultiResponseBundleEntryItem",
25
+ "CreateMultiResponseBundleEntryItemRequest",
26
+ "CreateMultiResponseResourcesItem",
17
27
  "CreateRequestResource",
18
28
  "DocumentRequestFileType",
19
29
  "DocumentRequestResource",
@@ -5,6 +5,7 @@ import typing
5
5
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
6
  from ..core.request_options import RequestOptions
7
7
  from .raw_client import AsyncRawLang2FhirClient, RawLang2FhirClient
8
+ from .types.create_multi_response import CreateMultiResponse
8
9
  from .types.create_request_resource import CreateRequestResource
9
10
  from .types.document_request_file_type import DocumentRequestFileType
10
11
  from .types.document_request_resource import DocumentRequestResource
@@ -79,6 +80,54 @@ class Lang2FhirClient:
79
80
  )
80
81
  return _response.data
81
82
 
83
+ def create_multi(
84
+ self,
85
+ *,
86
+ text: str,
87
+ version: typing.Optional[str] = OMIT,
88
+ provider: typing.Optional[str] = OMIT,
89
+ request_options: typing.Optional[RequestOptions] = None,
90
+ ) -> CreateMultiResponse:
91
+ """
92
+ Analyzes natural language text and extracts multiple FHIR resources, returning them as a transaction Bundle.
93
+ Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
94
+ Resources are linked with proper references (e.g., Conditions reference the Patient).
95
+
96
+ Parameters
97
+ ----------
98
+ text : str
99
+ Natural language text containing multiple clinical concepts to extract
100
+
101
+ version : typing.Optional[str]
102
+ FHIR version to use
103
+
104
+ provider : typing.Optional[str]
105
+ Optional FHIR provider name for provider-specific profiles
106
+
107
+ request_options : typing.Optional[RequestOptions]
108
+ Request-specific configuration.
109
+
110
+ Returns
111
+ -------
112
+ CreateMultiResponse
113
+ Successfully extracted FHIR resources
114
+
115
+ Examples
116
+ --------
117
+ from phenoml import phenoml
118
+
119
+ client = phenoml(
120
+ token="YOUR_TOKEN",
121
+ )
122
+ client.lang2fhir.create_multi(
123
+ text="John Smith, 45-year-old male, diagnosed with Type 2 Diabetes. Prescribed Metformin 500mg twice daily.",
124
+ )
125
+ """
126
+ _response = self._raw_client.create_multi(
127
+ text=text, version=version, provider=provider, request_options=request_options
128
+ )
129
+ return _response.data
130
+
82
131
  def search(self, *, text: str, request_options: typing.Optional[RequestOptions] = None) -> SearchResponse:
83
132
  """
84
133
  Converts natural language text into FHIR search parameters
@@ -143,9 +192,9 @@ class Lang2FhirClient:
143
192
  token="YOUR_TOKEN",
144
193
  )
145
194
  client.lang2fhir.upload_profile(
146
- version="version",
147
- resource="custom-patient",
148
- profile="profile",
195
+ version="R4",
196
+ resource="condition-encounter-diagnosis",
197
+ profile="(base64 encoded JSON string of the FHIR profile)",
149
198
  )
150
199
  """
151
200
  _response = self._raw_client.upload_profile(
@@ -278,6 +327,62 @@ class AsyncLang2FhirClient:
278
327
  )
279
328
  return _response.data
280
329
 
330
+ async def create_multi(
331
+ self,
332
+ *,
333
+ text: str,
334
+ version: typing.Optional[str] = OMIT,
335
+ provider: typing.Optional[str] = OMIT,
336
+ request_options: typing.Optional[RequestOptions] = None,
337
+ ) -> CreateMultiResponse:
338
+ """
339
+ Analyzes natural language text and extracts multiple FHIR resources, returning them as a transaction Bundle.
340
+ Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
341
+ Resources are linked with proper references (e.g., Conditions reference the Patient).
342
+
343
+ Parameters
344
+ ----------
345
+ text : str
346
+ Natural language text containing multiple clinical concepts to extract
347
+
348
+ version : typing.Optional[str]
349
+ FHIR version to use
350
+
351
+ provider : typing.Optional[str]
352
+ Optional FHIR provider name for provider-specific profiles
353
+
354
+ request_options : typing.Optional[RequestOptions]
355
+ Request-specific configuration.
356
+
357
+ Returns
358
+ -------
359
+ CreateMultiResponse
360
+ Successfully extracted FHIR resources
361
+
362
+ Examples
363
+ --------
364
+ import asyncio
365
+
366
+ from phenoml import Asyncphenoml
367
+
368
+ client = Asyncphenoml(
369
+ token="YOUR_TOKEN",
370
+ )
371
+
372
+
373
+ async def main() -> None:
374
+ await client.lang2fhir.create_multi(
375
+ text="John Smith, 45-year-old male, diagnosed with Type 2 Diabetes. Prescribed Metformin 500mg twice daily.",
376
+ )
377
+
378
+
379
+ asyncio.run(main())
380
+ """
381
+ _response = await self._raw_client.create_multi(
382
+ text=text, version=version, provider=provider, request_options=request_options
383
+ )
384
+ return _response.data
385
+
281
386
  async def search(self, *, text: str, request_options: typing.Optional[RequestOptions] = None) -> SearchResponse:
282
387
  """
283
388
  Converts natural language text into FHIR search parameters
@@ -355,9 +460,9 @@ class AsyncLang2FhirClient:
355
460
 
356
461
  async def main() -> None:
357
462
  await client.lang2fhir.upload_profile(
358
- version="version",
359
- resource="custom-patient",
360
- profile="profile",
463
+ version="R4",
464
+ resource="condition-encounter-diagnosis",
465
+ profile="(base64 encoded JSON string of the FHIR profile)",
361
466
  )
362
467
 
363
468
 
@@ -13,6 +13,7 @@ from .errors.failed_dependency_error import FailedDependencyError
13
13
  from .errors.forbidden_error import ForbiddenError
14
14
  from .errors.internal_server_error import InternalServerError
15
15
  from .errors.unauthorized_error import UnauthorizedError
16
+ from .types.create_multi_response import CreateMultiResponse
16
17
  from .types.create_request_resource import CreateRequestResource
17
18
  from .types.document_request_file_type import DocumentRequestFileType
18
19
  from .types.document_request_resource import DocumentRequestResource
@@ -120,6 +121,100 @@ class RawLang2FhirClient:
120
121
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
121
122
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
122
123
 
124
+ def create_multi(
125
+ self,
126
+ *,
127
+ text: str,
128
+ version: typing.Optional[str] = OMIT,
129
+ provider: typing.Optional[str] = OMIT,
130
+ request_options: typing.Optional[RequestOptions] = None,
131
+ ) -> HttpResponse[CreateMultiResponse]:
132
+ """
133
+ Analyzes natural language text and extracts multiple FHIR resources, returning them as a transaction Bundle.
134
+ Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
135
+ Resources are linked with proper references (e.g., Conditions reference the Patient).
136
+
137
+ Parameters
138
+ ----------
139
+ text : str
140
+ Natural language text containing multiple clinical concepts to extract
141
+
142
+ version : typing.Optional[str]
143
+ FHIR version to use
144
+
145
+ provider : typing.Optional[str]
146
+ Optional FHIR provider name for provider-specific profiles
147
+
148
+ request_options : typing.Optional[RequestOptions]
149
+ Request-specific configuration.
150
+
151
+ Returns
152
+ -------
153
+ HttpResponse[CreateMultiResponse]
154
+ Successfully extracted FHIR resources
155
+ """
156
+ _response = self._client_wrapper.httpx_client.request(
157
+ "lang2fhir/create/multi",
158
+ method="POST",
159
+ json={
160
+ "text": text,
161
+ "version": version,
162
+ "provider": provider,
163
+ },
164
+ headers={
165
+ "content-type": "application/json",
166
+ },
167
+ request_options=request_options,
168
+ omit=OMIT,
169
+ )
170
+ try:
171
+ if 200 <= _response.status_code < 300:
172
+ _data = typing.cast(
173
+ CreateMultiResponse,
174
+ parse_obj_as(
175
+ type_=CreateMultiResponse, # type: ignore
176
+ object_=_response.json(),
177
+ ),
178
+ )
179
+ return HttpResponse(response=_response, data=_data)
180
+ if _response.status_code == 400:
181
+ raise BadRequestError(
182
+ headers=dict(_response.headers),
183
+ body=typing.cast(
184
+ typing.Optional[typing.Any],
185
+ parse_obj_as(
186
+ type_=typing.Optional[typing.Any], # type: ignore
187
+ object_=_response.json(),
188
+ ),
189
+ ),
190
+ )
191
+ if _response.status_code == 401:
192
+ raise UnauthorizedError(
193
+ headers=dict(_response.headers),
194
+ body=typing.cast(
195
+ typing.Optional[typing.Any],
196
+ parse_obj_as(
197
+ type_=typing.Optional[typing.Any], # type: ignore
198
+ object_=_response.json(),
199
+ ),
200
+ ),
201
+ )
202
+ if _response.status_code == 500:
203
+ raise InternalServerError(
204
+ headers=dict(_response.headers),
205
+ body=typing.cast(
206
+ typing.Optional[typing.Any],
207
+ parse_obj_as(
208
+ type_=typing.Optional[typing.Any], # type: ignore
209
+ object_=_response.json(),
210
+ ),
211
+ ),
212
+ )
213
+ _response_json = _response.json()
214
+ except JSONDecodeError:
215
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
216
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
217
+
123
218
  def search(
124
219
  self, *, text: str, request_options: typing.Optional[RequestOptions] = None
125
220
  ) -> HttpResponse[SearchResponse]:
@@ -502,6 +597,100 @@ class AsyncRawLang2FhirClient:
502
597
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
503
598
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
504
599
 
600
+ async def create_multi(
601
+ self,
602
+ *,
603
+ text: str,
604
+ version: typing.Optional[str] = OMIT,
605
+ provider: typing.Optional[str] = OMIT,
606
+ request_options: typing.Optional[RequestOptions] = None,
607
+ ) -> AsyncHttpResponse[CreateMultiResponse]:
608
+ """
609
+ Analyzes natural language text and extracts multiple FHIR resources, returning them as a transaction Bundle.
610
+ Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
611
+ Resources are linked with proper references (e.g., Conditions reference the Patient).
612
+
613
+ Parameters
614
+ ----------
615
+ text : str
616
+ Natural language text containing multiple clinical concepts to extract
617
+
618
+ version : typing.Optional[str]
619
+ FHIR version to use
620
+
621
+ provider : typing.Optional[str]
622
+ Optional FHIR provider name for provider-specific profiles
623
+
624
+ request_options : typing.Optional[RequestOptions]
625
+ Request-specific configuration.
626
+
627
+ Returns
628
+ -------
629
+ AsyncHttpResponse[CreateMultiResponse]
630
+ Successfully extracted FHIR resources
631
+ """
632
+ _response = await self._client_wrapper.httpx_client.request(
633
+ "lang2fhir/create/multi",
634
+ method="POST",
635
+ json={
636
+ "text": text,
637
+ "version": version,
638
+ "provider": provider,
639
+ },
640
+ headers={
641
+ "content-type": "application/json",
642
+ },
643
+ request_options=request_options,
644
+ omit=OMIT,
645
+ )
646
+ try:
647
+ if 200 <= _response.status_code < 300:
648
+ _data = typing.cast(
649
+ CreateMultiResponse,
650
+ parse_obj_as(
651
+ type_=CreateMultiResponse, # type: ignore
652
+ object_=_response.json(),
653
+ ),
654
+ )
655
+ return AsyncHttpResponse(response=_response, data=_data)
656
+ if _response.status_code == 400:
657
+ raise BadRequestError(
658
+ headers=dict(_response.headers),
659
+ body=typing.cast(
660
+ typing.Optional[typing.Any],
661
+ parse_obj_as(
662
+ type_=typing.Optional[typing.Any], # type: ignore
663
+ object_=_response.json(),
664
+ ),
665
+ ),
666
+ )
667
+ if _response.status_code == 401:
668
+ raise UnauthorizedError(
669
+ headers=dict(_response.headers),
670
+ body=typing.cast(
671
+ typing.Optional[typing.Any],
672
+ parse_obj_as(
673
+ type_=typing.Optional[typing.Any], # type: ignore
674
+ object_=_response.json(),
675
+ ),
676
+ ),
677
+ )
678
+ if _response.status_code == 500:
679
+ raise InternalServerError(
680
+ headers=dict(_response.headers),
681
+ body=typing.cast(
682
+ typing.Optional[typing.Any],
683
+ parse_obj_as(
684
+ type_=typing.Optional[typing.Any], # type: ignore
685
+ object_=_response.json(),
686
+ ),
687
+ ),
688
+ )
689
+ _response_json = _response.json()
690
+ except JSONDecodeError:
691
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
692
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
693
+
505
694
  async def search(
506
695
  self, *, text: str, request_options: typing.Optional[RequestOptions] = None
507
696
  ) -> AsyncHttpResponse[SearchResponse]:
@@ -2,6 +2,11 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
+ from .create_multi_response import CreateMultiResponse
6
+ from .create_multi_response_bundle import CreateMultiResponseBundle
7
+ from .create_multi_response_bundle_entry_item import CreateMultiResponseBundleEntryItem
8
+ from .create_multi_response_bundle_entry_item_request import CreateMultiResponseBundleEntryItemRequest
9
+ from .create_multi_response_resources_item import CreateMultiResponseResourcesItem
5
10
  from .create_request_resource import CreateRequestResource
6
11
  from .document_request_file_type import DocumentRequestFileType
7
12
  from .document_request_resource import DocumentRequestResource
@@ -10,6 +15,11 @@ from .lang2fhir_upload_profile_response import Lang2FhirUploadProfileResponse
10
15
  from .search_response import SearchResponse
11
16
 
12
17
  __all__ = [
18
+ "CreateMultiResponse",
19
+ "CreateMultiResponseBundle",
20
+ "CreateMultiResponseBundleEntryItem",
21
+ "CreateMultiResponseBundleEntryItemRequest",
22
+ "CreateMultiResponseResourcesItem",
13
23
  "CreateRequestResource",
14
24
  "DocumentRequestFileType",
15
25
  "DocumentRequestResource",
@@ -0,0 +1,39 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .create_multi_response_bundle import CreateMultiResponseBundle
8
+ from .create_multi_response_resources_item import CreateMultiResponseResourcesItem
9
+
10
+
11
+ class CreateMultiResponse(UniversalBaseModel):
12
+ success: typing.Optional[bool] = pydantic.Field(default=None)
13
+ """
14
+ Whether extraction was successful
15
+ """
16
+
17
+ message: typing.Optional[str] = pydantic.Field(default=None)
18
+ """
19
+ Status message
20
+ """
21
+
22
+ bundle: typing.Optional[CreateMultiResponseBundle] = pydantic.Field(default=None)
23
+ """
24
+ FHIR transaction Bundle containing all extracted resources
25
+ """
26
+
27
+ resources: typing.Optional[typing.List[CreateMultiResponseResourcesItem]] = pydantic.Field(default=None)
28
+ """
29
+ Summary of extracted resources
30
+ """
31
+
32
+ if IS_PYDANTIC_V2:
33
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
34
+ else:
35
+
36
+ class Config:
37
+ frozen = True
38
+ smart_union = True
39
+ extra = pydantic.Extra.allow
@@ -0,0 +1,28 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ import typing_extensions
7
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
+ from ...core.serialization import FieldMetadata
9
+ from .create_multi_response_bundle_entry_item import CreateMultiResponseBundleEntryItem
10
+
11
+
12
+ class CreateMultiResponseBundle(UniversalBaseModel):
13
+ """
14
+ FHIR transaction Bundle containing all extracted resources
15
+ """
16
+
17
+ resource_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="resourceType")] = None
18
+ type: typing.Optional[str] = None
19
+ entry: typing.Optional[typing.List[CreateMultiResponseBundleEntryItem]] = None
20
+
21
+ if IS_PYDANTIC_V2:
22
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
23
+ else:
24
+
25
+ class Config:
26
+ frozen = True
27
+ smart_union = True
28
+ extra = pydantic.Extra.allow
@@ -0,0 +1,24 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ import typing_extensions
7
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
+ from ...core.serialization import FieldMetadata
9
+ from .create_multi_response_bundle_entry_item_request import CreateMultiResponseBundleEntryItemRequest
10
+
11
+
12
+ class CreateMultiResponseBundleEntryItem(UniversalBaseModel):
13
+ full_url: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="fullUrl")] = None
14
+ resource: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
15
+ request: typing.Optional[CreateMultiResponseBundleEntryItemRequest] = None
16
+
17
+ if IS_PYDANTIC_V2:
18
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
19
+ else:
20
+
21
+ class Config:
22
+ frozen = True
23
+ smart_union = True
24
+ extra = pydantic.Extra.allow
@@ -0,0 +1,20 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+
8
+
9
+ class CreateMultiResponseBundleEntryItemRequest(UniversalBaseModel):
10
+ method: typing.Optional[str] = None
11
+ url: typing.Optional[str] = None
12
+
13
+ if IS_PYDANTIC_V2:
14
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
15
+ else:
16
+
17
+ class Config:
18
+ frozen = True
19
+ smart_union = True
20
+ extra = pydantic.Extra.allow
@@ -0,0 +1,38 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ import typing_extensions
7
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
+ from ...core.serialization import FieldMetadata
9
+
10
+
11
+ class CreateMultiResponseResourcesItem(UniversalBaseModel):
12
+ temp_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="tempId")] = pydantic.Field(
13
+ default=None
14
+ )
15
+ """
16
+ Temporary UUID for the resource
17
+ """
18
+
19
+ resource_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="resourceType")] = (
20
+ pydantic.Field(default=None)
21
+ )
22
+ """
23
+ FHIR resource type
24
+ """
25
+
26
+ description: typing.Optional[str] = pydantic.Field(default=None)
27
+ """
28
+ Text excerpt this resource was extracted from
29
+ """
30
+
31
+ if IS_PYDANTIC_V2:
32
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
33
+ else:
34
+
35
+ class Config:
36
+ frozen = True
37
+ smart_union = True
38
+ extra = pydantic.Extra.allow
@@ -7,6 +7,7 @@ from .types import (
7
7
  CreateSummaryRequestMode,
8
8
  CreateSummaryResponse,
9
9
  CreateSummaryTemplateResponse,
10
+ ErrorResponse,
10
11
  FhirBundle,
11
12
  FhirBundleEntryItem,
12
13
  FhirResource,
@@ -24,6 +25,7 @@ __all__ = [
24
25
  "CreateSummaryRequestMode",
25
26
  "CreateSummaryResponse",
26
27
  "CreateSummaryTemplateResponse",
28
+ "ErrorResponse",
27
29
  "FhirBundle",
28
30
  "FhirBundleEntryItem",
29
31
  "FhirResource",
phenoml/summary/client.py CHANGED
@@ -268,19 +268,25 @@ class SummaryClient:
268
268
  request_options: typing.Optional[RequestOptions] = None,
269
269
  ) -> CreateSummaryResponse:
270
270
  """
271
- Creates a summary from FHIR resources using one of two modes:
271
+ Creates a summary from FHIR resources using one of three modes:
272
272
  - **narrative**: Uses a template to substitute FHIR data into placeholders (requires template_id)
273
273
  - **flatten**: Flattens FHIR resources into a searchable format for RAG/search (no template needed)
274
+ - **ips**: Generates an International Patient Summary (IPS) narrative per ISO 27269/HL7 FHIR IPS IG. Requires a Bundle with exactly one Patient resource (returns 400 error if no Patient or multiple Patients are present). Automatically filters resources to those referencing the patient and generates sections for allergies, medications, problems, immunizations, procedures, and vital signs.
274
275
 
275
276
  Parameters
276
277
  ----------
277
278
  fhir_resources : CreateSummaryRequestFhirResources
278
- FHIR resources (single resource or Bundle)
279
+ FHIR resources (single resource or Bundle).
280
+ For IPS mode, must be a Bundle containing exactly one Patient resource with at least one
281
+ identifier (id, fullUrl, or identifier field). Returns an error if no Patient is found,
282
+ if multiple Patients are present, or if the Patient has no identifiers. Resources are
283
+ automatically filtered to only include those referencing the patient.
279
284
 
280
285
  mode : typing.Optional[CreateSummaryRequestMode]
281
286
  Summary generation mode:
282
287
  - narrative: Substitute FHIR data into a template (requires template_id)
283
288
  - flatten: Flatten FHIR resources for RAG/search (no template needed)
289
+ - ips: Generate International Patient Summary (IPS) narrative per ISO 27269/HL7 FHIR IPS IG
284
290
 
285
291
  template_id : typing.Optional[str]
286
292
  ID of the template to use (required for narrative mode)
@@ -603,19 +609,25 @@ class AsyncSummaryClient:
603
609
  request_options: typing.Optional[RequestOptions] = None,
604
610
  ) -> CreateSummaryResponse:
605
611
  """
606
- Creates a summary from FHIR resources using one of two modes:
612
+ Creates a summary from FHIR resources using one of three modes:
607
613
  - **narrative**: Uses a template to substitute FHIR data into placeholders (requires template_id)
608
614
  - **flatten**: Flattens FHIR resources into a searchable format for RAG/search (no template needed)
615
+ - **ips**: Generates an International Patient Summary (IPS) narrative per ISO 27269/HL7 FHIR IPS IG. Requires a Bundle with exactly one Patient resource (returns 400 error if no Patient or multiple Patients are present). Automatically filters resources to those referencing the patient and generates sections for allergies, medications, problems, immunizations, procedures, and vital signs.
609
616
 
610
617
  Parameters
611
618
  ----------
612
619
  fhir_resources : CreateSummaryRequestFhirResources
613
- FHIR resources (single resource or Bundle)
620
+ FHIR resources (single resource or Bundle).
621
+ For IPS mode, must be a Bundle containing exactly one Patient resource with at least one
622
+ identifier (id, fullUrl, or identifier field). Returns an error if no Patient is found,
623
+ if multiple Patients are present, or if the Patient has no identifiers. Resources are
624
+ automatically filtered to only include those referencing the patient.
614
625
 
615
626
  mode : typing.Optional[CreateSummaryRequestMode]
616
627
  Summary generation mode:
617
628
  - narrative: Substitute FHIR data into a template (requires template_id)
618
629
  - flatten: Flatten FHIR resources for RAG/search (no template needed)
630
+ - ips: Generate International Patient Summary (IPS) narrative per ISO 27269/HL7 FHIR IPS IG
619
631
 
620
632
  template_id : typing.Optional[str]
621
633
  ID of the template to use (required for narrative mode)