Skip to content

Commit 9202e58

Browse files
committed
implementation RadiologyInsightsInferenceResult in samples and tests
1 parent a39586c commit 9202e58

21 files changed

+86
-52
lines changed

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_age_mismatch_inference.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,16 @@ def radiology_insights_sync(self) -> None:
103103

104104
# Construct the request with the patient and configuration
105105
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
106-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
106+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
107107

108108
# Health Insights Radiology Insights
109109
try:
110110
poller = radiology_insights_client.begin_infer_radiology_insights(
111111
id=job_id,
112112
resource=job_data,
113113
)
114-
radiology_insights_result = poller.result()
114+
job_response = poller.result()
115+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
115116
self.display_age_mismatch(radiology_insights_result,doc_content1)
116117
except Exception as ex:
117118
print(str(ex))

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_age_mismatch_inference_async.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,15 @@ async def radiology_insights_async(self) -> None:
105105

106106
# Construct the request with the patient and configuration
107107
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
108-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
108+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
109109

110110
try:
111111
poller = await radiology_insights_client.begin_infer_radiology_insights(
112112
id=job_id,
113113
resource=job_data,
114114
)
115-
radiology_insights_result = await poller.result()
115+
job_response = await poller.result()
116+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
116117
self.display_age_mismatch(radiology_insights_result, doc_content1)
117118
await radiology_insights_client.close()
118119
except Exception as ex:

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_complete_order_discrespancy_inference.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@ def radiology_insights_sync(self) -> None:
101101

102102
# Construct the request with the patient and configuration
103103
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
104-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
104+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
105105

106106
# Health Insights Radiology Insights
107107
try:
108108
poller = radiology_insights_client.begin_infer_radiology_insights(
109109
id=job_id,
110110
resource=job_data,
111111
)
112-
radiology_insights_result = poller.result()
112+
job_response = poller.result()
113+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
113114
self.display_complete_order_discrepancy(radiology_insights_result)
114115
except Exception as ex:
115116
print(str(ex))

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_complete_order_discrespancy_inference_async.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,15 @@ async def radiology_insights_async(self) -> None:
103103

104104
# Construct the request with the patient and configuration
105105
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
106-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
106+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
107107

108108
try:
109109
poller = await radiology_insights_client.begin_infer_radiology_insights(
110110
id=job_id,
111111
resource=job_data,
112112
)
113-
radiology_insights_result = await poller.result()
113+
job_response = await poller.result()
114+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
114115
self.display_complete_order_discrepancy(radiology_insights_result)
115116
await radiology_insights_client.close()
116117
except Exception as ex:

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,16 @@ def radiology_insights_sync(self) -> None:
9797

9898
# Construct the request with the patient and configuration
9999
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
100-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
100+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
101101

102102
# Health Insights Radiology Insights
103103
try:
104104
poller = radiology_insights_client.begin_infer_radiology_insights(
105105
id=job_id,
106106
resource=job_data,
107107
)
108-
radiology_insights_result = poller.result()
108+
job_response = poller.result()
109+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
109110
self.display_critical_results(radiology_insights_result)
110111
except Exception as ex:
111112
print(str(ex))

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_finding_inference.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,16 @@ def radiology_insights_sync(self) -> None:
107107

108108
# Construct the request with the patient and configuration
109109
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
110-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
110+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
111111

112112
# Health Insights Radiology Insights
113113
try:
114114
poller = radiology_insights_client.begin_infer_radiology_insights(
115115
id=job_id,
116116
resource=job_data,
117117
)
118-
radiology_insights_result = poller.result()
118+
job_response = poller.result()
119+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
119120
self.display_finding(radiology_insights_result)
120121
except Exception as ex:
121122
print(str(ex))

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_finding_inference_async.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ async def radiology_insights_async(self) -> None:
109109

110110
# Construct the request with the patient and configuration
111111
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
112-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
112+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
113113

114114
try:
115115
poller = await radiology_insights_client.begin_infer_radiology_insights(
116116
id=job_id,
117117
resource=job_data,
118118
)
119-
radiology_insights_result = await poller.result()
119+
job_response = await poller.result()
120+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
120121
self.display_finding(radiology_insights_result)
121122
await radiology_insights_client.close()
122123
except Exception as ex:

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_communication_inference.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@ def radiology_insights_sync(self) -> None:
101101

102102
# Construct the request with the patient and configuration
103103
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
104-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
104+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
105105

106106
# Health Insights Radiology Insights
107107
try:
108108
poller = radiology_insights_client.begin_infer_radiology_insights(
109109
id=job_id,
110110
resource=job_data,
111111
)
112-
radiology_insights_result = poller.result()
112+
job_response = poller.result()
113+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
113114
self.display_followup_communication(radiology_insights_result)
114115
except Exception as ex:
115116
print(str(ex))
@@ -120,10 +121,16 @@ def display_followup_communication(self,radiology_insights_result):
120121
for ri_inference in patient_result.inferences:
121122
if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_COMMUNICATION:
122123
print(f"Follow-up Communication Inference found")
123-
for datetime in ri_inference.date_time:
124-
print(f"Follow-up Communication: Date Time: {datetime}")
125-
for recepient in ri_inference.recipient:
126-
print(f"Follow-up Communication: Recipient: {recepient}")
124+
if ri_inference.communicated_at is not None:
125+
for communicatedat in ri_inference.communicated_at:
126+
print(f"Follow-up Communication: Date Time: {communicatedat}")
127+
else:
128+
print(f"Follow-up Communication: Date Time: Unknown")
129+
if ri_inference.recipient is not None:
130+
for recepient in ri_inference.recipient:
131+
print(f"Follow-up Communication: Recipient: {recepient}")
132+
else:
133+
print(f"Follow-up Communication: Recipient: Unknown")
127134
print(f"Follow-up Communication: Was Acknowledged: {ri_inference.was_acknowledged}")
128135

129136

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_communication_inference_async.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,15 @@ async def radiology_insights_async(self) -> None:
103103

104104
# Construct the request with the patient and configuration
105105
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
106-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
106+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
107107

108108
try:
109109
poller = await radiology_insights_client.begin_infer_radiology_insights(
110110
id=job_id,
111111
resource=job_data,
112112
)
113-
radiology_insights_result = await poller.result()
113+
job_response = await poller.result()
114+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
114115
self.display_followup_communication(radiology_insights_result)
115116
await radiology_insights_client.close()
116117
except Exception as ex:
@@ -123,10 +124,16 @@ def display_followup_communication(self, radiology_insights_result):
123124
for ri_inference in patient_result.inferences:
124125
if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_COMMUNICATION:
125126
print(f"Follow-up Communication Inference found")
126-
for datetime in ri_inference.date_time:
127-
print(f"Follow-up Communication: Date Time: {datetime}")
128-
for recepient in ri_inference.recipient:
129-
print(f"Follow-up Communication: Recipient: {recepient}")
127+
if ri_inference.communicated_at is not None:
128+
for communicatedat in ri_inference.communicated_at:
129+
print(f"Follow-up Communication: Date Time: {communicatedat}")
130+
else:
131+
print(f"Follow-up Communication: Date Time: Unknown")
132+
if ri_inference.recipient is not None:
133+
for recepient in ri_inference.recipient:
134+
print(f"Follow-up Communication: Recipient: {recepient}")
135+
else:
136+
print(f"Follow-up Communication: Recipient: Unknown")
130137
print(f"Follow-up Communication: Was Acknowledged: {ri_inference.was_acknowledged}")
131138

132139
# [END display_followup_communication]

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_recommendation_inference.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,15 @@ def radiology_insights_sync(self) -> None:
117117

118118
# Construct the request with the patient and configuration
119119
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
120-
120+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
121121
# Health Insights Radiology Insights
122122
try:
123123
poller = radiology_insights_client.begin_infer_radiology_insights(
124-
radiology_insights_data,
124+
id=job_id,
125+
resource=job_data
125126
)
126-
radiology_insights_result = poller.result()
127+
job_response = poller.result()
128+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
127129
self.display_followup_recommendation(radiology_insights_result)
128130
except Exception as ex:
129131
print(str(ex))

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_recommendation_inference_async.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,15 @@ async def radiology_insights_async(self) -> None:
119119

120120
# Construct the request with the patient and configuration
121121
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
122-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
122+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
123123

124124
try:
125125
poller = await radiology_insights_client.begin_infer_radiology_insights(
126126
id=job_id,
127127
resource=job_data,
128128
)
129-
radiology_insights_result = await poller.result()
129+
job_response = await poller.result()
130+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
130131
self.display_followup_recommendation(radiology_insights_result)
131132
await radiology_insights_client.close()
132133
except Exception as ex:

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_laterality_discrepancy_inference.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,16 @@ def radiology_insights_sync(self) -> None:
9191

9292
# Construct the request with the patient and configuration
9393
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
94-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
94+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
9595

9696
# Health Insights Radiology Insights
9797
try:
9898
poller = radiology_insights_client.begin_infer_radiology_insights(
9999
id=job_id,
100100
resource=job_data,
101101
)
102-
radiology_insights_result = poller.result()
102+
job_response = poller.result()
103+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
103104
self.display_laterality_discrepancy(radiology_insights_result)
104105
except Exception as ex:
105106
print(str(ex))

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_laterality_discrepancy_inference_async.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ async def radiology_insights_async(self) -> None:
9393

9494
# Construct the request with the patient and configuration
9595
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
96-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
96+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
9797

9898
try:
9999
poller = await radiology_insights_client.begin_infer_radiology_insights(
100100
id=job_id,
101101
resource=job_data,
102102
)
103-
radiology_insights_result = await poller.result()
103+
job_response = await poller.result()
104+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
104105
self.display_laterality_discrepancy(radiology_insights_result)
105106
await radiology_insights_client.close()
106107
except Exception as ex:

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_limited_order_discrepancy_inference.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,16 @@ def radiology_insights_sync(self) -> None:
9898

9999
# Construct the request with the patient and configuration
100100
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
101-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
101+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
102102

103103
# Health Insights Radiology Insights
104104
try:
105105
poller = radiology_insights_client.begin_infer_radiology_insights(
106106
id=job_id,
107107
resource=job_data,
108108
)
109-
radiology_insights_result = poller.result()
109+
job_response = poller.result()
110+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
110111
self.display_limited_order_discrepancy(radiology_insights_result)
111112
except Exception as ex:
112113
print(str(ex))

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_limited_order_discrepancy_inference_async.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ async def radiology_insights_async(self) -> None:
100100

101101
# Construct the request with the patient and configuration
102102
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
103-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
103+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
104104

105105
try:
106106
poller = await radiology_insights_client.begin_infer_radiology_insights(
107107
id=job_id,
108108
resource=job_data,
109109
)
110-
radiology_insights_result = await poller.result()
110+
job_response = await poller.result()
111+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
111112
self.display_limited_order_discrepancy(radiology_insights_result)
112113
await radiology_insights_client.close()
113114
except Exception as ex:

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_radiology_procedure_inference.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,16 @@ def radiology_insights_sync(self) -> None:
9898

9999
# Construct the request with the patient and configuration
100100
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
101-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
101+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
102102

103103
# Health Insights Radiology Insights
104104
try:
105105
poller = radiology_insights_client.begin_infer_radiology_insights(
106106
id=job_id,
107107
resource=job_data,
108108
)
109-
radiology_insights_result = poller.result()
109+
job_response = poller.result()
110+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
110111
self.display_radiology_procedure(radiology_insights_result)
111112
except Exception as ex:
112113
print(str(ex))

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_radiology_procedure_inference_async.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async def radiology_insights_async(self) -> None:
3636
KEY = os.environ["AZURE_HEALTH_INSIGHTS_API_KEY"]
3737
ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"]
3838

39+
3940
job_id = str(uuid.uuid4())
4041

4142
radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential=AzureKeyCredential(KEY))
@@ -100,14 +101,15 @@ async def radiology_insights_async(self) -> None:
100101

101102
# Construct the request with the patient and configuration
102103
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
103-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
104+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
104105

105106
try:
106107
poller = await radiology_insights_client.begin_infer_radiology_insights(
107108
id=job_id,
108109
resource=job_data,
109110
)
110-
radiology_insights_result = await poller.result()
111+
job_response = await poller.result()
112+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
111113
self.display_radiology_procedure(radiology_insights_result)
112114
await radiology_insights_client.close()
113115
except Exception as ex:

sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_sex_mismatch_inference.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,16 @@ def radiology_insights_sync(self) -> None:
9696

9797
# Construct the request with the patient and configuration
9898
radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration)
99-
job_data = models.RadiologyInsightsJob(radiology_insights_data)
99+
job_data = models.RadiologyInsightsJob(job_data=radiology_insights_data)
100100

101101
# Health Insights Radiology Insights
102102
try:
103103
poller = radiology_insights_client.begin_infer_radiology_insights(
104104
id=job_id,
105105
resource=job_data,
106106
)
107-
radiology_insights_result = poller.result()
107+
job_response = poller.result()
108+
radiology_insights_result = models.RadiologyInsightsInferenceResult(job_response)
108109
self.display_sex_mismatch(radiology_insights_result)
109110
except Exception as ex:
110111
print(str(ex))

0 commit comments

Comments
 (0)