Skip to content

Commit a8fb132

Browse files
committed
data from tsp
1 parent 044d77b commit a8fb132

File tree

20 files changed

+2932
-1
lines changed

20 files changed

+2932
-1
lines changed

src/healthcareapis/azext_healthcareapis/aaz/latest/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
# pylint: skip-file
99
# flake8: noqa
1010

11+
from ._clients import *
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_client("AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis")
15+
class AAZHealthdataaiservicesDeidservicesDataPlaneClient(AAZBaseClient):
16+
_CLOUD_HOST_TEMPLATES = {
17+
CloudNameEnum.AzureCloud: "https://{endpoint}",
18+
}
19+
20+
_AAD_CREDENTIAL_SCOPES = [
21+
"https://deid.azure.com/.default",
22+
]
23+
24+
@classmethod
25+
def _build_base_url(cls, ctx, **kwargs):
26+
endpoint = None
27+
if not endpoint:
28+
endpoint = cls._CLOUD_HOST_TEMPLATES.get(ctx.cli_ctx.cloud.name, None)
29+
return endpoint
30+
31+
@classmethod
32+
def _build_configuration(cls, ctx, credential, **kwargs):
33+
return AAZClientConfiguration(
34+
credential=credential,
35+
credential_scopes=cls._AAD_CREDENTIAL_SCOPES,
36+
**kwargs
37+
)
38+
39+
40+
class _AAZHealthdataaiservicesDeidservicesDataPlaneClientHelper:
41+
"""Helper class for AAZHealthdataaiservicesDeidservicesDataPlaneClient"""
42+
43+
44+
__all__ = [
45+
"AAZHealthdataaiservicesDeidservicesDataPlaneClient",
46+
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"health-data-ai-services",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Health Data Ai Services
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"health-data-ai-services deid-services",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Deid Services
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._deid import *
Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command(
15+
"health-data-ai-services deid-services deid",
16+
)
17+
class Deid(AAZCommand):
18+
"""A remote procedure call (RPC) operation.
19+
"""
20+
21+
_aaz_info = {
22+
"version": "2024-11-15",
23+
"resources": [
24+
["data-plane:healthdataaiservices.deidservices", "/deid", "2024-11-15"],
25+
]
26+
}
27+
28+
def _handler(self, command_args):
29+
super()._handler(command_args)
30+
self._execute_operations()
31+
return self._output()
32+
33+
_args_schema = None
34+
35+
@classmethod
36+
def _build_arguments_schema(cls, *args, **kwargs):
37+
if cls._args_schema is not None:
38+
return cls._args_schema
39+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
40+
41+
# define Arg Group "Client"
42+
43+
_args_schema = cls._args_schema
44+
_args_schema.endpoint = AAZStrArg(
45+
options=["--endpoint"],
46+
arg_group="Client",
47+
help="Url of your De-identification Service.",
48+
required=True,
49+
)
50+
51+
# define Arg Group "Body"
52+
53+
_args_schema = cls._args_schema
54+
_args_schema.customizations = AAZObjectArg(
55+
options=["--customizations"],
56+
arg_group="Body",
57+
help="Customization parameters to override default service behaviors.",
58+
)
59+
_args_schema.input_text = AAZStrArg(
60+
options=["--input-text"],
61+
arg_group="Body",
62+
help="Input text to de-identify.",
63+
required=True,
64+
fmt=AAZStrArgFormat(
65+
max_length=48000,
66+
),
67+
)
68+
_args_schema.operation = AAZStrArg(
69+
options=["--operation"],
70+
arg_group="Body",
71+
help="Operation to perform on the input documents.",
72+
default="Surrogate",
73+
enum={"Redact": "Redact", "Surrogate": "Surrogate", "Tag": "Tag"},
74+
)
75+
76+
customizations = cls._args_schema.customizations
77+
customizations.redaction_format = AAZStrArg(
78+
options=["redaction-format"],
79+
help="Format of the redacted output. Only valid when Operation is Redact. Please refer to https://learn.microsoft.com/azure/healthcare-apis/deidentification/redaction-format for more details.",
80+
fmt=AAZStrArgFormat(
81+
max_length=16,
82+
min_length=1,
83+
),
84+
)
85+
customizations.surrogate_locale = AAZStrArg(
86+
options=["surrogate-locale"],
87+
help="Locale in which the output surrogates are written.",
88+
default="en-US",
89+
)
90+
return cls._args_schema
91+
92+
def _execute_operations(self):
93+
self.pre_operations()
94+
self.DeidentifyText(ctx=self.ctx)()
95+
self.post_operations()
96+
97+
@register_callback
98+
def pre_operations(self):
99+
pass
100+
101+
@register_callback
102+
def post_operations(self):
103+
pass
104+
105+
def _output(self, *args, **kwargs):
106+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
107+
return result
108+
109+
class DeidentifyText(AAZHttpOperation):
110+
CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis"
111+
112+
def __call__(self, *args, **kwargs):
113+
request = self.make_request()
114+
session = self.client.send_request(request=request, stream=False, **kwargs)
115+
if session.http_response.status_code in [200]:
116+
return self.on_200(session)
117+
118+
return self.on_error(session.http_response)
119+
120+
@property
121+
def url(self):
122+
return self.client.format_url(
123+
"/deid",
124+
**self.url_parameters
125+
)
126+
127+
@property
128+
def method(self):
129+
return "POST"
130+
131+
@property
132+
def error_format(self):
133+
return "ODataV4Format"
134+
135+
@property
136+
def url_parameters(self):
137+
parameters = {
138+
**self.serialize_url_param(
139+
"endpoint", self.ctx.args.endpoint,
140+
skip_quote=True,
141+
required=True,
142+
),
143+
}
144+
return parameters
145+
146+
@property
147+
def query_parameters(self):
148+
parameters = {
149+
**self.serialize_query_param(
150+
"api-version", "2024-11-15",
151+
required=True,
152+
),
153+
}
154+
return parameters
155+
156+
@property
157+
def header_parameters(self):
158+
parameters = {
159+
**self.serialize_header_param(
160+
"Content-Type", "application/json",
161+
),
162+
**self.serialize_header_param(
163+
"Accept", "application/json",
164+
),
165+
}
166+
return parameters
167+
168+
@property
169+
def content(self):
170+
_content_value, _builder = self.new_content_builder(
171+
self.ctx.args,
172+
typ=AAZObjectType,
173+
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
174+
)
175+
_builder.set_prop("customizations", AAZObjectType, ".customizations")
176+
_builder.set_prop("inputText", AAZStrType, ".input_text", typ_kwargs={"flags": {"required": True}})
177+
_builder.set_prop("operation", AAZStrType, ".operation")
178+
179+
customizations = _builder.get(".customizations")
180+
if customizations is not None:
181+
customizations.set_prop("redactionFormat", AAZStrType, ".redaction_format")
182+
customizations.set_prop("surrogateLocale", AAZStrType, ".surrogate_locale")
183+
184+
return self.serialize_content(_content_value)
185+
186+
def on_200(self, session):
187+
data = self.deserialize_http_content(session)
188+
self.ctx.set_var(
189+
"instance",
190+
data,
191+
schema_builder=self._build_schema_on_200
192+
)
193+
194+
_schema_on_200 = None
195+
196+
@classmethod
197+
def _build_schema_on_200(cls):
198+
if cls._schema_on_200 is not None:
199+
return cls._schema_on_200
200+
201+
cls._schema_on_200 = AAZObjectType()
202+
203+
_schema_on_200 = cls._schema_on_200
204+
_schema_on_200.output_text = AAZStrType(
205+
serialized_name="outputText",
206+
)
207+
_schema_on_200.tagger_result = AAZObjectType(
208+
serialized_name="taggerResult",
209+
)
210+
211+
tagger_result = cls._schema_on_200.tagger_result
212+
tagger_result.entities = AAZListType(
213+
flags={"required": True},
214+
)
215+
216+
entities = cls._schema_on_200.tagger_result.entities
217+
entities.Element = AAZObjectType()
218+
219+
_element = cls._schema_on_200.tagger_result.entities.Element
220+
_element.category = AAZStrType(
221+
flags={"required": True},
222+
)
223+
_element.confidence_score = AAZFloatType(
224+
serialized_name="confidenceScore",
225+
)
226+
_element.length = AAZObjectType(
227+
flags={"required": True},
228+
)
229+
_DeidHelper._build_schema_stringindex_read(_element.length)
230+
_element.offset = AAZObjectType(
231+
flags={"required": True},
232+
)
233+
_DeidHelper._build_schema_stringindex_read(_element.offset)
234+
_element.text = AAZStrType()
235+
236+
return cls._schema_on_200
237+
238+
239+
class _DeidHelper:
240+
"""Helper class for Deid"""
241+
242+
_schema_stringindex_read = None
243+
244+
@classmethod
245+
def _build_schema_stringindex_read(cls, _schema):
246+
if cls._schema_stringindex_read is not None:
247+
_schema.code_point = cls._schema_stringindex_read.code_point
248+
_schema.utf16 = cls._schema_stringindex_read.utf16
249+
_schema.utf8 = cls._schema_stringindex_read.utf8
250+
return
251+
252+
cls._schema_stringindex_read = _schema_stringindex_read = AAZObjectType()
253+
254+
stringindex_read = _schema_stringindex_read
255+
stringindex_read.code_point = AAZIntType(
256+
serialized_name="codePoint",
257+
flags={"required": True},
258+
)
259+
stringindex_read.utf16 = AAZIntType(
260+
flags={"required": True},
261+
)
262+
stringindex_read.utf8 = AAZIntType(
263+
flags={"required": True},
264+
)
265+
266+
_schema.code_point = cls._schema_stringindex_read.code_point
267+
_schema.utf16 = cls._schema_stringindex_read.utf16
268+
_schema.utf8 = cls._schema_stringindex_read.utf8
269+
270+
271+
__all__ = ["Deid"]

0 commit comments

Comments
 (0)