

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

# FHIR リソース履歴の読み取り
<a name="managing-fhir-resources-read-history"></a>

FHIR `history`インタラクションは、HealthLake データストア内の特定の FHIR リソースの履歴を取得します。このインタラクションを使用して、FHIR リソースの内容が時間の経過とともにどのように変化したかを判断できます。また、監査ログと連携して、変更前後のリソースの状態を確認するのにも役立ちます。FHIR インタラクション `create`、`update`、および `delete`では、リソースの履歴バージョンが保存されます。詳細については、FHIR R4 RESTful API ドキュメント[https://hl7.org/fhir/R4/http.html#history](https://hl7.org/fhir/R4/http.html#history)の「」を参照してください。 ** R4 RESTful **

**注記**  
特定の FHIR リソースタイプ`history`に対して をオプトアウトできます。オプトアウトするには、 を使用してケースを作成します[AWS Support Center Console](https://console.aws.amazon.com/support/home#/)。ケースを作成するには、 にログイン AWS アカウント し、**ケースの作成**を選択します。

**FHIR リソース履歴を読み取るには**  


1. HealthLake `region`と `datastoreId`の値を収集します。詳細については、「[データストアのプロパティの取得](managing-data-stores-describe.md)」を参照してください。

1. 関連する`id`値`Resource`を読み取って収集する FHIR のタイプを決定します。詳細については、「[リソースタイプ:](reference-fhir-resource-types.md)」を参照してください。

1. HealthLake `region`と の収集された値を使用して、リクエストの URL を作成します`datastoreId`。また、FHIR `Resource`タイプ、関連付けられた `id`、およびオプションの検索パラメータを含めます。次の例の URL パス全体を表示するには、**コピー**ボタンをスクロールします。

   ```
   GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource/id/_history{?[parameters]}
   ```  
**HealthLake が FHIR `history`インタラクションでサポートする検索パラメータ**    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/healthlake/latest/devguide/managing-fhir-resources-read-history.html)

1.  リクエストを送信します。FHIR `history`インタラクションは、[AWS 署名バージョン 4 ](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html)または SMART on FHIR 認可の`GET`リクエストを使用します。次の`curl`例では、 `_count`検索パラメータを使用して、HealthLake の FHIR `Patient`リソースの 1 ページあたり 100 件の履歴検索結果を返します。例全体を表示するには、**コピー**ボタンをスクロールします。

------
#### [ SigV4 ]

   SigV4 認可

   ```
   curl --request GET \
     'https://healthlake.region.amazonaws.com/datastore/datastore-id/r4/Patient/id/_history?_count=100' \
     --aws-sigv4 'aws:amz:region:healthlake' \
     --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \
     --header "x-amz-security-token:$AWS_SESSION_TOKEN" \
     --header 'Accept: application/json'
   ```

------
#### [ SMART on FHIR ]

   [https://docs.aws.amazon.com/healthlake/latest/APIReference/API_IdentityProviderConfiguration.html](https://docs.aws.amazon.com/healthlake/latest/APIReference/API_IdentityProviderConfiguration.html) データ型の FHIR 認可の SMART の例。

   ```
   {
       "AuthorizationStrategy": "SMART_ON_FHIR",
       "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\",\"permission-v2\"]}"
   }
   ```

   発信者は認可 Lambda でアクセス許可を割り当てることができます。詳細については、「[OAuth 2.0 スコープ](reference-smart-on-fhir-oauth-scopes.md)」を参照してください。

------

   `history` インタラクションの戻りコンテンツは FHIR リソース に含まれ`Bundle`、タイプは に設定されます`history`。これには、指定されたバージョン履歴が含まれ、最後に最も古いバージョンでソートされ、削除されたリソースが含まれます。詳細については、**FHIR R4 ドキュメント**[https://hl7.org/fhir/R4/bundle.html](https://hl7.org/fhir/R4/bundle.html)の「」を参照してください。

## バージョン固有の FHIR リソース履歴の読み取り
<a name="managing-fhir-data-get-version-specific-resource"></a>

FHIR `vread`インタラクションは、HealthLake データストア内のリソースのバージョン固有の読み取りを実行します。このインタラクションを使用すると、FHIR リソースのコンテンツは、過去の特定の時点と同じように表示できます。

**注記**  
*なしで* FHIR `history`インタラクションを使用する場合`vread`、HealthLake は常にリソースのメタデータの最新バージョンを返します。

HealthLake は、サポートされている各リソースの でのバージョニングのサポート[https://hl7.org/fhir/R4/capabilitystatement-definitions.html#CapabilityStatement.rest.resource.versioning](https://hl7.org/fhir/R4/capabilitystatement-definitions.html#CapabilityStatement.rest.resource.versioning)を宣言します。すべての HealthLake データストアには、すべてのリソースに `Resource.meta.versionId` (`vid`) が含まれます。

FHIR `history`インタラクションが有効になっている場合 (10/25/2024 以降に作成されたデータストアの場合はデフォルトで、古いデータストアの場合はリクエストによって）、`Bundle`レスポンス`vid`には [https://hl7.org/fhir/R4/bundle-definitions.html#Bundle.entry.response.location](https://hl7.org/fhir/R4/bundle-definitions.html#Bundle.entry.response.location)要素の一部として が含まれます。次の例では、 は数値 として`vid`表示されます`1`。完全な例を表示するには、[「バンドル/バンドルレスポンス (JSON) の例](https://build.fhir.org/bundle-response.json.html)」を参照してください。

```
"response" : {
    "status" : "201 Created",
    "location" : "Patient/12423/_history/1",
    ...}
```

**バージョン固有の FHIR リソース履歴を読み取るには**  


1. HealthLake `region`と `datastoreId`の値を収集します。詳細については、「[データストアのプロパティの取得](managing-data-stores-describe.md)」を参照してください。

1. 関連する と`id``vid`値を読み取って収集する FHIR `Resource`タイプを決定します。詳細については、「[リソースタイプ:](reference-fhir-resource-types.md)」を参照してください。

1. HealthLake と FHIR 用に収集された値を使用して、リクエストの URL を作成します。次の例の URL パス全体を表示するには、**コピー**ボタンをスクロールします。

   ```
   GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource/id/_history/vid
   ```

1.  リクエストを送信します。FHIR `history`インタラクションは、[AWS 署名バージョン 4 ](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html)または SMART on FHIR 認可のいずれかの`GET`リクエストを使用します。次の`vread`インタラクションは、 で指定された`Patient`リソースメタデータのバージョンについて、FHIR リソースに指定されたコンテンツを含む単一のインスタンスを返します`vid`。次の例の URL パス全体を表示するには、**コピー**ボタンをスクロールします。

------
#### [ SigV4 ]

   SigV4 認可

   ```
   curl --request GET \
     'https://healthlake.region.amazonaws.com/datastore/datastore-id/r4/Patient/id/_history/vid' \
     --aws-sigv4 'aws:amz:region:healthlake' \
     --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \
     --header "x-amz-security-token:$AWS_SESSION_TOKEN" \
     --header 'Accept: application/json'
   ```

------
#### [ SMART on FHIR ]

   [https://docs.aws.amazon.com/healthlake/latest/APIReference/API_IdentityProviderConfiguration.html](https://docs.aws.amazon.com/healthlake/latest/APIReference/API_IdentityProviderConfiguration.html) データ型の FHIR 認可の SMART の例。

   ```
   {
       "AuthorizationStrategy": "SMART_ON_FHIR",
       "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\",\"permission-v2\"]}"
   }
   ```

   発信者は認可 Lambda でアクセス許可を割り当てることができます。詳細については、「[OAuth 2.0 スコープ](reference-smart-on-fhir-oauth-scopes.md)」を参照してください。

------