

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# HealthLake データストアの作成
<a name="managing-data-stores-create"></a>

を使用して`CreateFHIRDatastore`、FHIR R4 仕様に準拠した AWS HealthLake データストアを作成します。HealthLake データストアは、FHIR データのインポート、管理、検索、エクスポートに使用されます。Synthea オープンソースの FHIR R4 ヘルスデータをデータストアにインポート (プリロード) することを選択できます。詳細については、「[プリロードされたデータ型](reference-healthlake-preloaded-data-types.md)」を参照してください。

**[重要]**  
HealthLake は、FHIR 上の AWS SigV4 または SMART の 2 種類の FHIR データストア認可戦略をサポートしています。HealthLake FHIR データストアを作成する前に、いずれかの認可戦略を選択する必要があります。詳細については、「[データストア認可戦略](getting-started-concepts.md#concept-data-store-authorization-strategy)」を参照してください。

HealthLake データストアを作成すると、FHIR データリポジトリが RESTful API [エンドポイント](reference-healthlake-endpoints-quotas.md#reference-healthlake-endpoints)を介して利用可能になります。HealthLake データストアを作成したら、[その機能ステートメント](reference-fhir-capability-statement.md)をリクエストして、関連するすべての FHIR 関連の機能 (動作) を見つけることができます。

次のメニューでは、 AWS CLI および AWS SDKsの例と、 の手順を示します AWS マネジメントコンソール。詳細については、「*AWS HealthLake API リファレンス*」の「[https://docs.aws.amazon.com/healthlake/latest/APIReference/API_CreateFHIRDatastore.html](https://docs.aws.amazon.com/healthlake/latest/APIReference/API_CreateFHIRDatastore.html)」を参照してください。

**HealthLake データストアを作成するには**  
アクセス設定に基づいてメニューを選択します AWS HealthLake。

## AWS CLI および SDKs
<a name="managing-data-stores-create-cli-sdk"></a>

------
#### [ 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: SMART on FHIR 対応の HealthLake データストアを作成する**  
次の`create-fhir-datastore`例は、 AWS HealthLake で FHIR 対応データストアに新しい 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 データストアの作成とモニタリング](https://docs.aws.amazon.com/healthlake/latest/devguide/working-with-FHIR-healthlake.html)」を参照してください。  
+  API の詳細については、*AWS CLI コマンドリファレンス*の「[CreateFHIRDatastore](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/healthlake/create-fhir-datastore.html)」を参照してください。

------
#### [ 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
```
次のコードは、SMART on FHIR 対応 HealthLake データストアのパラメータの例を示しています。  

```
            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 SDK for Python (Boto3) API リファレンス*」の「[CreateFHIRDatastore](https://docs.aws.amazon.com/goto/boto3/healthlake-2017-07-01/CreateFHIRDatastore)」を参照してください。
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/healthlake#code-examples)での設定と実行の方法を確認してください。

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/hll#code-examples)での設定と実行の方法を確認してください。

```
    TRY.
        " iv_datastore_name = 'MyHealthLakeDataStore'
        oo_result = lo_hll->createfhirdatastore(
          iv_datastorename = iv_datastore_name
          iv_datastoretypeversion = 'R4'
        ).
        MESSAGE 'Data store created successfully.' TYPE 'I'.
      CATCH /aws1/cx_hllvalidationex INTO DATA(lo_validation_ex).
        DATA(lv_error) = |Validation error: { lo_validation_ex->av_err_code }-{ lo_validation_ex->av_err_msg }|.
        MESSAGE lv_error TYPE 'I'.
        RAISE EXCEPTION lo_validation_ex.
      CATCH /aws1/cx_hllinternalserverex INTO DATA(lo_internal_ex).
        lv_error = |Internal server error: { lo_internal_ex->av_err_code }-{ lo_internal_ex->av_err_msg }|.
        MESSAGE lv_error TYPE 'I'.
        RAISE EXCEPTION lo_internal_ex.
      CATCH /aws1/cx_hllthrottlingex INTO DATA(lo_throttling_ex).
        lv_error = |Throttling error: { lo_throttling_ex->av_err_code }-{ lo_throttling_ex->av_err_msg }|.
        MESSAGE lv_error TYPE 'I'.
        RAISE EXCEPTION lo_throttling_ex.
    ENDTRY.
```
+  API の詳細については、 *AWS SDK for SAP ABAP API リファレンス*の「[CreateFHIRDatastore](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html)」を参照してください。

------

**可用性の例**  
必要なものが見つからなかった場合。このページの右側サイドバーにある**フィードバックを提供する**リンクを使用して、コード例をリクエストします。

## AWS コンソール
<a name="managing-data-stores-create-console"></a>

**メモ**  
次の手順では、[AWS SigV4](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html) 認可を持つ HealthLake データストアを作成します。HealthLake コンソールは、FHIR データストアでの SMART の作成をサポートしていません。

**AWS SigV4 認可を使用して HealthLake データストアを作成するには**

1. HealthLake コンソールのデータ[ストアの作成](https://console.aws.amazon.com/healthlake/home#/create-datastore)ページにサインインします。

1. **データストアの作成**を選択します。

1. **データストア設定**セクションで、**データストア名**に名前を指定します。

1. (オプション) **データストア設定**セクションの**事前ロードサンプルデータ**で、チェックボックスを選択して Synthea データを事前ロードします。Synthea データはオープンソースのサンプルデータセットです。詳細については、「[HealthLake の Synthea プリロードされたデータ型](reference-healthlake-preloaded-data-types.md)」を参照してください。

1. **データストアの暗号化**セクションで、**AWS 所有キーを使用する (デフォルト)** または**別の AWS KMS キーを選択する (詳細)** を選択します。

1. **タグ - *オプション***セクションでは、データストアにタグを追加できます。データストアのタグ付けの詳細については、「」を参照してください[HealthLake データストアのタグ付け](managing-data-stores-tagging.md)。

1. **データストアの作成**を選択します。

   データストアのステータスは、**データストア**ページで確認できます。