@azure-rest/health-insights-radiologyinsights 1.0.0-beta.1 → 2.0.0-alpha.20250604.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/LICENSE +21 -0
  3. package/README.md +902 -181
  4. package/dist/browser/azureHealthInsightsClient.d.ts +16 -0
  5. package/dist/browser/azureHealthInsightsClient.d.ts.map +1 -0
  6. package/dist/browser/azureHealthInsightsClient.js +46 -0
  7. package/dist/browser/azureHealthInsightsClient.js.map +1 -0
  8. package/dist/browser/clientDefinitions.d.ts +21 -0
  9. package/dist/browser/clientDefinitions.d.ts.map +1 -0
  10. package/dist/browser/clientDefinitions.js +4 -0
  11. package/dist/browser/clientDefinitions.js.map +1 -0
  12. package/dist/browser/index.d.ts +11 -0
  13. package/dist/browser/index.d.ts.map +1 -0
  14. package/dist/browser/index.js +14 -0
  15. package/dist/browser/index.js.map +1 -0
  16. package/dist/browser/isUnexpected.d.ts +6 -0
  17. package/dist/browser/isUnexpected.d.ts.map +1 -0
  18. package/{dist-esm/src → dist/browser}/isUnexpected.js +3 -3
  19. package/dist/browser/isUnexpected.js.map +1 -0
  20. package/dist/browser/logger.d.ts +2 -0
  21. package/dist/browser/logger.d.ts.map +1 -0
  22. package/{dist-esm/src → dist/browser}/logger.js +1 -1
  23. package/{dist-esm/src → dist/browser}/logger.js.map +1 -1
  24. package/dist/browser/models.d.ts +1031 -0
  25. package/dist/browser/models.d.ts.map +1 -0
  26. package/dist/browser/models.js +4 -0
  27. package/dist/browser/models.js.map +1 -0
  28. package/dist/browser/outputModels.d.ts +1061 -0
  29. package/dist/browser/outputModels.d.ts.map +1 -0
  30. package/dist/browser/outputModels.js +4 -0
  31. package/dist/browser/outputModels.js.map +1 -0
  32. package/dist/browser/package.json +3 -0
  33. package/dist/browser/parameters.d.ts +50 -0
  34. package/dist/browser/parameters.d.ts.map +1 -0
  35. package/dist/browser/parameters.js +4 -0
  36. package/dist/browser/parameters.js.map +1 -0
  37. package/dist/browser/pollingHelper.d.ts +77 -0
  38. package/dist/browser/pollingHelper.d.ts.map +1 -0
  39. package/dist/browser/pollingHelper.js +97 -0
  40. package/dist/browser/pollingHelper.js.map +1 -0
  41. package/dist/browser/responses.d.ts +91 -0
  42. package/dist/browser/responses.d.ts.map +1 -0
  43. package/dist/browser/responses.js +4 -0
  44. package/dist/browser/responses.js.map +1 -0
  45. package/dist/commonjs/azureHealthInsightsClient.d.ts +16 -0
  46. package/dist/commonjs/azureHealthInsightsClient.d.ts.map +1 -0
  47. package/dist/commonjs/azureHealthInsightsClient.js +49 -0
  48. package/dist/commonjs/azureHealthInsightsClient.js.map +1 -0
  49. package/dist/commonjs/clientDefinitions.d.ts +21 -0
  50. package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
  51. package/dist/commonjs/clientDefinitions.js +5 -0
  52. package/dist/commonjs/clientDefinitions.js.map +1 -0
  53. package/dist/commonjs/index.d.ts +11 -0
  54. package/dist/commonjs/index.d.ts.map +1 -0
  55. package/dist/commonjs/index.js +17 -0
  56. package/dist/commonjs/index.js.map +1 -0
  57. package/dist/commonjs/isUnexpected.d.ts +6 -0
  58. package/dist/commonjs/isUnexpected.d.ts.map +1 -0
  59. package/dist/commonjs/isUnexpected.js +75 -0
  60. package/dist/commonjs/isUnexpected.js.map +1 -0
  61. package/dist/commonjs/logger.d.ts +2 -0
  62. package/dist/commonjs/logger.d.ts.map +1 -0
  63. package/dist/commonjs/logger.js +8 -0
  64. package/dist/commonjs/logger.js.map +1 -0
  65. package/dist/commonjs/models.d.ts +1031 -0
  66. package/dist/commonjs/models.d.ts.map +1 -0
  67. package/dist/commonjs/models.js +5 -0
  68. package/dist/commonjs/models.js.map +1 -0
  69. package/dist/commonjs/outputModels.d.ts +1061 -0
  70. package/dist/commonjs/outputModels.d.ts.map +1 -0
  71. package/dist/commonjs/outputModels.js +5 -0
  72. package/dist/commonjs/outputModels.js.map +1 -0
  73. package/dist/commonjs/package.json +3 -0
  74. package/dist/commonjs/parameters.d.ts +50 -0
  75. package/dist/commonjs/parameters.d.ts.map +1 -0
  76. package/dist/commonjs/parameters.js +5 -0
  77. package/dist/commonjs/parameters.js.map +1 -0
  78. package/dist/commonjs/pollingHelper.d.ts +77 -0
  79. package/dist/commonjs/pollingHelper.d.ts.map +1 -0
  80. package/dist/commonjs/pollingHelper.js +100 -0
  81. package/dist/commonjs/pollingHelper.js.map +1 -0
  82. package/dist/commonjs/responses.d.ts +91 -0
  83. package/dist/commonjs/responses.d.ts.map +1 -0
  84. package/dist/commonjs/responses.js +5 -0
  85. package/dist/commonjs/responses.js.map +1 -0
  86. package/dist/commonjs/tsdoc-metadata.json +11 -0
  87. package/dist/esm/azureHealthInsightsClient.d.ts +16 -0
  88. package/dist/esm/azureHealthInsightsClient.d.ts.map +1 -0
  89. package/dist/esm/azureHealthInsightsClient.js +46 -0
  90. package/dist/esm/azureHealthInsightsClient.js.map +1 -0
  91. package/dist/esm/clientDefinitions.d.ts +21 -0
  92. package/dist/esm/clientDefinitions.d.ts.map +1 -0
  93. package/dist/esm/clientDefinitions.js +4 -0
  94. package/dist/esm/clientDefinitions.js.map +1 -0
  95. package/dist/esm/index.d.ts +11 -0
  96. package/dist/esm/index.d.ts.map +1 -0
  97. package/dist/esm/index.js +14 -0
  98. package/dist/esm/index.js.map +1 -0
  99. package/dist/esm/isUnexpected.d.ts +6 -0
  100. package/dist/esm/isUnexpected.d.ts.map +1 -0
  101. package/dist/esm/isUnexpected.js +72 -0
  102. package/dist/esm/isUnexpected.js.map +1 -0
  103. package/dist/esm/logger.d.ts +2 -0
  104. package/dist/esm/logger.d.ts.map +1 -0
  105. package/dist/esm/logger.js +5 -0
  106. package/dist/esm/logger.js.map +1 -0
  107. package/dist/esm/models.d.ts +1031 -0
  108. package/dist/esm/models.d.ts.map +1 -0
  109. package/dist/esm/models.js +4 -0
  110. package/dist/esm/models.js.map +1 -0
  111. package/dist/esm/outputModels.d.ts +1061 -0
  112. package/dist/esm/outputModels.d.ts.map +1 -0
  113. package/dist/esm/outputModels.js +4 -0
  114. package/dist/esm/outputModels.js.map +1 -0
  115. package/dist/esm/package.json +3 -0
  116. package/dist/esm/parameters.d.ts +50 -0
  117. package/dist/esm/parameters.d.ts.map +1 -0
  118. package/dist/esm/parameters.js +4 -0
  119. package/dist/esm/parameters.js.map +1 -0
  120. package/dist/esm/pollingHelper.d.ts +77 -0
  121. package/dist/esm/pollingHelper.d.ts.map +1 -0
  122. package/dist/esm/pollingHelper.js +97 -0
  123. package/dist/esm/pollingHelper.js.map +1 -0
  124. package/dist/esm/responses.d.ts +91 -0
  125. package/dist/esm/responses.d.ts.map +1 -0
  126. package/dist/esm/responses.js +4 -0
  127. package/dist/esm/responses.js.map +1 -0
  128. package/dist/react-native/azureHealthInsightsClient.d.ts +16 -0
  129. package/dist/react-native/azureHealthInsightsClient.d.ts.map +1 -0
  130. package/dist/react-native/azureHealthInsightsClient.js +46 -0
  131. package/dist/react-native/azureHealthInsightsClient.js.map +1 -0
  132. package/dist/react-native/clientDefinitions.d.ts +21 -0
  133. package/dist/react-native/clientDefinitions.d.ts.map +1 -0
  134. package/dist/react-native/clientDefinitions.js +4 -0
  135. package/dist/react-native/clientDefinitions.js.map +1 -0
  136. package/dist/react-native/index.d.ts +11 -0
  137. package/dist/react-native/index.d.ts.map +1 -0
  138. package/dist/react-native/index.js +14 -0
  139. package/dist/react-native/index.js.map +1 -0
  140. package/dist/react-native/isUnexpected.d.ts +6 -0
  141. package/dist/react-native/isUnexpected.d.ts.map +1 -0
  142. package/dist/react-native/isUnexpected.js +72 -0
  143. package/dist/react-native/isUnexpected.js.map +1 -0
  144. package/dist/react-native/logger.d.ts +2 -0
  145. package/dist/react-native/logger.d.ts.map +1 -0
  146. package/dist/react-native/logger.js +5 -0
  147. package/dist/react-native/logger.js.map +1 -0
  148. package/dist/react-native/models.d.ts +1031 -0
  149. package/dist/react-native/models.d.ts.map +1 -0
  150. package/dist/react-native/models.js +4 -0
  151. package/dist/react-native/models.js.map +1 -0
  152. package/dist/react-native/outputModels.d.ts +1061 -0
  153. package/dist/react-native/outputModels.d.ts.map +1 -0
  154. package/dist/react-native/outputModels.js +4 -0
  155. package/dist/react-native/outputModels.js.map +1 -0
  156. package/dist/react-native/package.json +3 -0
  157. package/dist/react-native/parameters.d.ts +50 -0
  158. package/dist/react-native/parameters.d.ts.map +1 -0
  159. package/dist/react-native/parameters.js +4 -0
  160. package/dist/react-native/parameters.js.map +1 -0
  161. package/dist/react-native/pollingHelper.d.ts +77 -0
  162. package/dist/react-native/pollingHelper.d.ts.map +1 -0
  163. package/dist/react-native/pollingHelper.js +97 -0
  164. package/dist/react-native/pollingHelper.js.map +1 -0
  165. package/dist/react-native/responses.d.ts +91 -0
  166. package/dist/react-native/responses.d.ts.map +1 -0
  167. package/dist/react-native/responses.js +4 -0
  168. package/dist/react-native/responses.js.map +1 -0
  169. package/package.json +79 -68
  170. package/review/health-insights-radiologyinsights.api.md +581 -168
  171. package/dist/index.js +0 -159
  172. package/dist/index.js.map +0 -1
  173. package/dist-esm/src/azureHealthInsightsClient.js +0 -28
  174. package/dist-esm/src/azureHealthInsightsClient.js.map +0 -1
  175. package/dist-esm/src/clientDefinitions.js +0 -4
  176. package/dist-esm/src/clientDefinitions.js.map +0 -1
  177. package/dist-esm/src/index.js +0 -13
  178. package/dist-esm/src/index.js.map +0 -1
  179. package/dist-esm/src/isUnexpected.js.map +0 -1
  180. package/dist-esm/src/models.js +0 -4
  181. package/dist-esm/src/models.js.map +0 -1
  182. package/dist-esm/src/outputModels.js +0 -4
  183. package/dist-esm/src/outputModels.js.map +0 -1
  184. package/dist-esm/src/parameters.js +0 -4
  185. package/dist-esm/src/parameters.js.map +0 -1
  186. package/dist-esm/src/pollingHelper.js +0 -43
  187. package/dist-esm/src/pollingHelper.js.map +0 -1
  188. package/dist-esm/src/responses.js +0 -4
  189. package/dist-esm/src/responses.js.map +0 -1
package/README.md CHANGED
@@ -7,14 +7,7 @@
7
7
  **Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**
8
8
 
9
9
  Key links:
10
-
11
- Key links:
12
-
13
- - [Source code]
14
- - [Package (NPM)]
15
- - [API reference documentation]
16
- - [Product Information](https://docs.microsoft.com/rest/api/maps/route)
17
- - [Samples]
10
+ [Source code] | [Package (NPM)] | [API reference documentation] | [Product Information] | [Samples]
18
11
 
19
12
  ## Getting started
20
13
 
@@ -39,10 +32,6 @@ npm install @azure-rest/health-insights-radiologyinsights
39
32
 
40
33
  ### Create and authenticate a `RadiologyInsightsClient`
41
34
 
42
- |SDK version|Supported API version of service |
43
- |-------------|---------------|
44
- |1.0.0-beta.1 | 2024-01-19-preview|
45
-
46
35
  To use an [Azure Active Directory (AAD) token credential][token_credential],
47
36
  provide an instance of the desired credential type obtained from the [Azure Identity library][azure_identity].
48
37
 
@@ -50,214 +39,939 @@ To authenticate with AAD, you must first `npm` install [`@azure/identity`][ident
50
39
 
51
40
  After setup, you can choose which type of [credential][credential] from `@azure/identity` to use.
52
41
  As an example, [DefaultAzureCredential][defaultazurecredential]
53
- can be used to authenticate the client.
54
-
55
- Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
56
- AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
42
+ can be used to authenticate the client. See more info on defaultAzureCredentials [default_information].
43
+ Managed Identities can also be used to authenticate through DefaultAzureCredential [managed_identity].
57
44
 
58
45
  ## Examples
59
46
 
60
47
  ### Create a RadiologyInsights asynchronous client
61
48
 
62
- ```typescript
63
- const apiKey = process.env["HEALTH_INSIGHTS_API_KEY"] || "";
64
- const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || "";
65
- const credential = new AzureKeyCredential(apiKey);
49
+ ```ts snippet:ReadmeSampleCreateClient_Node
50
+ import { DefaultAzureCredential } from "@azure/identity";
51
+ import RadiologyInsightsRestClient from "@azure-rest/health-insights-radiologyinsights";
52
+
53
+ const endpoint = "https://<your-endpoint>";
54
+ const credential = new DefaultAzureCredential();
66
55
  const client = RadiologyInsightsRestClient(endpoint, credential);
67
56
  ```
68
57
 
69
- ### Build a request, send it to the client and print the description of a Critical Result Inference
58
+ ### Build a request, send it to the client and print out the description of a Critical Result Inference
59
+
60
+ ```ts snippet:ReadmeSampleCriticalResultInference
61
+ import { DefaultAzureCredential } from "@azure/identity";
62
+ import RadiologyInsightsRestClient, {
63
+ ClinicalDocumentTypeEnum,
64
+ isUnexpected,
65
+ getLongRunningPoller,
66
+ RadiologyProcedureInference,
67
+ Coding,
68
+ ImagingProcedure,
69
+ } from "@azure-rest/health-insights-radiologyinsights";
70
+
71
+ const endpoint = "https://<your-endpoint>";
72
+ const credential = new DefaultAzureCredential();
73
+ const client = RadiologyInsightsRestClient(endpoint, credential);
70
74
 
71
- ```typescript
75
+ const codingData = {
76
+ system: "Http://hl7.org/fhir/ValueSet/cpt-all",
77
+ code: "24727-0",
78
+ display: "CT HEAD W CONTRAST IV",
79
+ };
80
+
81
+ const code = {
82
+ coding: [codingData],
83
+ };
84
+
85
+ const patientInfo = {
86
+ sex: "female",
87
+ birthDate: new Date("1959-11-11T19:00:00+00:00"),
88
+ };
89
+
90
+ const encounterData = {
91
+ id: "encounterid1",
92
+ period: {
93
+ start: "2021-8-28T00:00:00",
94
+ end: "2021-8-28T00:00:00",
95
+ },
96
+ class: "inpatient",
97
+ };
98
+
99
+ const authorData = {
100
+ id: "authorid1",
101
+ fullName: "authorname1",
102
+ };
103
+
104
+ const orderedProceduresData = {
105
+ code: code,
106
+ description: "CT HEAD W CONTRAST IV",
107
+ };
108
+
109
+ const administrativeMetadata = {
110
+ orderedProcedures: [orderedProceduresData],
111
+ encounterId: "encounterid1",
112
+ };
113
+
114
+ const content = {
115
+ sourceType: "inline",
116
+ value: ` Exam: Head CT with Contrast
117
+
118
+ History: Headaches for 2 months
119
+ Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast.
120
+ IV contrast: 100 mL IV Omnipaque 300.
121
+
122
+ Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast.
123
+ However, there is no evidence of enhancing lesion in either internal auditory canal.
124
+ Impression: Negative CT of the brain without IV contrast.
125
+ I recommend a new brain CT within nine months.`,
126
+ };
127
+
128
+ const patientDocumentData = {
129
+ type: "note",
130
+ clinicalType: ClinicalDocumentTypeEnum.RadiologyReport,
131
+ id: "docid1",
132
+ language: "en",
133
+ authors: [authorData],
134
+ specialtyType: "radiology",
135
+ administrativeMetadata: administrativeMetadata,
136
+ content: content,
137
+ createdAt: new Date("2021-05-31T16:00:00.000Z"),
138
+ orderedProceduresAsCsv: "CT HEAD W CONTRAST IV",
139
+ };
140
+
141
+ const patientData = {
142
+ id: "Samantha Jones",
143
+ details: patientInfo,
144
+ encounters: [encounterData],
145
+ patientDocuments: [patientDocumentData],
146
+ };
147
+
148
+ const inferenceTypes = [
149
+ "finding",
150
+ "ageMismatch",
151
+ "lateralityDiscrepancy",
152
+ "sexMismatch",
153
+ "completeOrderDiscrepancy",
154
+ "limitedOrderDiscrepancy",
155
+ "criticalResult",
156
+ "criticalRecommendation",
157
+ "followupRecommendation",
158
+ "followupCommunication",
159
+ "radiologyProcedure",
160
+ ];
161
+
162
+ const followupRecommendationOptions = {
163
+ includeRecommendationsWithNoSpecifiedModality: true,
164
+ includeRecommendationsInReferences: true,
165
+ provideFocusedSentenceEvidence: true,
166
+ };
167
+
168
+ const findingOptions = {
169
+ provideFocusedSentenceEvidence: true,
170
+ };
171
+
172
+ //the mipscodes (“merit based payment incentive”) need to be filled in for which the qualityMeasure is checked
173
+ const qualityMeasureOptions = {
174
+ measureTypes: ["mipsxxx", "mipsyyy", "mipszz"],
175
+ };
176
+
177
+ const guidanceOptions = {
178
+ showGuidanceInHistory: true,
179
+ };
180
+
181
+ const inferenceOptions = {
182
+ followupRecommendationOptions: followupRecommendationOptions,
183
+ findingOptions: findingOptions,
184
+ GuidanceOptions: guidanceOptions,
185
+ QualityMeasureOptions: qualityMeasureOptions,
186
+ };
187
+
188
+ // Create RI Configuration
189
+ const configuration = {
190
+ inferenceOptions: inferenceOptions,
191
+ inferenceTypes: inferenceTypes,
192
+ locale: "en-US",
193
+ verbose: false,
194
+ includeEvidence: true,
195
+ };
196
+
197
+ // create RI Data
198
+ const radiologyInsightsJob = {
199
+ jobData: {
200
+ patients: [patientData],
201
+ configuration: configuration,
202
+ },
203
+ };
204
+
205
+ // Create request body
206
+ const radiologyInsightsParameter = { body: radiologyInsightsJob };
207
+
208
+ // Initiate radiology insights job and retrieve results
209
+ const dateString = Date.now();
210
+ const jobID = "jobId-" + dateString;
211
+ const initialResponse = await client
212
+ .path("/radiology-insights/jobs/{id}", jobID)
213
+ .put(radiologyInsightsParameter);
214
+
215
+ if (isUnexpected(initialResponse)) {
216
+ throw initialResponse.body.error;
217
+ }
72
218
 
73
- export async function main() {
74
- const credential = new AzureKeyCredential(apiKey);
75
- const client = AzureHealthInsightsClient(endpoint, credential);
219
+ const poller = await getLongRunningPoller(client, initialResponse);
220
+ const radiologyInsightsResult = await poller.pollUntilDone();
76
221
 
77
- // Create request body
78
- const radiologyInsightsParameter = createRequestBody();
222
+ if (isUnexpected(radiologyInsightsResult)) {
223
+ throw radiologyInsightsResult.body.error;
224
+ }
79
225
 
80
- // Initiate radiology insights job and retrieve results
81
- const initialResponse = await client.path("/radiology-insights/jobs").post(radiologyInsightsParameter);
82
- if (isUnexpected(initialResponse)) {
83
- throw initialResponse;
226
+ const result = radiologyInsightsResult.body.result;
227
+
228
+ if (result) {
229
+ for (const patientResult of result.patientResults) {
230
+ if (patientResult.inferences) {
231
+ for (const inference of patientResult.inferences) {
232
+ if (inference.kind === "radiologyProcedure") {
233
+ console.log("Radiology Procedure Inference found");
234
+ const radiologyProcedureInference = inference as RadiologyProcedureInference;
235
+ for (const procedureCode of radiologyProcedureInference?.procedureCodes || []) {
236
+ console.log(" Procedure Codes: ");
237
+ displayCodes(procedureCode.coding);
238
+ }
239
+
240
+ if (radiologyProcedureInference.imagingProcedures) {
241
+ console.log(" Imaging Procedure Codes: ");
242
+ for (const imagingProcedure of radiologyProcedureInference.imagingProcedures) {
243
+ displayImaging(imagingProcedure);
244
+ }
245
+ }
246
+
247
+ if (radiologyProcedureInference.orderedProcedure) {
248
+ console.log(" Ordered Procedure Codes: ");
249
+ displayCodes(radiologyProcedureInference.orderedProcedure.code?.coding);
250
+ }
251
+
252
+ if (radiologyProcedureInference.orderedProcedure.description) {
253
+ console.log(
254
+ ` Description: ${radiologyProcedureInference.orderedProcedure.description}`,
255
+ );
256
+ }
257
+ }
258
+ }
259
+ }
84
260
  }
85
- const poller = await getLongRunningPoller(client, initialResponse);
86
- const RadiologyInsightsResult = await poller.pollUntilDone();
87
- if (isUnexpected(RadiologyInsightsResult)) {
88
- throw RadiologyInsightsResult;
261
+ }
262
+
263
+ function displayCodes(codingList: Coding[] | undefined) {
264
+ for (const coding of codingList || []) {
265
+ console.log(` Coding: ${coding.code} , ${coding.display} (${coding.system})`);
89
266
  }
90
- const resultBody = RadiologyInsightsResult.body;
91
- printResults(resultBody);
92
267
  }
93
268
 
94
- function createRequestBody(): CreateJobParameters {
269
+ function displayImaging(images: ImagingProcedure): void {
270
+ console.log(" Modality Codes: ");
271
+ displayCodes(images.modality.coding);
272
+ console.log(" Anatomy Codes: ");
273
+ displayCodes(images.anatomy.coding);
274
+ if (images.laterality) {
275
+ console.log(" Laterality Codes: ");
276
+ displayCodes(images.laterality.coding);
277
+ }
278
+ if (images.contrast) {
279
+ console.log(" Contrast Codes: ");
280
+ displayCodes(images.contrast.code.coding);
281
+ }
282
+ if (images.view) {
283
+ console.log(" View Codes: ");
284
+ displayCodes(images.view.code.coding);
285
+ }
286
+ }
287
+ ```
95
288
 
96
- const codingData = {
97
- system: "Http://hl7.org/fhir/ValueSet/cpt-all",
98
- code: "USPELVIS",
99
- display: "US PELVIS COMPLETE"
100
- };
289
+ ### Print out the Age Mismatch Inference evidences
290
+
291
+ ```ts snippet:ReadmeSampleAgeMismatch
292
+ import {
293
+ RadiologyInsightsJobOutput,
294
+ ExtensionOutput,
295
+ } from "@azure-rest/health-insights-radiologyinsights";
296
+
297
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput, content: string): void {
298
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
299
+ for (const inference of patientResult?.inferences || []) {
300
+ if (inference.kind === "ageMismatch") {
301
+ console.log("Age Mismatch Inference found: ");
302
+ const evidence = findAgeEvidence(inference.extension, content);
303
+ console.log(" Evidence: " + evidence);
304
+ }
305
+ }
306
+ }
101
307
 
102
- const code = {
103
- coding: [codingData]
104
- };
308
+ function findAgeEvidence(extensions: ExtensionOutput[], content: string) {
309
+ let offset = -1;
310
+ let length = -1;
311
+ let piece = "";
312
+ let evidence = "";
313
+ // for loop needed for traversing from top to bottom of the array
314
+ for (const first of extensions) {
315
+ for (const ext of first.extension) {
316
+ if (ext.url === "offset") {
317
+ offset = ext.valueInteger;
318
+ } else if (ext.url === "length") {
319
+ length = ext.valueInteger;
320
+ }
321
+ if (offset > 0 && length > 0) {
322
+ piece = content.substring(offset, offset + length);
323
+ }
324
+ }
325
+ evidence += `${piece} `;
326
+ }
327
+ return evidence;
328
+ }
329
+ }
330
+ ```
105
331
 
106
- const patientInfo = {
107
- sex: "female",
108
- birthDate: new Date("1959-11-11T19:00:00+00:00"),
109
- };
332
+ ### Print out the Complete Order Discrepancy Inference ordertype and its missing Body Parts and missing Body Part Measurements
333
+
334
+ ```ts snippet:ReadmeSampleCompleteOrderDiscrepancy
335
+ import {
336
+ RadiologyInsightsJobOutput,
337
+ CompleteOrderDiscrepancyInference,
338
+ CodeableConcept,
339
+ } from "@azure-rest/health-insights-radiologyinsights";
340
+
341
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
342
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
343
+ for (const inference of patientResult?.inferences || []) {
344
+ if (inference.kind === "completeOrderDiscrepancy") {
345
+ const completeOrderDiscrepancyInference = inference as CompleteOrderDiscrepancyInference;
346
+ console.log("Complete Order Discrepancy Inference found: ");
347
+ console.log(" Ordertype: ");
348
+ displayCodes({ codeableConcept: completeOrderDiscrepancyInference.orderType });
349
+
350
+ for (const missingBodyPart of completeOrderDiscrepancyInference.missingBodyParts) {
351
+ console.log(" Missing Body Parts: ");
352
+ displayCodes({ codeableConcept: missingBodyPart });
353
+ }
110
354
 
111
- const encounterData = {
112
- id: "encounterid1",
113
- period: {
114
- "start": "2021-8-28T00:00:00",
115
- "end": "2021-8-28T00:00:00"
116
- },
117
- class: "inpatient"
118
- };
119
-
120
- const authorData = {
121
- "id": "authorid1",
122
- "name": "authorname1"
123
- };
124
-
125
- const orderedProceduresData = {
126
- code: code,
127
- description: "US PELVIS COMPLETE"
128
- };
129
-
130
- const administrativeMetadata = {
131
- orderedProcedures: [orderedProceduresData],
132
- encounterId: "encounterid1"
133
- };
134
-
135
- const content = {
136
- sourceType: "inline",
137
- value: "CLINICAL HISTORY: "
138
- + "\r\n20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy."
139
- + "\r\n "
140
- + "\r\nCOMPARISON: "
141
- + "\r\nRight upper quadrant sonographic performed 1 day prior."
142
- + "\r\n "
143
- + "\r\nTECHNIQUE: "
144
- + "\r\nTransabdominal grayscale pelvic sonography with duplex color Doppler "
145
- + "\r\nand spectral waveform analysis of the ovaries."
146
- + "\r\n "
147
- + "\r\nFINDINGS: "
148
- + "\r\nThe uterus is unremarkable given the transabdominal technique with "
149
- + "\r\nendometrial echo complex within physiologic normal limits. The "
150
- + "\r\novaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the "
151
- + "\r\nleft measuring 2.8 x 1.5 x 1.9 cm.\n \r\nOn duplex imaging, Doppler signal is symmetric."
152
- + "\r\n "
153
- + "\r\nIMPRESSION: "
154
- + "\r\n1. Normal pelvic sonography. Findings of testicular torsion."
155
- + "\r\n\nA new US pelvis within the next 6 months is recommended."
156
- + "\n\nThese results have been discussed with Dr. Jones at 3 PM on November 5 2020.\n "
157
- + "\r\n"
158
- };
159
-
160
- const patientDocumentData = {
161
- type: "note",
162
- clinicalType: "radiologyReport",
163
- id: "docid1",
164
- language: "en",
165
- authors: [authorData],
166
- specialtyType: "radiology",
167
- administrativeMetadata: administrativeMetadata,
168
- content: content,
169
- createdDateTime: new Date("2021-06-01T00:00:00.000"),
170
- orderedProceduresAsCsv: "US PELVIS COMPLETE"
171
- };
172
-
173
-
174
- const patientData = {
175
- id: "Samantha Jones",
176
- info: patientInfo,
177
- encounters: [encounterData],
178
- patientDocuments: [patientDocumentData]
179
- };
180
-
181
- const inferenceTypes = [
182
- "finding",
183
- "ageMismatch",
184
- "lateralityDiscrepancy",
185
- "sexMismatch",
186
- "completeOrderDiscrepancy",
187
- "limitedOrderDiscrepancy",
188
- "criticalResult",
189
- "criticalRecommendation",
190
- "followupRecommendation",
191
- "followupCommunication",
192
- "radiologyProcedure"];
193
-
194
- const followupRecommendationOptions = {
195
- includeRecommendationsWithNoSpecifiedModality: true,
196
- includeRecommendationsInReferences: true,
197
- provideFocusedSentenceEvidence: true
198
- };
199
-
200
- const findingOptions = {
201
- provideFocusedSentenceEvidence: true
202
- };
203
-
204
- const inferenceOptions = {
205
- followupRecommendationOptions: followupRecommendationOptions,
206
- findingOptions: findingOptions
207
- };
208
-
209
- const configuration = {
210
- inferenceOptions: inferenceOptions,
211
- inferenceTypes: inferenceTypes,
212
- locale: "en-US",
213
- verbose: false,
214
- includeEvidence: true
215
- };
216
-
217
- const radiologyInsightsData = {
218
- patients: [patientData],
219
- configuration: configuration
220
- };
355
+ for (const missingBodymeasure of completeOrderDiscrepancyInference.missingBodyPartMeasurements) {
356
+ console.log(" Missing Body Part Measurements: ");
357
+ displayCodes({ codeableConcept: missingBodymeasure });
358
+ }
359
+ }
360
+ }
361
+ }
362
+
363
+ function displayCodes({ codeableConcept }: { codeableConcept: CodeableConcept }): void {
364
+ for (const coding of codeableConcept.coding || []) {
365
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
366
+ }
367
+ }
368
+ }
369
+ ```
370
+
371
+ ### Print out the Finding Inference code, interpretation, Component codes and the section info
372
+
373
+ ```ts snippet:ReadmeSampleFindingInference
374
+ import {
375
+ RadiologyInsightsJobOutput,
376
+ FindingInference,
377
+ CodeableConcept,
378
+ Extension,
379
+ } from "@azure-rest/health-insights-radiologyinsights";
380
+
381
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
382
+ if (radiologyInsightsResult.result) {
383
+ for (const patientResult of radiologyInsightsResult.result.patientResults) {
384
+ if (patientResult.inferences) {
385
+ for (const inference of patientResult.inferences) {
386
+ console.log("Finding Inference found: ");
387
+ if (inference.kind === "finding") {
388
+ const findingInference = inference as FindingInference;
389
+
390
+ if (findingInference.finding.code) {
391
+ console.log(" Code: ");
392
+ displayCodes(findingInference.finding.code);
393
+ }
394
+
395
+ for (const interpretation of findingInference.finding.interpretation) {
396
+ console.log(" Interpretation: ");
397
+ displayCodes(interpretation);
398
+ }
399
+
400
+ for (const component of findingInference.finding.component) {
401
+ console.log(" Component code: ");
402
+ displayCodes(component.code);
403
+ if (component.valueCodeableConcept) {
404
+ console.log(" Value component codeable concept: ");
405
+ displayCodes(component.valueCodeableConcept);
406
+ }
407
+ }
408
+
409
+ if (findingInference.extension) {
410
+ displaySectionInfo(findingInference);
411
+ }
412
+ }
413
+ }
414
+ }
415
+ }
416
+ }
221
417
 
222
- return {
223
- body: radiologyInsightsData
418
+ function displayCodes(codeableConcept: CodeableConcept): void {
419
+ for (const coding of codeableConcept.coding || []) {
420
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
421
+ }
224
422
  }
225
423
 
424
+ function displaySectionInfo(inference: { extension?: Extension[] }) {
425
+ for (const extension of inference.extension || []) {
426
+ if (extension.url === "section") {
427
+ console.log(" Section:");
428
+ for (const { url, valueString } of extension.extension || []) {
429
+ console.log(` ${url}: ${valueString}`);
430
+ }
431
+ }
432
+ }
433
+ }
226
434
  }
435
+ ```
227
436
 
228
- function printResults(radiologyInsightsResult: RadiologyInsightsResultOutput): void {
229
- if (radiologyInsightsResult.status === "succeeded") {
230
- const results = radiologyInsightsResult.result;
231
- if (results !== undefined) {
232
- results.patientResults.forEach((patientResult: { inferences: any[]; }) => {
233
- if (patientResult.inferences) {
234
- patientResult.inferences.forEach((inference) => {
235
- if (inference.kind === "criticalResult") {
236
- if ("result" in inference) {
237
- console.log("Critical Result Inference found: " + inference.result.description);
437
+ ### Print out the Follow Up Communication Inference date and recipient
438
+
439
+ ```ts snippet:ReadmeSampleFollowUpCommunication
440
+ import {
441
+ RadiologyInsightsJobOutput,
442
+ FollowupCommunicationInference,
443
+ } from "@azure-rest/health-insights-radiologyinsights";
444
+
445
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
446
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
447
+ for (const inference of patientResult?.inferences || []) {
448
+ if (inference.kind === "followupCommunication") {
449
+ const followupCommunicationInference = inference as FollowupCommunicationInference;
450
+ console.log("Followup Communication Inference found");
451
+ if (followupCommunicationInference.communicatedAt) {
452
+ console.log(
453
+ `Communicated at: ${followupCommunicationInference.communicatedAt.join(" ")}`,
454
+ );
455
+ }
456
+ if (followupCommunicationInference.recipient) {
457
+ console.log(`Recipient: ${followupCommunicationInference.recipient.join(" ")}`);
458
+ }
459
+ console.log(` Acknowledged: ${followupCommunicationInference.wasAcknowledged}`);
460
+ }
461
+ }
462
+ }
463
+ }
464
+ ```
465
+
466
+ ### Print out the Follow Up Recommendation Inference booleans, Generic Procedure code, description and Imaging Procedure codes
467
+
468
+ ```ts snippet:ReadmeSampleFollowUpRecommendation
469
+ import {
470
+ RadiologyInsightsJobOutput,
471
+ FollowupRecommendationInference,
472
+ GenericProcedureRecommendation,
473
+ ImagingProcedureRecommendation,
474
+ CodeableConcept,
475
+ ImagingProcedure,
476
+ } from "@azure-rest/health-insights-radiologyinsights";
477
+
478
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
479
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
480
+ for (const inference of patientResult?.inferences || []) {
481
+ if (inference.kind === "followupRecommendation") {
482
+ const followupRecommendationInference = inference as FollowupRecommendationInference;
483
+
484
+ console.log("Follow Up Recommendation Inference found");
485
+ console.log(` Is conditional: ${followupRecommendationInference.isConditional}`);
486
+ console.log(` Is guideline: ${followupRecommendationInference.isGuideline}`);
487
+ console.log(` Is hedging: ${followupRecommendationInference.isHedging}`);
488
+ console.log(` Is option: ${followupRecommendationInference.isOption}`);
489
+
490
+ const procedure = followupRecommendationInference.recommendedProcedure;
491
+ if (procedure.kind === "genericProcedureRecommendation") {
492
+ const genericProcedureRecommendation = procedure as GenericProcedureRecommendation;
493
+ console.log(` Recommended Generic Procedure: ${genericProcedureRecommendation.code}`);
494
+ console.log(` Description: ${genericProcedureRecommendation.description}`);
495
+ } else if (procedure.kind === "imagingProcedureRecommendation") {
496
+ const imagingProcedureRecommendation = procedure as ImagingProcedureRecommendation;
497
+
498
+ for (const procedureCode of imagingProcedureRecommendation?.procedureCodes || []) {
499
+ console.log(" Recommended Procedure Codes: ");
500
+ displayCodes(procedureCode);
501
+ }
502
+
503
+ for (const imagingProcedure of imagingProcedureRecommendation?.imagingProcedures || []) {
504
+ console.log(" Recommended Imaging Procedure Codes: ");
505
+ displayImaging(imagingProcedure);
506
+ }
507
+ }
508
+ }
509
+ }
510
+ }
511
+
512
+ function displayCodes(codeableConcept: CodeableConcept): void {
513
+ for (const coding of codeableConcept.coding || []) {
514
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
515
+ }
516
+ }
517
+
518
+ function displayImaging(images: ImagingProcedure): void {
519
+ console.log(" Modality Codes: ");
520
+ displayCodes(images.modality);
521
+ console.log(" Anatomy Codes: ");
522
+ displayCodes(images.anatomy);
523
+ if (images.laterality) {
524
+ console.log(" Laterality Codes: ");
525
+ displayCodes(images.laterality);
526
+ }
527
+ if (images.contrast) {
528
+ console.log(" Contrast Codes: ");
529
+ displayCodes(images.contrast.code);
530
+ }
531
+ if (images.view) {
532
+ console.log(" View Codes: ");
533
+ displayCodes(images.view.code);
534
+ }
535
+ }
536
+ }
537
+ ```
538
+
539
+ ### Print out the Guidance Inference details, finding codes associated, identifier, present guidance information, Ranking, recommendationProposals and missing guidance information if present
540
+
541
+ ```ts snippet:ReadmeSampleGuidance
542
+ import {
543
+ RadiologyInsightsJobOutput,
544
+ GuidanceInference,
545
+ ImagingProcedureRecommendation,
546
+ CodeableConcept,
547
+ PresentGuidanceInformation,
548
+ Extension,
549
+ ImagingProcedure,
550
+ } from "@azure-rest/health-insights-radiologyinsights";
551
+
552
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
553
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
554
+ for (const inference of patientResult?.inferences || []) {
555
+ if (inference.kind === "guidance") {
556
+ const guidanceInference = inference as GuidanceInference;
557
+ console.log("Guidance Inference found: ");
558
+
559
+ if (guidanceInference.finding) {
560
+ const find = guidanceInference.finding.finding.code;
561
+ if (find) {
562
+ console.log(" Finding Code: ");
563
+ displayCodes(find);
564
+ }
565
+ }
566
+
567
+ if (guidanceInference.identifier) {
568
+ console.log(" Identifier: ");
569
+ displayCodes(guidanceInference.identifier);
570
+ }
571
+
572
+ if (guidanceInference.presentGuidanceInformation) {
573
+ console.log(" Present Guidance Information: ");
574
+ for (const presentInfo of guidanceInference.presentGuidanceInformation) {
575
+ displayPresentGuidanceInformation(presentInfo);
576
+ }
577
+ }
578
+
579
+ if (guidanceInference.ranking) {
580
+ console.log(` Ranking: , ${guidanceInference.ranking}`);
581
+ }
582
+
583
+ if (guidanceInference.recommendationProposals) {
584
+ console.log(" Recommendation Proposal: ");
585
+ const recommendationProposals = guidanceInference.recommendationProposals;
586
+ for (const proposal of recommendationProposals) {
587
+ console.log(` Recommended Proposal: ${proposal.kind}`);
588
+ console.log(` Recommendation Procedure: ${proposal.recommendedProcedure.kind}`);
589
+ let imagingprocedure;
590
+ if (proposal.recommendedProcedure.kind === "imagingProcedureRecommendation") {
591
+ imagingprocedure = (proposal.recommendedProcedure as ImagingProcedureRecommendation)
592
+ .imagingProcedures;
593
+ if (imagingprocedure) {
594
+ console.log(" Imaging Procedure Codes: ");
595
+ for (const imagingProcedure of imagingprocedure) {
596
+ displayImaging(imagingProcedure);
597
+ }
238
598
  }
239
599
  }
240
- });
600
+ }
601
+ }
602
+
603
+ for (const missingInfo of guidanceInference.missingGuidanceInformation || []) {
604
+ console.log(" Missing Guidance Information: ", missingInfo);
605
+ }
606
+ }
607
+ }
608
+ }
609
+
610
+ function displayCodes(codeableConcept: CodeableConcept): void {
611
+ for (const coding of codeableConcept.coding || []) {
612
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
613
+ }
614
+ }
615
+
616
+ function displayPresentGuidanceInformation(presentInfo: PresentGuidanceInformation): void {
617
+ console.log(" Present Guidance Information Item: ", presentInfo.presentGuidanceItem);
618
+ presentInfo.presentGuidanceValues?.forEach((sizes: any) => {
619
+ console.log(" Present Guidance Value: ", sizes);
620
+ });
621
+
622
+ presentInfo.sizes?.forEach((gsizes: any) => {
623
+ if ("valueQuantity" in gsizes) {
624
+ console.log(" Size valueQuantity: ");
625
+ displayQuantityOutput(gsizes.valueQuantity);
626
+ }
627
+ if ("valueRange" in gsizes) {
628
+ if ("low" in gsizes.valueRange) {
629
+ console.log(" Size ValueRange: min", gsizes.valueRange.low);
630
+ }
631
+ if ("high" in gsizes.valueRange) {
632
+ console.log(" Size ValueRange: max", gsizes.valueRange.high);
241
633
  }
242
- });
634
+ }
635
+ });
636
+
637
+ if ("maximumDiameterAsInText" in presentInfo) {
638
+ console.log(" Maximum Diameter As In Text: ");
639
+ displayQuantityOutput(presentInfo.maximumDiameterAsInText);
243
640
  }
244
- } else {
245
- const error = radiologyInsightsResult.error;
246
- if (error) {
247
- console.log(error.code, ":", error.message);
641
+
642
+ if ("extension" in presentInfo) {
643
+ console.log(" Extension: ");
644
+ displaySectionInfo(presentInfo.extension);
645
+ }
646
+ }
647
+
648
+ function displayQuantityOutput(quantity: any): void {
649
+ console.log(` Value: ${quantity.value}`);
650
+ console.log(` Unit: ${quantity.unit}`);
651
+ }
652
+
653
+ function displaySectionInfo(extensions: Extension[]): void {
654
+ for (const extension of extensions) {
655
+ if (extension.url === "section") {
656
+ console.log(" Section:");
657
+ for (const { url, valueString } of extension.extension || []) {
658
+ console.log(` ${url}: ${valueString}`);
659
+ }
660
+ }
661
+ }
662
+ }
663
+
664
+ function displayImaging(images: ImagingProcedure): void {
665
+ console.log(" Modality Codes: ");
666
+ displayCodes(images.modality);
667
+ console.log(" Anatomy Codes: ");
668
+ displayCodes(images.anatomy);
669
+ if (images.laterality) {
670
+ console.log(" Laterality Codes: ");
671
+ displayCodes(images.laterality);
672
+ }
673
+ if (images.contrast) {
674
+ console.log(" Contrast Codes: ");
675
+ displayCodes(images.contrast.code);
676
+ }
677
+ if (images.view) {
678
+ console.log(" View Codes: ");
679
+ displayCodes(images.view.code);
248
680
  }
249
681
  }
250
682
  }
251
683
  ```
252
684
 
685
+ ### Print out the Laterality Discrepancy Inference codes
686
+ ```ts snippet:ReadmeSampleLateralityDiscrepancy
687
+ import {
688
+ RadiologyInsightsJobOutput,
689
+ LateralityDiscrepancyInference,
690
+ CodeableConcept,
691
+ } from "@azure-rest/health-insights-radiologyinsights";
692
+
693
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
694
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
695
+ for (const inference of patientResult?.inferences || []) {
696
+ if (inference.kind === "lateralityDiscrepancy") {
697
+ const lateralityDiscrepancyInference = inference as LateralityDiscrepancyInference;
698
+ console.log("Laterality Discrepancy Inference found: ");
699
+ displayCodes(lateralityDiscrepancyInference.lateralityIndication);
700
+ }
701
+ }
702
+ }
703
+
704
+ function displayCodes(codeableConcept: CodeableConcept): void {
705
+ for (const coding of codeableConcept.coding || []) {
706
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
707
+ }
708
+ }
709
+ }
710
+ ```
711
+
712
+ ### Print out the Limited Order Discrepancy Inference ordertype with present Body Parts and present Body Part Measurements
713
+
714
+ ```ts snippet:ReadmeSampleLimitedOrderDiscrepancy
715
+ import {
716
+ RadiologyInsightsJobOutput,
717
+ LimitedOrderDiscrepancyInference,
718
+ CodeableConcept,
719
+ } from "@azure-rest/health-insights-radiologyinsights";
720
+
721
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
722
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
723
+ for (const inference of patientResult?.inferences || []) {
724
+ if (inference.kind === "limitedOrderDiscrepancy") {
725
+ const limitedOrderDiscrepancyInference = inference as LimitedOrderDiscrepancyInference;
726
+
727
+ console.log("Limited Order Discrepancy Inference found: ");
728
+ console.log(" Ordertype: ");
729
+ displayCodes(limitedOrderDiscrepancyInference.orderType);
730
+
731
+ for (const presentBodyParts of limitedOrderDiscrepancyInference?.presentBodyParts || []) {
732
+ console.log(" Present Body Parts: ");
733
+ displayCodes(presentBodyParts);
734
+ }
735
+
736
+ for (const presentBodymeasure of limitedOrderDiscrepancyInference?.presentBodyPartMeasurements ||
737
+ []) {
738
+ console.log(" Present Body Part Measurements: ");
739
+ displayCodes(presentBodymeasure);
740
+ }
741
+ }
742
+ }
743
+ }
744
+
745
+ function displayCodes(codeableConcept: CodeableConcept): void {
746
+ for (const coding of codeableConcept.coding || []) {
747
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
748
+ }
749
+ }
750
+ }
751
+ ```
752
+
753
+ ### Print out the Quality Measure Inference with the measure denominator, compliance typa and quality criterium. ! The MIPS-codes (“merit based payment incentive”) need to be filled in in the qualityMeasureOptions !
754
+ ```ts snippet:ReadmeSampleQualityMeasure
755
+ import {
756
+ RadiologyInsightsJobOutput,
757
+ QualityMeasureInference,
758
+ CodeableConcept,
759
+ } from "@azure-rest/health-insights-radiologyinsights";
760
+
761
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
762
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
763
+ for (const inference of patientResult?.inferences || []) {
764
+ if (inference.kind === "qualityMeasure") {
765
+ const qualityMeasureInference = inference as QualityMeasureInference;
766
+ console.log("Quality Measure Inference found: ");
767
+
768
+ if (qualityMeasureInference.qualityMeasureDenominator) {
769
+ console.log(" Quality Measure Denominator: ");
770
+ console.log(
771
+ ` Quality Measure Denominator: ${qualityMeasureInference.qualityMeasureDenominator}`,
772
+ );
773
+ }
774
+
775
+ if (qualityMeasureInference.complianceType) {
776
+ console.log(" Quality Measure Numerator: ");
777
+ console.log(` Quality Measure Numerator: ${qualityMeasureInference.complianceType}`);
778
+ }
779
+
780
+ for (const qualityCriteria of qualityMeasureInference.qualityCriteria || []) {
781
+ console.log(` Quality Criteria: ${qualityCriteria}`);
782
+ }
783
+ }
784
+ }
785
+ }
786
+ }
787
+
788
+ function displayCodes(codeableConcept: CodeableConcept): void {
789
+ for (const coding of codeableConcept.coding || []) {
790
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
791
+ }
792
+ }
793
+ ```
794
+
795
+ ### Print out the Radiology Procedure Inference codes, Imaging Procedure codes and Order Procedure Codes and its description
796
+
797
+ ```ts snippet:ReadmeSampleRadiologyProcedure
798
+ import {
799
+ RadiologyInsightsJobOutput,
800
+ RadiologyProcedureInference,
801
+ CodeableConcept,
802
+ ImagingProcedure,
803
+ } from "@azure-rest/health-insights-radiologyinsights";
804
+
805
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
806
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
807
+ for (const inference of patientResult?.inferences || []) {
808
+ if (inference.kind === "radiologyProcedure") {
809
+ const radiologyProcedureInference = inference as RadiologyProcedureInference;
810
+ console.log("Radiology Procedure Inference found");
811
+
812
+ for (const procedureCode of radiologyProcedureInference?.procedureCodes || []) {
813
+ console.log(" Procedure Codes: ");
814
+ displayCodes(procedureCode);
815
+ }
816
+
817
+ for (const imagingProcedure of radiologyProcedureInference?.imagingProcedures || []) {
818
+ console.log(" Imaging Procedure Codes: ");
819
+ displayImaging(imagingProcedure);
820
+ }
821
+
822
+ if (radiologyProcedureInference.orderedProcedure) {
823
+ console.log(" Ordered Procedure Codes: ");
824
+ displayCodes(radiologyProcedureInference.orderedProcedure.code);
825
+ }
826
+
827
+ if (radiologyProcedureInference.orderedProcedure.description) {
828
+ console.log(
829
+ ` Description: ${radiologyProcedureInference.orderedProcedure.description}`,
830
+ );
831
+ }
832
+ }
833
+ }
834
+ }
835
+
836
+ function displayCodes(codeableConcept: CodeableConcept): void {
837
+ for (const coding of codeableConcept.coding || []) {
838
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
839
+ }
840
+ }
841
+
842
+ function displayImaging(images: ImagingProcedure): void {
843
+ console.log(" Modality Codes: ");
844
+ displayCodes(images.modality);
845
+ console.log(" Anatomy Codes: ");
846
+ displayCodes(images.anatomy);
847
+ if (images.laterality) {
848
+ console.log(" Laterality Codes: ");
849
+ displayCodes(images.laterality);
850
+ }
851
+ if (images.contrast) {
852
+ console.log(" Contrast Codes: ");
853
+ displayCodes(images.contrast.code);
854
+ }
855
+ if (images.view) {
856
+ console.log(" View Codes: ");
857
+ displayCodes(images.view.code);
858
+ }
859
+ }
860
+ }
861
+ ```
862
+
863
+ ### Print out the Scoring and Assessment Inference with category and description and single or range values if present
864
+ ```ts snippet:ReadmeSampleScoringAndAssessment
865
+ import {
866
+ RadiologyInsightsJobOutput,
867
+ ScoringAndAssessmentInference,
868
+ } from "@azure-rest/health-insights-radiologyinsights";
869
+
870
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
871
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
872
+ for (const inference of patientResult?.inferences || []) {
873
+ if (inference.kind === "scoringAndAssessment") {
874
+ const scoringAndAssessmentInference = inference as ScoringAndAssessmentInference;
875
+ console.log("Scoring and Assessment Inference found: ");
876
+
877
+ if (scoringAndAssessmentInference.category) {
878
+ console.log(` Category: ${scoringAndAssessmentInference.category}`);
879
+ }
880
+
881
+ if (scoringAndAssessmentInference.categoryDescription) {
882
+ console.log(
883
+ ` Category Description: "${scoringAndAssessmentInference.categoryDescription}`,
884
+ );
885
+ }
886
+
887
+ if (scoringAndAssessmentInference.singleValue) {
888
+ console.log(` Single Value: "${scoringAndAssessmentInference.singleValue}`);
889
+ }
890
+
891
+ if (scoringAndAssessmentInference?.rangeValue) {
892
+ console.log(" Range Value: ");
893
+ displayValueRange(scoringAndAssessmentInference?.rangeValue);
894
+ }
895
+ }
896
+ }
897
+ }
898
+
899
+ function displayValueRange(valueRange: { minimum: string; maximum: string }): void {
900
+ console.log(` Low: ${valueRange.minimum}`);
901
+ console.log(` High: ${valueRange.maximum}`);
902
+ }
903
+ }
904
+ ```
905
+
906
+ ### Print out the Sex Mismatch Inference code
907
+ ```ts snippet:ReadmeSampleSexMismatch
908
+ import {
909
+ RadiologyInsightsJobOutput,
910
+ SexMismatchInference,
911
+ CodeableConcept,
912
+ } from "@azure-rest/health-insights-radiologyinsights";
913
+
914
+ function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void {
915
+ for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) {
916
+ for (const inference of patientResult?.inferences || []) {
917
+ if (inference.kind === "sexMismatch") {
918
+ const sexMismatchInference = inference as SexMismatchInference;
919
+ console.log("Sex Mismatch Inference found: ");
920
+ displayCodes(sexMismatchInference.sexIndication);
921
+ }
922
+ }
923
+ }
924
+
925
+ function displayCodes(codeableConcept: CodeableConcept): void {
926
+ for (const coding of codeableConcept.coding || []) {
927
+ console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`);
928
+ }
929
+ }
930
+ }
931
+ ```
932
+
933
+ ## Using a Managed Identity require changes in adding the clientID of your managed identity as a const, adding it to you DefaultAzureCredential and add the Authorization Header
934
+
935
+ ```ts snippet:ReadmeSampleManagedIdentity
936
+ import { DefaultAzureCredential } from "@azure/identity";
937
+ import RadiologyInsightsRestClient from "@azure-rest/health-insights-radiologyinsights";
938
+
939
+ const managedIdentityClientId = "<client-id>";
940
+ const endpoint = "https://<your-endpoint>";
941
+ const credential = new DefaultAzureCredential({ managedIdentityClientId });
942
+ const client = RadiologyInsightsRestClient(endpoint, credential);
943
+
944
+ const tokenResponse = await credential.getToken("https://cognitiveservices.azure.com/.default");
945
+
946
+ const jobID = "jobId-123456789";
947
+ const radiologyInsightsJob = {
948
+ jobData: {
949
+ patients: [],
950
+ configuration: {},
951
+ },
952
+ };
953
+
954
+ // Create request body
955
+ const radiologyInsightsParameter = { body: radiologyInsightsJob };
956
+ // Create request body
957
+ const initialResponse = await client
958
+ .path("/radiology-insights/jobs/{id}", jobID)
959
+ .put(radiologyInsightsParameter, {
960
+ headers: {
961
+ Authorization: `Bearer ${tokenResponse?.token}`,
962
+ "Content-Type": "application/json",
963
+ },
964
+ });
965
+ ```
966
+
253
967
  ## Troubleshooting
254
968
 
255
969
  ### Logging
256
970
 
257
971
  Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
258
972
 
259
- ```javascript
260
- const { setLogLevel } = require("@azure/logger");
973
+ ```ts snippet:SetLogLevel
974
+ import { setLogLevel } from "@azure/logger";
261
975
 
262
976
  setLogLevel("info");
263
977
  ```
@@ -265,11 +979,18 @@ setLogLevel("info");
265
979
  For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
266
980
 
267
981
  <!-- LINKS -->
982
+
268
983
  [health_insights]: https://learn.microsoft.com/azure/azure-health-insights/overview
269
984
  [radiology_insights_docs]: https://learn.microsoft.com/azure/azure-health-insights/radiology-insights/
270
-
985
+ [Source code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest
986
+ [Package (NPM)]: https://www.npmjs.com/package/@azure-rest/health-insights-radiologyinsights
987
+ [API reference documentation]: https://learn.microsoft.com/rest/api/cognitiveservices/healthinsights/operation-groups?view=rest-cognitiveservices-healthinsights-2024-04-01
988
+ [Product Information]: https://learn.microsoft.com/azure/azure-health-insights/radiology-insights/overview
989
+ [Samples]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1
271
990
  [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity
272
991
  [identity]: https://www.npmjs.com/package/@azure/identity
273
992
  [token_credential]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token
274
993
  [defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential
994
+ [default_information]: https://learn.microsoft.com/javascript/api/%40azure/identity/defaultazurecredential?view=azure-node-latest
995
+ [managed_identity]: https://learn.microsoft.com/javascript/api/%40azure/identity/managedidentitycredential?view=azure-node-latest
275
996
  [credential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials