阅读 FHIR 资源历史记录 - AWS HealthLake

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

阅读 FHIR 资源历史记录

FHIR history 交互会检索数据存储中特定 FHIR 资源的历史记录。 HealthLake 使用此交互,您可以确定 FHIR 资源的内容如何随着时间的推移而发生变化。它还可用于与审计日志协调以查看修改前后的资源状态。FHIR 的交互作用createdelete结果是要保存的资源的历史版本。update有关更多信息,请参阅 FHIR R4 RESTful API 文档history中的。

注意

您可以选择不使用特定history的 FHIR 资源类型。要选择退出,请使用创建案例AWS Support Center Console。要创建您的案例,请登录您的 AWS 账户 并选择创建案例

阅读 FHIR 资源历史记录

  1. 收集 HealthLake regiondatastoreId价值。有关更多信息,请参阅 获取数据存储属性

  2. 确定Resource要读取的 FHIR 类型并收集相关id值。有关更多信息,请参阅 资源类型

  3. 使用收集的 HealthLakeregion和值为请求构造一个 URL datastoreId。还应包括 FHIR Resource 类型、其关联id的和可选的搜索参数。要查看以下示例中的整个 URL 路径,请滚动到 “复制” 按钮。

    GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource/id/_history{?[parameters]}
    HealthLake FHIR history 交互支持的搜索参数
    参数 说明
    _count : integer 一页上搜索结果的最大数量。服务器将返回请求的数量或数据存储默认允许的最大搜索结果数,以较低者为准。
    _since : instant 仅包括在给定时刻或之后创建的资源版本。
    _at : date(Time) 仅包括在日期时间值中指定的时间段内某个时刻处于最新状态的资源版本。有关更多信息,请参阅 HL7 FH RESTful IR API 文档date中的。
  4. 发送 请求。FHIR history 交互在 FHIR 授权上使用AWS 签名版本 4 或 SMART 的GET请求。以下curl示例使用_count搜索参数为中的 HealthLake FHIR Patient 资源每页返回 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

    IdentityProviderConfiguration数据类型的 SMART on FHIR 授权示例。

    { "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 瞄准镜

    history交互的返回内容包含在 FHIR 资源中Bundle,类型设置为。history它包含指定的版本历史记录,按最旧版本排序,并包含已删除的资源。有关更多信息,请参阅 FHIR R4 文档Resource Bundle中的。

读取特定版本的 FHIR 资源历史记录

FHIR vread 交互对数据存储中的资源执行特定版本的读取。 HealthLake 使用此交互,您可以像过去特定时间一样查看 FHIR 资源的内容。

注意

如果您使用 FHIR history 交互而不使用vread,则 HealthLake 始终返回资源元数据的最新版本。

HealthLake 声明它支持对每个支持的资源CapabilityStatement.rest.resource.versioning进行版本控制。所有资源上的所有 HealthLake 数据存储都包含 Resource.meta.versionId (vid)。

启用 FHIR history 交互时(默认情况下,对于在 2024 年 10 月 25 日之后创建的数据存储或通过请求较旧的数据存储创建的数据存储),Bundle响应会将vid作为元素的一部分包括在内。location在以下示例中,vid显示为数字1。要查看完整示例,请参阅示例捆绑包/捆绑包响应 (JSON)。

"response" : { "status" : "201 Created", "location" : "Patient/12423/_history/1", ...}
阅读特定版本的 FHIR 资源历史记录

  1. 收集 HealthLake regiondatastoreId价值。有关更多信息,请参阅 获取数据存储属性

  2. 确定要读取和收集关联id的 and vid 值的 FHIR Resource 类型。有关更多信息,请参阅 资源类型

  3. 使用为 HealthLake 和 FHIR 收集的值为请求构造一个 URL。要查看以下示例中的整个 URL 路径,请滚动到 “复制” 按钮。

    GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource/id/_history/vid
  4. 发送 请求。FHIR history 交互在 FHIR 授权上使用AWS 签名版本 4 或 SMART 的GET请求。以下vread交互返回单个实例,其中包含为 FHIR Patient 资源指定的内容,该版本由指定的资源元数据。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

    IdentityProviderConfiguration数据类型的 SMART on FHIR 授权示例。

    { "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 瞄准镜