forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-dicom-import-job.js
More file actions
68 lines (64 loc) · 2.44 KB
/
start-dicom-import-job.js
File metadata and controls
68 lines (64 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { fileURLToPath } from "node:url";
// snippet-start:[medical-imaging.JavaScript.dicom.startDicomImportJobV3]
import { StartDICOMImportJobCommand } from "@aws-sdk/client-medical-imaging";
import { medicalImagingClient } from "../libs/medicalImagingClient.js";
/**
* @param {string} jobName - The name of the import job.
* @param {string} datastoreId - The ID of the data store.
* @param {string} dataAccessRoleArn - The Amazon Resource Name (ARN) of the role that grants permission.
* @param {string} inputS3Uri - The URI of the S3 bucket containing the input files.
* @param {string} outputS3Uri - The URI of the S3 bucket where the output files are stored.
* @param {Object} importConfiguration - The configuration for digital pathology import.
*/
export const startDicomImportJob = async (
jobName = "test-1",
datastoreId = "12345678901234567890123456789012",
dataAccessRoleArn = "arn:aws:iam::xxxxxxxxxxxx:role/ImportJobDataAccessRole",
inputS3Uri = "s3://medical-imaging-dicom-input/dicom_input/",
outputS3Uri = "s3://medical-imaging-output/job_output/",
importConfiguration = {
digitalPathologyImportConfiguration: {
qualityFactor: 85,
fileMetadataMappings: [
{
imageFilePath: "image.svs",
metadataFilePath: "metadata.json",
},
],
},
},
) => {
const response = await medicalImagingClient.send(
new StartDICOMImportJobCommand({
jobName: jobName,
datastoreId: datastoreId,
dataAccessRoleArn: dataAccessRoleArn,
inputS3Uri: inputS3Uri,
outputS3Uri: outputS3Uri,
importConfiguration: importConfiguration,
}),
);
console.log(response);
// {
// '$metadata': {
// httpStatusCode: 200,
// requestId: '6e81d191-d46b-4e48-a08a-cdcc7e11eb79',
// extendedRequestId: undefined,
// cfId: undefined,
// attempts: 1,
// totalRetryDelay: 0
// },
// datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
// jobId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
// jobStatus: 'SUBMITTED',
// submittedAt: 2023-09-22T14:48:45.767Z
// }
return response;
};
// snippet-end:[medical-imaging.JavaScript.dicom.startDicomImportJobV3]
// Invoke the following code if this file is being run directly.
if (process.argv[1] === fileURLToPath(import.meta.url)) {
await startDicomImportJob();
}