phenoml 0.0.15__py3-none-any.whl → 0.0.16__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.16",
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.16",
29
29
  **(self.get_custom_headers() or {}),
30
30
  }
31
31
  headers["Authorization"] = f"Bearer {self._get_token()}"
@@ -143,9 +143,9 @@ class Lang2FhirClient:
143
143
  token="YOUR_TOKEN",
144
144
  )
145
145
  client.lang2fhir.upload_profile(
146
- version="version",
147
- resource="custom-patient",
148
- profile="profile",
146
+ version="R4",
147
+ resource="condition-encounter-diagnosis",
148
+ profile="(base64 encoded JSON string of the FHIR profile)",
149
149
  )
150
150
  """
151
151
  _response = self._raw_client.upload_profile(
@@ -355,9 +355,9 @@ class AsyncLang2FhirClient:
355
355
 
356
356
  async def main() -> None:
357
357
  await client.lang2fhir.upload_profile(
358
- version="version",
359
- resource="custom-patient",
360
- profile="profile",
358
+ version="R4",
359
+ resource="condition-encounter-diagnosis",
360
+ profile="(base64 encoded JSON string of the FHIR profile)",
361
361
  )
362
362
 
363
363
 
@@ -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)
@@ -497,19 +497,25 @@ class RawSummaryClient:
497
497
  request_options: typing.Optional[RequestOptions] = None,
498
498
  ) -> HttpResponse[CreateSummaryResponse]:
499
499
  """
500
- Creates a summary from FHIR resources using one of two modes:
500
+ Creates a summary from FHIR resources using one of three modes:
501
501
  - **narrative**: Uses a template to substitute FHIR data into placeholders (requires template_id)
502
502
  - **flatten**: Flattens FHIR resources into a searchable format for RAG/search (no template needed)
503
+ - **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.
503
504
 
504
505
  Parameters
505
506
  ----------
506
507
  fhir_resources : CreateSummaryRequestFhirResources
507
- FHIR resources (single resource or Bundle)
508
+ FHIR resources (single resource or Bundle).
509
+ For IPS mode, must be a Bundle containing exactly one Patient resource with at least one
510
+ identifier (id, fullUrl, or identifier field). Returns an error if no Patient is found,
511
+ if multiple Patients are present, or if the Patient has no identifiers. Resources are
512
+ automatically filtered to only include those referencing the patient.
508
513
 
509
514
  mode : typing.Optional[CreateSummaryRequestMode]
510
515
  Summary generation mode:
511
516
  - narrative: Substitute FHIR data into a template (requires template_id)
512
517
  - flatten: Flatten FHIR resources for RAG/search (no template needed)
518
+ - ips: Generate International Patient Summary (IPS) narrative per ISO 27269/HL7 FHIR IPS IG
513
519
 
514
520
  template_id : typing.Optional[str]
515
521
  ID of the template to use (required for narrative mode)
@@ -1078,19 +1084,25 @@ class AsyncRawSummaryClient:
1078
1084
  request_options: typing.Optional[RequestOptions] = None,
1079
1085
  ) -> AsyncHttpResponse[CreateSummaryResponse]:
1080
1086
  """
1081
- Creates a summary from FHIR resources using one of two modes:
1087
+ Creates a summary from FHIR resources using one of three modes:
1082
1088
  - **narrative**: Uses a template to substitute FHIR data into placeholders (requires template_id)
1083
1089
  - **flatten**: Flattens FHIR resources into a searchable format for RAG/search (no template needed)
1090
+ - **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.
1084
1091
 
1085
1092
  Parameters
1086
1093
  ----------
1087
1094
  fhir_resources : CreateSummaryRequestFhirResources
1088
- FHIR resources (single resource or Bundle)
1095
+ FHIR resources (single resource or Bundle).
1096
+ For IPS mode, must be a Bundle containing exactly one Patient resource with at least one
1097
+ identifier (id, fullUrl, or identifier field). Returns an error if no Patient is found,
1098
+ if multiple Patients are present, or if the Patient has no identifiers. Resources are
1099
+ automatically filtered to only include those referencing the patient.
1089
1100
 
1090
1101
  mode : typing.Optional[CreateSummaryRequestMode]
1091
1102
  Summary generation mode:
1092
1103
  - narrative: Substitute FHIR data into a template (requires template_id)
1093
1104
  - flatten: Flatten FHIR resources for RAG/search (no template needed)
1105
+ - ips: Generate International Patient Summary (IPS) narrative per ISO 27269/HL7 FHIR IPS IG
1094
1106
 
1095
1107
  template_id : typing.Optional[str]
1096
1108
  ID of the template to use (required for narrative mode)
@@ -6,6 +6,7 @@ from .create_summary_request_fhir_resources import CreateSummaryRequestFhirResou
6
6
  from .create_summary_request_mode import CreateSummaryRequestMode
7
7
  from .create_summary_response import CreateSummaryResponse
8
8
  from .create_summary_template_response import CreateSummaryTemplateResponse
9
+ from .error_response import ErrorResponse
9
10
  from .fhir_bundle import FhirBundle
10
11
  from .fhir_bundle_entry_item import FhirBundleEntryItem
11
12
  from .fhir_resource import FhirResource
@@ -20,6 +21,7 @@ __all__ = [
20
21
  "CreateSummaryRequestMode",
21
22
  "CreateSummaryResponse",
22
23
  "CreateSummaryTemplateResponse",
24
+ "ErrorResponse",
23
25
  "FhirBundle",
24
26
  "FhirBundleEntryItem",
25
27
  "FhirResource",
@@ -2,4 +2,4 @@
2
2
 
3
3
  import typing
4
4
 
5
- CreateSummaryRequestMode = typing.Union[typing.Literal["narrative", "flatten"], typing.Any]
5
+ CreateSummaryRequestMode = typing.Union[typing.Literal["narrative", "flatten", "ips"], typing.Any]
@@ -0,0 +1,23 @@
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 ErrorResponse(UniversalBaseModel):
10
+ success: typing.Optional[bool] = None
11
+ error: typing.Optional[str] = pydantic.Field(default=None)
12
+ """
13
+ Error message describing what went wrong
14
+ """
15
+
16
+ if IS_PYDANTIC_V2:
17
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
18
+ else:
19
+
20
+ class Config:
21
+ frozen = True
22
+ smart_union = True
23
+ extra = pydantic.Extra.allow
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phenoml
3
- Version: 0.0.15
3
+ Version: 0.0.16
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -78,7 +78,7 @@ phenoml/construe/types/extracted_code_result.py,sha256=LmhaQYFeLXBWR_NWcF1c-qt3O
78
78
  phenoml/construe/types/upload_request_format.py,sha256=5mJhMM7R7hn6gGQNDJT9lxPDsRpUkRzqNxtRU0Nnlls,158
79
79
  phenoml/core/__init__.py,sha256=lTcqUPXcx4112yLDd70RAPeqq6tu3eFMe1pKOqkW9JQ,1562
80
80
  phenoml/core/api_error.py,sha256=44vPoTyWN59gonCIZMdzw7M1uspygiLnr3GNFOoVL2Q,614
81
- phenoml/core/client_wrapper.py,sha256=dUvEaVp_cJQ44-ojf3hyXvp6cMSs0DVF7mtfgXT-Fbs,2642
81
+ phenoml/core/client_wrapper.py,sha256=jUWGtvhTYtnP_U6RqZrJmxAQWdCH8x-eMwO-XW6PzrI,2645
82
82
  phenoml/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
83
83
  phenoml/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
84
84
  phenoml/core/force_multipart.py,sha256=awxh5MtcRYe74ehY8U76jzv6fYM_w_D3Rur7KQQzSDk,429
@@ -137,7 +137,7 @@ phenoml/fhir_provider/types/role.py,sha256=Igag80s-KaGOc4nWfrGWyT81HU__c6_WJ-1oV
137
137
  phenoml/fhir_provider/types/service_account_key.py,sha256=uup1Xl0HSc_B3278i0CS-ygCroShLS5_q0KtqXI96HY,1085
138
138
  phenoml/fhir_provider/types/smart_configuration.py,sha256=bG_J1yNFEWWo9kjxF0s2Ik9rXehB1JHcQ2fTn6dht6k,1174
139
139
  phenoml/lang2fhir/__init__.py,sha256=R8VOE03BLTk90GJVBfpiUXHeODUNX3rZLkRIC21s1ow,694
140
- phenoml/lang2fhir/client.py,sha256=4OA_WMG1TYI-PVdp_mKgFOV85loY9Mu1p2e9q1L8T0o,12708
140
+ phenoml/lang2fhir/client.py,sha256=HxOpDPSihtgHJq3ayaKsGPUl48wA-FG89-268MYb_sU,12810
141
141
  phenoml/lang2fhir/errors/__init__.py,sha256=nIzg981R3USgSar0WuuVrpDVg-H5vIp2AceEzbhphGw,458
142
142
  phenoml/lang2fhir/errors/bad_request_error.py,sha256=nv0bK4gtOnTon6a2NdVxJxHBje_O_7wIoRtXLZHovUQ,339
143
143
  phenoml/lang2fhir/errors/failed_dependency_error.py,sha256=eXiqG062inkUF7fs2Newhx9uAKReK6fosz29PMD4gVw,345
@@ -153,20 +153,21 @@ phenoml/lang2fhir/types/fhir_resource.py,sha256=EprHErQgwP_MkaCrul94OhkOWQcbvUjM
153
153
  phenoml/lang2fhir/types/lang2fhir_upload_profile_response.py,sha256=X41WiVztePQtZOcNRzNsder-h3rQTj94Y622HQ1izP8,721
154
154
  phenoml/lang2fhir/types/search_response.py,sha256=xM3jNTIl7XuxzCfvaYCzXiBryGXT4siH9UVCpbo0UgI,1019
155
155
  phenoml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
156
- phenoml/summary/__init__.py,sha256=0CioBmGauOx0MxDnrqvq3xVwi1XqmCKtwe2XEDmGYfs,1066
157
- phenoml/summary/client.py,sha256=2Q8SkqSHUgNl659voCUPT6UasbX27IxkaHq8vU0fiRA,18744
156
+ phenoml/summary/__init__.py,sha256=cjy6_yHLxfmek9E-rYGwYhqtBfnrv_URysL3PiSz4tI,1106
157
+ phenoml/summary/client.py,sha256=yxpMWDf055lZ2pCB1ZcuMdo0_j6koDpQd1Dt7R8ISKQ,20518
158
158
  phenoml/summary/errors/__init__.py,sha256=Wnvf4XPELmAIZ-jVxx2t-dBNZ-X9PcDxPSL5EHqJr1Q,434
159
159
  phenoml/summary/errors/bad_request_error.py,sha256=nv0bK4gtOnTon6a2NdVxJxHBje_O_7wIoRtXLZHovUQ,339
160
160
  phenoml/summary/errors/forbidden_error.py,sha256=ek8-sffTy9gY3F0zyaSkcskDVvq9puXP_YvvB2BJYbA,338
161
161
  phenoml/summary/errors/internal_server_error.py,sha256=biBHJfSP1_zWF5CJgxY4B8wrL1uC18RSccQ-BCKmYNs,343
162
162
  phenoml/summary/errors/not_found_error.py,sha256=hQ1KdyGQJCBQqo6iLu2-szlKJdzaoV5odq_7kdXAEbc,337
163
163
  phenoml/summary/errors/unauthorized_error.py,sha256=h8T6QhXuTo0GLL9MKfIM5p--wDqlB1-ZkMp3lY-aM3E,341
164
- phenoml/summary/raw_client.py,sha256=ar7TGzWoGM0XE0d5pZQFdu67NJ-PwQp0Bx0rOEvrbLg,47420
165
- phenoml/summary/types/__init__.py,sha256=Cef3yEm0KM3HM0lnBut2uTLNgAhX1yocxrwA1ubNCdI,1231
164
+ phenoml/summary/raw_client.py,sha256=Vp-Cn08kW16EXnWAEIgakFenonMiJjJdncPrj7vj76g,49194
165
+ phenoml/summary/types/__init__.py,sha256=14PisICOPkDVnkZpsrJzfFbBCMrzz5-UicdENYdzNzM,1294
166
166
  phenoml/summary/types/create_summary_request_fhir_resources.py,sha256=afdDyX3UPCFrEjynP8XL_w9ulDbgojw8nAFVgZAolvE,232
167
- phenoml/summary/types/create_summary_request_mode.py,sha256=YvRzzEGxaewryCyqGvJvpoOInjuB5GU1_1Mv3f2UODg,172
167
+ phenoml/summary/types/create_summary_request_mode.py,sha256=YWlfzJNag8F_oRmqqkjft1zWKearhdFAUQ_eMOBbvcQ,179
168
168
  phenoml/summary/types/create_summary_response.py,sha256=8I4AVApJSZCzjIKvZUCIIQ5jBhO2IQBZqVV1VXKzavU,862
169
169
  phenoml/summary/types/create_summary_template_response.py,sha256=mOujukt5jMKpTYTovvUagDjdvRIO3LJB2P0lCBzr5yc,751
170
+ phenoml/summary/types/error_response.py,sha256=QeNNq7Cmak04WEhrrLBQbzKIkT8vZYPktmgbxwmVQjA,673
170
171
  phenoml/summary/types/fhir_bundle.py,sha256=ZP4LkXXUs18FQJyCvL1cSdQTas0mKWIYao815eM7qoU,798
171
172
  phenoml/summary/types/fhir_bundle_entry_item.py,sha256=nhXcR4Rb68PFL0-l4oMH6kCKaAgTC3k4BXD984ly4gU,604
172
173
  phenoml/summary/types/fhir_resource.py,sha256=GUtFqdTEyGJCGA2AOlZPLrwK3JA1dix20TtqBAvqjuU,726
@@ -236,7 +237,7 @@ phenoml/workflows/types/workflows_delete_response.py,sha256=izcubUOnSNOgThD9Ozo6
236
237
  phenoml/workflows/types/workflows_get_response.py,sha256=gfNyUs14JSynprRwT-fuq4IDsGrPZmUSsK3WmgqIEi8,891
237
238
  phenoml/workflows/types/workflows_update_response.py,sha256=FEvQpC9ZRk8dV1oaIAwV5bSDD2tkXZ5fG4mozRjibuQ,1046
238
239
  phenoml/wrapper_client.py,sha256=JYTdhXgju4tOsata06wQY_ZbMsuMj3qaxkgvDzpY068,5022
239
- phenoml-0.0.15.dist-info/LICENSE,sha256=Am1fNNveR2gcmOloSWQTsnUw2SQEF8HtowFqIvlagfk,1064
240
- phenoml-0.0.15.dist-info/METADATA,sha256=Om41pvkGYb9ySXaa5Frq--pCr9bTXjb9KUrcTBsJvDk,5331
241
- phenoml-0.0.15.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
242
- phenoml-0.0.15.dist-info/RECORD,,
240
+ phenoml-0.0.16.dist-info/LICENSE,sha256=Am1fNNveR2gcmOloSWQTsnUw2SQEF8HtowFqIvlagfk,1064
241
+ phenoml-0.0.16.dist-info/METADATA,sha256=OThqy03xut7-0sX_5DNEriUHduGA1vfP4LixDBtIH0w,5331
242
+ phenoml-0.0.16.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
243
+ phenoml-0.0.16.dist-info/RECORD,,