Skip to content

Commit 3ca1ec8

Browse files
noerogfhinkel
authored andcommitted
Fix lint (#1503)
1 parent 866f717 commit 3ca1ec8

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed

healthcare/dicom/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ Run the following command to install the library dependencies for Node.js:
6161
node dicomWebRetrieveRendered.js <projectId> <cloudRegion> Handles the GET requests specified in the DICOMweb
6262
<datasetId> <dicomStoreId> <studyUid> <seriesUid> standard.
6363
<instanceUid>
64-
64+
65+
node dicomWebSearchStudies.js <projectId> <cloudRegion> Searches studies using DICOM tags.
66+
<datasetId> <dicomStoreId>
67+
6568
node dicomWebDeleteStudy.js <projectId> <cloudRegion> Handles DELETE requests.
6669
<datasetId> <dicomStoreId> <studyUid>
6770
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* Copyright 2019, Google, LLC
3+
* Licensed under the Apache License, Version 2.0 (the `License`);
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an `AS IS` BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
/* eslint-disable no-warning-comments */
17+
18+
'use strict';
19+
20+
const main = (
21+
projectId = process.env.GCLOUD_PROJECT,
22+
cloudRegion = 'us-central1',
23+
datasetId,
24+
dicomStoreId
25+
) => {
26+
// [START healthcare_dicomweb_search_studies]
27+
const {google} = require('googleapis');
28+
const healthcare = google.healthcare('v1beta1');
29+
30+
const dicomWebSearchStudies = async () => {
31+
const auth = await google.auth.getClient({
32+
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
33+
});
34+
35+
google.options({
36+
auth,
37+
// Refine your search by appending DICOM tags to the
38+
// request in the form of query parameters. This sample
39+
// searches for studies containing a patient's name.
40+
params: {PatientName: 'Sally Zhang'},
41+
headers: {Accept: 'application/dicom+json'},
42+
});
43+
44+
// TODO(developer): uncomment these lines before running the sample
45+
// const cloudRegion = 'us-central1';
46+
// const projectId = 'adjective-noun-123';
47+
// const datasetId = 'my-dataset';
48+
// const dicomStoreId = 'my-dicom-store';
49+
const parent = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/dicomStores/${dicomStoreId}`;
50+
const dicomWebPath = `studies`;
51+
const request = {parent, dicomWebPath};
52+
53+
const studies = await healthcare.projects.locations.datasets.dicomStores.searchForStudies(
54+
request
55+
);
56+
console.log(studies);
57+
58+
console.log(`Found ${studies.data.length} studies:`);
59+
console.log(JSON.stringify(studies.data));
60+
};
61+
62+
dicomWebSearchStudies();
63+
// [END healthcare_dicomweb_search_studies]
64+
};
65+
66+
// node dicomWebSearchStudies.js <projectId> <cloudRegion> <datasetId> <dicomStoreId>
67+
main(...process.argv.slice(2));

healthcare/dicom/system-test/dicomweb.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ it('should retrieve a DICOM rendered PNG image', async () => {
103103
assert.ok(output.includes('Retrieved rendered image'));
104104
});
105105

106+
it('should search for DICOM studies', async () => {
107+
const output = await tools.runAsync(
108+
`node dicomWebSearchStudies.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`,
109+
cwd
110+
);
111+
assert.ok(output.includes('Found'));
112+
});
113+
106114
it('should delete a DICOM study', async () => {
107115
const output = await tools.runAsync(
108116
`node dicomWebDeleteStudy.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${studyUid}`,

0 commit comments

Comments
 (0)