建立 HealthLake 資料存放區 - AWS HealthLake

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

建立 HealthLake 資料存放區

使用 CreateFHIRDatastore建立符合 FHIR R4 規格 AWS HealthLake 的資料存放區。HealthLake 資料存放區用於匯入、管理、搜尋和匯出 FHIR 資料。建立時,您可以選擇將 (預先載入) Synthea 開放原始碼 FHIR R4 運作狀態資料匯入資料存放區。如需詳細資訊,請參閱預先載入的資料類型

重要

HealthLake 支援兩種類型的 FHIR 資料存放區授權策略: AWS SigV4 或 FHIR 上的 SMART。在建立 HealthLake FHIR 資料存放區之前,您必須選擇其中一個授權策略。如需詳細資訊,請參閱資料存放區授權策略

當您建立 HealthLake 資料存放區時,可透過 RESTful API 端點提供 FHIR 資料儲存庫。建立 HealthLake 資料存放區之後,您可以請求其功能聲明來尋找所有相關的 FHIR 相關功能 (行為)。

下列功能表提供 AWS CLI 和 AWS SDKs的範例,以及 的程序 AWS Management Console。如需詳細資訊,請參閱 AWS HealthLake API 參考中的 CreateFHIRDatastore

建立 HealthLake 資料存放區

根據您的存取偏好設定選擇選單 AWS HealthLake。

CLI
AWS CLI

範例 1:建立SigV4-enabled HealthLake 資料存放區

下列create-fhir-datastore範例示範如何在 AWS HealthLake 中建立新的資料存放區。

aws healthlake create-fhir-datastore \ --datastore-type-version R4 \ --datastore-name "FhirTestDatastore"

輸出:

{ "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/(Data store ID)/r4/", "DatastoreArn": "arn:aws:healthlake:us-east-1:(AWS Account ID):datastore/(Data store ID)", "DatastoreStatus": "CREATING", "DatastoreId": "(Data store ID)" }

範例 2:在啟用 FHIR 的 HealthLake 資料存放區上建立 SMART

下列create-fhir-datastore範例示範如何在啟用 FHIR 的資料存放區 in AWS HealthLake 上建立新的 SMART。

aws healthlake create-fhir-datastore \ --datastore-name "your-data-store-name" \ --datastore-type-version R4 \ --preload-data-config PreloadDataType="SYNTHEA" \ --sse-configuration '{ "KmsEncryptionConfig": { "CmkType": "CUSTOMER_MANAGED_KMS_KEY", "KmsKeyId": "arn:aws:kms:us-east-1:your-account-id:key/your-key-id" } }' \ --identity-provider-configuration file://identity_provider_configuration.json

identity_provider_configuration.json 的內容:

{ "AuthorizationStrategy": "SMART_ON_FHIR_V1", "FineGrainedAuthorizationEnabled": true, "IdpLambdaArn": "arn:aws:lambda:your-region:your-account-id:function:your-lambda-name", "Metadata": "{\"issuer\":\"https://ehr.example.com\", \"jwks_uri\":\"https://ehr.example.com/.well-known/jwks.json\",\"authorization_endpoint\":\"https://ehr.example.com/auth/authorize\",\"token_endpoint\":\"https://ehr.token.com/auth/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_basic\",\"foo\"],\"grant_types_supported\":[\"client_credential\",\"foo\"],\"registration_endpoint\":\"https://ehr.example.com/auth/register\",\"scopes_supported\":[\"openId\",\"profile\",\"launch\"],\"response_types_supported\":[\"code\"],\"management_endpoint\":\"https://ehr.example.com/user/manage\",\"introspection_endpoint\":\"https://ehr.example.com/user/introspect\",\"revocation_endpoint\":\"https://ehr.example.com/user/revoke\",\"code_challenge_methods_supported\":[\"S256\"],\"capabilities\":[\"launch-ehr\",\"sso-openid-connect\",\"client-public\"]}" }

輸出:

{ "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/(Data store ID)/r4/", "DatastoreArn": "arn:aws:healthlake:us-east-1:(AWS Account ID):datastore/(Data store ID)", "DatastoreStatus": "CREATING", "DatastoreId": "(Data store ID)" }

如需詳細資訊,請參閱 AWS HealthLake 開發人員指南中的建立和監控 FHIR 資料存放區。

Python
SDK for Python (Boto3)
@classmethod def from_client(cls) -> "HealthLakeWrapper": """ Creates a HealthLakeWrapper instance with a default AWS HealthLake client. :return: An instance of HealthLakeWrapper initialized with the default HealthLake client. """ health_lake_client = boto3.client("healthlake") return cls(health_lake_client) def create_fhir_datastore( self, datastore_name: str, sse_configuration: dict[str, any] = None, identity_provider_configuration: dict[str, any] = None, ) -> dict[str, str]: """ Creates a new HealthLake data store. When creating a SMART on FHIR data store, the following parameters are required: - sse_configuration: The server-side encryption configuration for a SMART on FHIR-enabled data store. - identity_provider_configuration: The identity provider configuration for a SMART on FHIR-enabled data store. :param datastore_name: The name of the data store. :param sse_configuration: The server-side encryption configuration for a SMART on FHIR-enabled data store. :param identity_provider_configuration: The identity provider configuration for a SMART on FHIR-enabled data store. :return: A dictionary containing the data store information. """ try: parameters = {"DatastoreName": datastore_name, "DatastoreTypeVersion": "R4"} if ( sse_configuration is not None and identity_provider_configuration is not None ): # Creating a SMART on FHIR-enabled data store parameters["SseConfiguration"] = sse_configuration parameters[ "IdentityProviderConfiguration" ] = identity_provider_configuration response = self.health_lake_client.create_fhir_datastore(**parameters) return response except ClientError as err: logger.exception( "Couldn't create data store %s. Here's why %s", datastore_name, err.response["Error"]["Message"], ) raise

下列程式碼顯示啟用 FHIR 的 HealthLake 資料存放區上的 SMART 參數範例。

sse_configuration = { "KmsEncryptionConfig": {"CmkType": "AWS_OWNED_KMS_KEY"} } # TODO: Update the metadata to match your environment. metadata = { "issuer": "https://ehr.example.com", "jwks_uri": "https://ehr.example.com/.well-known/jwks.json", "authorization_endpoint": "https://ehr.example.com/auth/authorize", "token_endpoint": "https://ehr.token.com/auth/token", "token_endpoint_auth_methods_supported": [ "client_secret_basic", "foo", ], "grant_types_supported": ["client_credential", "foo"], "registration_endpoint": "https://ehr.example.com/auth/register", "scopes_supported": ["openId", "profile", "launch"], "response_types_supported": ["code"], "management_endpoint": "https://ehr.example.com/user/manage", "introspection_endpoint": "https://ehr.example.com/user/introspect", "revocation_endpoint": "https://ehr.example.com/user/revoke", "code_challenge_methods_supported": ["S256"], "capabilities": [ "launch-ehr", "sso-openid-connect", "client-public", ], } # TODO: Update the IdpLambdaArn. identity_provider_configuration = { "AuthorizationStrategy": "SMART_ON_FHIR_V1", "FineGrainedAuthorizationEnabled": True, "IdpLambdaArn": "arn:aws:lambda:your-region:your-account-id:function:your-lambda-name", "Metadata": json.dumps(metadata), } data_store = self.create_fhir_datastore( datastore_name, sse_configuration, identity_provider_configuration )
  • 如需 API 詳細資訊,請參閱《適用於 AWS Python (Boto3) 的 SDK API 參考》中的 CreateFHIRDatastore

注意

GitHub 上提供更多範例。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫中設定和執行。

可用性範例

找不到所需的內容嗎? 使用此頁面右側的提供意見回饋連結來請求程式碼範例。

注意

下列程序會使用 AWS SigV4 授權建立 HealthLake 資料存放區。HealthLake 主控台不支援在 FHIR 資料存放區上建立 SMART。

使用 AWS SigV4 授權建立 HealthLake 資料存放區
  1. 登入 HealthLake 主控台上的建立資料存放區頁面。

  2. 選擇建立資料存放區

  3. 資料存放區設定區段中,針對資料存放區名稱指定名稱。

  4. (選用) 在資料存放區設定區段中,針對預先載入範例資料,選取核取方塊以預先載入 Synthea 資料。Synthea 資料是開放原始碼範例資料集。如需詳細資訊,請參閱HealthLake 的 Synthea 預先載入資料類型

  5. 資料存放區加密區段中,選擇使用 AWS 擁有的金鑰 (預設)選擇不同的 AWS KMS 金鑰 (進階)

  6. 標籤 - 選用區段中,您可以將標籤新增至資料存放區。若要進一步了解如何標記資料存放區,請參閱 標記 HealthLake 資料存放區

  7. 選擇建立資料存放區

    資料存放區的狀態可在資料存放區頁面上取得。