使用 POST 搜尋 FHIR 資源 - AWS HealthLake

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 POST 搜尋 FHIR 資源

您可以使用 FHIR search互動與 POST 請求來搜尋 HealthLake 資料存放區。使用 時POST,HealthLake 支援 URL 或請求內文中的搜尋參數,但您無法在單一請求中使用兩者。

重要

對於涉及個人身分識別資訊 (PII) 或受保護醫療資訊 (PHI) 的搜尋,安全最佳實務會使用 POST 請求,因為 PII 和 PHI 會新增為請求內文的一部分,並在傳輸中加密。

以下程序後面是使用 FHIR R4 與 search互動POST來搜尋 HealthLake 資料存放區的範例。這些範例示範如何在 JSON 請求內文中指定搜尋參數。

使用 搜尋 HealthLake 資料存放區 POST

  1. 收集 HealthLake regiondatastoreId 值。如需詳細資訊,請參閱取得資料存放區屬性

  2. 決定要搜尋的 FHIR 資源類型,並收集相關聯的id值。如需詳細資訊,請參閱資源類型

  3. 使用 HealthLake region和 的收集值來建構請求的 URLdatastoreId。同時包含 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互動使用GET請求搭配 AWS Signature 第 4 版或 FHIR 授權上的 SMART。

    注意

    POST請求內文中使用搜尋參數提出請求時,請使用 Content-Type: application/x-www-form-urlencoded做為 標頭的一部分。

    下列curl範例會針對Observation資源類型提出 POST 型搜尋請求。請求使用value-concept搜尋參數來尋找266919005指出值 的醫療程式碼Never 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 資料類型的 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 範圍

範例:使用 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

您必須指定請求 URL 和請求內文。以下是請求 URL 的範例。

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

若要指定您要搜尋的醫療代碼,請將下列 JSON 元素新增至請求內文。

code=72892002
DocumentReference

若要查看 HealthLake 在DocumentReference資源類型上提出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 和請求內文。以下是請求 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

若要指定狀態,請在 JSON 內文value-concept=266919005中設定 Never smoker

value-concept=266919005