Skip to content

Commit 38a9659

Browse files
authored
Merge pull request #1 from koen-mertens/radiology-insights-GA-cb3
Radiology insights ga cb3
2 parents 3c98a95 + 8bee798 commit 38a9659

35 files changed

+15169
-3246
lines changed

sdk/healthinsights/azure-healthinsights-radiologyinsights/README.md

+138-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
### Prequisites
99

10-
- Python 3.8 or later is required to use this package.
10+
- [Python 3.8+][python] is required to use this package.
1111
- You need an [Azure subscription][azure_sub] to use this package.
1212
- An existing Cognitive Services Health Insights instance.
1313

@@ -51,7 +51,7 @@ az cognitiveservices account keys list --resource-group <your-resource-group-nam
5151
Once you have the value for the API key, you can pass it as a string into an instance of **AzureKeyCredential**. Use the key as the credential parameter to authenticate the client:
5252

5353
<!-- SNIPPET:sample_critical_result_inference_async.create_radiology_insights_client-->
54-
```python
54+
```Python
5555
import os
5656
from azure.core.credentials import AzureKeyCredential
5757
from azure.healthinsights.radiologyinsights import RadiologyInsightsClient
@@ -76,31 +76,154 @@ Sample code snippets are provided to illustrate using long-running operations [b
7676

7777
## Key concepts
7878

79+
Once you've initialized a 'RadiologyInsightsClient', you can use it to analyse document text by displaying inferences found within the text.
80+
* Age Mismatch
81+
* Laterality Discrepancy
82+
* Sex Mismatch
83+
* Complete Order Discrepancy
84+
* Limited Order Discrepancy
85+
* Finding
86+
* Critical Result
87+
* Follow-up Recommendation
88+
* Communication
89+
* Radiology Procedure
7990
Radiology Insights currently supports one document from one patient. Please take a look [here][inferences] for more detailed information about the inferences this service produces.
8091

8192
## Examples
8293

83-
### Create a RadiologyInsights request and get the result using an asynchronous client
84-
94+
For each inference samples are available that show how to retrieve the information either in a synchronous (block until operation is complete, slower) or in an asynchronous way (non-blocking, faster).
8595
For an example how to create a client, a request and get the result see the example in the [sample folder][sample_folder].
8696

97+
* [Age Mismatch](#get-age-mismatch-inference-information)
98+
* [Complete Order Discrepancy](#get-complete-order-discrepancy-inference-information)
99+
* [Critical Result](#get-critical-result-inference-information)
100+
* [Finding](#get-finding-information)
101+
* [Follow-up Communication](#get-follow-up-communication-information)
102+
* [Follow-up Recommendation](#get-follow-up-recommendation-information)
103+
* [Laterality Descripancy](#get-laterality-discrepancy-information)
104+
* [Limited Order Descripancy](#get-limited-order-discrepancy-information)
105+
* [Radiology Procedure](#get-radiology-procedure-information)
106+
* [Sex Mismatch](#get-sex-mismatch-information)
107+
108+
### Running the samples
109+
110+
1. Open a terminal window and `cd` to the directory that the samples are saved in.
111+
2. Set the environment variables specified in the sample file you wish to run.
112+
113+
### Get Age Mismatch Inference information
114+
115+
<!-- SNIPPET:sample_age_mismatch_inference_async.display_age_mismatch-->
116+
```Python
117+
for patient_result in radiology_insights_result.patient_results:
118+
for ri_inference in patient_result.inferences:
119+
if ri_inference.kind == models.RadiologyInsightsInferenceType.AGE_MISMATCH:
120+
print(f"Age Mismatch Inference found")
121+
```
122+
<!-- SNIPPET:sample_age_mismatch_inference_async.display_age_mismatch-->
123+
124+
### Get Complete Order Discrepancy Inference information
125+
126+
<!-- SNIPPET:sample_complete_order_discrespancy_inference_async.display_complete_order_discrepancy-->
127+
```Python
128+
for patient_result in radiology_insights_result.patient_results:
129+
for ri_inference in patient_result.inferences:
130+
if ri_inference.kind == models.RadiologyInsightsInferenceType.COMPLETE_ORDER_DISCREPANCY:
131+
print(f"Complete Order Discrepancy Inference found")
132+
```
133+
<!-- SNIPPET:sample_complete_order_discrespancy_inference_async.display_complete_order_discrepancy-->
134+
87135
### Get Critical Result Inference information
88136

89137
<!-- SNIPPET:sample_critical_result_inference_async.display_critical_results-->
90-
```python
138+
```Python
91139
for patient_result in radiology_insights_result.patient_results:
92140
for ri_inference in patient_result.inferences:
93-
if (
94-
ri_inference.kind
95-
== models.RadiologyInsightsInferenceType.CRITICAL_RESULT
96-
):
141+
if ri_inference.kind == models.RadiologyInsightsInferenceType.CRITICAL_RESULT:
97142
critical_result = ri_inference.result
98-
print(
99-
f"Critical Result Inference found: {critical_result.description}"
100-
)
143+
print(
144+
f"Critical Result Inference found: {critical_result.description}")
101145
```
102146
<!-- SNIPPET:sample_critical_result_inference_async.display_critical_results-->
103147

148+
### Get Finding Inference information
149+
150+
<!-- SNIPPET:sample_finding_inference_async.display_finding-->
151+
```Python
152+
for patient_result in radiology_insights_result.patient_results:
153+
counter = 0
154+
for ri_inference in patient_result.inferences:
155+
if ri_inference.kind == models.RadiologyInsightsInferenceType.FINDING:
156+
counter += 1
157+
print(f"Finding Inference found")
158+
```
159+
<!-- SNIPPET:sample_finding_inference_async.display_finding-->
160+
161+
### Get Follow-up Communication information
162+
163+
<!-- SNIPPET:sample_followup_communication_inference_async.display_followup_communication-->
164+
```Python
165+
for patient_result in radiology_insights_result.patient_results:
166+
for ri_inference in patient_result.inferences:
167+
if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_COMMUNICATION:
168+
print(f"Follow-up Communication Inference found")
169+
```
170+
<!-- SNIPPET:sample_followup_communication_inference_async.display_followup_communication-->
171+
172+
### Get Follow-up Recommendation information
173+
174+
<!-- SNIPPET:sample_followup_recommendation_inference_async.display_followup_recommendation-->
175+
```Python
176+
for patient_result in radiology_insights_result.patient_results:
177+
for ri_inference in patient_result.inferences:
178+
if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_RECOMMENDATION:
179+
print(f"Follow-up Recommendation Inference found")
180+
```
181+
<!-- SNIPPET:sample_followup_recommendation_inference_async.display_followup_recommendation-->
182+
183+
### Get Laterality Discrepancy information
184+
185+
<!-- SNIPPET:sample_laterality_discrepancy_inference_async.display_laterality_discrepancy-->
186+
```Python
187+
for patient_result in radiology_insights_result.patient_results:
188+
for ri_inference in patient_result.inferences:
189+
if ri_inference.kind == models.RadiologyInsightsInferenceType.LATERALITY_DISCREPANCY:
190+
print(f"Laterality Discrepancy Inference found")
191+
```
192+
<!-- SNIPPET:sample_laterality_discrepancy_inference_async.display_laterality_discrepancy-->
193+
194+
### Get Limited Order Discrepancy information
195+
196+
<!-- SNIPPET:sample_limited_order_discrepancy_inference_async.display_limited_order_discrepancy-->
197+
```Python
198+
for patient_result in radiology_insights_result.patient_results:
199+
for ri_inference in patient_result.inferences:
200+
if ri_inference.kind == models.RadiologyInsightsInferenceType.LIMITED_ORDER_DISCREPANCY:
201+
print(f"Limited Order Discrepancy Inference found")
202+
```
203+
<!-- SNIPPET:sample_limited_order_discrepancy_inference_async.display_limited_order_discrepancy-->
204+
205+
### Get Radiology Procedure information
206+
207+
<!-- SNIPPET:sample_radiology_procedure_inference_async.display_radiology_procedure-->
208+
```Python
209+
for patient_result in radiology_insights_result.patient_results:
210+
for ri_inference in patient_result.inferences:
211+
if ri_inference.kind == models.RadiologyInsightsInferenceType.RADIOLOGY_PROCEDURE:
212+
print(f"Radiology Procedure Inference found")
213+
```
214+
<!-- SNIPPET:sample_radiology_procedure_inference_async.display_radiology_procedure-->
215+
216+
### Get Sex Mismatch information
217+
218+
<!-- SNIPPET:sample_sex_mismatch_inference_async.display_sex_mismatch-->
219+
```Python
220+
for patient_result in radiology_insights_result.patient_results:
221+
for ri_inference in patient_result.inferences:
222+
if ri_inference.kind == models.RadiologyInsightsInferenceType.SEX_MISMATCH:
223+
print(f"Sex Mismatch Inference found")
224+
```
225+
<!-- SNIPPET:sample_sex_mismatch_inference_async.display_sex_mismatch-->
226+
104227
For detailed conceptual information of this and other inferences please read more [here][inferences].
105228

106229
## Troubleshooting
@@ -140,6 +263,8 @@ see the Code of Conduct FAQ or contact <opencode@microsoft.com> with any
140263
additional questions or comments.
141264

142265
<!-- LINKS -->
266+
[azure_cli]: https://docs.microsoft.com/cli/azure
267+
[azure_portal]: https://portal.azure.com
143268
[health_insights]: https://learn.microsoft.com/azure/azure-health-insights/overview
144269
[radiology_insights_docs]: https://learn.microsoft.com/azure/azure-health-insights/radiology-insights/
145270
[azure_sub]: https://azure.microsoft.com/free/
@@ -148,4 +273,5 @@ additional questions or comments.
148273
[azure_cli]: https://learn.microsoft.com/cli/azure/
149274
[inferences]: https://learn.microsoft.com/azure/azure-health-insights/radiology-insights/inferences
150275
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
276+
[python]: https://www.python.org/downloads/
151277
[sample_folder]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples

sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ class RadiologyInsightsClient(
2727
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
2828
https://westus2.api.cognitive.microsoft.com). Required.
2929
:type endpoint: str
30-
:param credential: Credential needed for the client to connect to Azure. Required.
30+
:param credential: Credential used to authenticate requests to the service. Required.
3131
:type credential: ~azure.core.credentials.AzureKeyCredential
32-
:keyword api_version: The API version to use for this operation. Default value is
33-
"2023-09-01-preview". Note that overriding this default value may result in unsupported
34-
behavior.
32+
:keyword api_version: The API version to use for this operation. Default value is "2024-04-01".
33+
Note that overriding this default value may result in unsupported behavior.
3534
:paramtype api_version: str
3635
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
3736
Retry-After header is present.

sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ class RadiologyInsightsClientConfiguration: # pylint: disable=too-many-instance
2323
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
2424
https://westus2.api.cognitive.microsoft.com). Required.
2525
:type endpoint: str
26-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2727
:type credential: ~azure.core.credentials.AzureKeyCredential
28-
:keyword api_version: The API version to use for this operation. Default value is
29-
"2023-09-01-preview". Note that overriding this default value may result in unsupported
30-
behavior.
28+
:keyword api_version: The API version to use for this operation. Default value is "2024-04-01".
29+
Note that overriding this default value may result in unsupported behavior.
3130
:paramtype api_version: str
3231
"""
3332

3433
def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None:
35-
api_version: str = kwargs.pop("api_version", "2023-09-01-preview")
34+
api_version: str = kwargs.pop("api_version", "2024-04-01")
3635

3736
if endpoint is None:
3837
raise ValueError("Parameter 'endpoint' must not be None.")

0 commit comments

Comments
 (0)