建立 FHIR 資源 - AWS HealthLake

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

建立 FHIR 資源

FHIR create互動會在 HealthLake 資料存放區中建立新的 FHIR 資源。如需詳細資訊,請參閱 FHIR R4 RESTful API 文件create中的 。

建立 FHIR 資源

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

  2. 決定Resource要建立的 FHIR 類型。如需詳細資訊,請參閱資源類型

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

    POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource
  4. 為請求建構 JSON 內文,指定新資源的 FHIR 資料。基於此程序的目的,我們使用 FHIR Patient 資源,因此請將檔案儲存為 create-patient.json

    { "resourceType": "Patient", "identifier": [ { "system": "urn:oid:1.2.36.146.595.217.0.1", "value": "12345" } ], "name": [ { "family": "Silva", "given": [ "Ana", "Carolina" ] } ], "gender": "female", "birthDate": "1992-02-10" }
  5. 傳送 請求。FHIR create互動使用具有AWS 簽章第 4 版或 FHIR 授權上的 SMART 的POST請求。下列範例會使用 curl 或 HealthLake 主控台在 HealthLake 中建立 FHIR Patient 資源。若要檢視整個範例,請捲動至複製按鈕。

    SigV4

    SigV4 授權

    curl --request POST \ 'https://healthlake.region.amazonaws.com/datastore/datastore-id/r4/Patient' \ --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' \ --data @create-patient.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 主控台僅支援 AWS SigV4 授權。

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

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

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

    • 查詢類型 — 選擇 Create

    • 資源類型 — 選擇要建立的 FHIR 資源類型

    • 請求內文 - 建構請求的 JSON 內文,指定新資源的 FHIR 資料。

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

設定資源建立的驗證層級

建立 FHIR 資源時,您可以選擇指定 x-amzn-healthlake-fhir-validation-level HTTP 標頭來設定資源的驗證層級。 AWS HealthLake 目前支援下列驗證層級:

  • strict:資源會根據資源的設定檔元素進行驗證,如果沒有設定檔,則為 R4 規格。這是 的預設驗證層級 AWS HealthLake。

  • structure-only:資源會根據 R4 驗證,忽略任何參考的設定檔。

  • minimal:最少驗證資源,忽略某些 R4 規則。搜尋/分析所需的結構檢查失敗的資源將更新為包含稽核警告。

使用最低驗證層級建立的資源可能會擷取至資料存放區,即使搜尋索引所需的驗證失敗。在這種情況下,資源將更新為包含 Healthlake 特定的延伸,以記錄上述失敗:

{ "url": "http://healthlake.amazonaws.com/fhir/StructureDefinition/validation-issue", "valueString": "{\"resourceType\":\"OperationOutcome\",\"issue\":[{\"severity\":\"error\",\"code\":\"processing\",\"details\":{\"text\":\"FHIR resource in payload failed FHIR validation rules.\"},\"diagnostics\":\"FHIR resource in payload failed FHIR validation rules.\"}]}" }

此外,以下 HTTP 回應標頭會包含在「true」的值中:

x-amzn-healthlake-validation-issues : true
注意

如果存在這些錯誤,根據 R4 規格格式不正確擷取的資料可能無法如預期搜尋。