diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/_meta.json b/sdk/healthinsights/azure-healthinsights-radiologyinsights/_meta.json new file mode 100644 index 000000000000..b0990f046958 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/_meta.json @@ -0,0 +1,6 @@ +{ + "commit": "9458b84485608b75bb0aa3057a951e41102c6f40", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", + "typespec_src": "specification/ai/HealthInsights/HealthInsights.RadiologyInsights", + "@azure-tools/typespec-python": "0.31.1" +} \ No newline at end of file diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/__init__.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/__init__.py index 6b6d1d35581a..280758827c61 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/__init__.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/__init__.py @@ -6,17 +6,21 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._patch import RadiologyInsightsClient +from ._client import RadiologyInsightsClient from ._version import VERSION __version__ = VERSION - +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ "RadiologyInsightsClient", ] - +__all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py index 744299e0905c..6edf6591aa17 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py @@ -36,8 +36,9 @@ class RadiologyInsightsClient( AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2024-08-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py index 209906a0759e..c503c11009d1 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py @@ -31,13 +31,14 @@ class RadiologyInsightsClientConfiguration: # pylint: disable=too-many-instance AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2024-08-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") + api_version: str = kwargs.pop("api_version", "2024-08-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_operations.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_operations.py index 72fc5d89cbc2..a0fcf4c637d8 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_operations.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_operations.py @@ -52,7 +52,7 @@ def build_radiology_insights_infer_radiology_insights_request( # pylint: disabl _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_patch.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_patch.py index d599e61e8554..f7dd32510333 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_patch.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_patch.py @@ -1,4 +1,3 @@ -# pylint: disable=protected-access # ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. @@ -7,264 +6,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import ( - Any, - IO, - Optional, - Dict, - Union, - cast, - overload, - List, - MutableMapping, - TypeVar, - Callable, - TYPE_CHECKING, -) # pylint: disable=line-too-long -from azure.core.credentials import AzureKeyCredential -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.polling.base_polling import LROBasePolling -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict +from typing import List -from . import models as _models -from ._model_base import _deserialize -from ._client import RadiologyInsightsClient as _RadiologyInsightsClient - - -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class RadiologyInsightsClient: # pylint: disable=client-accepts-api-version-keyword - """RadiologyInsightsClient. - - :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: - https://westus2.api.cognitive.microsoft.com). Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - self._client = _RadiologyInsightsClient(endpoint=endpoint, credential=credential, **kwargs) - - @overload - def begin_infer_radiology_insights( - self, - id: str, - resource: _models.RadiologyInsightsJob, - *, - expand: Optional[List[str]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights inference result. - - Creates a Radiology Insights inference result with the given request body. - - :param id: The unique ID of the inference result. Required. - :type id: str - :param resource: The resource instance. Required. - :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob - :keyword expand: Expand the indicated resources into the response. Default value is None. - :paramtype expand: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsResult] - :raises ~azure.core.exceptions.HttpResponseError:""" - - @overload - def begin_infer_radiology_insights( - self, - id: str, - resource: JSON, - *, - expand: Optional[List[str]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights inference result. - - Creates a Radiology Insights inference result with the given request body. - - :param id: The unique ID of the inference result. Required. - :type id: str - :param resource: The resource instance. Required. - :type resource: JSON - :keyword expand: Expand the indicated resources into the response. Default value is None. - :paramtype expand: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError:""" - - @overload - def begin_infer_radiology_insights( - self, - id: str, - resource: IO[bytes], - *, - expand: Optional[List[str]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights inference result. - - Creates a Radiology Insights inference result with the given request body. - - :param id: The unique ID of the inference result. Required. - :type id: str - :param resource: The resource instance. Required. - :type resource: IO[bytes] - :keyword expand: Expand the indicated resources into the response. Default value is None. - :paramtype expand: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError:""" - - @distributed_trace - def begin_infer_radiology_insights( - self, - id: str, - resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], - *, - expand: Optional[List[str]] = None, - **kwargs: Any - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights inference result. - - Creates a Radiology Insights inference result with the given request body. - - :param id: The unique ID of the inference result. Required. - :type id: str - :param resource: The resource instance. Is one of the following types: RadiologyInsightsJob, JSON, IO[bytes] Required. - :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob or JSON or IO[bytes] - :keyword expand: Expand the indicated resources into the response. Default value is None. - :paramtype expand: list[str] - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError:""" - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RadiologyInsightsJob] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop( - "polling_interval", self._client._config.polling_interval # pylint: disable=protected-access - ) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._client._infer_radiology_insights_initial( # pylint: disable=protected-access - id=id, - resource=resource, - expand=expand, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["x-ms-request-id"] = self._client._deserialize( # pylint: disable=protected-access - "str", response.headers.get("x-ms-request-id") - ) - response_headers["Operation-Location"] = self._client._deserialize( # pylint: disable=protected-access - "str", response.headers.get("Operation-Location") - ) - deserialized = _deserialize(_models.RadiologyInsightsInferenceResult, response.json().get("result")) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._client._serialize.url( # pylint: disable=protected-access - "self._client._config.endpoint", self._client._config.endpoint, "str", skip_quote=True - ), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RadiologyInsightsInferenceResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client._client, # pylint: disable=protected-access - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RadiologyInsightsInferenceResult]( - self._client._client, raw_result, get_long_running_output, polling_method # type: ignore # pylint: disable=protected-access - ) - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - return self._client.send_request(request, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "RadiologyInsightsClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) - - -__all__: List[str] = [ - "RadiologyInsightsClient" -] # Add all objects you want publicly available to users at this package level # pylint: disable=line-too-long +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_types.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_types.py deleted file mode 100644 index b2586801fb70..000000000000 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_types.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import sys -from typing import Union - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -RepeatabilityResult = Union[Literal["accepted"], Literal["rejected"]] diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/__init__.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/__init__.py index 1dcea5894741..3a05b0feea6f 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/__init__.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/__init__.py @@ -6,14 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._patch import RadiologyInsightsClient - +from ._client import RadiologyInsightsClient +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ "RadiologyInsightsClient", ] - +__all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_client.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_client.py index 958b0baba68b..bd83881cfcb0 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_client.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_client.py @@ -36,8 +36,9 @@ class RadiologyInsightsClient( AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2024-08-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_configuration.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_configuration.py index b42d868a8896..90b4e35a5f52 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_configuration.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_configuration.py @@ -31,15 +31,16 @@ class RadiologyInsightsClientConfiguration: # pylint: disable=too-many-instance AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2024-08-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") + api_version: str = kwargs.pop("api_version", "2024-08-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_patch.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_patch.py index 455941122974..f7dd32510333 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_patch.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_patch.py @@ -6,7 +6,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_patch.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_patch.py index 1a00f5c523e0..f7dd32510333 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_patch.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_patch.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines, protected-access # ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. @@ -7,275 +6,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import ( - Any, - Callable, - Dict, - IO, - TYPE_CHECKING, - List, - Optional, - Awaitable, - TypeVar, - Union, - cast, - overload, - MutableMapping, -) # pylint: disable=line-too-long +from typing import List -from azure.core.pipeline import PipelineResponse -from azure.core.credentials import AzureKeyCredential -from azure.core.polling import AsyncLROPoller, AsyncPollingMethod, AsyncNoPolling -from azure.core.polling.async_base_polling import AsyncLROBasePolling -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ._client import RadiologyInsightsClient as _RadiologyInsightsClient -from .._model_base import _deserialize -from .. import models as _models - - -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class RadiologyInsightsClient: # pylint: disable=client-accepts-api-version-keyword - """RadiologyInsightsClient. - - :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: - https://westus2.api.cognitive.microsoft.com). Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any - ) -> None: # pylint: disable=line-too-long - self._client = _RadiologyInsightsClient(endpoint=endpoint, credential=credential, **kwargs) - - @overload # type: ignore[override] - async def begin_infer_radiology_insights( - self, - id: str, - resource: _models.RadiologyInsightsJob, - *, - expand: Optional[List[str]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights inference result. - - Creates a Radiology Insights inference result with the given request body. - - :param id: The unique ID of the inference result. Required. - :type id: str - :param resource: The resource instance. Required. - :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob - :keyword expand: Expand the indicated resources into the response. Default value is None. - :paramtype expand: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError:""" - - @overload # type: ignore[override] - async def begin_infer_radiology_insights( - self, - id: str, - resource: JSON, - *, - expand: Optional[List[str]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights inference result. - - Creates a Radiology Insights inference result with the given request body. - - :param id: The unique ID of the inference result. Required. - :type id: str - :param resource: The resource instance. Required. - :type resource: JSON - :keyword expand: Expand the indicated resources into the response. Default value is None. - :paramtype expand: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload # type: ignore[override] - async def begin_infer_radiology_insights( - self, - id: str, - resource: IO[bytes], - *, - expand: Optional[List[str]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights inference result. - - Creates a Radiology Insights inference result with the given request body. - - :param id: The unique ID of the inference result. Required. - :type id: str - :param resource: The resource instance. Required. - :type resource: IO[bytes] - :keyword expand: Expand the indicated resources into the response. Default value is None. - :paramtype expand: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async # type: ignore[override] - async def begin_infer_radiology_insights( - self, - id: str, - resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], - *, - expand: Optional[List[str]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights inference result. - - Creates a Radiology Insights inference result with the given request body. - - :param id: The unique ID of the inference result. Required. - :type id: str - :param resource: The resource instance. Is one of the following types: RadiologyInsightsJob, JSON, IO[bytes] Required. - :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob or JSON or IO[bytes] - :keyword expand: Expand the indicated resources into the response. Default value is None. - :paramtype expand: list[str] - :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RadiologyInsightsJob] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop( - "polling_interval", self._client._config.polling_interval - ) # pylint: disable=protected-access - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._client._infer_radiology_insights_initial( # pylint: disable=protected-access - id=id, - resource=resource, - expand=expand, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["x-ms-request-id"] = self._client._deserialize( - "str", response.headers.get("x-ms-request-id") - ) # pylint: disable=protected-access - response_headers["Operation-Location"] = self._client._deserialize( - "str", response.headers.get("Operation-Location") - ) # pylint: disable=protected-access - deserialized = _deserialize(_models.RadiologyInsightsInferenceResult, response.json().get("result")) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._client._serialize.url( - "self._client._config.endpoint", self._client._config.endpoint, "str", skip_quote=True - ), # pylint: disable=protected-access - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RadiologyInsightsInferenceResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - - return AsyncLROPoller[_models.RadiologyInsightsInferenceResult]( - self._client._client, raw_result, get_long_running_output, polling_method # type: ignore # pylint: disable=protected-access - ) - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - return self._client.send_request(request, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "RadiologyInsightsClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) - - -__all__: List[str] = [ - "RadiologyInsightsClient" -] # Add all objects you want publicly available to users at this package level +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_models.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_models.py index 5394f78299e0..af20cc736e8f 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_models.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_models.py @@ -1,5 +1,5 @@ # coding=utf-8 -# pylint: disable=too-many-lines, line-too-long +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -115,7 +115,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class Element(_model_base.Model): """The base definition for all elements contained inside a resource. - Based on `FHIR Element `__. + Based on `FHIR Element `_. :ivar id: Unique id for inter-element referencing. :vartype id: str @@ -635,7 +635,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class Extension(Element): # pylint: disable=too-many-instance-attributes """Base for all elements - Based on `FHIR Element `_. + Based on `FHIR Element `_. :ivar url: Source of the definition for the extension code - a logical name or a URL. Required. diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/conftest.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/conftest.py new file mode 100644 index 000000000000..8bc425af96df --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/conftest.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + radiologyinsights_subscription_id = os.environ.get( + "RADIOLOGYINSIGHTS_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + radiologyinsights_tenant_id = os.environ.get("RADIOLOGYINSIGHTS_TENANT_ID", "00000000-0000-0000-0000-000000000000") + radiologyinsights_client_id = os.environ.get("RADIOLOGYINSIGHTS_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + radiologyinsights_client_secret = os.environ.get( + "RADIOLOGYINSIGHTS_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=radiologyinsights_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=radiologyinsights_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=radiologyinsights_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=radiologyinsights_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/test_radiology_insights.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/test_radiology_insights.py new file mode 100644 index 000000000000..877fc674c2f2 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/test_radiology_insights.py @@ -0,0 +1,472 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import RadiologyInsightsClientTestBase, RadiologyInsightsPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestRadiologyInsights(RadiologyInsightsClientTestBase): + @RadiologyInsightsPreparer() + @recorded_by_proxy + def test_begin_infer_radiology_insights(self, radiologyinsights_endpoint): + client = self.create_client(endpoint=radiologyinsights_endpoint) + response = client.begin_infer_radiology_insights( + id="str", + resource={ + "id": "str", + "status": "str", + "createdAt": "2020-02-20 00:00:00", + "error": ~azure.core.HttpResponseError, + "expiresAt": "2020-02-20 00:00:00", + "jobData": { + "patients": [ + { + "id": "str", + "details": { + "birthDate": "2020-02-20", + "clinicalInfo": [ + { + "resourceType": "str", + "id": "str", + "implicitRules": "str", + "language": "str", + "meta": { + "lastUpdated": "str", + "profile": ["str"], + "security": [ + { + "code": "str", + "display": "str", + "extension": [ + { + "url": "str", + "valueBoolean": bool, + "valueCodeableConcept": {"coding": [...], "text": "str"}, + "valueDateTime": "str", + "valueInteger": 0, + "valuePeriod": {"end": "str", "start": "str"}, + "valueQuantity": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "valueRange": { + "high": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "low": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueRatio": { + "denominator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "numerator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueReference": { + "display": "str", + "identifier": { + "assigner": ..., + "period": {"end": "str", "start": "str"}, + "system": "str", + "type": {"coding": [...], "text": "str"}, + "use": "str", + "value": "str", + }, + "reference": "str", + "type": "str", + }, + "valueSampledData": { + "dimensions": 0, + "origin": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "period": 0.0, + "data": "str", + "factor": 0.0, + "lowerLimit": 0.0, + "upperLimit": 0.0, + }, + "valueString": "str", + "valueTime": "12:30:00", + } + ], + "id": "str", + "system": "str", + "version": "str", + } + ], + "source": "str", + "tag": [ + { + "code": "str", + "display": "str", + "extension": [ + { + "url": "str", + "valueBoolean": bool, + "valueCodeableConcept": {"coding": [...], "text": "str"}, + "valueDateTime": "str", + "valueInteger": 0, + "valuePeriod": {"end": "str", "start": "str"}, + "valueQuantity": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "valueRange": { + "high": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "low": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueRatio": { + "denominator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "numerator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueReference": { + "display": "str", + "identifier": { + "assigner": ..., + "period": {"end": "str", "start": "str"}, + "system": "str", + "type": {"coding": [...], "text": "str"}, + "use": "str", + "value": "str", + }, + "reference": "str", + "type": "str", + }, + "valueSampledData": { + "dimensions": 0, + "origin": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "period": 0.0, + "data": "str", + "factor": 0.0, + "lowerLimit": 0.0, + "upperLimit": 0.0, + }, + "valueString": "str", + "valueTime": "12:30:00", + } + ], + "id": "str", + "system": "str", + "version": "str", + } + ], + "versionId": "str", + }, + } + ], + "sex": "str", + }, + "encounters": [ + { + "id": "str", + "class": "str", + "period": {"end": "2020-02-20 00:00:00", "start": "2020-02-20 00:00:00"}, + } + ], + "patientDocuments": [ + { + "content": {"sourceType": "str", "value": "str"}, + "id": "str", + "type": "str", + "administrativeMetadata": { + "encounterId": "str", + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", + "display": "str", + "extension": [ + { + "url": "str", + "valueBoolean": bool, + "valueCodeableConcept": ..., + "valueDateTime": "str", + "valueInteger": 0, + "valuePeriod": {"end": "str", "start": "str"}, + "valueQuantity": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "valueRange": { + "high": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "low": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueRatio": { + "denominator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "numerator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueReference": { + "display": "str", + "identifier": { + "assigner": ..., + "period": {"end": "str", "start": "str"}, + "system": "str", + "type": ..., + "use": "str", + "value": "str", + }, + "reference": "str", + "type": "str", + }, + "valueSampledData": { + "dimensions": 0, + "origin": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "period": 0.0, + "data": "str", + "factor": 0.0, + "lowerLimit": 0.0, + "upperLimit": 0.0, + }, + "valueString": "str", + "valueTime": "12:30:00", + } + ], + "id": "str", + "system": "str", + "version": "str", + } + ], + "text": "str", + }, + "description": "str", + "extension": [ + { + "url": "str", + "valueBoolean": bool, + "valueCodeableConcept": { + "coding": [ + { + "code": "str", + "display": "str", + "extension": [...], + "id": "str", + "system": "str", + "version": "str", + } + ], + "text": "str", + }, + "valueDateTime": "str", + "valueInteger": 0, + "valuePeriod": {"end": "str", "start": "str"}, + "valueQuantity": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "valueRange": { + "high": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "low": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueRatio": { + "denominator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "numerator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueReference": { + "display": "str", + "identifier": { + "assigner": ..., + "period": {"end": "str", "start": "str"}, + "system": "str", + "type": { + "coding": [ + { + "code": "str", + "display": "str", + "extension": [...], + "id": "str", + "system": "str", + "version": "str", + } + ], + "text": "str", + }, + "use": "str", + "value": "str", + }, + "reference": "str", + "type": "str", + }, + "valueSampledData": { + "dimensions": 0, + "origin": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "period": 0.0, + "data": "str", + "factor": 0.0, + "lowerLimit": 0.0, + "upperLimit": 0.0, + }, + "valueString": "str", + "valueTime": "12:30:00", + } + ], + } + ], + }, + "authors": [{"fullName": "str", "id": "str"}], + "clinicalType": "str", + "createdAt": "2020-02-20 00:00:00", + "language": "str", + "specialtyType": "str", + } + ], + } + ], + "configuration": { + "includeEvidence": bool, + "inferenceOptions": { + "findingOptions": {"provideFocusedSentenceEvidence": bool}, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + "includeRecommendationsWithNoSpecifiedModality": bool, + "provideFocusedSentenceEvidence": bool, + }, + }, + "inferenceTypes": ["str"], + "locale": "str", + "verbose": bool, + }, + }, + "result": { + "modelVersion": "str", + "patientResults": [{"inferences": ["radiology_insights_inference"], "patientId": "str"}], + }, + "updatedAt": "2020-02-20 00:00:00", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/test_radiology_insights_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/test_radiology_insights_async.py new file mode 100644 index 000000000000..111d5fd115e8 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/test_radiology_insights_async.py @@ -0,0 +1,484 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import RadiologyInsightsPreparer +from testpreparer_async import RadiologyInsightsClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestRadiologyInsightsAsync(RadiologyInsightsClientTestBaseAsync): + @RadiologyInsightsPreparer() + @recorded_by_proxy_async + async def test_begin_infer_radiology_insights(self, radiologyinsights_endpoint): + client = self.create_async_client(endpoint=radiologyinsights_endpoint) + response = await ( + await client.begin_infer_radiology_insights( + id="str", + resource={ + "id": "str", + "status": "str", + "createdAt": "2020-02-20 00:00:00", + "error": ~azure.core.HttpResponseError, + "expiresAt": "2020-02-20 00:00:00", + "jobData": { + "patients": [ + { + "id": "str", + "details": { + "birthDate": "2020-02-20", + "clinicalInfo": [ + { + "resourceType": "str", + "id": "str", + "implicitRules": "str", + "language": "str", + "meta": { + "lastUpdated": "str", + "profile": ["str"], + "security": [ + { + "code": "str", + "display": "str", + "extension": [ + { + "url": "str", + "valueBoolean": bool, + "valueCodeableConcept": { + "coding": [...], + "text": "str", + }, + "valueDateTime": "str", + "valueInteger": 0, + "valuePeriod": {"end": "str", "start": "str"}, + "valueQuantity": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "valueRange": { + "high": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "low": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueRatio": { + "denominator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "numerator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueReference": { + "display": "str", + "identifier": { + "assigner": ..., + "period": {"end": "str", "start": "str"}, + "system": "str", + "type": {"coding": [...], "text": "str"}, + "use": "str", + "value": "str", + }, + "reference": "str", + "type": "str", + }, + "valueSampledData": { + "dimensions": 0, + "origin": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "period": 0.0, + "data": "str", + "factor": 0.0, + "lowerLimit": 0.0, + "upperLimit": 0.0, + }, + "valueString": "str", + "valueTime": "12:30:00", + } + ], + "id": "str", + "system": "str", + "version": "str", + } + ], + "source": "str", + "tag": [ + { + "code": "str", + "display": "str", + "extension": [ + { + "url": "str", + "valueBoolean": bool, + "valueCodeableConcept": { + "coding": [...], + "text": "str", + }, + "valueDateTime": "str", + "valueInteger": 0, + "valuePeriod": {"end": "str", "start": "str"}, + "valueQuantity": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "valueRange": { + "high": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "low": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueRatio": { + "denominator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "numerator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueReference": { + "display": "str", + "identifier": { + "assigner": ..., + "period": {"end": "str", "start": "str"}, + "system": "str", + "type": {"coding": [...], "text": "str"}, + "use": "str", + "value": "str", + }, + "reference": "str", + "type": "str", + }, + "valueSampledData": { + "dimensions": 0, + "origin": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "period": 0.0, + "data": "str", + "factor": 0.0, + "lowerLimit": 0.0, + "upperLimit": 0.0, + }, + "valueString": "str", + "valueTime": "12:30:00", + } + ], + "id": "str", + "system": "str", + "version": "str", + } + ], + "versionId": "str", + }, + } + ], + "sex": "str", + }, + "encounters": [ + { + "id": "str", + "class": "str", + "period": {"end": "2020-02-20 00:00:00", "start": "2020-02-20 00:00:00"}, + } + ], + "patientDocuments": [ + { + "content": {"sourceType": "str", "value": "str"}, + "id": "str", + "type": "str", + "administrativeMetadata": { + "encounterId": "str", + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", + "display": "str", + "extension": [ + { + "url": "str", + "valueBoolean": bool, + "valueCodeableConcept": ..., + "valueDateTime": "str", + "valueInteger": 0, + "valuePeriod": {"end": "str", "start": "str"}, + "valueQuantity": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "valueRange": { + "high": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "low": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueRatio": { + "denominator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "numerator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueReference": { + "display": "str", + "identifier": { + "assigner": ..., + "period": { + "end": "str", + "start": "str", + }, + "system": "str", + "type": ..., + "use": "str", + "value": "str", + }, + "reference": "str", + "type": "str", + }, + "valueSampledData": { + "dimensions": 0, + "origin": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "period": 0.0, + "data": "str", + "factor": 0.0, + "lowerLimit": 0.0, + "upperLimit": 0.0, + }, + "valueString": "str", + "valueTime": "12:30:00", + } + ], + "id": "str", + "system": "str", + "version": "str", + } + ], + "text": "str", + }, + "description": "str", + "extension": [ + { + "url": "str", + "valueBoolean": bool, + "valueCodeableConcept": { + "coding": [ + { + "code": "str", + "display": "str", + "extension": [...], + "id": "str", + "system": "str", + "version": "str", + } + ], + "text": "str", + }, + "valueDateTime": "str", + "valueInteger": 0, + "valuePeriod": {"end": "str", "start": "str"}, + "valueQuantity": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "valueRange": { + "high": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "low": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueRatio": { + "denominator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "numerator": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + }, + "valueReference": { + "display": "str", + "identifier": { + "assigner": ..., + "period": {"end": "str", "start": "str"}, + "system": "str", + "type": { + "coding": [ + { + "code": "str", + "display": "str", + "extension": [...], + "id": "str", + "system": "str", + "version": "str", + } + ], + "text": "str", + }, + "use": "str", + "value": "str", + }, + "reference": "str", + "type": "str", + }, + "valueSampledData": { + "dimensions": 0, + "origin": { + "code": "str", + "comparator": "str", + "system": "str", + "unit": "str", + "value": 0.0, + }, + "period": 0.0, + "data": "str", + "factor": 0.0, + "lowerLimit": 0.0, + "upperLimit": 0.0, + }, + "valueString": "str", + "valueTime": "12:30:00", + } + ], + } + ], + }, + "authors": [{"fullName": "str", "id": "str"}], + "clinicalType": "str", + "createdAt": "2020-02-20 00:00:00", + "language": "str", + "specialtyType": "str", + } + ], + } + ], + "configuration": { + "includeEvidence": bool, + "inferenceOptions": { + "findingOptions": {"provideFocusedSentenceEvidence": bool}, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + "includeRecommendationsWithNoSpecifiedModality": bool, + "provideFocusedSentenceEvidence": bool, + }, + }, + "inferenceTypes": ["str"], + "locale": "str", + "verbose": bool, + }, + }, + "result": { + "modelVersion": "str", + "patientResults": [{"inferences": ["radiology_insights_inference"], "patientId": "str"}], + }, + "updatedAt": "2020-02-20 00:00:00", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/testpreparer.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/testpreparer.py new file mode 100644 index 000000000000..ec55a05d610b --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/testpreparer.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer +import functools + + +class RadiologyInsightsClientTestBase(AzureRecordedTestCase): + + def create_client(self, endpoint): + credential = self.get_credential(RadiologyInsightsClient) + return self.create_client_from_credential( + RadiologyInsightsClient, + credential=credential, + endpoint=endpoint, + ) + + +RadiologyInsightsPreparer = functools.partial( + PowerShellPreparer, "radiologyinsights", radiologyinsights_endpoint="https://fake_radiologyinsights_endpoint.com" +) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/testpreparer_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/testpreparer_async.py new file mode 100644 index 000000000000..d95a566f99fa --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/generated_tests/testpreparer_async.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient +from devtools_testutils import AzureRecordedTestCase + + +class RadiologyInsightsClientTestBaseAsync(AzureRecordedTestCase): + + def create_async_client(self, endpoint): + credential = self.get_credential(RadiologyInsightsClient, is_async=True) + return self.create_client_from_credential( + RadiologyInsightsClient, + credential=credential, + endpoint=endpoint, + ) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tsp-location.yaml b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tsp-location.yaml index 93646ace46f4..48834af9e883 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tsp-location.yaml +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tsp-location.yaml @@ -1,7 +1,6 @@ directory: specification/ai/HealthInsights/HealthInsights.RadiologyInsights -additionalDirectories: -- specification/ai/HealthInsights/HealthInsights.Common/ -- specification/ai/HealthInsights/HealthInsights.OpenAPI/ -repo: Azure/azure-rest-api-specs -commit: db63bea839f5648462c94e685d5cc96f8e8b38ba - +commit: 9458b84485608b75bb0aa3057a951e41102c6f40 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: +- specification/ai/HealthInsights/HealthInsights.Common +- specification/ai/HealthInsights/HealthInsights.OpenAPI