Skip to content

Commit 71b335f

Browse files
noerogfhinkel
andauthored
healthcare API: update hl7v2, datasets, and DICOM samples from v1beta1 to v1 (GoogleCloudPlatform#1732)
Co-authored-by: F. Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent e07c935 commit 71b335f

29 files changed

Lines changed: 64 additions & 79 deletions

healthcare/datasets/createDataset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const main = (
2323
) => {
2424
// [START healthcare_create_dataset]
2525
const {google} = require('googleapis');
26-
const healthcare = google.healthcare('v1beta1');
26+
const healthcare = google.healthcare('v1');
2727

2828
const createDataset = async () => {
2929
const auth = await google.auth.getClient({

healthcare/datasets/deidentifyDataset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const main = (
2525
) => {
2626
// [START healthcare_dicom_keeplist_deidentify_dataset]
2727
const {google} = require('googleapis');
28-
const healthcare = google.healthcare('v1beta1');
28+
const healthcare = google.healthcare('v1');
2929

3030
const deidentifyDataset = async () => {
3131
const auth = await google.auth.getClient({

healthcare/datasets/deleteDataset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const main = (
2323
) => {
2424
// [START healthcare_delete_dataset]
2525
const {google} = require('googleapis');
26-
const healthcare = google.healthcare('v1beta1');
26+
const healthcare = google.healthcare('v1');
2727

2828
const deleteDataset = async () => {
2929
const auth = await google.auth.getClient({

healthcare/datasets/getDataset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const main = (
2323
) => {
2424
// [START healthcare_get_dataset]
2525
const {google} = require('googleapis');
26-
const healthcare = google.healthcare('v1beta1');
26+
const healthcare = google.healthcare('v1');
2727

2828
const getDataset = async () => {
2929
const auth = await google.auth.getClient({

healthcare/datasets/getDatasetIamPolicy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const main = (
2323
) => {
2424
// [START healthcare_dataset_get_iam_policy]
2525
const {google} = require('googleapis');
26-
const healthcare = google.healthcare('v1beta1');
26+
const healthcare = google.healthcare('v1');
2727

2828
const getDatasetIamPolicy = async () => {
2929
const auth = await google.auth.getClient({

healthcare/datasets/listDatasets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const main = (
2222
) => {
2323
// [START healthcare_list_datasets]
2424
const {google} = require('googleapis');
25-
const healthcare = google.healthcare('v1beta1');
25+
const healthcare = google.healthcare('v1');
2626

2727
const listDatasets = async () => {
2828
const auth = await google.auth.getClient({

healthcare/datasets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"mocha": "^7.0.0"
1616
},
1717
"dependencies": {
18-
"googleapis": "^48.0.0",
18+
"googleapis": "^49.0.0",
1919
"uuid": "^7.0.0",
2020
"yargs": "^15.0.0"
2121
},

healthcare/datasets/patchDataset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const main = (
2424
) => {
2525
// [START healthcare_patch_dataset]
2626
const {google} = require('googleapis');
27-
const healthcare = google.healthcare('v1beta1');
27+
const healthcare = google.healthcare('v1');
2828

2929
const patchDataset = async () => {
3030
const auth = await google.auth.getClient({

healthcare/datasets/setDatasetIamPolicy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const main = (
2525
) => {
2626
// [START healthcare_dataset_set_iam_policy]
2727
const {google} = require('googleapis');
28-
const healthcare = google.healthcare('v1beta1');
28+
const healthcare = google.healthcare('v1');
2929

3030
const setDatasetIamPolicy = async () => {
3131
const auth = await google.auth.getClient({

healthcare/datasets/system-test/datasets.test.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const assert = require('assert');
1919
const uuid = require('uuid');
2020
const {execSync} = require('child_process');
2121

22-
const cwd = path.join(__dirname, '..');
2322
const projectId = process.env.GCLOUD_PROJECT;
2423
const datasetId = `dataset-${uuid.v4()}`.replace(/-/gi, '_');
2524
const destinationDatasetId = `destination-${uuid.v4()}`.replace(/-/gi, '_');
@@ -39,25 +38,22 @@ before(() => {
3938
after(() => {
4039
try {
4140
execSync(
42-
`node deleteDataset.js ${projectId} ${cloudRegion} ${destinationDatasetId}`,
43-
cwd
41+
`node deleteDataset.js ${projectId} ${cloudRegion} ${destinationDatasetId}`
4442
);
4543
// eslint-disable-next-line no-empty
4644
} catch (err) {} // Ignore error
4745
});
4846

4947
it('should create a dataset', () => {
5048
const output = execSync(
51-
`node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`,
52-
cwd
49+
`node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`
5350
);
54-
assert.strictEqual(output, `Created dataset: ${datasetId}`);
51+
assert.ok(output.includes('Created dataset'));
5552
});
5653

5754
it('should get a dataset', () => {
5855
const output = execSync(
5956
`node getDataset.js ${projectId} ${cloudRegion} ${datasetId}`,
60-
cwd
6157
);
6258
assert.ok(output.includes('name'));
6359
});
@@ -66,30 +62,24 @@ it('should patch a dataset', () => {
6662
const timeZone = 'GMT';
6763
const output = execSync(
6864
`node patchDataset.js ${projectId} ${cloudRegion} ${datasetId} ${timeZone}`,
69-
cwd
7065
);
71-
assert.strictEqual(
72-
output,
73-
`Dataset ${datasetId} patched with time zone ${timeZone}`
66+
assert.ok(
67+
output.includes('patched with time zone')
7468
);
7569
});
7670

7771
it('should list datasets', () => {
78-
const output = execSync(
79-
`node listDatasets.js ${projectId} ${cloudRegion}`,
80-
cwd
81-
);
72+
const output = execSync(`node listDatasets.js ${projectId} ${cloudRegion}`, {
73+
});
8274
assert.ok(output.includes('datasets'));
8375
});
8476

8577
it('should de-identify data in a dataset and write to a new dataset', () => {
8678
const output = execSync(
8779
`node deidentifyDataset.js ${projectId} ${cloudRegion} ${datasetId} ${destinationDatasetId} ${keeplistTags}`,
88-
cwd
8980
);
90-
assert.strictEqual(
91-
output,
92-
`De-identified data written from dataset ${datasetId} to dataset ${destinationDatasetId}`
81+
assert.ok(
82+
output.includes('De-identified data written')
9383
);
9484
});
9585

@@ -99,7 +89,6 @@ it('should create and get a dataset IAM policy', () => {
9989

10090
let output = execSync(
10191
`node setDatasetIamPolicy.js ${projectId} ${cloudRegion} ${datasetId} ${localMember} ${localRole}`,
102-
cwd
10392
);
10493
assert.ok(output.includes, 'ETAG');
10594

@@ -112,7 +101,6 @@ it('should create and get a dataset IAM policy', () => {
112101
it('should delete a dataset', () => {
113102
const output = execSync(
114103
`node deleteDataset.js ${projectId} ${cloudRegion} ${datasetId}`,
115-
cwd
116104
);
117-
assert.strictEqual(output, `Deleted dataset: ${datasetId}`);
105+
assert.ok(output.includes('Deleted dataset'));
118106
});

0 commit comments

Comments
 (0)