Skip to content

Commit

Permalink
healthcare API: add version when creating FHIR store (#1822)
Browse files Browse the repository at this point in the history
Fixes b/157053159
  • Loading branch information
noerog authored May 21, 2020
1 parent 07b20f5 commit 972e346
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
13 changes: 11 additions & 2 deletions healthcare/fhir/createFhirStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const main = (
projectId = process.env.GCLOUD_PROJECT,
cloudRegion = 'us-central1',
datasetId,
fhirStoreId
fhirStoreId,
version
) => {
// [START healthcare_create_fhir_store]
const {google} = require('googleapis');
Expand All @@ -37,8 +38,15 @@ const main = (
// const projectId = 'adjective-noun-123';
// const datasetId = 'my-dataset';
// const fhirStoreId = 'my-fhir-store';
// const version = 'STU3';
const parent = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}`;
const request = {parent, fhirStoreId};
const request = {
parent,
fhirStoreId,
resource: {
version
},
};

await healthcare.projects.locations.datasets.fhirStores.create(request);
console.log(`Created FHIR store: ${fhirStoreId}`);
Expand All @@ -49,4 +57,5 @@ const main = (
};

// node createFhirStore.js <projectId> <cloudRegion> <datasetId> <fhirStoreId>
// <version>
main(...process.argv.slice(2));
3 changes: 2 additions & 1 deletion healthcare/fhir/system-test/fhir_resources.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const fhirStoreId = `nodejs-docs-samples-test-fhir-store${uuid.v4()}`.replace(

const bundleFile = 'resources/bundle.json';
const resourceType = 'Patient';
const version = 'STU3';
let resourceId;

before(() => {
Expand Down Expand Up @@ -59,7 +60,7 @@ after(() => {

it('should create a FHIR resource', () => {
execSync(
`node createFhirStore.js ${projectId} ${cloudRegion} ${datasetId} ${fhirStoreId}`,
`node createFhirStore.js ${projectId} ${cloudRegion} ${datasetId} ${fhirStoreId} ${version}`,
{cwd}
);
const output = execSync(
Expand Down
3 changes: 2 additions & 1 deletion healthcare/fhir/system-test/fhir_stores.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const fhirStoreId = `nodejs-docs-samples-test-fhir-store${uuid.v4()}`.replace(
/-/gi,
'_'
);
const version = 'STU3';

const fhirFileName = 'fhir_data.ndjson';

Expand Down Expand Up @@ -85,7 +86,7 @@ after(async () => {

it('should create a FHIR store', () => {
const output = execSync(
`node createFhirStore.js ${projectId} ${cloudRegion} ${datasetId} ${fhirStoreId}`,
`node createFhirStore.js ${projectId} ${cloudRegion} ${datasetId} ${fhirStoreId} ${version}`,
{cwd}
);
assert.ok(output.includes('Created FHIR store'));
Expand Down

0 comments on commit 972e346

Please sign in to comment.