phenoml 0.0.1__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.
Potentially problematic release.
This version of phenoml might be problematic. Click here for more details.
- phenoml/__init__.py +30 -0
- phenoml/agent/__init__.py +58 -0
- phenoml/agent/client.py +820 -0
- phenoml/agent/errors/__init__.py +11 -0
- phenoml/agent/errors/bad_request_error.py +10 -0
- phenoml/agent/errors/forbidden_error.py +10 -0
- phenoml/agent/errors/internal_server_error.py +10 -0
- phenoml/agent/errors/not_found_error.py +10 -0
- phenoml/agent/errors/unauthorized_error.py +10 -0
- phenoml/agent/prompts/__init__.py +7 -0
- phenoml/agent/prompts/client.py +707 -0
- phenoml/agent/prompts/raw_client.py +1345 -0
- phenoml/agent/prompts/types/__init__.py +8 -0
- phenoml/agent/prompts/types/prompts_delete_response.py +20 -0
- phenoml/agent/prompts/types/prompts_list_response.py +22 -0
- phenoml/agent/raw_client.py +1501 -0
- phenoml/agent/types/__init__.py +45 -0
- phenoml/agent/types/agent_chat_response.py +33 -0
- phenoml/agent/types/agent_create_request_provider.py +13 -0
- phenoml/agent/types/agent_create_request_provider_item.py +7 -0
- phenoml/agent/types/agent_delete_response.py +20 -0
- phenoml/agent/types/agent_fhir_config.py +31 -0
- phenoml/agent/types/agent_list_response.py +22 -0
- phenoml/agent/types/agent_prompts_response.py +22 -0
- phenoml/agent/types/agent_response.py +22 -0
- phenoml/agent/types/agent_template.py +56 -0
- phenoml/agent/types/agent_template_provider.py +13 -0
- phenoml/agent/types/agent_template_provider_item.py +5 -0
- phenoml/agent/types/agent_update_request_provider.py +13 -0
- phenoml/agent/types/agent_update_request_provider_item.py +7 -0
- phenoml/agent/types/chat_fhir_client_config.py +31 -0
- phenoml/agent/types/json_patch.py +7 -0
- phenoml/agent/types/json_patch_operation.py +36 -0
- phenoml/agent/types/json_patch_operation_op.py +5 -0
- phenoml/agent/types/prompt_template.py +52 -0
- phenoml/agent/types/success_response.py +20 -0
- phenoml/authtoken/__init__.py +17 -0
- phenoml/authtoken/auth/__init__.py +7 -0
- phenoml/authtoken/auth/client.py +129 -0
- phenoml/authtoken/auth/raw_client.py +173 -0
- phenoml/authtoken/auth/types/__init__.py +7 -0
- phenoml/authtoken/auth/types/auth_generate_token_response.py +22 -0
- phenoml/authtoken/client.py +39 -0
- phenoml/authtoken/errors/__init__.py +8 -0
- phenoml/authtoken/errors/bad_request_error.py +10 -0
- phenoml/authtoken/errors/unauthorized_error.py +10 -0
- phenoml/authtoken/raw_client.py +13 -0
- phenoml/authtoken/types/__init__.py +8 -0
- phenoml/authtoken/types/bad_request_error_body.py +21 -0
- phenoml/authtoken/types/unauthorized_error_body.py +21 -0
- phenoml/client.py +168 -0
- phenoml/cohort/__init__.py +8 -0
- phenoml/cohort/client.py +113 -0
- phenoml/cohort/errors/__init__.py +9 -0
- phenoml/cohort/errors/bad_request_error.py +10 -0
- phenoml/cohort/errors/internal_server_error.py +10 -0
- phenoml/cohort/errors/unauthorized_error.py +10 -0
- phenoml/cohort/raw_client.py +185 -0
- phenoml/cohort/types/__init__.py +8 -0
- phenoml/cohort/types/cohort_response.py +33 -0
- phenoml/cohort/types/search_concept.py +37 -0
- phenoml/construe/__init__.py +45 -0
- phenoml/construe/client.py +399 -0
- phenoml/construe/errors/__init__.py +11 -0
- phenoml/construe/errors/bad_request_error.py +10 -0
- phenoml/construe/errors/conflict_error.py +10 -0
- phenoml/construe/errors/failed_dependency_error.py +10 -0
- phenoml/construe/errors/internal_server_error.py +10 -0
- phenoml/construe/errors/unauthorized_error.py +10 -0
- phenoml/construe/raw_client.py +706 -0
- phenoml/construe/types/__init__.py +41 -0
- phenoml/construe/types/bad_request_error_body.py +27 -0
- phenoml/construe/types/construe_cohort_request_config.py +37 -0
- phenoml/construe/types/construe_cohort_response.py +33 -0
- phenoml/construe/types/construe_cohort_response_queries_item.py +49 -0
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item.py +31 -0
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py +32 -0
- phenoml/construe/types/construe_upload_code_system_response.py +19 -0
- phenoml/construe/types/extract_codes_result.py +22 -0
- phenoml/construe/types/extract_request_config.py +23 -0
- phenoml/construe/types/extract_request_config_chunking_method.py +5 -0
- phenoml/construe/types/extract_request_system.py +37 -0
- phenoml/construe/types/extracted_code_result.py +41 -0
- phenoml/construe/types/internal_server_error_body.py +27 -0
- phenoml/construe/types/unauthorized_error_body.py +27 -0
- phenoml/construe/types/upload_request_format.py +5 -0
- phenoml/core/__init__.py +52 -0
- phenoml/core/api_error.py +23 -0
- phenoml/core/client_wrapper.py +85 -0
- phenoml/core/datetime_utils.py +28 -0
- phenoml/core/file.py +67 -0
- phenoml/core/force_multipart.py +16 -0
- phenoml/core/http_client.py +543 -0
- phenoml/core/http_response.py +55 -0
- phenoml/core/jsonable_encoder.py +100 -0
- phenoml/core/pydantic_utilities.py +255 -0
- phenoml/core/query_encoder.py +58 -0
- phenoml/core/remove_none_from_dict.py +11 -0
- phenoml/core/request_options.py +35 -0
- phenoml/core/serialization.py +276 -0
- phenoml/environment.py +7 -0
- phenoml/lang2fhir/__init__.py +27 -0
- phenoml/lang2fhir/client.py +430 -0
- phenoml/lang2fhir/errors/__init__.py +11 -0
- phenoml/lang2fhir/errors/bad_request_error.py +10 -0
- phenoml/lang2fhir/errors/failed_dependency_error.py +10 -0
- phenoml/lang2fhir/errors/forbidden_error.py +10 -0
- phenoml/lang2fhir/errors/internal_server_error.py +10 -0
- phenoml/lang2fhir/errors/unauthorized_error.py +10 -0
- phenoml/lang2fhir/raw_client.py +788 -0
- phenoml/lang2fhir/types/__init__.py +19 -0
- phenoml/lang2fhir/types/create_request_resource.py +25 -0
- phenoml/lang2fhir/types/document_request_file_type.py +7 -0
- phenoml/lang2fhir/types/document_request_resource.py +5 -0
- phenoml/lang2fhir/types/fhir_resource.py +5 -0
- phenoml/lang2fhir/types/lang2fhir_upload_profile_response.py +23 -0
- phenoml/lang2fhir/types/search_response.py +33 -0
- phenoml/py.typed +0 -0
- phenoml/tools/__init__.py +33 -0
- phenoml/tools/client.py +392 -0
- phenoml/tools/errors/__init__.py +11 -0
- phenoml/tools/errors/bad_request_error.py +10 -0
- phenoml/tools/errors/failed_dependency_error.py +10 -0
- phenoml/tools/errors/forbidden_error.py +10 -0
- phenoml/tools/errors/internal_server_error.py +10 -0
- phenoml/tools/errors/unauthorized_error.py +10 -0
- phenoml/tools/raw_client.py +745 -0
- phenoml/tools/types/__init__.py +25 -0
- phenoml/tools/types/cohort_request_provider.py +5 -0
- phenoml/tools/types/cohort_response.py +49 -0
- phenoml/tools/types/fhir_client_config.py +31 -0
- phenoml/tools/types/lang2fhir_and_create_request_provider.py +7 -0
- phenoml/tools/types/lang2fhir_and_create_request_resource.py +25 -0
- phenoml/tools/types/lang2fhir_and_create_response.py +33 -0
- phenoml/tools/types/lang2fhir_and_search_request_provider.py +7 -0
- phenoml/tools/types/lang2fhir_and_search_response.py +40 -0
- phenoml/tools/types/search_concept.py +41 -0
- phenoml/version.py +3 -0
- phenoml/wrapper_client.py +123 -0
- phenoml-0.0.1.dist-info/LICENSE +21 -0
- phenoml-0.0.1.dist-info/METADATA +192 -0
- phenoml-0.0.1.dist-info/RECORD +143 -0
- phenoml-0.0.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from .raw_client import AsyncRawLang2FhirClient, RawLang2FhirClient
|
|
8
|
+
from .types.create_request_resource import CreateRequestResource
|
|
9
|
+
from .types.document_request_file_type import DocumentRequestFileType
|
|
10
|
+
from .types.document_request_resource import DocumentRequestResource
|
|
11
|
+
from .types.fhir_resource import FhirResource
|
|
12
|
+
from .types.lang2fhir_upload_profile_response import Lang2FhirUploadProfileResponse
|
|
13
|
+
from .types.search_response import SearchResponse
|
|
14
|
+
|
|
15
|
+
# this is used as the default value for optional parameters
|
|
16
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Lang2FhirClient:
|
|
20
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
|
+
self._raw_client = RawLang2FhirClient(client_wrapper=client_wrapper)
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def with_raw_response(self) -> RawLang2FhirClient:
|
|
25
|
+
"""
|
|
26
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
RawLang2FhirClient
|
|
31
|
+
"""
|
|
32
|
+
return self._raw_client
|
|
33
|
+
|
|
34
|
+
def create(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
version: str,
|
|
38
|
+
resource: CreateRequestResource,
|
|
39
|
+
text: str,
|
|
40
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
41
|
+
) -> FhirResource:
|
|
42
|
+
"""
|
|
43
|
+
Converts natural language text into a structured FHIR resource
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
version : str
|
|
48
|
+
FHIR version to use
|
|
49
|
+
|
|
50
|
+
resource : CreateRequestResource
|
|
51
|
+
Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile. Recommended to use the supported US Core Profiles for validated results but you can also use any custom profile you've uploaded (if you're a develop or launch customer)
|
|
52
|
+
|
|
53
|
+
text : str
|
|
54
|
+
Natural language text to convert
|
|
55
|
+
|
|
56
|
+
request_options : typing.Optional[RequestOptions]
|
|
57
|
+
Request-specific configuration.
|
|
58
|
+
|
|
59
|
+
Returns
|
|
60
|
+
-------
|
|
61
|
+
FhirResource
|
|
62
|
+
Successfully created FHIR resource
|
|
63
|
+
|
|
64
|
+
Examples
|
|
65
|
+
--------
|
|
66
|
+
from phenoml import phenoml
|
|
67
|
+
|
|
68
|
+
client = phenoml(
|
|
69
|
+
token="YOUR_TOKEN",
|
|
70
|
+
)
|
|
71
|
+
client.lang2fhir.create(
|
|
72
|
+
version="R4",
|
|
73
|
+
resource="auto",
|
|
74
|
+
text="Patient has severe asthma with acute exacerbation",
|
|
75
|
+
)
|
|
76
|
+
"""
|
|
77
|
+
_response = self._raw_client.create(
|
|
78
|
+
version=version, resource=resource, text=text, request_options=request_options
|
|
79
|
+
)
|
|
80
|
+
return _response.data
|
|
81
|
+
|
|
82
|
+
def search(self, *, text: str, request_options: typing.Optional[RequestOptions] = None) -> SearchResponse:
|
|
83
|
+
"""
|
|
84
|
+
Converts natural language text into FHIR search parameters
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
text : str
|
|
89
|
+
Natural language text to convert into FHIR search parameters
|
|
90
|
+
|
|
91
|
+
request_options : typing.Optional[RequestOptions]
|
|
92
|
+
Request-specific configuration.
|
|
93
|
+
|
|
94
|
+
Returns
|
|
95
|
+
-------
|
|
96
|
+
SearchResponse
|
|
97
|
+
Successfully generated FHIR search parameters
|
|
98
|
+
|
|
99
|
+
Examples
|
|
100
|
+
--------
|
|
101
|
+
from phenoml import phenoml
|
|
102
|
+
|
|
103
|
+
client = phenoml(
|
|
104
|
+
token="YOUR_TOKEN",
|
|
105
|
+
)
|
|
106
|
+
client.lang2fhir.search(
|
|
107
|
+
text="Appointments between March 2-9, 2025",
|
|
108
|
+
)
|
|
109
|
+
"""
|
|
110
|
+
_response = self._raw_client.search(text=text, request_options=request_options)
|
|
111
|
+
return _response.data
|
|
112
|
+
|
|
113
|
+
def upload_profile(
|
|
114
|
+
self, *, version: str, resource: str, profile: str, request_options: typing.Optional[RequestOptions] = None
|
|
115
|
+
) -> Lang2FhirUploadProfileResponse:
|
|
116
|
+
"""
|
|
117
|
+
Upload a custom FHIR StructureDefinition profile for use with the lang2fhir service
|
|
118
|
+
|
|
119
|
+
Parameters
|
|
120
|
+
----------
|
|
121
|
+
version : str
|
|
122
|
+
FHIR version that this profile implements
|
|
123
|
+
|
|
124
|
+
resource : str
|
|
125
|
+
Name for the custom resource profile (will be converted to lowercase)
|
|
126
|
+
|
|
127
|
+
profile : str
|
|
128
|
+
Base64 encoded JSON string of the FHIR StructureDefinition profile
|
|
129
|
+
|
|
130
|
+
request_options : typing.Optional[RequestOptions]
|
|
131
|
+
Request-specific configuration.
|
|
132
|
+
|
|
133
|
+
Returns
|
|
134
|
+
-------
|
|
135
|
+
Lang2FhirUploadProfileResponse
|
|
136
|
+
Profile successfully uploaded
|
|
137
|
+
|
|
138
|
+
Examples
|
|
139
|
+
--------
|
|
140
|
+
from phenoml import phenoml
|
|
141
|
+
|
|
142
|
+
client = phenoml(
|
|
143
|
+
token="YOUR_TOKEN",
|
|
144
|
+
)
|
|
145
|
+
client.lang2fhir.upload_profile(
|
|
146
|
+
version="version",
|
|
147
|
+
resource="custom-patient",
|
|
148
|
+
profile="profile",
|
|
149
|
+
)
|
|
150
|
+
"""
|
|
151
|
+
_response = self._raw_client.upload_profile(
|
|
152
|
+
version=version, resource=resource, profile=profile, request_options=request_options
|
|
153
|
+
)
|
|
154
|
+
return _response.data
|
|
155
|
+
|
|
156
|
+
def document(
|
|
157
|
+
self,
|
|
158
|
+
*,
|
|
159
|
+
version: str,
|
|
160
|
+
resource: DocumentRequestResource,
|
|
161
|
+
content: str,
|
|
162
|
+
file_type: DocumentRequestFileType,
|
|
163
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
164
|
+
) -> FhirResource:
|
|
165
|
+
"""
|
|
166
|
+
Extracts text from a document (PDF or image) and converts it into a structured FHIR resource
|
|
167
|
+
|
|
168
|
+
Parameters
|
|
169
|
+
----------
|
|
170
|
+
version : str
|
|
171
|
+
FHIR version to use
|
|
172
|
+
|
|
173
|
+
resource : DocumentRequestResource
|
|
174
|
+
Type of FHIR resource to create (questionnaire and US Core questionnaireresponse profiles currently supported)
|
|
175
|
+
|
|
176
|
+
content : str
|
|
177
|
+
Base64 encoded file content
|
|
178
|
+
|
|
179
|
+
file_type : DocumentRequestFileType
|
|
180
|
+
MIME type of the file
|
|
181
|
+
|
|
182
|
+
request_options : typing.Optional[RequestOptions]
|
|
183
|
+
Request-specific configuration.
|
|
184
|
+
|
|
185
|
+
Returns
|
|
186
|
+
-------
|
|
187
|
+
FhirResource
|
|
188
|
+
Successfully created FHIR resource from document
|
|
189
|
+
|
|
190
|
+
Examples
|
|
191
|
+
--------
|
|
192
|
+
from phenoml import phenoml
|
|
193
|
+
|
|
194
|
+
client = phenoml(
|
|
195
|
+
token="YOUR_TOKEN",
|
|
196
|
+
)
|
|
197
|
+
client.lang2fhir.document(
|
|
198
|
+
version="R4",
|
|
199
|
+
resource="questionnaire",
|
|
200
|
+
content="content",
|
|
201
|
+
file_type="application/pdf",
|
|
202
|
+
)
|
|
203
|
+
"""
|
|
204
|
+
_response = self._raw_client.document(
|
|
205
|
+
version=version, resource=resource, content=content, file_type=file_type, request_options=request_options
|
|
206
|
+
)
|
|
207
|
+
return _response.data
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class AsyncLang2FhirClient:
|
|
211
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
212
|
+
self._raw_client = AsyncRawLang2FhirClient(client_wrapper=client_wrapper)
|
|
213
|
+
|
|
214
|
+
@property
|
|
215
|
+
def with_raw_response(self) -> AsyncRawLang2FhirClient:
|
|
216
|
+
"""
|
|
217
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
218
|
+
|
|
219
|
+
Returns
|
|
220
|
+
-------
|
|
221
|
+
AsyncRawLang2FhirClient
|
|
222
|
+
"""
|
|
223
|
+
return self._raw_client
|
|
224
|
+
|
|
225
|
+
async def create(
|
|
226
|
+
self,
|
|
227
|
+
*,
|
|
228
|
+
version: str,
|
|
229
|
+
resource: CreateRequestResource,
|
|
230
|
+
text: str,
|
|
231
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
232
|
+
) -> FhirResource:
|
|
233
|
+
"""
|
|
234
|
+
Converts natural language text into a structured FHIR resource
|
|
235
|
+
|
|
236
|
+
Parameters
|
|
237
|
+
----------
|
|
238
|
+
version : str
|
|
239
|
+
FHIR version to use
|
|
240
|
+
|
|
241
|
+
resource : CreateRequestResource
|
|
242
|
+
Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile. Recommended to use the supported US Core Profiles for validated results but you can also use any custom profile you've uploaded (if you're a develop or launch customer)
|
|
243
|
+
|
|
244
|
+
text : str
|
|
245
|
+
Natural language text to convert
|
|
246
|
+
|
|
247
|
+
request_options : typing.Optional[RequestOptions]
|
|
248
|
+
Request-specific configuration.
|
|
249
|
+
|
|
250
|
+
Returns
|
|
251
|
+
-------
|
|
252
|
+
FhirResource
|
|
253
|
+
Successfully created FHIR resource
|
|
254
|
+
|
|
255
|
+
Examples
|
|
256
|
+
--------
|
|
257
|
+
import asyncio
|
|
258
|
+
|
|
259
|
+
from phenoml import Asyncphenoml
|
|
260
|
+
|
|
261
|
+
client = Asyncphenoml(
|
|
262
|
+
token="YOUR_TOKEN",
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
async def main() -> None:
|
|
267
|
+
await client.lang2fhir.create(
|
|
268
|
+
version="R4",
|
|
269
|
+
resource="auto",
|
|
270
|
+
text="Patient has severe asthma with acute exacerbation",
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
asyncio.run(main())
|
|
275
|
+
"""
|
|
276
|
+
_response = await self._raw_client.create(
|
|
277
|
+
version=version, resource=resource, text=text, request_options=request_options
|
|
278
|
+
)
|
|
279
|
+
return _response.data
|
|
280
|
+
|
|
281
|
+
async def search(self, *, text: str, request_options: typing.Optional[RequestOptions] = None) -> SearchResponse:
|
|
282
|
+
"""
|
|
283
|
+
Converts natural language text into FHIR search parameters
|
|
284
|
+
|
|
285
|
+
Parameters
|
|
286
|
+
----------
|
|
287
|
+
text : str
|
|
288
|
+
Natural language text to convert into FHIR search parameters
|
|
289
|
+
|
|
290
|
+
request_options : typing.Optional[RequestOptions]
|
|
291
|
+
Request-specific configuration.
|
|
292
|
+
|
|
293
|
+
Returns
|
|
294
|
+
-------
|
|
295
|
+
SearchResponse
|
|
296
|
+
Successfully generated FHIR search parameters
|
|
297
|
+
|
|
298
|
+
Examples
|
|
299
|
+
--------
|
|
300
|
+
import asyncio
|
|
301
|
+
|
|
302
|
+
from phenoml import Asyncphenoml
|
|
303
|
+
|
|
304
|
+
client = Asyncphenoml(
|
|
305
|
+
token="YOUR_TOKEN",
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
async def main() -> None:
|
|
310
|
+
await client.lang2fhir.search(
|
|
311
|
+
text="Appointments between March 2-9, 2025",
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
asyncio.run(main())
|
|
316
|
+
"""
|
|
317
|
+
_response = await self._raw_client.search(text=text, request_options=request_options)
|
|
318
|
+
return _response.data
|
|
319
|
+
|
|
320
|
+
async def upload_profile(
|
|
321
|
+
self, *, version: str, resource: str, profile: str, request_options: typing.Optional[RequestOptions] = None
|
|
322
|
+
) -> Lang2FhirUploadProfileResponse:
|
|
323
|
+
"""
|
|
324
|
+
Upload a custom FHIR StructureDefinition profile for use with the lang2fhir service
|
|
325
|
+
|
|
326
|
+
Parameters
|
|
327
|
+
----------
|
|
328
|
+
version : str
|
|
329
|
+
FHIR version that this profile implements
|
|
330
|
+
|
|
331
|
+
resource : str
|
|
332
|
+
Name for the custom resource profile (will be converted to lowercase)
|
|
333
|
+
|
|
334
|
+
profile : str
|
|
335
|
+
Base64 encoded JSON string of the FHIR StructureDefinition profile
|
|
336
|
+
|
|
337
|
+
request_options : typing.Optional[RequestOptions]
|
|
338
|
+
Request-specific configuration.
|
|
339
|
+
|
|
340
|
+
Returns
|
|
341
|
+
-------
|
|
342
|
+
Lang2FhirUploadProfileResponse
|
|
343
|
+
Profile successfully uploaded
|
|
344
|
+
|
|
345
|
+
Examples
|
|
346
|
+
--------
|
|
347
|
+
import asyncio
|
|
348
|
+
|
|
349
|
+
from phenoml import Asyncphenoml
|
|
350
|
+
|
|
351
|
+
client = Asyncphenoml(
|
|
352
|
+
token="YOUR_TOKEN",
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
async def main() -> None:
|
|
357
|
+
await client.lang2fhir.upload_profile(
|
|
358
|
+
version="version",
|
|
359
|
+
resource="custom-patient",
|
|
360
|
+
profile="profile",
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
asyncio.run(main())
|
|
365
|
+
"""
|
|
366
|
+
_response = await self._raw_client.upload_profile(
|
|
367
|
+
version=version, resource=resource, profile=profile, request_options=request_options
|
|
368
|
+
)
|
|
369
|
+
return _response.data
|
|
370
|
+
|
|
371
|
+
async def document(
|
|
372
|
+
self,
|
|
373
|
+
*,
|
|
374
|
+
version: str,
|
|
375
|
+
resource: DocumentRequestResource,
|
|
376
|
+
content: str,
|
|
377
|
+
file_type: DocumentRequestFileType,
|
|
378
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
379
|
+
) -> FhirResource:
|
|
380
|
+
"""
|
|
381
|
+
Extracts text from a document (PDF or image) and converts it into a structured FHIR resource
|
|
382
|
+
|
|
383
|
+
Parameters
|
|
384
|
+
----------
|
|
385
|
+
version : str
|
|
386
|
+
FHIR version to use
|
|
387
|
+
|
|
388
|
+
resource : DocumentRequestResource
|
|
389
|
+
Type of FHIR resource to create (questionnaire and US Core questionnaireresponse profiles currently supported)
|
|
390
|
+
|
|
391
|
+
content : str
|
|
392
|
+
Base64 encoded file content
|
|
393
|
+
|
|
394
|
+
file_type : DocumentRequestFileType
|
|
395
|
+
MIME type of the file
|
|
396
|
+
|
|
397
|
+
request_options : typing.Optional[RequestOptions]
|
|
398
|
+
Request-specific configuration.
|
|
399
|
+
|
|
400
|
+
Returns
|
|
401
|
+
-------
|
|
402
|
+
FhirResource
|
|
403
|
+
Successfully created FHIR resource from document
|
|
404
|
+
|
|
405
|
+
Examples
|
|
406
|
+
--------
|
|
407
|
+
import asyncio
|
|
408
|
+
|
|
409
|
+
from phenoml import Asyncphenoml
|
|
410
|
+
|
|
411
|
+
client = Asyncphenoml(
|
|
412
|
+
token="YOUR_TOKEN",
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
async def main() -> None:
|
|
417
|
+
await client.lang2fhir.document(
|
|
418
|
+
version="R4",
|
|
419
|
+
resource="questionnaire",
|
|
420
|
+
content="content",
|
|
421
|
+
file_type="application/pdf",
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
asyncio.run(main())
|
|
426
|
+
"""
|
|
427
|
+
_response = await self._raw_client.document(
|
|
428
|
+
version=version, resource=resource, content=content, file_type=file_type, request_options=request_options
|
|
429
|
+
)
|
|
430
|
+
return _response.data
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
from .bad_request_error import BadRequestError
|
|
6
|
+
from .failed_dependency_error import FailedDependencyError
|
|
7
|
+
from .forbidden_error import ForbiddenError
|
|
8
|
+
from .internal_server_error import InternalServerError
|
|
9
|
+
from .unauthorized_error import UnauthorizedError
|
|
10
|
+
|
|
11
|
+
__all__ = ["BadRequestError", "FailedDependencyError", "ForbiddenError", "InternalServerError", "UnauthorizedError"]
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
|
|
7
|
+
|
|
8
|
+
class BadRequestError(ApiError):
|
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
|
+
super().__init__(status_code=400, headers=headers, body=body)
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
|
|
7
|
+
|
|
8
|
+
class FailedDependencyError(ApiError):
|
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
|
+
super().__init__(status_code=424, headers=headers, body=body)
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
|
|
7
|
+
|
|
8
|
+
class ForbiddenError(ApiError):
|
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
|
+
super().__init__(status_code=403, headers=headers, body=body)
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
|
|
7
|
+
|
|
8
|
+
class InternalServerError(ApiError):
|
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
|
+
super().__init__(status_code=500, headers=headers, body=body)
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
|
|
7
|
+
|
|
8
|
+
class UnauthorizedError(ApiError):
|
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
|
+
super().__init__(status_code=401, headers=headers, body=body)
|