建立資料倉庫 - AWS HealthImaging

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

建立資料倉庫

使用此CreateDatastore動作可建立用於匯入 DICOM P10 檔案的AWS HealthImaging 資料倉庫。下列功能表提供的程序 AWS Management Console 和程式碼範例 AWS CLI 以及 AWS SDKs。如需詳細資訊,請參閱〈AWS HealthImaging API參考CreateDatastore中的〈〉。

重要

請勿使用受保護的健康信息(PHI),個人身份信息(PII)或其他機密或敏感信息來命名數據存儲。

建立資料倉庫的步驟

根據您的存取偏好選擇選單AWS HealthImaging。

  1. 開啟 HealthImaging 主控台「建立資料倉庫」頁面

  2. 在「詳細資料」下,對於「資料倉庫名稱」,輸入資料倉庫的名稱。

  3. 在「資料加密」下,選擇 AWS KMS 用於加密資源的金鑰。如需詳細資訊,請參閱 中的資料保護AWS HealthImaging

  4. 在「標籤-可」下,您可以在建立資料倉庫時將標籤新增至資料倉庫。如需詳細資訊,請參閱標記資源

  5. 選擇 [建立資料倉庫]。

Bash
AWS CLI 與 Bash 腳本
############################################################################### # function errecho # # This function outputs everything sent to it to STDERR (standard error output). ############################################################################### function errecho() { printf "%s\n" "$*" 1>&2 } ############################################################################### # function imaging_create_datastore # # This function creates an AWS HealthImaging data store for importing DICOM P10 files. # # Parameters: # -n data_store_name - The name of the data store. # # Returns: # The datastore ID. # And: # 0 - If successful. # 1 - If it fails. ############################################################################### function imaging_create_datastore() { local datastore_name response local option OPTARG # Required to use getopts command in a function. # bashsupport disable=BP5008 function usage() { echo "function imaging_create_datastore" echo "Creates an AWS HealthImaging data store for importing DICOM P10 files." echo " -n data_store_name - The name of the data store." echo "" } # Retrieve the calling parameters. while getopts "n:h" option; do case "${option}" in n) datastore_name="${OPTARG}" ;; h) usage return 0 ;; \?) echo "Invalid parameter" usage return 1 ;; esac done export OPTIND=1 if [[ -z "$datastore_name" ]]; then errecho "ERROR: You must provide a data store name with the -n parameter." usage return 1 fi response=$(aws medical-imaging create-datastore \ --datastore-name "$datastore_name" \ --output text \ --query 'datastoreId') local error_code=${?} if [[ $error_code -ne 0 ]]; then aws_cli_error_log $error_code errecho "ERROR: AWS reports medical-imaging create-datastore operation failed.$response" return 1 fi echo "$response" return 0 }
  • 有API關詳細資訊,請參閱 CreateDatastoreAWS CLI 指令參考

注意

還有更多關於 GitHub。尋找完整的範例,並瞭解如何設定和執行 AWS 代碼示例存儲庫

CLI
AWS CLI

建立資料倉庫的步驟

下列create-datastore程式碼範例會建立名稱的資料存放區my-datastore

aws medical-imaging create-datastore \ --datastore-name "my-datastore"

輸出:

{ "datastoreId": "12345678901234567890123456789012", "datastoreStatus": "CREATING" }

有關詳情,請參閱在中建立資料倉庫 AWS HealthImaging 開發人員指南

  • 有API關詳細資訊,請參閱 CreateDatastoreAWS CLI 指令參考

Java
SDK對於爪哇 2.x
public static String createMedicalImageDatastore(MedicalImagingClient medicalImagingClient, String datastoreName) { try { CreateDatastoreRequest datastoreRequest = CreateDatastoreRequest.builder() .datastoreName(datastoreName) .build(); CreateDatastoreResponse response = medicalImagingClient.createDatastore(datastoreRequest); return response.datastoreId(); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return ""; }
  • 有API關詳細資訊,請參閱 CreateDatastoreAWS SDK for Java 2.x API參考

注意

還有更多關於 GitHub。尋找完整的範例,並瞭解如何設定和執行 AWS 代碼示例存儲庫

JavaScript
SDK對於 JavaScript (3)
import { CreateDatastoreCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreName - The name of the data store to create. */ export const createDatastore = async (datastoreName = "DATASTORE_NAME") => { const response = await medicalImagingClient.send( new CreateDatastoreCommand({ datastoreName: datastoreName }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: 'a71cd65f-2382-49bf-b682-f9209d8d399b', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // datastoreStatus: 'CREATING' // } return response; };
  • 有API關詳細資訊,請參閱 CreateDatastoreAWS SDK for JavaScript API參考

注意

還有更多關於 GitHub。尋找完整的範例,並瞭解如何設定和執行 AWS 代碼示例存儲庫

Python
SDK對於 Python(肉毒桿菌 3)
class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def create_datastore(self, name): """ Create a data store. :param name: The name of the data store to create. :return: The data store ID. """ try: data_store = self.health_imaging_client.create_datastore(datastoreName=name) except ClientError as err: logger.error( "Couldn't create data store %s. Here's why: %s: %s", name, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return data_store["datastoreId"]

下面的代碼實例化對 MedicalImagingWrapper 象。

client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
  • 有API關詳細資訊,請參閱 CreateDatastoreAWS SDK對於 Python(肉毒桿 3)API參考。

注意

還有更多關於 GitHub。尋找完整的範例,並瞭解如何設定和執行 AWS 代碼示例存儲庫