@azure-rest/health-insights-cancerprofiling 1.0.0-alpha.20250108.1 → 1.0.0-alpha.20250110.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.
- package/README.md +94 -90
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -31,9 +31,9 @@ Install the CancerProfiling REST client library for JavaScript with `npm`:
|
|
|
31
31
|
npm install @azure-rest/health-insights-cancerprofiling
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|SDK version|Supported API version of service |
|
|
35
|
-
|
|
36
|
-
|1.0.0-beta.1 | 2023-03-01-preview|
|
|
34
|
+
| SDK version | Supported API version of service |
|
|
35
|
+
| ------------ | -------------------------------- |
|
|
36
|
+
| 1.0.0-beta.1 | 2023-03-01-preview |
|
|
37
37
|
|
|
38
38
|
### Create and authenticate a `CancerProfilingRestClient`
|
|
39
39
|
|
|
@@ -41,7 +41,7 @@ To use an [Azure Active Directory (AAD) token credential](https://github.com/Azu
|
|
|
41
41
|
provide an instance of the desired credential type obtained from the
|
|
42
42
|
[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
|
|
43
43
|
|
|
44
|
-
To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
|
|
44
|
+
To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
|
|
45
45
|
|
|
46
46
|
After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use.
|
|
47
47
|
As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
|
|
@@ -55,57 +55,57 @@ AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
|
|
|
55
55
|
The Cancer Profiling model allows you to infer cancer attributes such as tumor site, histology, clinical stage TNM categories and pathologic stage TNM categories from unstructured clinical documents.
|
|
56
56
|
|
|
57
57
|
## Examples
|
|
58
|
+
|
|
58
59
|
- [Infer Cancer Profiling](#cancer_profiling)
|
|
59
60
|
|
|
60
61
|
```typescript
|
|
61
62
|
const apiKey = process.env["HEALTH_INSIGHTS_API_KEY"] || "";
|
|
62
|
-
const endpoint =
|
|
63
|
-
process.env["HEALTH_INSIGHTS_ENDPOINT"] || "";
|
|
63
|
+
const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || "";
|
|
64
64
|
const credential = new AzureKeyCredential(apiKey);
|
|
65
65
|
const client = CancerProfilingRestClient(endpoint, credential);
|
|
66
66
|
|
|
67
67
|
// Define patient information and clinical documents for the request body
|
|
68
68
|
const patientInfo = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const doc1 = "15.8.2021"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
69
|
+
sex: "FEMALE",
|
|
70
|
+
birthDate: new Date("1979-10-08T00:00:00.000Z"), // Note: Months are zero-based (11 represents December)
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const doc1 = "15.8.2021";
|
|
74
|
+
("Jane Doe 091175-8967");
|
|
75
|
+
("42 year old female, married with 3 children, works as a nurse. ");
|
|
76
|
+
("Healthy, no medications taken on a regular basis.");
|
|
77
|
+
("PMHx is significant for migraines with aura, uses Mirena for contraception.");
|
|
78
|
+
("Smoking history of 10 pack years (has stopped and relapsed several times).");
|
|
79
|
+
("She is in c/o 2 weeks of productive cough and shortness of breath.");
|
|
80
|
+
("She has a fever of 37.8 and general weakness. ");
|
|
81
|
+
("Denies night sweats and rash. She denies symptoms of rhinosinusitis, asthma, and heartburn. ");
|
|
82
|
+
("On PE:");
|
|
83
|
+
("GENERAL: mild pallor, no cyanosis. Regular breathing rate. ");
|
|
84
|
+
("LUNGS: decreased breath sounds on the base of the right lung. Vesicular breathing.");
|
|
85
|
+
(" No crackles, rales, and wheezes. Resonant percussion. ");
|
|
86
|
+
("PLAN: ");
|
|
87
|
+
("Will be referred for a chest x-ray. ");
|
|
88
|
+
("======================================");
|
|
89
|
+
("CXR showed mild nonspecific opacities in right lung base. ");
|
|
90
|
+
("PLAN:");
|
|
91
|
+
("Findings are suggestive of a working diagnosis of pneumonia. The patient is referred to a ");
|
|
92
|
+
("follow-up CXR in 2 weeks. ");
|
|
93
93
|
|
|
94
94
|
const docContent = {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
sourceType: "INLINE",
|
|
96
|
+
value: doc1,
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const patientDoc1 = {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
type: "NOTE",
|
|
101
|
+
id: "doc1",
|
|
102
|
+
content: docContent,
|
|
103
|
+
clinicalType: "IMAGING",
|
|
104
|
+
language: "en",
|
|
105
|
+
createdDateTime: new Date("2021-15-08T00:00:00.000Z"),
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
const doc1 = `15.8.2021
|
|
109
109
|
Jane Doe 091175-8967
|
|
110
110
|
42 year old female, married with 3 children, works as a nurse.
|
|
111
111
|
Healthy, no medications taken on a regular basis.
|
|
@@ -126,21 +126,21 @@ const patientDoc1 = {
|
|
|
126
126
|
Findings are suggestive of a working diagnosis of pneumonia. The patient is referred to a
|
|
127
127
|
follow-up CXR in 2 weeks. `;
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
const docContent = {
|
|
130
|
+
sourceType: "INLINE",
|
|
131
|
+
value: doc1,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const patientDoc1 = {
|
|
135
|
+
type: "NOTE",
|
|
136
|
+
id: "doc1",
|
|
137
|
+
content: docContent,
|
|
138
|
+
clinicalType: "IMAGING",
|
|
139
|
+
language: "en",
|
|
140
|
+
createdDateTime: new Date("2021-15-08T00:00:00.000Z"),
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const doc2 = `Oncology Clinic
|
|
144
144
|
20.10.2021
|
|
145
145
|
Jane Doe 091175-8967
|
|
146
146
|
42-year-old healthy female who works as a nurse in the ER of this hospital.
|
|
@@ -168,68 +168,72 @@ const patientDoc1 = {
|
|
|
168
168
|
Different treatment options were explained- the patient wants to get a second opinion.`;
|
|
169
169
|
|
|
170
170
|
const docContent2 = {
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
sourceType: "INLINE",
|
|
172
|
+
value: doc2,
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
const patientDoc2 = {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
type: "NOTE",
|
|
177
|
+
id: "doc2",
|
|
178
|
+
content: docContent3,
|
|
179
|
+
clinicalType: "PATHOLOGY",
|
|
180
|
+
language: "en",
|
|
181
|
+
createdDateTime: new Date("2022-01-01T00:00:00.000Z"),
|
|
182
182
|
};
|
|
183
183
|
|
|
184
184
|
const patient1 = {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
id: "patient_id",
|
|
186
|
+
info: patientInfo,
|
|
187
|
+
data: [patientDoc1, patientDoc2],
|
|
188
188
|
};
|
|
189
189
|
|
|
190
190
|
const cancerProfilingData: OncoPhenotypeData = {
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
patients: [patient1],
|
|
192
|
+
configuration: { includeEvidence: true },
|
|
193
193
|
};
|
|
194
194
|
|
|
195
195
|
const parameters = {
|
|
196
|
-
|
|
196
|
+
body: cancerProfilingData,
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
// Initiate cancer profiling job and retrieve results
|
|
200
200
|
const initialResponse = await client.path("/oncophenotype/jobs").post(parameters);
|
|
201
201
|
if (isUnexpected(initialResponse)) {
|
|
202
|
-
|
|
202
|
+
throw initialResponse;
|
|
203
203
|
}
|
|
204
204
|
const poller = await getLongRunningPoller(client, initialResponse);
|
|
205
205
|
const cancerProfilingResult = await poller.pollUntilDone();
|
|
206
206
|
if (isUnexpected(cancerProfilingResult)) {
|
|
207
|
-
|
|
207
|
+
throw cancerProfilingResult;
|
|
208
208
|
}
|
|
209
209
|
const resultBody = cancerProfilingResult.body;
|
|
210
210
|
// Print the inference results for a patient's cancer attributes
|
|
211
211
|
if (cancerProfilingResult.status === "succeeded") {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
212
|
+
const results = cancerProfilingResult.results;
|
|
213
|
+
if (results) {
|
|
214
|
+
for (const patientResult of results.patients) {
|
|
215
|
+
console.log(`Inferences of Patient ${patientResult.id}`);
|
|
216
|
+
for (const { type, value, confidenceScore, evidence } of patientResult.inferences) {
|
|
217
|
+
console.log(
|
|
218
|
+
`Clinical Type: ${String(type)} Value: ${value}, ConfidenceScore: ${confidenceScore}`,
|
|
219
|
+
);
|
|
220
|
+
for (const { patientDataEvidence } of evidence || []) {
|
|
221
|
+
if (patientDataEvidence) {
|
|
222
|
+
console.log(
|
|
223
|
+
`Evidence: ${patientDataEvidence.id} ${patientDataEvidence.offset} ${patientDataEvidence.length} ${patientDataEvidence.text}`,
|
|
224
|
+
);
|
|
225
|
+
}
|
|
224
226
|
}
|
|
227
|
+
}
|
|
225
228
|
}
|
|
229
|
+
}
|
|
226
230
|
} else {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
231
|
+
const errors = cancerProfilingResult.errors;
|
|
232
|
+
if (errors) {
|
|
233
|
+
for (const error of errors) {
|
|
234
|
+
console.log(error.code, ":", error.message);
|
|
232
235
|
}
|
|
236
|
+
}
|
|
233
237
|
}
|
|
234
238
|
```
|
|
235
239
|
|
|
@@ -250,13 +254,12 @@ For more detailed instructions on how to enable logs, you can look at the [@azur
|
|
|
250
254
|
## Next steps
|
|
251
255
|
|
|
252
256
|
This code sample show common scenario operation with the Azure Health Insights Cancer Profiling library. More samples can be found under the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-cancerprofiling-rest/samples/v1-beta/typescript/src/) directory.
|
|
253
|
-
- Infer Cancer Profiling: [sample_infer_cancer_profiling.ts](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-cancerprofiling-rest/samples/v1-beta/typescript/src/sample_infer_cancer_profiling.ts)
|
|
254
257
|
|
|
258
|
+
- Infer Cancer Profiling: [sample_infer_cancer_profiling.ts](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-cancerprofiling-rest/samples/v1-beta/typescript/src/sample_infer_cancer_profiling.ts)
|
|
255
259
|
|
|
256
260
|
### Additional documentation
|
|
257
261
|
|
|
258
|
-
For more extensive documentation on Azure Health Insights Cancer Profiling, see the [Cancer Profiling documentation](https://learn.microsoft.com/azure/azure-health-insights/oncophenotype/overview) on
|
|
259
|
-
|
|
262
|
+
For more extensive documentation on Azure Health Insights Cancer Profiling, see the [Cancer Profiling documentation](https://learn.microsoft.com/azure/azure-health-insights/oncophenotype/overview) on learn.microsoft.com.
|
|
260
263
|
|
|
261
264
|
## Contributing
|
|
262
265
|
|
|
@@ -267,6 +270,7 @@ When you submit a pull request, a CLA-bot will automatically determine whether y
|
|
|
267
270
|
This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.
|
|
268
271
|
|
|
269
272
|
<!-- LINKS -->
|
|
273
|
+
|
|
270
274
|
[cla]: https://cla.microsoft.com
|
|
271
275
|
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
|
|
272
276
|
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure-rest/health-insights-cancerprofiling",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "1.0.0-alpha.
|
|
5
|
+
"version": "1.0.0-alpha.20250110.1",
|
|
6
6
|
"description": "A generated SDK for Health Insights Cancer Profiling Rest",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"azure"
|
|
100
100
|
],
|
|
101
101
|
"disableDocsMs": true,
|
|
102
|
-
"apiRefLink": "https://
|
|
102
|
+
"apiRefLink": "https://learn.microsoft.com/javascript/api"
|
|
103
103
|
},
|
|
104
104
|
"type": "module",
|
|
105
105
|
"tshy": {
|