创建 HealthLake 数据存储 - AWS HealthLake

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

创建 HealthLake 数据存储

CreateFHIRDatastore用于创建符合 FHIR R4 规范 AWS HealthLake 的数据存储。 HealthLake 数据存储用于导入、管理、搜索和导出 FHIR 数据。在创建 Synthea 开源 FHIR R4 健康数据时,你可以选择将其导入(预加载)到数据存储中。有关更多信息,请参阅 预加载的数据类型

重要提示

HealthLake 支持两种类型的 FHIR 数据存储授权策略,即 AWS Sigv4 或 FHIR 上的 SMART。在创建 HealthLake FHIR 数据存储之前,必须选择一种授权策略。有关更多信息,请参阅 数据存储授权策略

创建 HealthLake 数据存储时,FHIR 数据存储库可通过 RESTful API 端点使用。创建 HealthLake 数据存储后,您可以请求其能力声明来查找所有关联的 FHIR 相关能力(行为)。

以下菜单提供了 AWS CLI 和的示例, AWS SDKs 并提供了操作步骤 AWS Management Console。有关更多信息,请参阅 AWS HealthLake API 参考中的 CreateFHIRDatastore

创建 HealthLake 数据存储

根据您的访问偏好选择菜单 AWS HealthLake。

CLI
AWS CLI

示例 1:创建支持 Sigv4 的数据存储 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 的数据存储上创建 SM HealthLake ART

以下create-fhir-datastore示例演示了如何在中启用 FHIR 的数据存储上创建新的 SMART。 AWS HealthLake

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 数据存储

  • 有关 API 的详细信息,请参阅FHIRDatastore《AWS CLI 命令参考》中的 “创建”。

Python
适用于 Python 的 SDK (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

以下代码显示了启用 FH HealthLake IR 的数据存储上的 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 的详细信息,请参阅在 Python AWS 开发工具包FHIRDatastore中创建 (Boto3) API 参考

注意

还有更多相关信息 GitHub。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

示例可用性

找不到所需的内容? 使用本页右侧边栏上的 “提供反馈” 链接请求代码示例。

注意

以下过程使用 AWS Sigv4 授权创建 HealthLake 数据存储。 HealthLake 控制台不支持在 FHIR 上创建 SMART 数据存储。

使用 AWS Sigv4 授权创建 HealthLake 数据存储
  1. 登录 HealthLake 控制台上的 “创建数据存储” 页面。

  2. 选择 “创建数据存储”。

  3. 数据存储设置部分中,为数据存储名称指定一个名称。

  4. (可选)在数据存储设置部分中,对于预加载样本数据,选中预加载合成数据的复选框。Synthea 数据是一个开源示例数据集。有关更多信息,请参阅 合成预加载的数据类型 HealthLake

  5. 数据存储加密部分,选择使用 AWS 拥有的密钥(默认)选择其他 AWS KMS 密钥(高级)

  6. 在 “标签-可选” 部分中,您可以向数据存储中添加标签。要了解有关为数据存储添加标签的更多信息,请参阅标记 HealthLake 数据存储

  7. 选择 “创建数据存储”。

    数据存储的状态可在数据存储页面上找到。