使用 POST 搜索 FHIR 资源 - AWS HealthLake

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

使用 POST 搜索 FHIR 资源

您可以使用 FHIR 与POST请求的search交互来搜索HealthLake 数据存储。使用时POST, HealthLake 支持在 URL 或请求正文中使用搜索参数,但不能在单个请求中同时使用这两个参数。

重要提示

对于涉及个人身份信息 (PII) 或受保护的健康信息 (PHI) 的搜索,安全最佳实践要求使用POST请求,因为 PII 和 PHI 是作为请求正文的一部分添加的,并在传输过程中进行加密。

以下过程是使用 FHIR R4 与的search交互POST来搜索 HealthLake 数据存储的示例。这些示例展示了如何在 JSON 请求正文中指定搜索参数。

使用搜索 HealthLake 数据存储 POST

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

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

  3. 使用收集到的 HealthLakeregion和值为请求构造一个 URL datastoreId。还包括 FHIR Resource 类型和_search交互作用。要查看以下示例中的整个 URL 路径,请滚动到 “复制” 按钮。

    POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource/_search
  4. 为请求构建 JSON 正文,指定要搜索的 FHIR 数据。出于此手术的目的,您将搜索Observation资源以发现从未吸烟的患者。要指定医疗代码状态Never smoker,请在 JSON 请求正文value-concept=266919005中进行设置。将该文件保存为 search-observation.json

    value-concept=266919005
  5. 发送 请求。FHIR search 交互使用带有AWS 签名版本 4 或 SMART 的 FHIR 授权GET请求。

    注意

    POST请求正文中使用搜索参数发出请求时,请Content-Type: application/x-www-form-urlencoded将其用作标头的一部分。

    以下curl示例对Observation资源类型发出基于 Post的搜索请求。该请求使用value-concept搜索参数来查找表示值的医疗代码266919005Never smoker。要查看整个示例,请滚动到 “复” 按钮。

    SigV4

    Sigv4 授权

    curl --request POST \ 'https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Observation/_search' \ --aws-sigv4 'aws:amz:region:healthlake' \ --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \ --header "x-amz-security-token:$AWS_SESSION_TOKEN" \ --header "Content-Type: application/x-www-form-urlencoded" --header "Accept: application/json" --data @search-observation.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 瞄准镜

示例:使用 POST 进行搜索

以下选项卡提供了使用搜索特定 FHIR 资源类型的示例。POST这些示例说明了如何在中指定请求 URLs。

注意

HealthLake 控制台仅支持 SigV4 授权。通过 AWS CLI 和 AWS SDKs支持 FHIR 上的 SMART 授权。

HealthLake 支持 FHIR R4 搜索参数的子集。有关更多信息,请参阅 搜索参数

Patient (age)

尽管年龄不是在 FHIR 中定义的资源类型,但它被捕获为Patient资源类型中的一个元素。使用以下示例对Patient资源类型发出POST基于搜索的请求。以下搜索示例使用搜索比较器来eq搜索 1997 年出生的个人。

POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Patient/_search

要在搜索中指定 1997 年,请在请求正文中添加以下元素。

birthdate=eq1997
Condition

使用以下内容对Condition资源类型POST提出请求。此搜索可在您的 HealthLake 数据存储中查找包含医疗代码的位置72892002

您必须指定请求网址和请求正文。以下是请求网址的示例。

POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Condition/_search

要指定要搜索的医疗代码,请在请求正文中添加以下 JSON 元素。

code=72892002
DocumentReference

要在对 HealthLakeDocumentReference资源类型POST提出请求时查看集成自然语言处理 (NLP) 的结果,请按以下方式格式化请求。

POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/DocumentReference/_search

要指定要引用的DocumentReference搜索参数,请参阅搜索参数类型。以下查询字符串使用多个搜索参数搜索用于生成集成 NLP 结果的 Amazon Comprehend Medical API 操作。

_lastUpdated=le2021-12-19&infer-icd10cm-entity-text-concept-score;=streptococcal|0.6&infer-rxnorm-entity-text-concept-score=Amoxicillin|0.8
Location

使用以下示例对Location资源类型发出POST请求。搜索会在您的HealthLake 数据存储中查找地址中包含城市名称波士顿的位置。

您必须指定请求 URL 和请求正文。以下是请求网址的示例。

POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Location/_search

要在搜索Boston中指定,请在请求正文中添加以下元素:

address=Boston
Observation

使用以下示例对Observation资源类型发出POST基于搜索的请求。搜索使用value-concept搜索参数来查找医疗代码,266919005这表示出来Never smoker

POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Observation/_search

要指定状态Never smoker,请在 JSON 的正文value-concept=266919005中进行设置。

value-concept=266919005