phenoml 2.0.0__py3-none-any.whl → 2.1.0__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.
@@ -3,6 +3,7 @@
3
3
  # isort: skip_file
4
4
 
5
5
  from .types import (
6
+ Citation,
6
7
  CodeResponse,
7
8
  CodeSystemDetails,
8
9
  CodeSystemInfo,
@@ -35,6 +36,7 @@ from .errors import (
35
36
 
36
37
  __all__ = [
37
38
  "BadRequestError",
39
+ "Citation",
38
40
  "CodeResponse",
39
41
  "CodeSystemDetails",
40
42
  "CodeSystemInfo",
@@ -49,7 +49,7 @@ class ConstrueClient:
49
49
  request_options: typing.Optional[RequestOptions] = None,
50
50
  ) -> ConstrueUploadCodeSystemResponse:
51
51
  """
52
- Upload a custom medical code system with codes and descriptions for use in code extraction.
52
+ Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
53
53
  Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
54
54
  subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
55
55
 
@@ -123,7 +123,9 @@ class ConstrueClient:
123
123
  request_options: typing.Optional[RequestOptions] = None,
124
124
  ) -> ExtractCodesResult:
125
125
  """
126
- Converts natural language text into structured medical codes
126
+ Converts natural language text into structured medical codes.
127
+
128
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
127
129
 
128
130
  Parameters
129
131
  ----------
@@ -162,7 +164,7 @@ class ConstrueClient:
162
164
  self, *, request_options: typing.Optional[RequestOptions] = None
163
165
  ) -> ListCodeSystemsResponse:
164
166
  """
165
- Returns metadata about all available code systems including built-in and custom systems.
167
+ Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
166
168
 
167
169
  Parameters
168
170
  ----------
@@ -196,7 +198,9 @@ class ConstrueClient:
196
198
  request_options: typing.Optional[RequestOptions] = None,
197
199
  ) -> ListCodesResponse:
198
200
  """
199
- Returns a paginated list of all codes in the specified code system.
201
+ Returns a paginated list of all codes in the specified code system from the terminology server.
202
+
203
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
200
204
 
201
205
  Parameters
202
206
  ----------
@@ -248,7 +252,9 @@ class ConstrueClient:
248
252
  request_options: typing.Optional[RequestOptions] = None,
249
253
  ) -> GetCodeResponse:
250
254
  """
251
- Returns details for a specific code within a code system.
255
+ Looks up a specific code in the terminology server and returns its details.
256
+
257
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
252
258
 
253
259
  Parameters
254
260
  ----------
@@ -313,6 +319,8 @@ class ConstrueClient:
313
319
 
314
320
  See also: `/search/text` for faster keyword-based lookup with typo tolerance.
315
321
 
322
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
323
+
316
324
  Parameters
317
325
  ----------
318
326
  codesystem : str
@@ -354,7 +362,7 @@ class ConstrueClient:
354
362
  )
355
363
  return _response.data
356
364
 
357
- def text_search_keyword_based(
365
+ def terminology_server_text_search(
358
366
  self,
359
367
  codesystem: str,
360
368
  *,
@@ -383,6 +391,8 @@ class ConstrueClient:
383
391
 
384
392
  See also: `/search/semantic` for finding conceptually similar codes.
385
393
 
394
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
395
+
386
396
  Parameters
387
397
  ----------
388
398
  codesystem : str
@@ -412,14 +422,14 @@ class ConstrueClient:
412
422
  client = phenoml(
413
423
  token="YOUR_TOKEN",
414
424
  )
415
- client.construe.text_search_keyword_based(
425
+ client.construe.terminology_server_text_search(
416
426
  codesystem="ICD-10-CM",
417
427
  q="E11.65",
418
428
  version="version",
419
429
  limit=1,
420
430
  )
421
431
  """
422
- _response = self._raw_client.text_search_keyword_based(
432
+ _response = self._raw_client.terminology_server_text_search(
423
433
  codesystem, q=q, version=version, limit=limit, request_options=request_options
424
434
  )
425
435
  return _response.data
@@ -454,7 +464,7 @@ class AsyncConstrueClient:
454
464
  request_options: typing.Optional[RequestOptions] = None,
455
465
  ) -> ConstrueUploadCodeSystemResponse:
456
466
  """
457
- Upload a custom medical code system with codes and descriptions for use in code extraction.
467
+ Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
458
468
  Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
459
469
  subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
460
470
 
@@ -536,7 +546,9 @@ class AsyncConstrueClient:
536
546
  request_options: typing.Optional[RequestOptions] = None,
537
547
  ) -> ExtractCodesResult:
538
548
  """
539
- Converts natural language text into structured medical codes
549
+ Converts natural language text into structured medical codes.
550
+
551
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
540
552
 
541
553
  Parameters
542
554
  ----------
@@ -583,7 +595,7 @@ class AsyncConstrueClient:
583
595
  self, *, request_options: typing.Optional[RequestOptions] = None
584
596
  ) -> ListCodeSystemsResponse:
585
597
  """
586
- Returns metadata about all available code systems including built-in and custom systems.
598
+ Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
587
599
 
588
600
  Parameters
589
601
  ----------
@@ -625,7 +637,9 @@ class AsyncConstrueClient:
625
637
  request_options: typing.Optional[RequestOptions] = None,
626
638
  ) -> ListCodesResponse:
627
639
  """
628
- Returns a paginated list of all codes in the specified code system.
640
+ Returns a paginated list of all codes in the specified code system from the terminology server.
641
+
642
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
629
643
 
630
644
  Parameters
631
645
  ----------
@@ -685,7 +699,9 @@ class AsyncConstrueClient:
685
699
  request_options: typing.Optional[RequestOptions] = None,
686
700
  ) -> GetCodeResponse:
687
701
  """
688
- Returns details for a specific code within a code system.
702
+ Looks up a specific code in the terminology server and returns its details.
703
+
704
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
689
705
 
690
706
  Parameters
691
707
  ----------
@@ -758,6 +774,8 @@ class AsyncConstrueClient:
758
774
 
759
775
  See also: `/search/text` for faster keyword-based lookup with typo tolerance.
760
776
 
777
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
778
+
761
779
  Parameters
762
780
  ----------
763
781
  codesystem : str
@@ -807,7 +825,7 @@ class AsyncConstrueClient:
807
825
  )
808
826
  return _response.data
809
827
 
810
- async def text_search_keyword_based(
828
+ async def terminology_server_text_search(
811
829
  self,
812
830
  codesystem: str,
813
831
  *,
@@ -836,6 +854,8 @@ class AsyncConstrueClient:
836
854
 
837
855
  See also: `/search/semantic` for finding conceptually similar codes.
838
856
 
857
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
858
+
839
859
  Parameters
840
860
  ----------
841
861
  codesystem : str
@@ -870,7 +890,7 @@ class AsyncConstrueClient:
870
890
 
871
891
 
872
892
  async def main() -> None:
873
- await client.construe.text_search_keyword_based(
893
+ await client.construe.terminology_server_text_search(
874
894
  codesystem="ICD-10-CM",
875
895
  q="E11.65",
876
896
  version="version",
@@ -880,7 +900,7 @@ class AsyncConstrueClient:
880
900
 
881
901
  asyncio.run(main())
882
902
  """
883
- _response = await self._raw_client.text_search_keyword_based(
903
+ _response = await self._raw_client.terminology_server_text_search(
884
904
  codesystem, q=q, version=version, limit=limit, request_options=request_options
885
905
  )
886
906
  return _response.data
@@ -51,7 +51,7 @@ class RawConstrueClient:
51
51
  request_options: typing.Optional[RequestOptions] = None,
52
52
  ) -> HttpResponse[ConstrueUploadCodeSystemResponse]:
53
53
  """
54
- Upload a custom medical code system with codes and descriptions for use in code extraction.
54
+ Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
55
55
  Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
56
56
  subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
57
57
 
@@ -187,7 +187,9 @@ class RawConstrueClient:
187
187
  request_options: typing.Optional[RequestOptions] = None,
188
188
  ) -> HttpResponse[ExtractCodesResult]:
189
189
  """
190
- Converts natural language text into structured medical codes
190
+ Converts natural language text into structured medical codes.
191
+
192
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
191
193
 
192
194
  Parameters
193
195
  ----------
@@ -287,7 +289,7 @@ class RawConstrueClient:
287
289
  self, *, request_options: typing.Optional[RequestOptions] = None
288
290
  ) -> HttpResponse[ListCodeSystemsResponse]:
289
291
  """
290
- Returns metadata about all available code systems including built-in and custom systems.
292
+ Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
291
293
 
292
294
  Parameters
293
295
  ----------
@@ -351,7 +353,9 @@ class RawConstrueClient:
351
353
  request_options: typing.Optional[RequestOptions] = None,
352
354
  ) -> HttpResponse[ListCodesResponse]:
353
355
  """
354
- Returns a paginated list of all codes in the specified code system.
356
+ Returns a paginated list of all codes in the specified code system from the terminology server.
357
+
358
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
355
359
 
356
360
  Parameters
357
361
  ----------
@@ -453,7 +457,9 @@ class RawConstrueClient:
453
457
  request_options: typing.Optional[RequestOptions] = None,
454
458
  ) -> HttpResponse[GetCodeResponse]:
455
459
  """
456
- Returns details for a specific code within a code system.
460
+ Looks up a specific code in the terminology server and returns its details.
461
+
462
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
457
463
 
458
464
  Parameters
459
465
  ----------
@@ -567,6 +573,8 @@ class RawConstrueClient:
567
573
 
568
574
  See also: `/search/text` for faster keyword-based lookup with typo tolerance.
569
575
 
576
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
577
+
570
578
  Parameters
571
579
  ----------
572
580
  codesystem : str
@@ -658,7 +666,7 @@ class RawConstrueClient:
658
666
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
659
667
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
660
668
 
661
- def text_search_keyword_based(
669
+ def terminology_server_text_search(
662
670
  self,
663
671
  codesystem: str,
664
672
  *,
@@ -687,6 +695,8 @@ class RawConstrueClient:
687
695
 
688
696
  See also: `/search/semantic` for finding conceptually similar codes.
689
697
 
698
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
699
+
690
700
  Parameters
691
701
  ----------
692
702
  codesystem : str
@@ -819,7 +829,7 @@ class AsyncRawConstrueClient:
819
829
  request_options: typing.Optional[RequestOptions] = None,
820
830
  ) -> AsyncHttpResponse[ConstrueUploadCodeSystemResponse]:
821
831
  """
822
- Upload a custom medical code system with codes and descriptions for use in code extraction.
832
+ Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
823
833
  Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
824
834
  subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
825
835
 
@@ -955,7 +965,9 @@ class AsyncRawConstrueClient:
955
965
  request_options: typing.Optional[RequestOptions] = None,
956
966
  ) -> AsyncHttpResponse[ExtractCodesResult]:
957
967
  """
958
- Converts natural language text into structured medical codes
968
+ Converts natural language text into structured medical codes.
969
+
970
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
959
971
 
960
972
  Parameters
961
973
  ----------
@@ -1055,7 +1067,7 @@ class AsyncRawConstrueClient:
1055
1067
  self, *, request_options: typing.Optional[RequestOptions] = None
1056
1068
  ) -> AsyncHttpResponse[ListCodeSystemsResponse]:
1057
1069
  """
1058
- Returns metadata about all available code systems including built-in and custom systems.
1070
+ Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
1059
1071
 
1060
1072
  Parameters
1061
1073
  ----------
@@ -1119,7 +1131,9 @@ class AsyncRawConstrueClient:
1119
1131
  request_options: typing.Optional[RequestOptions] = None,
1120
1132
  ) -> AsyncHttpResponse[ListCodesResponse]:
1121
1133
  """
1122
- Returns a paginated list of all codes in the specified code system.
1134
+ Returns a paginated list of all codes in the specified code system from the terminology server.
1135
+
1136
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
1123
1137
 
1124
1138
  Parameters
1125
1139
  ----------
@@ -1221,7 +1235,9 @@ class AsyncRawConstrueClient:
1221
1235
  request_options: typing.Optional[RequestOptions] = None,
1222
1236
  ) -> AsyncHttpResponse[GetCodeResponse]:
1223
1237
  """
1224
- Returns details for a specific code within a code system.
1238
+ Looks up a specific code in the terminology server and returns its details.
1239
+
1240
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
1225
1241
 
1226
1242
  Parameters
1227
1243
  ----------
@@ -1335,6 +1351,8 @@ class AsyncRawConstrueClient:
1335
1351
 
1336
1352
  See also: `/search/text` for faster keyword-based lookup with typo tolerance.
1337
1353
 
1354
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
1355
+
1338
1356
  Parameters
1339
1357
  ----------
1340
1358
  codesystem : str
@@ -1426,7 +1444,7 @@ class AsyncRawConstrueClient:
1426
1444
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1427
1445
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1428
1446
 
1429
- async def text_search_keyword_based(
1447
+ async def terminology_server_text_search(
1430
1448
  self,
1431
1449
  codesystem: str,
1432
1450
  *,
@@ -1455,6 +1473,8 @@ class AsyncRawConstrueClient:
1455
1473
 
1456
1474
  See also: `/search/semantic` for finding conceptually similar codes.
1457
1475
 
1476
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
1477
+
1458
1478
  Parameters
1459
1479
  ----------
1460
1480
  codesystem : str
@@ -2,6 +2,7 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
+ from .citation import Citation
5
6
  from .code_response import CodeResponse
6
7
  from .code_system_details import CodeSystemDetails
7
8
  from .code_system_info import CodeSystemInfo
@@ -22,6 +23,7 @@ from .text_search_result import TextSearchResult
22
23
  from .upload_request_format import UploadRequestFormat
23
24
 
24
25
  __all__ = [
26
+ "Citation",
25
27
  "CodeResponse",
26
28
  "CodeSystemDetails",
27
29
  "CodeSystemInfo",
@@ -0,0 +1,36 @@
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 Citation(UniversalBaseModel):
10
+ """
11
+ A reference to source text that led to a code extraction
12
+ """
13
+
14
+ text: str = pydantic.Field()
15
+ """
16
+ The exact text span containing evidence for the code
17
+ """
18
+
19
+ begin_offset: int = pydantic.Field()
20
+ """
21
+ Starting byte offset in the original input text (0-indexed)
22
+ """
23
+
24
+ end_offset: int = pydantic.Field()
25
+ """
26
+ Ending byte offset (exclusive), such that input[begin_offset:end_offset] == text
27
+ """
28
+
29
+ if IS_PYDANTIC_V2:
30
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
31
+ else:
32
+
33
+ class Config:
34
+ frozen = True
35
+ smart_union = True
36
+ extra = pydantic.Extra.allow
@@ -50,6 +50,15 @@ class ExtractRequestConfig(UniversalBaseModel):
50
50
  Whether to include codes that failed validation in the results
51
51
  """
52
52
 
53
+ include_citations: typing.Optional[bool] = pydantic.Field(default=None)
54
+ """
55
+ Whether to include source text citations for each extracted code.
56
+ Citations show the exact text spans (with character offsets) that led to each code.
57
+ Only available when using chunking_method: "sentences".
58
+ The "none" method returns full text as one chunk (not useful for citations).
59
+ LLM-based chunking (paragraphs, topics) does not support citations.
60
+ """
61
+
53
62
  if IS_PYDANTIC_V2:
54
63
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
55
64
  else:
@@ -21,7 +21,9 @@ class ExtractRequestSystem(UniversalBaseModel):
21
21
  * CPT - version 2025
22
22
 
23
23
  Custom systems:
24
- * Any valid system name configured in your environment. Must have self-hosted construe module.
24
+ * Any valid system name uploaded via /construe/upload. Requires a paid plan.
25
+
26
+ Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
25
27
  """
26
28
 
27
29
  version: typing.Optional[str] = pydantic.Field(default=None)
@@ -6,6 +6,7 @@ import pydantic
6
6
  import typing_extensions
7
7
  from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
8
  from ...core.serialization import FieldMetadata
9
+ from .citation import Citation
9
10
 
10
11
 
11
12
  class ExtractedCodeResult(UniversalBaseModel):
@@ -36,6 +37,19 @@ class ExtractedCodeResult(UniversalBaseModel):
36
37
  Explanation for why this code was extracted (if include_rationale is true)
37
38
  """
38
39
 
40
+ is_ancestor: typing.Optional[bool] = pydantic.Field(default=None)
41
+ """
42
+ Whether this code is an ancestor (parent) of an extracted code rather than directly extracted.
43
+ Only present when include_ancestors is true.
44
+ """
45
+
46
+ citations: typing.Optional[typing.List[Citation]] = pydantic.Field(default=None)
47
+ """
48
+ Source text references showing where this code was found in the input.
49
+ Only present when include_citations is true and chunking method supports it.
50
+ Ancestor codes do not receive citations.
51
+ """
52
+
39
53
  if IS_PYDANTIC_V2:
40
54
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
41
55
  else:
@@ -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/2.0.0",
25
+ "User-Agent": "phenoml/2.1.0",
26
26
  "X-Fern-Language": "Python",
27
27
  "X-Fern-SDK-Name": "phenoml",
28
- "X-Fern-SDK-Version": "2.0.0",
28
+ "X-Fern-SDK-Version": "2.1.0",
29
29
  **(self.get_custom_headers() or {}),
30
30
  }
31
31
  headers["Authorization"] = f"Bearer {self._get_token()}"
phenoml/fhir/__init__.py CHANGED
@@ -15,9 +15,10 @@ from .types import (
15
15
  FhirResourceMeta,
16
16
  FhirSearchResponse,
17
17
  )
18
- from .errors import BadRequestError, InternalServerError, NotFoundError, UnauthorizedError
18
+ from .errors import BadGatewayError, BadRequestError, InternalServerError, NotFoundError, UnauthorizedError
19
19
 
20
20
  __all__ = [
21
+ "BadGatewayError",
21
22
  "BadRequestError",
22
23
  "ErrorResponse",
23
24
  "FhirBundle",
@@ -2,9 +2,10 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
+ from .bad_gateway_error import BadGatewayError
5
6
  from .bad_request_error import BadRequestError
6
7
  from .internal_server_error import InternalServerError
7
8
  from .not_found_error import NotFoundError
8
9
  from .unauthorized_error import UnauthorizedError
9
10
 
10
- __all__ = ["BadRequestError", "InternalServerError", "NotFoundError", "UnauthorizedError"]
11
+ __all__ = ["BadGatewayError", "BadRequestError", "InternalServerError", "NotFoundError", "UnauthorizedError"]
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.api_error import ApiError
6
+ from ..types.error_response import ErrorResponse
7
+
8
+
9
+ class BadGatewayError(ApiError):
10
+ def __init__(self, body: ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
+ super().__init__(status_code=502, headers=headers, body=body)
@@ -10,10 +10,12 @@ from ..core.jsonable_encoder import jsonable_encoder
10
10
  from ..core.pydantic_utilities import parse_obj_as
11
11
  from ..core.request_options import RequestOptions
12
12
  from ..core.serialization import convert_and_respect_annotation_metadata
13
+ from .errors.bad_gateway_error import BadGatewayError
13
14
  from .errors.bad_request_error import BadRequestError
14
15
  from .errors.internal_server_error import InternalServerError
15
16
  from .errors.not_found_error import NotFoundError
16
17
  from .errors.unauthorized_error import UnauthorizedError
18
+ from .types.error_response import ErrorResponse
17
19
  from .types.fhir_bundle import FhirBundle
18
20
  from .types.fhir_bundle_entry_item import FhirBundleEntryItem
19
21
  from .types.fhir_patch_request_body_item import FhirPatchRequestBodyItem
@@ -147,6 +149,17 @@ class RawFhirClient:
147
149
  ),
148
150
  ),
149
151
  )
152
+ if _response.status_code == 502:
153
+ raise BadGatewayError(
154
+ headers=dict(_response.headers),
155
+ body=typing.cast(
156
+ ErrorResponse,
157
+ parse_obj_as(
158
+ type_=ErrorResponse, # type: ignore
159
+ object_=_response.json(),
160
+ ),
161
+ ),
162
+ )
150
163
  _response_json = _response.json()
151
164
  except JSONDecodeError:
152
165
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -269,6 +282,17 @@ class RawFhirClient:
269
282
  ),
270
283
  ),
271
284
  )
285
+ if _response.status_code == 502:
286
+ raise BadGatewayError(
287
+ headers=dict(_response.headers),
288
+ body=typing.cast(
289
+ ErrorResponse,
290
+ parse_obj_as(
291
+ type_=ErrorResponse, # type: ignore
292
+ object_=_response.json(),
293
+ ),
294
+ ),
295
+ )
272
296
  _response_json = _response.json()
273
297
  except JSONDecodeError:
274
298
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -391,6 +415,17 @@ class RawFhirClient:
391
415
  ),
392
416
  ),
393
417
  )
418
+ if _response.status_code == 502:
419
+ raise BadGatewayError(
420
+ headers=dict(_response.headers),
421
+ body=typing.cast(
422
+ ErrorResponse,
423
+ parse_obj_as(
424
+ type_=ErrorResponse, # type: ignore
425
+ object_=_response.json(),
426
+ ),
427
+ ),
428
+ )
394
429
  _response_json = _response.json()
395
430
  except JSONDecodeError:
396
431
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -503,6 +538,17 @@ class RawFhirClient:
503
538
  ),
504
539
  ),
505
540
  )
541
+ if _response.status_code == 502:
542
+ raise BadGatewayError(
543
+ headers=dict(_response.headers),
544
+ body=typing.cast(
545
+ ErrorResponse,
546
+ parse_obj_as(
547
+ type_=ErrorResponse, # type: ignore
548
+ object_=_response.json(),
549
+ ),
550
+ ),
551
+ )
506
552
  _response_json = _response.json()
507
553
  except JSONDecodeError:
508
554
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -628,6 +674,17 @@ class RawFhirClient:
628
674
  ),
629
675
  ),
630
676
  )
677
+ if _response.status_code == 502:
678
+ raise BadGatewayError(
679
+ headers=dict(_response.headers),
680
+ body=typing.cast(
681
+ ErrorResponse,
682
+ parse_obj_as(
683
+ type_=ErrorResponse, # type: ignore
684
+ object_=_response.json(),
685
+ ),
686
+ ),
687
+ )
631
688
  _response_json = _response.json()
632
689
  except JSONDecodeError:
633
690
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -741,6 +798,17 @@ class RawFhirClient:
741
798
  ),
742
799
  ),
743
800
  )
801
+ if _response.status_code == 502:
802
+ raise BadGatewayError(
803
+ headers=dict(_response.headers),
804
+ body=typing.cast(
805
+ ErrorResponse,
806
+ parse_obj_as(
807
+ type_=ErrorResponse, # type: ignore
808
+ object_=_response.json(),
809
+ ),
810
+ ),
811
+ )
744
812
  _response_json = _response.json()
745
813
  except JSONDecodeError:
746
814
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -869,6 +937,17 @@ class AsyncRawFhirClient:
869
937
  ),
870
938
  ),
871
939
  )
940
+ if _response.status_code == 502:
941
+ raise BadGatewayError(
942
+ headers=dict(_response.headers),
943
+ body=typing.cast(
944
+ ErrorResponse,
945
+ parse_obj_as(
946
+ type_=ErrorResponse, # type: ignore
947
+ object_=_response.json(),
948
+ ),
949
+ ),
950
+ )
872
951
  _response_json = _response.json()
873
952
  except JSONDecodeError:
874
953
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -991,6 +1070,17 @@ class AsyncRawFhirClient:
991
1070
  ),
992
1071
  ),
993
1072
  )
1073
+ if _response.status_code == 502:
1074
+ raise BadGatewayError(
1075
+ headers=dict(_response.headers),
1076
+ body=typing.cast(
1077
+ ErrorResponse,
1078
+ parse_obj_as(
1079
+ type_=ErrorResponse, # type: ignore
1080
+ object_=_response.json(),
1081
+ ),
1082
+ ),
1083
+ )
994
1084
  _response_json = _response.json()
995
1085
  except JSONDecodeError:
996
1086
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -1113,6 +1203,17 @@ class AsyncRawFhirClient:
1113
1203
  ),
1114
1204
  ),
1115
1205
  )
1206
+ if _response.status_code == 502:
1207
+ raise BadGatewayError(
1208
+ headers=dict(_response.headers),
1209
+ body=typing.cast(
1210
+ ErrorResponse,
1211
+ parse_obj_as(
1212
+ type_=ErrorResponse, # type: ignore
1213
+ object_=_response.json(),
1214
+ ),
1215
+ ),
1216
+ )
1116
1217
  _response_json = _response.json()
1117
1218
  except JSONDecodeError:
1118
1219
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -1225,6 +1326,17 @@ class AsyncRawFhirClient:
1225
1326
  ),
1226
1327
  ),
1227
1328
  )
1329
+ if _response.status_code == 502:
1330
+ raise BadGatewayError(
1331
+ headers=dict(_response.headers),
1332
+ body=typing.cast(
1333
+ ErrorResponse,
1334
+ parse_obj_as(
1335
+ type_=ErrorResponse, # type: ignore
1336
+ object_=_response.json(),
1337
+ ),
1338
+ ),
1339
+ )
1228
1340
  _response_json = _response.json()
1229
1341
  except JSONDecodeError:
1230
1342
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -1350,6 +1462,17 @@ class AsyncRawFhirClient:
1350
1462
  ),
1351
1463
  ),
1352
1464
  )
1465
+ if _response.status_code == 502:
1466
+ raise BadGatewayError(
1467
+ headers=dict(_response.headers),
1468
+ body=typing.cast(
1469
+ ErrorResponse,
1470
+ parse_obj_as(
1471
+ type_=ErrorResponse, # type: ignore
1472
+ object_=_response.json(),
1473
+ ),
1474
+ ),
1475
+ )
1353
1476
  _response_json = _response.json()
1354
1477
  except JSONDecodeError:
1355
1478
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -1463,6 +1586,17 @@ class AsyncRawFhirClient:
1463
1586
  ),
1464
1587
  ),
1465
1588
  )
1589
+ if _response.status_code == 502:
1590
+ raise BadGatewayError(
1591
+ headers=dict(_response.headers),
1592
+ body=typing.cast(
1593
+ ErrorResponse,
1594
+ parse_obj_as(
1595
+ type_=ErrorResponse, # type: ignore
1596
+ object_=_response.json(),
1597
+ ),
1598
+ ),
1599
+ )
1466
1600
  _response_json = _response.json()
1467
1601
  except JSONDecodeError:
1468
1602
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phenoml
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -60,8 +60,8 @@ phenoml/cohort/raw_client.py,sha256=yhquYZ6fNyhAJG_-6YwQqLMOcIP_JvojryxOEXt_Qfc,
60
60
  phenoml/cohort/types/__init__.py,sha256=zNq1Pom_534srvUJxnEcFPoUK98Cr4oYzPxvL_ifBmc,218
61
61
  phenoml/cohort/types/cohort_response.py,sha256=A0ekTeNT6jh_yMRAcdnMoavcrqUGKZuy_6-k4YwoFmk,981
62
62
  phenoml/cohort/types/search_concept.py,sha256=yIGRoIp8ASZ0I0G-9UA6eTseoZPwHrUuvRRQMamf4yA,1041
63
- phenoml/construe/__init__.py,sha256=4RjZ8KtqX_siMN5gVigcXfP7UIpQe9Md5uO7wcoojNw,1535
64
- phenoml/construe/client.py,sha256=VD8fQ26X0fCeToP9bvWVPcbVgkEOL86xPCp7GzRIx_c,26795
63
+ phenoml/construe/__init__.py,sha256=KHCJ7TiA4JxJ55RZpC6JQwQc5o9R7rBlBPL2pYqYOY8,1565
64
+ phenoml/construe/client.py,sha256=xbWorgGPs6vk4e0tmI4zst0evbMnYXeT5pHziDLHqvA,27913
65
65
  phenoml/construe/errors/__init__.py,sha256=OW8bCfk31qWc4LNXH4Csi91w88lP8Vwjku3kN-X6dYk,718
66
66
  phenoml/construe/errors/bad_request_error.py,sha256=nv0bK4gtOnTon6a2NdVxJxHBje_O_7wIoRtXLZHovUQ,339
67
67
  phenoml/construe/errors/conflict_error.py,sha256=NyA4yoleBcQcrDK2rF79eVs62xclhih2kpEIBlAToow,337
@@ -71,18 +71,19 @@ phenoml/construe/errors/not_found_error.py,sha256=hQ1KdyGQJCBQqo6iLu2-szlKJdzaoV
71
71
  phenoml/construe/errors/not_implemented_error.py,sha256=xI30CT0KC5dz6BojqH9VXfa9syDvBp8ofKaWv_PxM0c,343
72
72
  phenoml/construe/errors/service_unavailable_error.py,sha256=eY72I1v4lGcCKg76JWWQhXcCIFV7ejpjEMOz4iaWJkE,347
73
73
  phenoml/construe/errors/unauthorized_error.py,sha256=h8T6QhXuTo0GLL9MKfIM5p--wDqlB1-ZkMp3lY-aM3E,341
74
- phenoml/construe/raw_client.py,sha256=liF12jN6_X7F4N1mvjo2ETJb3y3o6i9myOYQnV-3sZw,62166
75
- phenoml/construe/types/__init__.py,sha256=J2zYQRjytXyrpfRYwVgTji9Cqt5eDiVqKF1oe1Q4vmY,1672
74
+ phenoml/construe/raw_client.py,sha256=D_egRBiFICg5YSfrm9S5RdhZin8z516Wirk62sfGbBE,63264
75
+ phenoml/construe/types/__init__.py,sha256=OpjGeaS5BgVQhFvJs4c82KcB0_hjra_UShW5nFQalf8,1719
76
+ phenoml/construe/types/citation.py,sha256=8xuaHC9eRFaTIWCmS7eVGoFXIr1buNWzVkQboS8_wH8,949
76
77
  phenoml/construe/types/code_response.py,sha256=w9DNpGQLEwCtQjY_EyQ7ARF6FFcyY0PJn5PgrmzxbwI,806
77
78
  phenoml/construe/types/code_system_details.py,sha256=fq6SFEObhTDD4DSplavTKvcQed7AZI6IXdXL7VTCFN8,867
78
79
  phenoml/construe/types/code_system_info.py,sha256=M5bfzOJV11UDMtTVUzDBQ_OQwmCtSccGPTTRF8Betrk,655
79
80
  phenoml/construe/types/construe_upload_code_system_response.py,sha256=s0m5EHpkhkp7hYiC5zLZeIeqQ4mrwXlPI1Msihb-ZGo,566
80
81
  phenoml/construe/types/extract_codes_result.py,sha256=DbVDLWqtmt9TyD5MC0q8grgnNXPnXq4eJnLDinTe0uc,701
81
- phenoml/construe/types/extract_request_config.py,sha256=2A22PNA1Hxq9qz1x89LvbySF-Hw8iB6oA2QqoSIrvg8,2112
82
+ phenoml/construe/types/extract_request_config.py,sha256=HBozvJPQJqZq1wP5WeJZnLmyBTffdcUn667luv3oCA4,2576
82
83
  phenoml/construe/types/extract_request_config_chunking_method.py,sha256=AmVPPj0oT5r0pwWUoFxG_K8s5g8xaGYIRsPt3VvqSXQ,209
83
84
  phenoml/construe/types/extract_request_config_validation_method.py,sha256=6uUqKn8DXF34EDtNKPa6KLW07DsxgQF2aR5BGdG5Fd4,199
84
- phenoml/construe/types/extract_request_system.py,sha256=50qkxvinJKS5y1_glr-OFe5tQRyMWLYpeny1NZ9gFzw,1191
85
- phenoml/construe/types/extracted_code_result.py,sha256=3mIHO952KjbMRBY_YvwBt75XOjqdflg9Odc-xBbURac,1321
85
+ phenoml/construe/types/extract_request_system.py,sha256=dMLflz7FeNbXwMmoEn8jlypqnAfFr_oh2aasbdiQ-CA,1257
86
+ phenoml/construe/types/extracted_code_result.py,sha256=RsL8Er3m6D_FA885lsCowmDq0WTXoU_t1L4O6fyHqng,1890
86
87
  phenoml/construe/types/get_code_response.py,sha256=cDR4SI3AvfQnpOlblXOCLOizxPjFacKmBWyC789o5cw,881
87
88
  phenoml/construe/types/list_code_systems_response.py,sha256=XPHSKsg6sIYAyLgIlSJRtkj6KtfCslL01V21HubzyWo,612
88
89
  phenoml/construe/types/list_codes_response.py,sha256=f5ZOQ6nYUGYX2S1nc1qtScm-EcNUHWHxpJxq9BH7pFo,909
@@ -93,7 +94,7 @@ phenoml/construe/types/text_search_result.py,sha256=FqHzcSBId9Pcp68gB10aJJYsHpsy
93
94
  phenoml/construe/types/upload_request_format.py,sha256=5mJhMM7R7hn6gGQNDJT9lxPDsRpUkRzqNxtRU0Nnlls,158
94
95
  phenoml/core/__init__.py,sha256=lTcqUPXcx4112yLDd70RAPeqq6tu3eFMe1pKOqkW9JQ,1562
95
96
  phenoml/core/api_error.py,sha256=44vPoTyWN59gonCIZMdzw7M1uspygiLnr3GNFOoVL2Q,614
96
- phenoml/core/client_wrapper.py,sha256=vk504TvNeh8V3j9n2ce9EVq1Z0hLaM5upqStADgDk8A,2641
97
+ phenoml/core/client_wrapper.py,sha256=pT8QCb_CxBgzRdPY4RmXvEOsMeUjjObBDrzSEnboH04,2641
97
98
  phenoml/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
98
99
  phenoml/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
99
100
  phenoml/core/force_multipart.py,sha256=awxh5MtcRYe74ehY8U76jzv6fYM_w_D3Rur7KQQzSDk,429
@@ -106,14 +107,15 @@ phenoml/core/remove_none_from_dict.py,sha256=EU9SGgYidWq7SexuJbNs4-PZ-5Bl3Vppd86
106
107
  phenoml/core/request_options.py,sha256=h0QUNCFVdCW_7GclVySCAY2w4NhtXVBUCmHgmzaxpcg,1681
107
108
  phenoml/core/serialization.py,sha256=ECL3bvv_0i7U4uvPidZCNel--MUbA0iq0aGcNKi3kws,9818
108
109
  phenoml/environment.py,sha256=x2TB5u9AblwVCke6_38YZmVhcjjHLE5gXBo5TMeaeO8,164
109
- phenoml/fhir/__init__.py,sha256=CGOe2OSGyiryHY66fcRyZXsSMHiM5Y_GkTNPUqzwTP8,910
110
+ phenoml/fhir/__init__.py,sha256=zIsx4hoEBYLeZpXAleNc2zZYm48K9Cesxmu1lVB7aNo,950
110
111
  phenoml/fhir/client.py,sha256=1hQSCDOYsC89zPlPWHJIKgVBa-j8mRT_97lDHFJ3jN8,43581
111
- phenoml/fhir/errors/__init__.py,sha256=1K_bceYvXUdWyvhH-WRwOEcc1gkiT_K6kGrs3VKg3PA,372
112
+ phenoml/fhir/errors/__init__.py,sha256=9mougWJnia9nrNLt0kHJB7fMylhz6I9IhN4Su2XX6_E,438
113
+ phenoml/fhir/errors/bad_gateway_error.py,sha256=-NquqI4plYJj4z9xUwa3qvJsK5XdGMHrCL6zDxTvaaI,374
112
114
  phenoml/fhir/errors/bad_request_error.py,sha256=nv0bK4gtOnTon6a2NdVxJxHBje_O_7wIoRtXLZHovUQ,339
113
115
  phenoml/fhir/errors/internal_server_error.py,sha256=biBHJfSP1_zWF5CJgxY4B8wrL1uC18RSccQ-BCKmYNs,343
114
116
  phenoml/fhir/errors/not_found_error.py,sha256=hQ1KdyGQJCBQqo6iLu2-szlKJdzaoV5odq_7kdXAEbc,337
115
117
  phenoml/fhir/errors/unauthorized_error.py,sha256=h8T6QhXuTo0GLL9MKfIM5p--wDqlB1-ZkMp3lY-aM3E,341
116
- phenoml/fhir/raw_client.py,sha256=XZE1iWjujv5hSROSSo8kdG773l6T_vKV66iZYqcvNks,66380
118
+ phenoml/fhir/raw_client.py,sha256=K-eBndiyB78j4BfwK7hc-XKfNrKf8e-R4zoFRMUWbHQ,71750
117
119
  phenoml/fhir/types/__init__.py,sha256=J9Gj1h5TZ5mNjBYE-Vn2bVPR3VCRwRIf1BrS5DHQrV4,1054
118
120
  phenoml/fhir/types/error_response.py,sha256=Vw1veSbj51ki93gmYml3fRjB6XAEwvnkcYkSNhyLDeU,897
119
121
  phenoml/fhir/types/fhir_bundle.py,sha256=p_CsuL2U1q7Qzmkdu6vCBtNZLznWmHXw5WtMzDnstdE,1373
@@ -264,7 +266,7 @@ phenoml/workflows/types/workflows_delete_response.py,sha256=izcubUOnSNOgThD9Ozo6
264
266
  phenoml/workflows/types/workflows_get_response.py,sha256=gfNyUs14JSynprRwT-fuq4IDsGrPZmUSsK3WmgqIEi8,891
265
267
  phenoml/workflows/types/workflows_update_response.py,sha256=FEvQpC9ZRk8dV1oaIAwV5bSDD2tkXZ5fG4mozRjibuQ,1046
266
268
  phenoml/wrapper_client.py,sha256=JYTdhXgju4tOsata06wQY_ZbMsuMj3qaxkgvDzpY068,5022
267
- phenoml-2.0.0.dist-info/LICENSE,sha256=Am1fNNveR2gcmOloSWQTsnUw2SQEF8HtowFqIvlagfk,1064
268
- phenoml-2.0.0.dist-info/METADATA,sha256=p7eHNT7TrxLHOEWys5gTDVbqmvnVjHns-KNzRQYfvWM,5330
269
- phenoml-2.0.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
270
- phenoml-2.0.0.dist-info/RECORD,,
269
+ phenoml-2.1.0.dist-info/LICENSE,sha256=Am1fNNveR2gcmOloSWQTsnUw2SQEF8HtowFqIvlagfk,1064
270
+ phenoml-2.1.0.dist-info/METADATA,sha256=NyFbd9whY0E4436OXxs01mPEhbdyeowfsUA4uAjYufU,5330
271
+ phenoml-2.1.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
272
+ phenoml-2.1.0.dist-info/RECORD,,