使用 GET 搜尋 FHIR 資源 - AWS HealthLake

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

使用 GET 搜尋 FHIR 資源

您可以使用 GET 請求來搜尋 HealthLake 資料存放區。使用 時GET,HealthLake 支援提供搜尋參數做為 URL 的一部分,但不支援做為請求內文的一部分。如需詳細資訊,請參閱HealthLake 的 FHIR R4 搜尋參數

重要

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

以下程序後面接著使用 GET搜尋 HealthLake 資料存放區的範例。

使用 搜尋 HealthLake 資料存放區 GET

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

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

  3. 使用 HealthLake region和 的收集值來建構請求的 URLdatastoreId。同時包含 FHIR Resource類型和支援的搜尋參數。若要在下列範例中檢視整個 URL 路徑,請捲動至複製按鈕。

    GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource{?[parameters]{&_format=[mime-type]}}
  4. 使用 AWS Signature 第 4 版或 FHIR 上的 SMART 授權傳送GET請求。下列curl範例會傳回 HealthLake 資料存放區中的Patient資源總數。若要檢視整個範例,請捲動至複製按鈕。

    SigV4

    SigV4 授權

    curl --request GET \ 'https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Patient?_total=accurate' \ --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 資料類型的 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 範圍

    AWS Console
    注意

    HealthLake 主控台僅支援 SigV4 授權。透過 AWS CLI 和 AWS SDKs支援 FHIR 上的 SMART 授權。

    1. 登入 HealthLake 主控台上的執行查詢頁面。

    2. 在查詢設定區段下,進行下列選擇。

    • 資料存放區 ID — 選擇資料存放區 ID 以產生查詢字串。

    • 查詢類型 — 選擇 Search with GET

    • 資源類型 — 選擇要搜尋的 FHIR 資源類型

    • 搜尋參數 — 選取搜尋參數或搜尋參數組合,將您的查詢集中在特定記錄上。

    3. 選擇 Run query (執行查詢)。

範例:使用 GET 搜尋

下列索引標籤提供使用 搜尋特定 FHIR 資源類型的範例GET。這些範例示範如何在請求 URLs中指定搜尋參數。

注意

HealthLake 主控台僅支援 SigV4 授權。透過 AWS CLI 和 AWS SDKs支援 FHIR 上的 SMART 授權。

HealthLake 支援 FHIR R4 搜尋參數的子集。如需詳細資訊,請參閱搜尋參數

Patient (age)

雖然年齡不是 FHIR 中定義的資源類型,但會擷取為Patient資源類型中的 元素。使用下列範例,使用 birthDate 元素和eq搜尋比較器Patient資源類型提出GET以 為基礎的搜尋請求,以搜尋 1997 年出生的個人。

GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Patient?birthdate=eq1997
Condition

使用下列範例對Condition資源類型提出GET請求。搜尋會在您的 HealthLake 資料存放區中找到包含 SNOMED 醫療碼 的條件72892002,其會轉譯為 Normal pregnancy

GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Condition?code=72892002
DocumentationReference

下列範例示範如何針對具有鏈球菌診斷的 Patient() 和也獲開立 amoxicillin 的人員,在DocumentReference資源類型上建立GET請求。

GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/DocumentReference?_lastUpdated=le2021-12-19&infer-icd10cm-entity-text-concept-score;=streptococcal|0.6&infer-rxnorm-entity-text-concept-score=Amoxicillin|0.8
Location

使用下列範例對Location資源類型提出GET請求。下列搜尋會尋找 HealthLake 資料存放區中包含城市名稱波士頓做為地址一部分的位置。

GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Location?address=boston
Observation

使用下列範例,對Observation資源類型提出GET以 為基礎的搜尋請求。此搜尋使用value-concept搜尋參數來尋找醫療代碼 266919005,其會轉譯為 Never smoker

GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Observation?value-concept=266919005